Search in sources :

Example 16 with TitledBorder

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);
    }
}
Also used : Graphics(java.awt.Graphics) Insets(java.awt.Insets) TitledBorder(javax.swing.border.TitledBorder) BufferedImage(java.awt.image.BufferedImage)

Example 17 with TitledBorder

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);
}
Also used : JPanel(javax.swing.JPanel) TitledBorder(javax.swing.border.TitledBorder) Font(java.awt.Font)

Example 18 with TitledBorder

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)));
}
Also used : JPanel(javax.swing.JPanel) JButton(javax.swing.JButton) TitledBorder(javax.swing.border.TitledBorder)

Example 19 with TitledBorder

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]);
        }
    }
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) JRadioButton(javax.swing.JRadioButton) GridBagLayout(java.awt.GridBagLayout) InfoFacade(pcgen.facade.core.InfoFacade) ButtonGroup(javax.swing.ButtonGroup) TitledBorder(javax.swing.border.TitledBorder)

Example 20 with TitledBorder

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;
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) JLabelPane(pcgen.gui2.util.JLabelPane) BorderLayout(java.awt.BorderLayout) Sponsor(pcgen.cdom.content.Sponsor) TitledBorder(javax.swing.border.TitledBorder)

Aggregations

TitledBorder (javax.swing.border.TitledBorder)96 JPanel (javax.swing.JPanel)58 BorderLayout (java.awt.BorderLayout)30 GridBagConstraints (java.awt.GridBagConstraints)27 JLabel (javax.swing.JLabel)25 JScrollPane (javax.swing.JScrollPane)21 GridBagLayout (java.awt.GridBagLayout)20 Insets (java.awt.Insets)20 JButton (javax.swing.JButton)19 Dimension (java.awt.Dimension)18 EmptyBorder (javax.swing.border.EmptyBorder)18 GridLayout (java.awt.GridLayout)17 ActionEvent (java.awt.event.ActionEvent)17 ActionListener (java.awt.event.ActionListener)15 JCheckBox (javax.swing.JCheckBox)10 Color (java.awt.Color)9 Border (javax.swing.border.Border)9 FlowLayout (java.awt.FlowLayout)7 EtchedBorder (javax.swing.border.EtchedBorder)7 JTextField (javax.swing.JTextField)6