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:com.floreantpos.bo.ui.explorer.MenuItemExplorer.java

private JPanel buildSearchForm() {
    JPanel panel = new JPanel();
    panel.setLayout(new MigLayout("", "[][]15[][]15[][]15[]", "[]5[]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

    JLabel lblOrderType = new JLabel(Messages.getString("MenuItemExplorer.4")); //$NON-NLS-1$
    cbOrderTypes = new JComboBox();

    cbOrderTypes.addItem(Messages.getString("MenuItemExplorer.5")); //$NON-NLS-1$
    cbOrderTypes.addItem("<None>");

    List<OrderType> orderTypes = Application.getInstance().getOrderTypes();
    for (OrderType orderType : orderTypes) {
        cbOrderTypes.addItem(orderType);
    }//from   www . jav a2 s . c om

    JLabel lblName = new JLabel(Messages.getString("MenuItemExplorer.0")); //$NON-NLS-1$
    JLabel lblGroup = new JLabel(Messages.getString("MenuItemExplorer.1")); //$NON-NLS-1$
    tfName = new JTextField(15);

    try {

        List<MenuGroup> menuGroupList = MenuGroupDAO.getInstance().findAll();

        cbGroup = new JComboBox();

        cbGroup.addItem(Messages.getString("MenuItemExplorer.2")); //$NON-NLS-1$
        cbGroup.addItem("<None>");
        for (MenuGroup s : menuGroupList) {
            cbGroup.addItem(s);
        }

        JButton searchBttn = new JButton(Messages.getString("MenuItemExplorer.3")); //$NON-NLS-1$

        panel.add(lblName, "align label"); //$NON-NLS-1$
        panel.add(tfName);
        panel.add(lblGroup);
        panel.add(cbGroup);
        panel.add(lblOrderType);
        panel.add(cbOrderTypes);
        panel.add(searchBttn);

        Border loweredetched = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
        TitledBorder title = BorderFactory.createTitledBorder(loweredetched, "Search"); //$NON-NLS-1$
        title.setTitleJustification(TitledBorder.LEFT);
        panel.setBorder(title);

        searchBttn.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                searchItem();
            }
        });

        tfName.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                searchItem();
            }
        });

    } catch (Throwable x) {
        BOMessageDialog.showError(POSConstants.ERROR_MESSAGE, x);
    }

    return panel;
}

From source file:com.floreantpos.bo.ui.explorer.ModifierExplorer.java

private JPanel buildSearchForm() {
    List<MenuModifierGroup> grpName;
    JPanel panel = new JPanel();
    panel.setLayout(new MigLayout("", "[][]30[][]30[]", "[]20[]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

    JLabel nameLabel = new JLabel(Messages.getString("ModifierExplorer.3")); //$NON-NLS-1$
    JLabel groupLabel = new JLabel(Messages.getString("ModifierExplorer.4")); //$NON-NLS-1$
    final JTextField nameField = new JTextField(15);
    grpName = MenuModifierGroupDAO.getInstance().findAll();
    final JComboBox cbGroup = new JComboBox();
    cbGroup.addItem(Messages.getString("ModifierExplorer.5")); //$NON-NLS-1$
    for (MenuModifierGroup s : grpName) {
        cbGroup.addItem(s);//w  w  w .  j  a  v a 2  s.  c  o  m
    }

    JButton searchBttn = new JButton(Messages.getString("ModifierExplorer.6")); //$NON-NLS-1$
    panel.add(nameLabel, "align label"); //$NON-NLS-1$
    panel.add(nameField);
    panel.add(groupLabel);
    panel.add(cbGroup);
    panel.add(searchBttn);

    TitledBorder title;
    Border loweredetched;
    loweredetched = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
    title = BorderFactory.createTitledBorder(loweredetched, Messages.getString("ModifierExplorer.8")); //$NON-NLS-1$
    title.setTitleJustification(TitledBorder.LEFT);
    panel.setBorder(title);
    searchBttn.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            List<MenuModifier> modifierList;
            String txName = nameField.getText();
            Object selectedItem = cbGroup.getSelectedItem();
            if (selectedItem instanceof MenuModifierGroup) {
                modifierList = ModifierDAO.getInstance().findModifier(txName, (MenuModifierGroup) selectedItem);
            } else {
                modifierList = ModifierDAO.getInstance().findModifier(txName, null);
            }

            setModifierList(modifierList);
        }
    });
    return panel;
}

From source file:net.minelord.gui.panes.IRCPane.java

public void updateTopic() {
    if (client.getTopic().trim().length() > 0) {
        if (topic == null)
            topic = new JLabel();
        topic.setText(client.getTopic());
        TitledBorder title = BorderFactory.createTitledBorder(
                BorderFactory.createEtchedBorder(EtchedBorder.LOWERED),
                "Topic set by " + client.getTopicSetter());
        title.setTitleJustification(TitledBorder.LEFT);
        topic.setBorder(title);//from   www  . j av a  2 s.  com
        // add(topic);

    } else {
        showTopic(false);
    }
    repaint();
}

From source file:net.minelord.gui.panes.IRCPane.java

public void connected() {
    SwingUtilities.invokeLater(new Runnable() {

        @Override/*from w  w w.  j a v  a 2 s . co  m*/
        public void run() {
            scroller.setBounds(scrollerWithoutTopicWithUserlist);
            scroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
            status = "Connected";
            client.connectAlertListener();
            TitledBorder title = BorderFactory
                    .createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "Connected");
            title.setTitleJustification(TitledBorder.RIGHT);
            userList = new JList(client.getUserList().toArray());
            userScroller = new JScrollPane(userList);
            userScroller.setBounds(userScrollerWithoutTopic);
            userList.setBounds(0, 0, 210, 250);
            userList.setBackground(Color.gray);
            userList.setForeground(Color.gray.darker().darker().darker());
            userScroller.setBorder(title);
            userScroller.getVerticalScrollBar().setUnitIncrement(5);
            scroller.setBorder(BorderFactory
                    .createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), ""));
            if (client.getTopic().trim().length() > 0) {
                topic = new JLabel(client.getTopic());
                scroller.setBounds(scrollerWithTopicWithUserlist);
                userScroller.setBounds(userScrollWithTopic);
                userList.setBounds(0, 0, 210, 225);
                title = BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED),
                        "Topic set by " + client.getTopicSetter());
                title.setTitleJustification(TitledBorder.LEFT);
                topic.setBorder(title);
                topic.setBounds(topicBounds);
                add(topic);
            } else
                topic = new JLabel("");
            input.setEnabled(true);
            input.requestFocus();
            final JPopupMenu userPopup = new JPopupMenu();
            JLabel breakLine = new JLabel("____");
            JLabel help = new JLabel("Politely ask for help");
            JLabel message = new JLabel("Message");
            JLabel sortNormal = new JLabel("Normal");
            JLabel sortAlphabetical = new JLabel("Alphabetical");
            JLabel sortRoles = new JLabel("Roles");

            help.addMouseListener(new MouseAdapter() {
                public void mousePressed(MouseEvent e) {
                    userPopup.setVisible(false);
                    sendMessage("/me kicks " + userList.getModel().getElementAt(userList.getSelectedIndex())
                            + " in the shins");
                    sendMessage("I need help you pleb");
                }

                public void mouseReleased(MouseEvent e) {
                }
            });
            message.addMouseListener(new MouseAdapter() {

                @Override
                public void mouseReleased(MouseEvent paramMouseEvent) {
                    userPopup.setVisible(false);
                    input.setText("/msg " + userList.getModel().getElementAt(userList.getSelectedIndex())
                            + (input.getText().length() > 0 && input.getText().charAt(0) == ' '
                                    ? input.getText()
                                    : " " + input.getText()));
                    input.select(0, ("/msg " + userList.getModel().getElementAt(userList.getSelectedIndex())
                            + (input.getText().length() > 0 && input.getText().charAt(0) == ' ' ? "" : " "))
                                    .length());
                    input.requestFocus();
                }
            });
            sortNormal.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseReleased(MouseEvent paramMouseEvent) {
                    userPopup.setVisible(false);
                    updateUserList(0);
                }
            });
            sortAlphabetical.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseReleased(MouseEvent paramMouseEvent) {
                    userPopup.setVisible(false);
                    updateUserList(1);
                }
            });
            sortRoles.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseReleased(MouseEvent paramMouseEvent) {
                    userPopup.setVisible(false);
                    updateUserList(2);
                }
            });
            userPopup.add(help);
            userPopup.add(message);
            userPopup.add(breakLine);
            userPopup.add(sortNormal);
            userPopup.add(sortAlphabetical);
            userPopup.add(sortRoles);

            userList.addMouseListener(new MouseAdapter() {
                public void mousePressed(MouseEvent e) {
                    check(e);
                }

                public void mouseReleased(MouseEvent e) {
                    check(e);
                }

                public void check(MouseEvent e) {
                    userList.setSelectedIndex(userList.locationToIndex(e.getPoint()));
                    userPopup.show(userList, e.getX(), e.getY());
                }
            });
            add(userScroller);

            final JPopupMenu textPopup = new JPopupMenu();
            JLabel copy = new JLabel("Copy");
            copy.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseReleased(MouseEvent paramMouseEvent) {
                    textPopup.setVisible(false);
                    if (text.getSelectedText() != null && text.getSelectedText().length() != 0) {
                        StringSelection selection = new StringSelection(text.getSelectedText());
                        Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
                        clipboard.setContents(selection, selection);
                    }
                }
            });
            textPopup.add(copy);
            text.addMouseListener(new MouseAdapter() {
                public void mousePressed(MouseEvent e) {
                }

                public void mouseReleased(MouseEvent e) {
                    if (SwingUtilities.isRightMouseButton(e))
                        textPopup.show(text, e.getX(), e.getY());
                }
            });
            add(userScroller);
            repaint();
        }
    });
}

From source file:de.adv_online.aaa.profiltool.ProfilDialog.java

