use of javax.swing.border.TitledBorder in project jdk8u_jdk by JetBrains.
the class Test7034614 method main.
public static void main(String[] args) {
Graphics g = new BufferedImage(9, 9, 9).getGraphics();
BrokenBorder broken = new BrokenBorder();
TitledBorder titled = new TitledBorder(broken, broken.getClass().getName());
Insets insets = (Insets) broken.getBorderInsets(broken).clone();
titled.getBorderInsets(broken);
broken.validate(insets);
for (int i = 0; i < 10; i++) {
titled.paintBorder(broken, g, 0, 0, i, i);
broken.validate(insets);
titled.getBaseline(broken, i, i);
broken.validate(insets);
}
}
use of javax.swing.border.TitledBorder in project jdk8u_jdk by JetBrains.
the class Test4243289 method init.
public void init() {
// NON-NLS: the font name
Font font = new Font("Dialog", Font.PLAIN, 12);
TitledBorder border = BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), // NON-NLS: the title of the border
"Panel Title", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, font);
JPanel panel = new JPanel();
panel.setBorder(border);
getContentPane().add(panel);
}
use of javax.swing.border.TitledBorder in project jdk8u_jdk by JetBrains.
the class Test4247606 method init.
public void init() {
// NON-NLS: the button text
JButton button = new JButton("Button");
button.setBorder(BorderFactory.createLineBorder(Color.red, 1));
// NON-NLS: the panel title
TitledBorder border = new TitledBorder("Bordered Pane");
border.setTitlePosition(TitledBorder.BELOW_BOTTOM);
JPanel panel = create(button, border);
panel.setBackground(Color.green);
getContentPane().add(create(panel, BorderFactory.createEmptyBorder(10, 10, 10, 10)));
}
use of javax.swing.border.TitledBorder in project pcgen by PCGen.
the class RadioChooserDialog method buildButtonPanel.
/**
* Create the panel of radio buttons.
*/
private void buildButtonPanel() {
ListFacade<InfoFacade> availableList = chooser.getAvailableList();
int row = 0;
avaRadioButton = new JRadioButton[availableList.getSize()];
avaGroup = new ButtonGroup();
// Create the buttons
for (InfoFacade infoFacade : availableList) {
avaRadioButton[row] = new JRadioButton(infoFacade.toString(), false);
avaGroup.add(avaRadioButton[row]);
avaRadioButton[row].addActionListener(this);
++row;
}
int numRows = row;
if (numRows > 0) {
avaRadioButton[0].setSelected(true);
selectedButton = avaRadioButton[0];
}
// Layout the buttons
GridBagLayout gridbag = new GridBagLayout();
buttonPanel = new JPanel();
TitledBorder title = BorderFactory.createTitledBorder(null, "");
buttonPanel.setBorder(title);
buttonPanel.setLayout(gridbag);
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.HORIZONTAL;
if (numRows > 11) {
buildTwoColLayout(numRows, c, gridbag);
} else {
for (int i = 0; i < numRows; ++i) {
int cr = i;
c.anchor = GridBagConstraints.WEST;
Utility.buildConstraints(c, 0, cr, 2, 1, 1, 0);
gridbag.setConstraints(avaRadioButton[i], c);
buttonPanel.add(avaRadioButton[i]);
}
}
}
use of javax.swing.border.TitledBorder in project pcgen by PCGen.
the class MainAbout method buildSponsorsPanel.
private JPanel buildSponsorsPanel() {
TitledBorder title = BorderFactory.createTitledBorder(null, //$NON-NLS-1$
LanguageBundle.getString("in_abt_sponsorsTitle"));
title.setTitleJustification(TitledBorder.CENTER);
JLabelPane sponsorLabel = new JLabelPane();
JScrollPane sp = new JScrollPane(sponsorLabel);
sp.setBorder(title);
JPanel panel = new JPanel(new BorderLayout());
sponsorLabel.setBackground(panel.getBackground());
panel.add(sp, BorderLayout.CENTER);
Collection<Sponsor> sponsors = Globals.getGlobalContext().getReferenceContext().getConstructedCDOMObjects(Sponsor.class);
StringBuilder sb = new StringBuilder();
sb.append("<html><b>");
sb.append(LanguageBundle.getString("in_abt_ourSponsors")).append("</b><br>");
for (Sponsor sponsor : sponsors) {
if ("PCGEN".equals(sponsor.getKeyName())) {
continue;
}
sb.append("<img src='").append(sponsor.getBannerImage()).append("'><br>");
}
sb.append("</html>");
sponsorLabel.setText(sb.toString());
return panel;
}
Aggregations