• Post Reply Bookmark Topic Watch Topic
  • New Topic

Resize TitleBorder

 
Bacchi Gerem
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I need to add titleborder to a panel.The titleborder contains 2 JRadioButtons.Iam getting tileborder size equals to panel size.How can i resize titleborder.

My code is as follows:


JRadioButton let = new JRadioButton("Letter(default)", true);
JRadioButton a4 = new JRadioButton("A4", false);
ButtonGroup paperSize = new ButtonGroup();
paperSize.add(let);
paperSize.add(a4);
panel5.add(let);
panel5.add(a4);
panel5.setBorder(
javax.swing.BorderFactory.createTitledBorder(
null,
"Paper Size",
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
javax.swing.border.TitledBorder.DEFAULT_POSITION,
new java.awt.Font("Dialog", java.awt.Font.BOLD, 12),
java.awt.Color.black));
panel5.setVisible(true);


Thanks
 
sasi kala
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi bhaskar,
One solution to your problems is use CompoundBorder(from javax.swing.border.*). It allows two borders to one component.

place titleborder as outter border and emptyborder as innerborder.


Hope This Helps
All The Best
[ May 25, 2005: Message edited by: sasi kala ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!