private Component createMainTab() {

    String s;//from   ww  w .j  av  a 2s  .c o m

    String appSchemaStr;
    s = options.parameter("appSchemaName");
    if (s != null && s.trim().length() > 0)
        appSchemaStr = s.trim();
    else
        appSchemaStr = "";

    String mart;
    s = options.parameter(paramProfilClass, "Modellart");
    if (s != null && s.trim().length() > 0)
        mart = s.trim();
    else
        mart = "";

    String profil;
    s = options.parameter(paramProfilClass, "Profil");
    if (s != null && s.trim().length() > 0)
        profil = s.trim();
    else
        profil = "";

    String quelle;
    s = options.parameter(paramProfilClass, "Quelle");
    if (s != null && s.trim().length() > 0)
        quelle = s.trim();
    else
        quelle = "Neu_Minimal";

    String ziel;
    s = options.parameter(paramProfilClass, "Ziel");
    if (s != null && s.trim().length() > 0)
        ziel = s.trim();
    else
        ziel = "Datei";

    String pfadStr;
    s = options.parameter(paramProfilClass, "Verzeichnis");
    if (s == null || s.trim().length() == 0)
        pfadStr = "";
    else {
        File f = new File(s.trim());
        if (f.exists())
            pfadStr = f.getAbsolutePath();
        else
            pfadStr = "";
    }

    String mdlDirStr = eap;

    final JPanel topPanel = new JPanel();
    final JPanel topInnerPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 30, 5));
    topPanel.setLayout(new BoxLayout(topPanel, BoxLayout.X_AXIS));
    topPanel.setBorder(BorderFactory.createEmptyBorder(15, 20, 15, 10));

    // Anwendungsschema

    appSchemaField = new JTextField(35);
    appSchemaField.setText(appSchemaStr);
    appSchemaFieldLabel = new JLabel("Name des zu prozessierenden Anwendungsschemas:");

    Box asBox = Box.createVerticalBox();
    asBox.add(appSchemaFieldLabel);
    asBox.add(appSchemaField);

    modellartField = new JTextField(10);
    modellartField.setText(mart);
    modellartFieldLabel = new JLabel("Modellart:");

    asBox.add(modellartFieldLabel);
    asBox.add(modellartField);

    profilField = new JTextField(10);
    profilField.setText(profil);
    profilFieldLabel = new JLabel("Profilkennung:");

    asBox.add(profilFieldLabel);
    asBox.add(profilField);

    topInnerPanel.add(asBox);
    topPanel.add(topInnerPanel);

    // Quelle

    Box quelleBox = Box.createVerticalBox();

    final JPanel quellePanel = new JPanel(new GridLayout(4, 1));
    quelleGroup = new ButtonGroup();
    rbq3ap = new JRadioButton("3ap-Datei");
    quellePanel.add(rbq3ap);
    if (quelle.equals("Datei"))
        rbq3ap.setSelected(true);
    rbq3ap.setActionCommand("Datei");
    quelleGroup.add(rbq3ap);
    rbqtv = new JRadioButton("'AAA:Profile' Tagged Values in Modell");
    quellePanel.add(rbqtv);
    if (quelle.equals("Modell"))
        rbqtv.setSelected(true);
    rbqtv.setActionCommand("Modell");
    quelleGroup.add(rbqtv);
    rbqmin = new JRadioButton("Neues Minimalprofil erzeugen");
    quellePanel.add(rbqmin);
    if (quelle.equals("Neu_Minimal"))
        rbqmin.setSelected(true);
    rbqmin.setActionCommand("Neu_Minimal");
    quelleGroup.add(rbqmin);
    rbqmax = new JRadioButton("Neues Maximalprofil erzeugen");
    quellePanel.add(rbqmax);
    if (quelle.equals("Neu_Maximal"))
        rbqmax.setSelected(true);
    rbqmax.setActionCommand("Neu_Maximal");
    quelleGroup.add(rbqmax);
    quelleBorder = new TitledBorder(new LineBorder(Color.black), "Quelle der Profildefinition",
            TitledBorder.LEFT, TitledBorder.TOP);
    quellePanel.setBorder(quelleBorder);

    quelleBox.add(quellePanel);

    Box zielBox = Box.createVerticalBox();

    final JPanel zielPanel = new JPanel(new GridLayout(4, 1));
    zielGroup = new ButtonGroup();
    rbz3ap = new JRadioButton("3ap-Datei");
    zielPanel.add(rbz3ap);
    if (ziel.equals("Datei"))
        rbz3ap.setSelected(true);
    rbz3ap.setActionCommand("Datei");
    zielGroup.add(rbz3ap);
    rbztv = new JRadioButton("'AAA:Profile' Tagged Values in Modell");
    zielPanel.add(rbztv);
    if (ziel.equals("Modell"))
        rbztv.setSelected(true);
    rbztv.setActionCommand("Modell");
    zielGroup.add(rbztv);
    rbzbeide = new JRadioButton("Beides");
    zielPanel.add(rbzbeide);
    if (ziel.equals("DateiModell"))
        rbzbeide.setSelected(true);
    rbzbeide.setActionCommand("DateiModell");
    zielGroup.add(rbzbeide);
    rbzdel = new JRadioButton("Profilkennung wird aus Modell entfernt");
    zielPanel.add(rbzdel);
    if (ziel.equals("Ohne"))
        rbzdel.setSelected(true);
    rbzdel.setActionCommand("Ohne");
    zielGroup.add(rbzdel);
    zielBorder = new TitledBorder(new LineBorder(Color.black), "Ziel der Profildefinition", TitledBorder.LEFT,
            TitledBorder.TOP);
    zielPanel.setBorder(zielBorder);

    zielBox.add(zielPanel);

    // Pfadangaben

    Box pfadBox = Box.createVerticalBox();
    final JPanel pfadInnerPanel = new JPanel();
    Box skBox = Box.createVerticalBox();

    pfadFieldLabel = new JLabel("Pfad in dem 3ap-Dateien liegen/geschrieben werden:");
    skBox.add(pfadFieldLabel);
    pfadField = new JTextField(40);
    pfadField.setText(pfadStr);
    skBox.add(pfadField);

    mdlDirFieldLabel = new JLabel("Pfad zum Modell:");
    skBox.add(mdlDirFieldLabel);
    mdlDirField = new JTextField(40);
    mdlDirField.setText(mdlDirStr);
    skBox.add(mdlDirField);

    pfadInnerPanel.add(skBox);
    pfadBox.add(pfadInnerPanel);

    final JPanel pfadPanel = new JPanel();
    pfadPanel.add(pfadBox);
    pfadPanel.setBorder(
            new TitledBorder(new LineBorder(Color.black), "Pfadangaben", TitledBorder.LEFT, TitledBorder.TOP));

    // Zusammenstellung
    Box fileBox = Box.createVerticalBox();
    fileBox.add(topPanel);
    fileBox.add(quellePanel);
    fileBox.add(zielPanel);
    fileBox.add(pfadPanel);

    JPanel panel = new JPanel(new BorderLayout());
    panel.add(fileBox, BorderLayout.NORTH);

    if (profil.isEmpty()) {
        setModellartOnly = true;
        disableProfileElements();
    }

    // Listen for changes in the profilkennung
    profilField.getDocument().addDocumentListener(new DocumentListener() {
        public void changedUpdate(DocumentEvent e) {
            upd();
        }

        public void removeUpdate(DocumentEvent e) {
            upd();
        }

        public void insertUpdate(DocumentEvent e) {
            upd();
        }

        public void upd() {
            if (!setModellartOnly && profilField.getText().isEmpty()) {
                setModellartOnly = true;
                disableProfileElements();
            } else if (setModellartOnly && !profilField.getText().isEmpty()) {
                setModellartOnly = false;
                enableProfileElements();
            }
        }
    });

    return panel;
}

From source file:de.adv_online.aaa.katalogtool.KatalogDialog.java

