Example usage for javax.swing.border TitledBorder LEFT

List of usage examples for javax.swing.border TitledBorder LEFT

Introduction

In this page you can find the example usage for javax.swing.border TitledBorder LEFT.

Prototype

int LEFT

To view the source code for javax.swing.border TitledBorder LEFT.

Click Source Link

Document

Position title text at the left side of the border line.

Usage

From source file:pcgen.gui2.prefs.LookAndFeelPanel.java

/**
 * Instantiates a new look and feel panel.
 *///w w  w .  java 2s  . com
public LookAndFeelPanel(Dialog parent) {

    JLabel label;
    ButtonGroup exclusiveGroup;
    Border etched = null;
    TitledBorder title1 = BorderFactory.createTitledBorder(etched, IN_LOOK_AND_FEEL);

    title1.setTitleJustification(TitledBorder.LEFT);
    this.setBorder(title1);
    GridBagLayout gridbag = new GridBagLayout();
    this.setLayout(gridbag);
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.WEST;
    c.insets = new Insets(2, 2, 2, 2);

    exclusiveGroup = new ButtonGroup();
    Action[] actions = LookAndFeelManager.getActions();
    laf = new JRadioButton[actions.length - 1];

    for (int i = 0; i < laf.length; ++i) {
        laf[i] = new JRadioButton(actions[i]);

        int whichChar = (laf[i].getText().charAt(0) == 'C') ? 1 : 0;
        laf[i].setMnemonic(laf[i].getText().charAt(whichChar));

        Utility.buildConstraints(c, 0, i, 3, 1, 0, 0);
        gridbag.setConstraints(laf[i], c);
        this.add(laf[i]);
        exclusiveGroup.add(laf[i]);
    }

    skinnedLookFeel.addActionListener(actions[actions.length - 1]);
    skinnedLookFeel.setText(IN_SKINNED_LAF + ": ");
    skinnedLookFeel.setToolTipText(LanguageBundle.getString("in_Prefs_skinnedLAFTooltip"));
    skinnedLookFeel.setMnemonic(LanguageBundle.getMnemonic("in_mn_Prefs_skinnedLAF"));
    Utility.buildConstraints(c, 0, laf.length, 3, 1, 0, 0);
    gridbag.setConstraints(skinnedLookFeel, c);
    this.add(skinnedLookFeel);
    exclusiveGroup.add(skinnedLookFeel);

    Utility.buildConstraints(c, 3, laf.length, 1, 1, 1, 0);
    themepackLabel = new JTextField(LookAndFeelManager.getCurrentThemePack());
    themepackLabel.setEditable(false);
    gridbag.setConstraints(themepackLabel, c);
    this.add(themepackLabel);
    Utility.buildConstraints(c, 4, laf.length, 1, 1, 0, 0);
    themepack = new JButton(IN_CHOOSE);
    themepack.setToolTipText(LanguageBundle.getString("in_Prefs_chooseSkinTooltip"));
    gridbag.setConstraints(themepack, c);
    this.add(themepack);
    themepack.addActionListener(prefsButtonHandler);

    Utility.buildConstraints(c, 0, laf.length + 1, 5, 1, 0, 0);
    label = new JLabel("");
    gridbag.setConstraints(label, c);
    this.add(label);

    Utility.buildConstraints(c, 0, laf.length + 2, 5, 1, 0, 0);
    label = new JLabel(LanguageBundle.getString("in_Prefs_restartInfo"));
    gridbag.setConstraints(label, c);
    this.add(label);

    Utility.buildConstraints(c, 0, 20, 5, 1, 1, 1);
    c.fill = GridBagConstraints.BOTH;
    label = new JLabel(" ");
    gridbag.setConstraints(label, c);
    this.add(label);
}