private Component createMainTab() {

    // bernahme der Eigenschaften
    String s = "";

    String appSchemaStr;// w ww. j  a  va2  s . c o  m
    s = options.parameter("appSchemaName");
    if (s != null && s.trim().length() > 0)
        appSchemaStr = s.trim();
    else
        appSchemaStr = "";

    String schemaKennungenStr;
    s = options.parameter(paramKatalogClass, "schemakennungen");
    if (s != null && s.trim().length() > 0)
        schemaKennungenStr = s.trim();
    else
        schemaKennungenStr = "*";

    Boolean geerbEigBool = false;
    s = options.parameter(paramKatalogClass, "geerbteEigenschaften");
    if (s != null && s.equals("true"))
        geerbEigBool = true;

    String modellartenStr;
    s = options.parameter(paramKatalogClass, "modellarten");
    if (s == null || s.trim().length() == 0)
        modellartenStr = "";
    else
        modellartenStr = s.trim();

    Boolean grundDatBool = false;
    s = options.parameter(paramKatalogClass, "nurGrunddatenbestand");
    if (s != null && s.equals("true"))
        grundDatBool = true;

    Boolean profEinschrBool = false;
    Boolean profDateiBool = false;
    String profileStr;
    s = options.parameter(paramKatalogClass, "profile");
    if (s == null || s.trim().length() == 0)
        profileStr = "";
    else
        profileStr = s.trim();
    if (profileStr.length() > 0)
        profEinschrBool = true;
    s = options.parameter(paramKatalogClass, "profilquelle");
    if (s != null && s.trim().equals("Datei"))
        profDateiBool = true;

    Boolean pkgBool = false;
    String pkgStr;
    s = options.parameter(paramKatalogClass, "paket");
    if (s == null || s.trim().length() == 0)
        pkgStr = "";
    else
        pkgStr = s.trim();
    if (pkgStr.length() > 0)
        pkgBool = true;

    String xsltPfadStr;
    s = options.parameter(paramKatalogClass, "xsltPfad");
    if (s == null || s.trim().length() == 0)
        xsltPfadStr = "";
    else {
        if (s.toLowerCase().startsWith("http://")) {
            xsltPfadStr = s;
        } else {
            File f = new File(s.trim());
            if (f.exists())
                xsltPfadStr = f.getAbsolutePath();
            else
                xsltPfadStr = "";
        }
    }

    String outDirStr;
    s = options.parameter(paramKatalogClass, "Verzeichnis");
    if (s == null || s.trim().length() == 0)
        outDirStr = "";
    else {
        File f = new File(s.trim());
        if (f.exists())
            outDirStr = f.getAbsolutePath();
        else
            outDirStr = "";
    }

    String mdlDirStr = eap;

    // Anwendungsschema

    final JPanel appSchemaPanel = new JPanel();
    final JPanel appSchemaInnerPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 30, 5));
    appSchemaPanel.setLayout(new BoxLayout(appSchemaPanel, BoxLayout.X_AXIS));
    appSchemaPanel.setBorder(BorderFactory.createEmptyBorder(15, 20, 15, 10));

    appSchemaField = new JTextField(37);
    appSchemaField.setText(appSchemaStr);
    appSchemaFieldLabel = new JLabel("Name des zu exportierenden Anwendungsschemas:");

    Box asBox = Box.createVerticalBox();
    asBox.add(appSchemaFieldLabel);
    asBox.add(appSchemaField);

    pkgBox = new JCheckBox("Eingeschrnkt auf Paket:");
    pkgBox.setSelected(pkgBool);
    pkgBox.addItemListener(this);
    pkgField = new JTextField(37);
    pkgField.setText(pkgStr);
    if (pkgStr.length() == 0) {
        pkgField.setEnabled(false);
        pkgField.setEditable(false);
    }
    asBox.add(pkgBox);
    asBox.add(pkgField);

    appSchemaInnerPanel.add(asBox);

    appSchemaPanel.add(appSchemaInnerPanel);

    // Ausgabeoptionen

    Box outOptBox = Box.createVerticalBox();

    final JPanel outOptInnerPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 15, 5));
    Box skBox = Box.createVerticalBox();
    schemaKennFieldLabel1 = new JLabel("Liste der zu bercksichtigenden Schema-Kennungen");
    skBox.add(schemaKennFieldLabel1);
    schemaKennFieldLabel2 = new JLabel("(nur Klassen mit diesen Kennungen werden exportiert)");
    skBox.add(schemaKennFieldLabel2);
    schemaKennField = new JTextField(35);
    schemaKennField.setText(schemaKennungenStr);
    skBox.add(schemaKennField);
    outOptInnerPanel.add(skBox);
    outOptBox.add(outOptInnerPanel);

    final JPanel targetPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 10, 5));
    for (String label : targetLabels) {
        targetPanel.add(targetGuiElems.get(label).selBox);
    }
    outOptBox.add(targetPanel);

    final JPanel geerbEigPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 10, 5));
    geerbEigBox = new JCheckBox("Eigenschaften aus Superklassen auch in abgeleiteten Klassen darstellen");
    geerbEigBox.setSelected(geerbEigBool);
    geerbEigBox.addItemListener(this);
    geerbEigPanel.add(geerbEigBox);
    outOptBox.add(geerbEigPanel);

    final JPanel outOptPanel = new JPanel();
    outOptPanel.add(outOptBox);
    outOptPanel.setBorder(new TitledBorder(new LineBorder(Color.black), "Ausgabeoptionen", TitledBorder.LEFT,
            TitledBorder.TOP));

    // Modellarten und Profile
    Box modProfBox = Box.createVerticalBox();

    final JPanel modProfInnerPanel1 = new JPanel(new FlowLayout(FlowLayout.LEADING, 15, 5));

    skBox = Box.createVerticalBox();
    modellartFieldLabel = new JLabel("Ausgewhlte Modellarten:");
    modellartField = new JTextField(45);
    modellartField.setText(modellartenStr);
    skBox.add(modellartFieldLabel);
    skBox.add(modellartField);
    modProfInnerPanel1.add(skBox);
    modProfBox.add(modProfInnerPanel1);
    final JPanel grundDatPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 10, 8));
    grundDatBox = new JCheckBox("Nur Grunddatenbestand exportieren");
    grundDatBox.setSelected(grundDatBool);
    grundDatBox.addItemListener(this);
    grundDatPanel.add(grundDatBox);
    modProfBox.add(grundDatPanel);

    final JPanel profPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 10, 5));
    profEinschrBox = new JCheckBox("Eingeschrnkt auf folgende Profilkennung(en) im Modell:");
    profEinschrBox.setSelected(profEinschrBool);
    profEinschrBox.addItemListener(this);
    profPanel.add(profEinschrBox);
    final JPanel profPanel2 = new JPanel(new FlowLayout(FlowLayout.LEADING, 15, 2));
    profileField = new JTextField(45);
    profileField.setText(profileStr);
    profPanel2.add(profileField);
    final JPanel profPanel3 = new JPanel(new FlowLayout(FlowLayout.LEADING, 15, 2));
    profDateiBox = new JCheckBox(
            "Profil(e) nur aus 3ap-Datei laden und verwenden statt der Profilkennungen aus dem Modell");
    profDateiBox.setSelected(profDateiBool);
    profDateiBox.addItemListener(this);
    profPanel3.add(profDateiBox);
    if (profileStr.length() == 0) {
        profileField.setEnabled(false);
        profileField.setEditable(false);
        profDateiBox.setEnabled(false);
    }

    modProfBox.add(profPanel);
    modProfBox.add(profPanel2);
    modProfBox.add(profPanel3);

    final JPanel modProfPanel = new JPanel();
    modProfPanel.add(modProfBox);
    modProfPanel.setBorder(new TitledBorder(new LineBorder(Color.black), "Auswahl der Modellarten und Profile",
            TitledBorder.LEFT, TitledBorder.TOP));

    // Pfadangaben
    Box pfadBox = Box.createVerticalBox();
    final JPanel pfadInnerPanel = new JPanel();
    skBox = Box.createVerticalBox();
    xsltpfadFieldLabel = new JLabel("Pfad in dem die XSLT-Skripte liegen:");
    skBox.add(xsltpfadFieldLabel);
    xsltpfadField = new JTextField(45);
    xsltpfadField.setText(xsltPfadStr);
    skBox.add(xsltpfadField);
    outDirFieldLabel = new JLabel("Pfad in den die Kataloge geschrieben werden:");
    skBox.add(outDirFieldLabel);
    outDirField = new JTextField(45);
    outDirField.setText(outDirStr);
    skBox.add(outDirField);
    mdlDirFieldLabel = new JLabel("Pfad zum Modell:");
    skBox.add(mdlDirFieldLabel);
    mdlDirField = new JTextField(45);
    mdlDirField.setText(mdlDirStr);
    skBox.add(mdlDirField);
    pfadInnerPanel.add(skBox);
    pfadBox.add(pfadInnerPanel);

    final JPanel pfadPanel = new JPanel();
    pfadPanel.add(pfadBox);
    pfadPanel.setBorder(
            new TitledBorder(new LineBorder(Color.black), "Pfadangaben", TitledBorder.LEFT, TitledBorder.TOP));

    // Zusammenstellung
    Box fileBox = Box.createVerticalBox();
    fileBox.add(appSchemaPanel);
    fileBox.add(outOptPanel);
    fileBox.add(modProfPanel);
    fileBox.add(pfadPanel);

    JPanel panel = new JPanel(new BorderLayout());
    panel.add(fileBox, BorderLayout.NORTH);

    return panel;
}

From source file:it.imtech.metadata.MetaUtility.java

/**
 * Metodo adibito alla creazione dinamica ricorsiva dell'interfaccia dei
 * metadati/*w  ww  . j  a  va2  s .c  o  m*/
 *
 * @param submetadatas Map contente i metadati e i sottolivelli di metadati
 * @param vocabularies Map contenente i dati contenuti nel file xml
 * vocabulary.xml
 * @param parent Jpanel nel quale devono venir inseriti i metadati
 * @param level Livello corrente
 */
public void create_metadata_view(Map<Object, Metadata> submetadatas, JPanel parent, int level,
        final String panelname) throws Exception {
    ResourceBundle bundle = ResourceBundle.getBundle(Globals.RESOURCES, Globals.CURRENT_LOCALE, Globals.loader);
    int lenght = submetadatas.size();
    int labelwidth = 220;
    int i = 0;
    JButton addcontribute = null;

    for (Map.Entry<Object, Metadata> kv : submetadatas.entrySet()) {
        ArrayList<Component> tabobjects = new ArrayList<Component>();

        if (kv.getValue().MID == 17 || kv.getValue().MID == 23 || kv.getValue().MID == 18
                || kv.getValue().MID == 137) {
            continue;
        }

        //Crea un jpanel nuovo e fa appen su parent
        JPanel innerPanel = new JPanel(new MigLayout("fillx, insets 1 1 1 1"));
        innerPanel.setName("pannello" + level + i);

        i++;
        String datatype = kv.getValue().datatype.toString();

        if (kv.getValue().MID == 45) {
            JPanel choice = new JPanel(new MigLayout());

            JComboBox combo = addClassificationChoice(choice, kv.getValue().sequence, panelname);

            JLabel labelc = new JLabel();
            labelc.setText(Utility.getBundleString("selectclassif", bundle));
            labelc.setPreferredSize(new Dimension(100, 20));

            choice.add(labelc);

            findLastClassification(panelname);
            if (last_classification != 0 && classificationRemoveButton == null) {
                logger.info("Removing last clasification");
                classificationRemoveButton = new JButton("-");

                classificationRemoveButton.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent event) {
                        BookImporter.getInstance().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                        removeClassificationToMetadata(panelname);
                        BookImporter.getInstance().refreshMetadataTab(false, panelname);
                        findLastClassification(panelname); //update last_classification
                        BookImporter.getInstance().setCursor(null);
                    }
                });
                if (Integer.parseInt(kv.getValue().sequence) == last_classification) {
                    choice.add(classificationRemoveButton, "wrap, width :50:");
                }
            }

            if (classificationAddButton == null) {
                logger.info("Adding a new classification");
                choice.add(combo, "width 100:600:600");

                classificationAddButton = new JButton("+");

                classificationAddButton.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent event) {
                        BookImporter.getInstance().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                        addClassificationToMetadata(panelname);
                        BookImporter.getInstance().refreshMetadataTab(false, panelname);
                        BookImporter.getInstance().setCursor(null);
                    }
                });

                choice.add(classificationAddButton, "width :50:");
            } else {
                //choice.add(combo, "wrap,width 100:700:700");
                choice.add(combo, "width 100:700:700");
                if (Integer.parseInt(kv.getValue().sequence) == last_classification) {
                    choice.add(classificationRemoveButton, "wrap, width :50");
                }
            }
            parent.add(choice, "wrap,width 100:700:700");
            classificationMID = kv.getValue().MID;

            innerPanel.setName(panelname + "---ImPannelloClassif---" + kv.getValue().sequence);
            try {

                addClassification(innerPanel, classificationMID, kv.getValue().sequence, panelname);
            } catch (Exception ex) {
                logger.error("Errore nell'aggiunta delle classificazioni");
            }
            parent.add(innerPanel, "wrap, growx");
            BookImporter.policy.addIndexedComponent(combo);

            continue;
        }

        if (datatype.equals("Node")) {
            JLabel label = new JLabel();
            label.setText(kv.getValue().description);
            label.setPreferredSize(new Dimension(100, 20));

            int size = 16 - (level * 2);
            Font myFont = new Font("MS Sans Serif", Font.PLAIN, size);
            label.setFont(myFont);

            if (Integer.toString(kv.getValue().MID).equals("11")) {
                JPanel temppanel = new JPanel(new MigLayout());

                //update last_contribute
                findLastContribute(panelname);

                if (last_contribute != 0 && removeContribute == null) {
                    logger.info("Removing last contribute");
                    removeContribute = new JButton("-");

                    removeContribute.addActionListener(new ActionListener() {
                        @Override
                        public void actionPerformed(ActionEvent event) {
                            BookImporter.getInstance()
                                    .setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                            removeContributorToMetadata(panelname);
                            BookImporter.getInstance().refreshMetadataTab(false, panelname);
                            BookImporter.getInstance().setCursor(null);
                        }
                    });

                    if (!kv.getValue().sequence.equals("")) {
                        if (Integer.parseInt(kv.getValue().sequence) == last_contribute) {
                            innerPanel.add(removeContribute, "width :50:");
                        }
                    }
                }

                if (addcontribute == null) {
                    logger.info("Adding a new contribute");
                    addcontribute = new JButton("+");

                    addcontribute.addActionListener(new ActionListener() {
                        @Override
                        public void actionPerformed(ActionEvent event) {
                            BookImporter.getInstance()
                                    .setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                            addContributorToMetadata(panelname);
                            BookImporter.getInstance().refreshMetadataTab(false, panelname);
                            BookImporter.getInstance().setCursor(null);
                        }
                    });

                    temppanel.add(label, " width :200:");
                    temppanel.add(addcontribute, "width :50:");
                    innerPanel.add(temppanel, "wrap, growx");
                } else {
                    temppanel.add(label, " width :200:");
                    findLastContribute(panelname);
                    if (!kv.getValue().sequence.equals("")) {
                        if (Integer.parseInt(kv.getValue().sequence) == last_contribute) {
                            temppanel.add(removeContribute, "width :50:");
                        }
                    }
                    innerPanel.add(temppanel, "wrap, growx");
                }
            } else if (Integer.toString(kv.getValue().MID).equals("115")) {
                logger.info("Devo gestire una provenience!");
            }
        } else {
            String title = "";

            if (kv.getValue().mandatory.equals("Y") || kv.getValue().MID == 14 || kv.getValue().MID == 15) {
                title = kv.getValue().description + " *";
            } else {
                title = kv.getValue().description;
            }

            innerPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), title,
                    TitledBorder.LEFT, TitledBorder.TOP));

            if (datatype.equals("Vocabulary")) {
                TreeMap<String, String> entryCombo = new TreeMap<String, String>();
                int index = 0;
                String selected = null;

                if (!Integer.toString(kv.getValue().MID).equals("8"))
                    entryCombo.put(Utility.getBundleString("comboselect", bundle),
                            Utility.getBundleString("comboselect", bundle));

                for (Map.Entry<String, TreeMap<String, VocEntry>> vc : vocabularies.entrySet()) {
                    String tempmid = Integer.toString(kv.getValue().MID);

                    if (Integer.toString(kv.getValue().MID_parent).equals("11")
                            || Integer.toString(kv.getValue().MID_parent).equals("13")) {
                        String[] testmid = tempmid.split("---");
                        tempmid = testmid[0];
                    }

                    if (vc.getKey().equals(tempmid)) {
                        TreeMap<String, VocEntry> iEntry = vc.getValue();

                        for (Map.Entry<String, VocEntry> ivc : iEntry.entrySet()) {
                            entryCombo.put(ivc.getValue().description, ivc.getValue().ID);
                            if (kv.getValue().value != null) {
                                if (kv.getValue().value.equals(ivc.getValue().ID)) {
                                    selected = ivc.getValue().ID;
                                }
                            }
                            index++;
                        }
                    }
                }

                final ComboMapImpl model = new ComboMapImpl();
                model.setVocabularyCombo(true);
                model.putAll(entryCombo);

                final JComboBox voc = new javax.swing.JComboBox(model);
                model.specialRenderCombo(voc);

                if (Integer.toString(kv.getValue().MID_parent).equals("11")
                        || Integer.toString(kv.getValue().MID_parent).equals("13")) {
                    voc.setName("MID_" + Integer.toString(kv.getValue().MID) + "---" + kv.getValue().sequence);
                } else {
                    voc.setName("MID_" + Integer.toString(kv.getValue().MID));
                }

                if (Integer.toString(kv.getValue().MID).equals("8") && selected == null)
                    selected = "44";

                selected = (selected == null) ? Utility.getBundleString("comboselect", bundle) : selected;

                for (int k = 0; k < voc.getItemCount(); k++) {
                    Map.Entry<String, String> el = (Map.Entry<String, String>) voc.getItemAt(k);
                    if (el.getValue().equals(selected))
                        voc.setSelectedIndex(k);
                }

                voc.setPreferredSize(new Dimension(150, 30));
                innerPanel.add(voc, "wrap, width :400:");
                tabobjects.add(voc);
            } else if (datatype.equals("CharacterString") || datatype.equals("GPS")) {
                final JTextArea textField = new javax.swing.JTextArea();

                if (Integer.toString(kv.getValue().MID_parent).equals("11")
                        || Integer.toString(kv.getValue().MID_parent).equals("13")) {
                    textField.setName(
                            "MID_" + Integer.toString(kv.getValue().MID) + "---" + kv.getValue().sequence);
                } else {
                    textField.setName("MID_" + Integer.toString(kv.getValue().MID));
                }

                textField.setPreferredSize(new Dimension(230, 0));
                textField.setText(kv.getValue().value);
                textField.setLineWrap(true);
                textField.setWrapStyleWord(true);

                innerPanel.add(textField, "wrap, width :300:");

                textField.addKeyListener(new KeyAdapter() {
                    @Override
                    public void keyPressed(KeyEvent e) {
                        if (e.getKeyCode() == KeyEvent.VK_TAB) {
                            if (e.getModifiers() > 0) {
                                textField.transferFocusBackward();
                            } else {
                                textField.transferFocus();
                            }
                            e.consume();
                        }
                    }
                });

                tabobjects.add(textField);
            } else if (datatype.equals("LangString")) {
                JScrollPane inner_scroll = new javax.swing.JScrollPane();
                inner_scroll.setHorizontalScrollBarPolicy(
                        javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
                inner_scroll.setVerticalScrollBarPolicy(
                        javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
                inner_scroll.setPreferredSize(new Dimension(240, 80));
                inner_scroll.setName("langStringScroll");
                final JTextArea jTextArea1 = new javax.swing.JTextArea();
                jTextArea1.setName("MID_" + Integer.toString(kv.getValue().MID));
                jTextArea1.setText(kv.getValue().value);

                jTextArea1.setSize(new Dimension(350, 70));
                jTextArea1.setLineWrap(true);
                jTextArea1.setWrapStyleWord(true);

                inner_scroll.setViewportView(jTextArea1);
                innerPanel.add(inner_scroll, "width :300:");

                //Add combo language box
                JComboBox voc = getComboLangBox(kv.getValue().language);
                voc.setName("MID_" + Integer.toString(kv.getValue().MID) + "_lang");

                voc.setPreferredSize(new Dimension(200, 20));
                innerPanel.add(voc, "wrap, width :300:");

                jTextArea1.addKeyListener(new KeyAdapter() {
                    @Override
                    public void keyPressed(KeyEvent e) {
                        if (e.getKeyCode() == KeyEvent.VK_TAB) {
                            if (e.getModifiers() > 0) {
                                jTextArea1.transferFocusBackward();
                            } else {
                                jTextArea1.transferFocus();
                            }
                            e.consume();
                        }
                    }
                });
                tabobjects.add(jTextArea1);
                tabobjects.add(voc);
            } else if (datatype.equals("Language")) {
                final JComboBox voc = getComboLangBox(kv.getValue().value);
                voc.setName("MID_" + Integer.toString(kv.getValue().MID));

                voc.setPreferredSize(new Dimension(150, 20));
                voc.setBounds(5, 5, 150, 20);
                innerPanel.add(voc, "wrap, width :500:");

                //BookImporter.policy.addIndexedComponent(voc);
                tabobjects.add(voc);

            } else if (datatype.equals("Boolean")) {
                int selected = 0;
                TreeMap bin = new TreeMap<String, String>();
                bin.put("yes", Utility.getBundleString("voc1", bundle));
                bin.put("no", Utility.getBundleString("voc2", bundle));

                if (kv.getValue().value == null) {
                    switch (kv.getValue().MID) {
                    case 35:
                        selected = 0;
                        break;
                    case 36:
                        selected = 1;
                        break;
                    }
                } else if (kv.getValue().value.equals("yes")) {
                    selected = 1;
                } else {
                    selected = 0;
                }

                final ComboMapImpl model = new ComboMapImpl();
                model.putAll(bin);

                final JComboBox voc = new javax.swing.JComboBox(model);
                model.specialRenderCombo(voc);

                voc.setName("MID_" + Integer.toString(kv.getValue().MID));
                voc.setSelectedIndex(selected);

                voc.setPreferredSize(new Dimension(150, 20));
                voc.setBounds(5, 5, 150, 20);
                innerPanel.add(voc, "wrap, width :300:");
                //BookImporter.policy.addIndexedComponent(voc);
                tabobjects.add(voc);
            } else if (datatype.equals("License")) {
                String selectedIndex = null;
                int vindex = 0;
                int defaultIndex = 0;

                TreeMap<String, String> entryCombo = new TreeMap<String, String>();

                for (Map.Entry<String, TreeMap<String, VocEntry>> vc : vocabularies.entrySet()) {
                    if (vc.getKey().equals(Integer.toString(kv.getValue().MID))) {
                        TreeMap<String, VocEntry> iEntry = vc.getValue();

                        for (Map.Entry<String, VocEntry> ivc : iEntry.entrySet()) {
                            entryCombo.put(ivc.getValue().description, ivc.getValue().ID);

                            if (ivc.getValue().ID.equals("1"))
                                defaultIndex = vindex;

                            if (kv.getValue().value != null) {
                                if (ivc.getValue().ID.equals(kv.getValue().value)) {
                                    selectedIndex = Integer.toString(vindex);
                                }
                            }
                            vindex++;
                        }
                    }
                }

                if (selectedIndex == null)
                    selectedIndex = Integer.toString(defaultIndex);

                ComboMapImpl model = new ComboMapImpl();
                model.putAll(entryCombo);
                model.setVocabularyCombo(true);

                JComboBox voc = new javax.swing.JComboBox(model);
                model.specialRenderCombo(voc);

                voc.setName("MID_" + Integer.toString(kv.getValue().MID));
                voc.setSelectedIndex(Integer.parseInt(selectedIndex));
                voc.setPreferredSize(new Dimension(150, 20));

                voc.setBounds(5, 5, 150, 20);
                innerPanel.add(voc, "wrap, width :500:");
                //BookImporter.policy.addIndexedComponent(voc);
                tabobjects.add(voc);
            } else if (datatype.equals("DateTime")) {
                //final JXDatePicker datePicker = new JXDatePicker();
                JDateChooser datePicker = new JDateChooser();
                datePicker.setName("MID_" + Integer.toString(kv.getValue().MID));

                JPanel test = new JPanel(new MigLayout());
                JLabel lbefore = new JLabel(Utility.getBundleString("beforechristlabel", bundle));
                JCheckBox beforechrist = new JCheckBox();
                beforechrist.setName("MID_" + Integer.toString(kv.getValue().MID) + "_check");

                if (kv.getValue().value != null) {
                    try {
                        if (kv.getValue().value.charAt(0) == '-') {
                            beforechrist.setSelected(true);
                        }

                        Date date1 = new Date();
                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                        if (kv.getValue().value.charAt(0) == '-') {
                            date1 = sdf.parse(adjustDate(kv.getValue().value));
                        } else {
                            date1 = sdf.parse(kv.getValue().value);
                        }
                        datePicker.setDate(date1);
                    } catch (Exception e) {
                        //Console.WriteLine("ERROR import date:" + ex.Message);
                    }
                }

                test.add(datePicker, "width :200:");
                test.add(lbefore, "gapleft 30");
                test.add(beforechrist, "wrap");

                innerPanel.add(test, "wrap");
            }
        }

        //Recursive call
        create_metadata_view(kv.getValue().submetadatas, innerPanel, level + 1, panelname);

        if (kv.getValue().editable.equals("Y")
                || (datatype.equals("Node") && kv.getValue().hidden.equals("0"))) {
            parent.add(innerPanel, "wrap, growx");

            for (Component tabobject : tabobjects) {
                BookImporter.policy.addIndexedComponent(tabobject);
            }
        }
    }
}

From source file:it.imtech.metadata.MetaUtility.java

/**
 * Aggiunge il pannello delle classificazioni all'interfaccia dei metadati
 *
 * @param innerPanel Pannello sul quale aggiungere i metadati
 * @param kv Valori dei metadati//w  w  w . ja v  a 2s.co m
 */
private void addClassification(JPanel innerPanel, Integer kv, final String sequence, final String panelname)
        throws Exception {
    try {
        ResourceBundle bundle = ResourceBundle.getBundle(Globals.RESOURCES, Globals.CURRENT_LOCALE,
                Globals.loader);

        DefaultMutableTreeNode hierarchy = new DefaultMutableTreeNode("root");
        selected = null;
        String selectedPath = "";

        String link = selectedClassificationList.get(panelname + "---" + sequence);

        recursiveOefosTreeviewBuild(hierarchy, oefos.get(link), sequence, panelname);
        DefaultTreeModel model = new DefaultTreeModel(hierarchy);

        final JTree tree = new JTree(model);
        tree.setRootVisible(false);

        if (selected != null) {
            TreePath selpath = new TreePath(selected.getPath());
            tree.setSelectionPath(selpath);

            Object[] nodes = selpath.getPath();

            for (int i = 1; i < nodes.length; i++) {
                selectedPath += nodes[i].toString();
                selectedPath += (i != nodes.length - 1) ? "/" : "";
            }
        }

        tree.setName("MID_" + Integer.toString(kv) + "---" + sequence);
        tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);

        tree.addTreeSelectionListener(new TreeSelectionListener() {

            public void valueChanged(TreeSelectionEvent e) {
                try {
                    setOEFOS(tree, sequence, panelname);
                } catch (Exception ex) {
                    logger.error(ex.getMessage());
                }
            }
        });

        javax.swing.JScrollPane tree_scroller = new javax.swing.JScrollPane();
        tree_scroller
                .setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
        tree_scroller.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
        tree_scroller.setViewportView(tree);
        tree_scroller.setBorder(null);

        innerPanel.add(tree_scroller, "wrap, width 100:800:800");

        JPanel iPanel = new JPanel(new MigLayout());
        iPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
                Utility.getBundleString("choose2", bundle), TitledBorder.LEFT, TitledBorder.TOP));
        JLabel label = new JLabel();
        label.setName("classification_path" + "---" + sequence);
        label.setText(selectedPath);
        iPanel.add(label, "wrap, growx, height 30:30:30");

        innerPanel.add(iPanel, "wrap, width 100:800:800");

        findLastClassification(panelname);

    } catch (Exception ex) {
        logger.error(ex.getMessage());
        throw new Exception("Exception in addClassification: " + ex.getStackTrace() + "\n");
    }
}

From source file:org.jtrfp.trcl.gui.ConfigWindow.java

public ConfigWindow() {
    setTitle("Settings");
    setSize(340, 540);// w ww  .ja v a 2s  .c o  m
    if (config == null)
        config = new TRConfiguration();
    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    getContentPane().add(tabbedPane, BorderLayout.CENTER);

    JPanel generalTab = new JPanel();
    tabbedPane.addTab("General",
            new ImageIcon(ConfigWindow.class
                    .getResource("/org/freedesktop/tango/22x22/mimetypes/application-x-executable.png")),
            generalTab, null);
    GridBagLayout gbl_generalTab = new GridBagLayout();
    gbl_generalTab.columnWidths = new int[] { 0, 0 };
    gbl_generalTab.rowHeights = new int[] { 0, 188, 222, 0 };
    gbl_generalTab.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
    gbl_generalTab.rowWeights = new double[] { 0.0, 1.0, 0.0, Double.MIN_VALUE };
    generalTab.setLayout(gbl_generalTab);

    JPanel settingsLoadSavePanel = new JPanel();
    GridBagConstraints gbc_settingsLoadSavePanel = new GridBagConstraints();
    gbc_settingsLoadSavePanel.insets = new Insets(0, 0, 5, 0);
    gbc_settingsLoadSavePanel.anchor = GridBagConstraints.WEST;
    gbc_settingsLoadSavePanel.gridx = 0;
    gbc_settingsLoadSavePanel.gridy = 0;
    generalTab.add(settingsLoadSavePanel, gbc_settingsLoadSavePanel);
    settingsLoadSavePanel.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null),
            "Overall Settings", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    FlowLayout flowLayout_1 = (FlowLayout) settingsLoadSavePanel.getLayout();
    flowLayout_1.setAlignment(FlowLayout.LEFT);

    JButton btnSave = new JButton("Export...");
    btnSave.setToolTipText("Export these settings to an external file");
    settingsLoadSavePanel.add(btnSave);
    btnSave.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            exportSettings();
        }
    });

    JButton btnLoad = new JButton("Import...");
    btnLoad.setToolTipText("Import an external settings file");
    settingsLoadSavePanel.add(btnLoad);
    btnLoad.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            importSettings();
        }
    });

    JButton btnConfigReset = new JButton("Reset");
    btnConfigReset.setToolTipText("Reset all settings to defaults");
    settingsLoadSavePanel.add(btnConfigReset);
    btnConfigReset.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            defaultSettings();
        }
    });

    JPanel registeredPODsPanel = new JPanel();
    registeredPODsPanel.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null),
            "Registered PODs", TitledBorder.LEFT, TitledBorder.TOP, null, null));
    GridBagConstraints gbc_registeredPODsPanel = new GridBagConstraints();
    gbc_registeredPODsPanel.insets = new Insets(0, 0, 5, 0);
    gbc_registeredPODsPanel.fill = GridBagConstraints.BOTH;
    gbc_registeredPODsPanel.gridx = 0;
    gbc_registeredPODsPanel.gridy = 1;
    generalTab.add(registeredPODsPanel, gbc_registeredPODsPanel);
    GridBagLayout gbl_registeredPODsPanel = new GridBagLayout();
    gbl_registeredPODsPanel.columnWidths = new int[] { 272, 0 };
    gbl_registeredPODsPanel.rowHeights = new int[] { 76, 0, 0 };
    gbl_registeredPODsPanel.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
    gbl_registeredPODsPanel.rowWeights = new double[] { 1.0, 1.0, Double.MIN_VALUE };
    registeredPODsPanel.setLayout(gbl_registeredPODsPanel);

    JPanel podListPanel = new JPanel();
    GridBagConstraints gbc_podListPanel = new GridBagConstraints();
    gbc_podListPanel.insets = new Insets(0, 0, 5, 0);
    gbc_podListPanel.fill = GridBagConstraints.BOTH;
    gbc_podListPanel.gridx = 0;
    gbc_podListPanel.gridy = 0;
    registeredPODsPanel.add(podListPanel, gbc_podListPanel);
    podListPanel.setLayout(new BorderLayout(0, 0));

    JScrollPane podListScrollPane = new JScrollPane();
    podListPanel.add(podListScrollPane, BorderLayout.CENTER);

    podList = new JList(podLM);
    podList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    podListScrollPane.setViewportView(podList);

    JPanel podListOpButtonPanel = new JPanel();
    podListOpButtonPanel.setBorder(null);
    GridBagConstraints gbc_podListOpButtonPanel = new GridBagConstraints();
    gbc_podListOpButtonPanel.anchor = GridBagConstraints.NORTH;
    gbc_podListOpButtonPanel.gridx = 0;
    gbc_podListOpButtonPanel.gridy = 1;
    registeredPODsPanel.add(podListOpButtonPanel, gbc_podListOpButtonPanel);
    FlowLayout flowLayout = (FlowLayout) podListOpButtonPanel.getLayout();
    flowLayout.setAlignment(FlowLayout.LEFT);

    JButton addPodButton = new JButton("Add...");
    addPodButton.setIcon(
            new ImageIcon(ConfigWindow.class.getResource("/org/freedesktop/tango/16x16/actions/list-add.png")));
    addPodButton.setToolTipText("Add a POD to the registry to be considered when running a game.");
    podListOpButtonPanel.add(addPodButton);
    addPodButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            addPOD();
        }
    });

    JButton removePodButton = new JButton("Remove");
    removePodButton.setIcon(new ImageIcon(
            ConfigWindow.class.getResource("/org/freedesktop/tango/16x16/actions/list-remove.png")));
    removePodButton.setToolTipText("Remove a POD file from being considered when playing a game");
    podListOpButtonPanel.add(removePodButton);
    removePodButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            podLM.removeElement(podList.getSelectedValue());
        }
    });

    JButton podEditButton = new JButton("Edit...");
    podEditButton.setIcon(null);
    podEditButton.setToolTipText("Edit the selected POD path");
    podListOpButtonPanel.add(podEditButton);
    podEditButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            editPODPath();
        }
    });

    JPanel missionPanel = new JPanel();
    GridBagConstraints gbc_missionPanel = new GridBagConstraints();
    gbc_missionPanel.fill = GridBagConstraints.BOTH;
    gbc_missionPanel.gridx = 0;
    gbc_missionPanel.gridy = 2;
    generalTab.add(missionPanel, gbc_missionPanel);
    missionPanel.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), "Missions",
            TitledBorder.LEADING, TitledBorder.TOP, null, null));
    GridBagLayout gbl_missionPanel = new GridBagLayout();
    gbl_missionPanel.columnWidths = new int[] { 0, 0 };
    gbl_missionPanel.rowHeights = new int[] { 0, 0, 0 };
    gbl_missionPanel.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
    gbl_missionPanel.rowWeights = new double[] { 1.0, 0.0, Double.MIN_VALUE };
    missionPanel.setLayout(gbl_missionPanel);

    JScrollPane scrollPane = new JScrollPane();
    GridBagConstraints gbc_scrollPane = new GridBagConstraints();
    gbc_scrollPane.insets = new Insets(0, 0, 5, 0);
    gbc_scrollPane.fill = GridBagConstraints.BOTH;
    gbc_scrollPane.gridx = 0;
    gbc_scrollPane.gridy = 0;
    missionPanel.add(scrollPane, gbc_scrollPane);

    missionList = new JList(missionLM);
    missionList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    scrollPane.setViewportView(missionList);

    JPanel missionListOpButtonPanel = new JPanel();
    GridBagConstraints gbc_missionListOpButtonPanel = new GridBagConstraints();
    gbc_missionListOpButtonPanel.anchor = GridBagConstraints.NORTH;
    gbc_missionListOpButtonPanel.gridx = 0;
    gbc_missionListOpButtonPanel.gridy = 1;
    missionPanel.add(missionListOpButtonPanel, gbc_missionListOpButtonPanel);

    JButton addVOXButton = new JButton("Add...");
    addVOXButton.setIcon(
            new ImageIcon(ConfigWindow.class.getResource("/org/freedesktop/tango/16x16/actions/list-add.png")));
    addVOXButton.setToolTipText("Add an external VOX file as a mission");
    missionListOpButtonPanel.add(addVOXButton);
    addVOXButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            addVOX();
        }
    });

    final JButton removeVOXButton = new JButton("Remove");
    removeVOXButton.setIcon(new ImageIcon(
            ConfigWindow.class.getResource("/org/freedesktop/tango/16x16/actions/list-remove.png")));
    removeVOXButton.setToolTipText("Remove the selected mission");
    missionListOpButtonPanel.add(removeVOXButton);
    removeVOXButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            missionLM.remove(missionList.getSelectedIndex());
        }
    });

    final JButton editVOXButton = new JButton("Edit...");
    editVOXButton.setToolTipText("Edit the selected Mission's VOX path");
    missionListOpButtonPanel.add(editVOXButton);
    editVOXButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            editVOXPath();
        }
    });

    missionList.addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent evt) {
            final String val = (String) missionList.getSelectedValue();
            if (val == null)
                missionList.setSelectedIndex(0);
            else if (isBuiltinVOX(val)) {
                removeVOXButton.setEnabled(false);
                editVOXButton.setEnabled(false);
            } else {
                removeVOXButton.setEnabled(true);
                editVOXButton.setEnabled(true);
            }
        }
    });

    JPanel soundTab = new JPanel();
    tabbedPane.addTab("Sound",
            new ImageIcon(
                    ConfigWindow.class.getResource("/org/freedesktop/tango/22x22/devices/audio-card.png")),
            soundTab, null);
    GridBagLayout gbl_soundTab = new GridBagLayout();
    gbl_soundTab.columnWidths = new int[] { 0, 0 };
    gbl_soundTab.rowHeights = new int[] { 65, 51, 70, 132, 0, 0, 0 };
    gbl_soundTab.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
    gbl_soundTab.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE };
    soundTab.setLayout(gbl_soundTab);

    JPanel checkboxPanel = new JPanel();
    GridBagConstraints gbc_checkboxPanel = new GridBagConstraints();
    gbc_checkboxPanel.insets = new Insets(0, 0, 5, 0);
    gbc_checkboxPanel.fill = GridBagConstraints.BOTH;
    gbc_checkboxPanel.gridx = 0;
    gbc_checkboxPanel.gridy = 0;
    soundTab.add(checkboxPanel, gbc_checkboxPanel);

    chckbxLinearInterpolation = new JCheckBox("Linear Filtering");
    chckbxLinearInterpolation.setToolTipText("Use the GPU's TMU to smooth playback of low-rate samples.");
    chckbxLinearInterpolation.setHorizontalAlignment(SwingConstants.LEFT);
    checkboxPanel.add(chckbxLinearInterpolation);

    chckbxLinearInterpolation.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            needRestart = true;
        }
    });

    chckbxBufferLag = new JCheckBox("Buffer Lag");
    chckbxBufferLag.setToolTipText("Improves efficiency, doubles latency.");
    checkboxPanel.add(chckbxBufferLag);

    JPanel modStereoWidthPanel = new JPanel();
    FlowLayout flowLayout_2 = (FlowLayout) modStereoWidthPanel.getLayout();
    flowLayout_2.setAlignment(FlowLayout.LEFT);
    modStereoWidthPanel.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null),
            "MOD Stereo Width", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    GridBagConstraints gbc_modStereoWidthPanel = new GridBagConstraints();
    gbc_modStereoWidthPanel.anchor = GridBagConstraints.NORTH;
    gbc_modStereoWidthPanel.insets = new Insets(0, 0, 5, 0);
    gbc_modStereoWidthPanel.fill = GridBagConstraints.HORIZONTAL;
    gbc_modStereoWidthPanel.gridx = 0;
    gbc_modStereoWidthPanel.gridy = 1;
    soundTab.add(modStereoWidthPanel, gbc_modStereoWidthPanel);

    modStereoWidthSlider = new JSlider();
    modStereoWidthSlider.setPaintTicks(true);
    modStereoWidthSlider.setMinorTickSpacing(25);
    modStereoWidthPanel.add(modStereoWidthSlider);

    final JLabel modStereoWidthLbl = new JLabel("NN%");
    modStereoWidthPanel.add(modStereoWidthLbl);

    JPanel bufferSizePanel = new JPanel();
    FlowLayout flowLayout_3 = (FlowLayout) bufferSizePanel.getLayout();
    flowLayout_3.setAlignment(FlowLayout.LEFT);
    bufferSizePanel.setBorder(
            new TitledBorder(null, "Buffer Size", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    GridBagConstraints gbc_bufferSizePanel = new GridBagConstraints();
    gbc_bufferSizePanel.anchor = GridBagConstraints.NORTH;
    gbc_bufferSizePanel.insets = new Insets(0, 0, 5, 0);
    gbc_bufferSizePanel.fill = GridBagConstraints.HORIZONTAL;
    gbc_bufferSizePanel.gridx = 0;
    gbc_bufferSizePanel.gridy = 2;
    soundTab.add(bufferSizePanel, gbc_bufferSizePanel);

    audioBufferSizeCB = new JComboBox();
    audioBufferSizeCB.setModel(new DefaultComboBoxModel(AudioBufferSize.values()));
    bufferSizePanel.add(audioBufferSizeCB);

    soundOutputSelectorGUI = new SoundOutputSelectorGUI();
    soundOutputSelectorGUI.setBorder(
            new TitledBorder(null, "Output Driver", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    GridBagConstraints gbc_soundOutputSelectorGUI = new GridBagConstraints();
    gbc_soundOutputSelectorGUI.anchor = GridBagConstraints.NORTH;
    gbc_soundOutputSelectorGUI.insets = new Insets(0, 0, 5, 0);
    gbc_soundOutputSelectorGUI.fill = GridBagConstraints.HORIZONTAL;
    gbc_soundOutputSelectorGUI.gridx = 0;
    gbc_soundOutputSelectorGUI.gridy = 3;
    soundTab.add(soundOutputSelectorGUI, gbc_soundOutputSelectorGUI);

    modStereoWidthSlider.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent arg0) {
            modStereoWidthLbl.setText(modStereoWidthSlider.getValue() + "%");
            needRestart = true;
        }
    });

    JPanel okCancelPanel = new JPanel();
    getContentPane().add(okCancelPanel, BorderLayout.SOUTH);
    okCancelPanel.setLayout(new BorderLayout(0, 0));

    JButton btnOk = new JButton("OK");
    btnOk.setToolTipText("Apply these settings and close the window");
    okCancelPanel.add(btnOk, BorderLayout.WEST);
    btnOk.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            applySettings();
            ConfigWindow.this.setVisible(false);
        }
    });

    JButton btnCancel = new JButton("Cancel");
    btnCancel.setToolTipText("Close the window without applying settings");
    okCancelPanel.add(btnCancel, BorderLayout.EAST);

    JLabel lblConfigpath = new JLabel(TRConfiguration.getConfigFilePath().getAbsolutePath());
    lblConfigpath.setIcon(null);
    lblConfigpath.setToolTipText("Default config file path");
    lblConfigpath.setHorizontalAlignment(SwingConstants.CENTER);
    lblConfigpath.setFont(new Font("Dialog", Font.BOLD, 6));
    okCancelPanel.add(lblConfigpath, BorderLayout.CENTER);
    btnCancel.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            ConfigWindow.this.setVisible(false);
        }
    });
}

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

/**
 * Instantiates a new location panel./*  w ww  . jav  a 2  s . c o  m*/
 */
public LocationPanel() {
    Border etched = null;
    TitledBorder title1 = BorderFactory.createTitledBorder(etched, IN_LOCATION);

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

    Utility.buildConstraints(constraints, 0, 0, 1, 1, 0, 0);
    JLabel label = new JLabel(IN_BROWSER_PATH + ": ");
    gridbag.setConstraints(label, constraints);
    this.add(label);
    Utility.buildConstraints(constraints, 1, 0, 1, 1, 1, 0);
    browserPath = new JTextField(String.valueOf(PCGenSettings.getBrowserPath()));

    // sage_sam 9 April 2003
    browserPath.addFocusListener(textFieldListener);
    gridbag.setConstraints(browserPath, constraints);
    this.add(browserPath);
    Utility.buildConstraints(constraints, 2, 0, 1, 1, 0, 0);
    browserPathButton = new JButton(IN_CHOOSE);
    gridbag.setConstraints(browserPathButton, constraints);
    this.add(browserPathButton);
    browserPathButton.addActionListener(prefsButtonHandler);

    Utility.buildConstraints(constraints, 1, 1, 1, 1, 0, 0);
    clearBrowserPathButton = new JButton(IN_CLEAR_BROWSER_PATH);
    gridbag.setConstraints(clearBrowserPathButton, constraints);
    this.add(clearBrowserPathButton);
    clearBrowserPathButton.addActionListener(prefsButtonHandler);

    Utility.buildConstraints(constraints, 0, 2, 1, 1, 0, 0);
    JLabel in_prefs_pcgenCharacterDir = new JLabel(
            LanguageBundle.getString("in_Prefs_pcgenCharacterDir") + ": ");
    gridbag.setConstraints(in_prefs_pcgenCharacterDir, constraints);
    this.add(in_prefs_pcgenCharacterDir);
    Utility.buildConstraints(constraints, 1, 2, 1, 1, 0, 0);
    pcgenCharacterDir = new JTextField(String.valueOf(PCGenSettings.getPcgDir()));

    // sage_sam 9 April 2003
    pcgenCharacterDir.addFocusListener(textFieldListener);
    gridbag.setConstraints(pcgenCharacterDir, constraints);
    this.add(pcgenCharacterDir);
    Utility.buildConstraints(constraints, 2, 2, 1, 1, 0, 0);
    pcgenCharacterDirButton = new JButton(IN_CHOOSE);
    gridbag.setConstraints(pcgenCharacterDirButton, constraints);
    this.add(pcgenCharacterDirButton);
    pcgenCharacterDirButton.addActionListener(prefsButtonHandler);

    Utility.buildConstraints(constraints, 0, 3, 1, 1, 0, 0);

    //TODO i18n
    in_prefs_pcgenCharacterDir = new JLabel("PCGen Portraits Directory" + ": ");
    gridbag.setConstraints(in_prefs_pcgenCharacterDir, constraints);
    this.add(in_prefs_pcgenCharacterDir);
    Utility.buildConstraints(constraints, 1, 3, 1, 1, 0, 0);
    pcgenPortraitsDir = new JTextField(String.valueOf(PCGenSettings.getPortraitsDir()));

    // sage_sam 9 April 2003
    pcgenPortraitsDir.addFocusListener(textFieldListener);
    gridbag.setConstraints(pcgenPortraitsDir, constraints);
    this.add(pcgenPortraitsDir);
    Utility.buildConstraints(constraints, 2, 3, 1, 1, 0, 0);
    pcgenPortraitsDirButton = new JButton(IN_CHOOSE);
    gridbag.setConstraints(pcgenPortraitsDirButton, constraints);
    this.add(pcgenPortraitsDirButton);
    pcgenPortraitsDirButton.addActionListener(prefsButtonHandler);

    Utility.buildConstraints(constraints, 0, 4, 1, 1, 0, 0);
    in_prefs_pcgenCharacterDir = new JLabel(LanguageBundle.getString("in_Prefs_pcgenDataDir") + ": ");
    gridbag.setConstraints(in_prefs_pcgenCharacterDir, constraints);
    this.add(in_prefs_pcgenCharacterDir);
    Utility.buildConstraints(constraints, 1, 4, 1, 1, 0, 0);
    pcgenDataDir = new JTextField(String.valueOf(ConfigurationSettings.getPccFilesDir()));

    // sage_sam 9 April 2003
    pcgenDataDir.addFocusListener(textFieldListener);
    gridbag.setConstraints(pcgenDataDir, constraints);
    this.add(pcgenDataDir);
    Utility.buildConstraints(constraints, 2, 4, 1, 1, 0, 0);
    pcgenDataDirButton = new JButton(IN_CHOOSE);
    gridbag.setConstraints(pcgenDataDirButton, constraints);
    this.add(pcgenDataDirButton);
    pcgenDataDirButton.addActionListener(prefsButtonHandler);

    //////////////////////
    Utility.buildConstraints(constraints, 0, 5, 1, 1, 0, 0);
    in_prefs_pcgenCharacterDir = new JLabel(LanguageBundle.getString("in_Prefs_pcgenCustomDir") + ": ");
    gridbag.setConstraints(in_prefs_pcgenCharacterDir, constraints);
    this.add(in_prefs_pcgenCharacterDir);
    Utility.buildConstraints(constraints, 1, 5, 1, 1, 0, 0);
    pcgenCustomDir = new JTextField(String.valueOf(PCGenSettings.getCustomDir()));

    // sage_sam 9 April 2003
    pcgenCustomDir.addFocusListener(textFieldListener);
    gridbag.setConstraints(pcgenCustomDir, constraints);
    this.add(pcgenCustomDir);
    Utility.buildConstraints(constraints, 2, 5, 1, 1, 0, 0);
    pcgenCustomDirButton = new JButton(IN_CHOOSE);
    gridbag.setConstraints(pcgenCustomDirButton, constraints);
    this.add(pcgenCustomDirButton);
    pcgenCustomDirButton.addActionListener(prefsButtonHandler);

    ////////////////////

    Utility.buildConstraints(constraints, 0, 6, 1, 1, 0, 0);
    in_prefs_pcgenCharacterDir = new JLabel(LanguageBundle.getString("in_Prefs_pcgenVendorDataDir") + ": ");
    gridbag.setConstraints(in_prefs_pcgenCharacterDir, constraints);
    this.add(in_prefs_pcgenCharacterDir);
    Utility.buildConstraints(constraints, 1, 6, 1, 1, 0, 0);
    pcgenVendorDataDir = new JTextField(String.valueOf(PCGenSettings.getVendorDataDir()));

    // sage_sam 9 April 2003
    pcgenVendorDataDir.addFocusListener(textFieldListener);
    gridbag.setConstraints(pcgenVendorDataDir, constraints);
    this.add(pcgenVendorDataDir);
    Utility.buildConstraints(constraints, 2, 6, 1, 1, 0, 0);
    pcgenVendorDataDirButton = new JButton(IN_CHOOSE);
    gridbag.setConstraints(pcgenVendorDataDirButton, constraints);
    this.add(pcgenVendorDataDirButton);
    pcgenVendorDataDirButton.addActionListener(prefsButtonHandler);

    Utility.buildConstraints(constraints, 0, 7, 1, 1, 0, 0);
    in_prefs_pcgenCharacterDir = new JLabel(LanguageBundle.getString("in_Prefs_pcgenHomebrewDataDir") + ": ");
    gridbag.setConstraints(in_prefs_pcgenCharacterDir, constraints);
    this.add(in_prefs_pcgenCharacterDir);
    Utility.buildConstraints(constraints, 1, 7, 1, 1, 0, 0);
    pcgenHomebrewDataDir = new JTextField(String.valueOf(PCGenSettings.getHomebrewDataDir()));

    pcgenHomebrewDataDir.addFocusListener(textFieldListener);
    gridbag.setConstraints(pcgenHomebrewDataDir, constraints);
    this.add(pcgenHomebrewDataDir);
    Utility.buildConstraints(constraints, 2, 7, 1, 1, 0, 0);
    pcgenHomebrewDataDirButton = new JButton(IN_CHOOSE);
    gridbag.setConstraints(pcgenHomebrewDataDirButton, constraints);
    this.add(pcgenHomebrewDataDirButton);
    pcgenHomebrewDataDirButton.addActionListener(prefsButtonHandler);

    Utility.buildConstraints(constraints, 0, 8, 1, 1, 0, 0);
    in_prefs_pcgenCharacterDir = new JLabel(LanguageBundle.getString("in_Prefs_pcgenDocsDir") + ": ");
    gridbag.setConstraints(in_prefs_pcgenCharacterDir, constraints);
    this.add(in_prefs_pcgenCharacterDir);
    Utility.buildConstraints(constraints, 1, 8, 1, 1, 0, 0);
    pcgenDocsDir = new JTextField(String.valueOf(ConfigurationSettings.getDocsDir()));

    // sage_sam 9 April 2003
    pcgenDocsDir.addFocusListener(textFieldListener);
    gridbag.setConstraints(pcgenDocsDir, constraints);
    this.add(pcgenDocsDir);
    Utility.buildConstraints(constraints, 2, 8, 1, 1, 0, 0);
    pcgenDocsDirButton = new JButton(IN_CHOOSE);
    gridbag.setConstraints(pcgenDocsDirButton, constraints);
    this.add(pcgenDocsDirButton);
    pcgenDocsDirButton.addActionListener(prefsButtonHandler);

    Utility.buildConstraints(constraints, 0, 9, 1, 1, 0, 0);
    in_prefs_pcgenCharacterDir = new JLabel(LanguageBundle.getString("in_Prefs_pcgenSystemDir") + ": ");
    gridbag.setConstraints(in_prefs_pcgenCharacterDir, constraints);
    this.add(in_prefs_pcgenCharacterDir);
    Utility.buildConstraints(constraints, 1, 9, 1, 1, 0, 0);
    pcgenSystemDir = new JTextField(String.valueOf(ConfigurationSettings.getSystemsDir()));

    // sage_sam 9 April 2003
    pcgenSystemDir.addFocusListener(textFieldListener);
    gridbag.setConstraints(pcgenSystemDir, constraints);
    this.add(pcgenSystemDir);
    Utility.buildConstraints(constraints, 2, 9, 1, 1, 0, 0);
    pcgenSystemDirButton = new JButton(IN_CHOOSE);
    gridbag.setConstraints(pcgenSystemDirButton, constraints);
    this.add(pcgenSystemDirButton);
    pcgenSystemDirButton.addActionListener(prefsButtonHandler);

    // Output Sheet directory
    Utility.buildConstraints(constraints, 0, 10, 1, 1, 0, 0);
    in_prefs_pcgenCharacterDir = new JLabel(LanguageBundle.getString("in_Prefs_pcgenOutputSheetDir") + ": ");
    gridbag.setConstraints(in_prefs_pcgenCharacterDir, constraints);
    this.add(in_prefs_pcgenCharacterDir);
    Utility.buildConstraints(constraints, 1, 10, 1, 1, 0, 0);
    pcgenOutputSheetDir = new JTextField(String.valueOf(ConfigurationSettings.getOutputSheetsDir()));
    pcgenOutputSheetDir.addFocusListener(textFieldListener);
    gridbag.setConstraints(pcgenOutputSheetDir, constraints);
    this.add(pcgenOutputSheetDir);
    Utility.buildConstraints(constraints, 2, 10, 1, 1, 0, 0);
    pcgenOutputSheetDirButton = new JButton(IN_CHOOSE);
    gridbag.setConstraints(pcgenOutputSheetDirButton, constraints);
    this.add(pcgenOutputSheetDirButton);
    pcgenOutputSheetDirButton.addActionListener(prefsButtonHandler);

    Utility.buildConstraints(constraints, 0, 11, 1, 1, 0, 0);
    in_prefs_pcgenCharacterDir = new JLabel(LanguageBundle.getString("in_Prefs_pcgenPreviewDir") + ": ");
    gridbag.setConstraints(in_prefs_pcgenCharacterDir, constraints);
    this.add(in_prefs_pcgenCharacterDir);
    Utility.buildConstraints(constraints, 1, 11, 1, 1, 0, 0);
    pcgenPreviewDir = new JTextField(String.valueOf(ConfigurationSettings.getPreviewDir()));
    pcgenPreviewDir.addFocusListener(textFieldListener);
    gridbag.setConstraints(pcgenPreviewDir, constraints);
    this.add(pcgenPreviewDir);
    Utility.buildConstraints(constraints, 2, 11, 1, 1, 0, 0);
    pcgenPreviewDirButton = new JButton(IN_CHOOSE);
    gridbag.setConstraints(pcgenPreviewDirButton, constraints);
    this.add(pcgenPreviewDirButton);
    pcgenPreviewDirButton.addActionListener(prefsButtonHandler);

    // Character File Backup directory
    Utility.buildConstraints(constraints, 0, 12, 1, 1, 0, 0);
    in_prefs_pcgenCharacterDir = new JLabel(
            LanguageBundle.getString("in_Prefs_pcgenCreateBackupCharacter") + ": ");
    gridbag.setConstraints(in_prefs_pcgenCharacterDir, constraints);
    this.add(in_prefs_pcgenCharacterDir);
    Utility.buildConstraints(constraints, 1, 12, 1, 1, 0, 0);
    gridbag.setConstraints(pcgenCreateBackupCharacter, constraints);
    this.add(pcgenCreateBackupCharacter);

    Utility.buildConstraints(constraints, 0, 13, 1, 1, 0, 0);
    in_prefs_pcgenCharacterDir = new JLabel(
            LanguageBundle.getString("in_Prefs_pcgenBackupCharacterDir") + ": ");
    gridbag.setConstraints(in_prefs_pcgenCharacterDir, constraints);
    this.add(in_prefs_pcgenCharacterDir);
    Utility.buildConstraints(constraints, 1, 13, 1, 1, 0, 0);
    pcgenBackupCharacterDir = new JTextField(String.valueOf(PCGenSettings.getBackupPcgDir()));
    pcgenBackupCharacterDir.addFocusListener(textFieldListener);
    gridbag.setConstraints(pcgenBackupCharacterDir, constraints);
    this.add(pcgenBackupCharacterDir);
    Utility.buildConstraints(constraints, 2, 13, 1, 1, 0, 0);
    pcgenBackupCharacterDirButton = new JButton(IN_CHOOSE);
    gridbag.setConstraints(pcgenBackupCharacterDirButton, constraints);
    this.add(pcgenBackupCharacterDirButton);
    pcgenBackupCharacterDirButton.addActionListener(prefsButtonHandler);

    // Where to store options.ini file
    Utility.buildConstraints(constraints, 0, 14, 1, 1, 0, 0);
    in_prefs_pcgenCharacterDir = new JLabel(LanguageBundle.getString("in_Prefs_pcgenFilesDir") + ": ");
    gridbag.setConstraints(in_prefs_pcgenCharacterDir, constraints);
    this.add(in_prefs_pcgenCharacterDir);

    pcgenFilesDirRadio = new JRadioButton("PCGen Dir");
    usersFilesDirRadio = new JRadioButton("Home Dir");
    selectFilesDirRadio = new JRadioButton("Select a directory");
    pcgenFilesDir = new JTextField(String.valueOf(ConfigurationSettings.getSettingsDir()));
    pcgenFilesDir.addFocusListener(textFieldListener);

    String fType = ConfigurationSettings.getSystemProperty(ConfigurationSettings.SETTINGS_FILES_PATH);

    if ((fType == null) || (fType.length() < 1)) {
        // make sure we have a default
        fType = ConfigurationSettings.getDefaultSettingsFilesPath();
        ConfigurationSettings.setSystemProperty(ConfigurationSettings.SETTINGS_FILES_PATH, fType);
    }

    pcgenFilesDir.setText(ConfigurationSettings.getSettingsDir());
    if (fType.equals(SettingsFilesPath.pcgen.name())) {
        pcgenFilesDirRadio.setSelected(true);
    } else if (fType.equals(SettingsFilesPath.user.name()) || fType.equals(SettingsFilesPath.mac_user.name())
            || fType.equals(SettingsFilesPath.FD_USER.name())) {
        usersFilesDirRadio.setSelected(true);
    } else {
        selectFilesDirRadio.setSelected(true);
    }

    Utility.buildConstraints(constraints, 0, 15, 1, 1, 0, 0);
    gridbag.setConstraints(pcgenFilesDirRadio, constraints);
    this.add(pcgenFilesDirRadio);
    Utility.buildConstraints(constraints, 1, 15, 1, 1, 0, 0);
    gridbag.setConstraints(usersFilesDirRadio, constraints);
    this.add(usersFilesDirRadio);

    groupFilesDir = new ButtonGroup();
    groupFilesDir.add(pcgenFilesDirRadio);
    groupFilesDir.add(usersFilesDirRadio);
    groupFilesDir.add(selectFilesDirRadio);

    pcgenFilesDirRadio.addActionListener(evt -> {
        pcgenFilesDir.setText(SettingsFilesPath.pcgen.getSettingsDir());
        pcgenFilesDirButton.setEnabled(false);
    });
    usersFilesDirRadio.addActionListener(evt -> {
        pcgenFilesDir.setText(ConfigurationSettings.getUserSettingsDirFromFilePath());
        pcgenFilesDirButton.setEnabled(false);
    });
    selectFilesDirRadio.addActionListener(evt -> {
        pcgenFilesDir.setText("");
        pcgenFilesDirButton.setEnabled(true);
    });

    Utility.buildConstraints(constraints, 0, 16, 1, 1, 0, 0);
    gridbag.setConstraints(selectFilesDirRadio, constraints);
    this.add(selectFilesDirRadio);
    Utility.buildConstraints(constraints, 1, 16, 1, 1, 0, 0);
    gridbag.setConstraints(pcgenFilesDir, constraints);
    this.add(pcgenFilesDir);
    Utility.buildConstraints(constraints, 2, 16, 1, 1, 0, 0);
    pcgenFilesDirButton = new JButton(IN_CHOOSE);
    pcgenFilesDirButton.setEnabled(selectFilesDirRadio.isSelected());
    gridbag.setConstraints(pcgenFilesDirButton, constraints);
    this.add(pcgenFilesDirButton);
    pcgenFilesDirButton.addActionListener(prefsButtonHandler);

    Utility.buildConstraints(constraints, 0, 20, 3, 1, 1, 1);
    constraints.fill = GridBagConstraints.BOTH;
    JLabel emptyLabel = new JLabel(" ");

    gridbag.setConstraints(emptyLabel, constraints);
    this.add(emptyLabel);
}