Example usage for javax.swing JPanel setName

List of usage examples for javax.swing JPanel setName

Introduction

In this page you can find the example usage for javax.swing JPanel setName.

Prototype

public void setName(String name) 

Source Link

Document

Sets the name of the component to the specified string.

Usage

From source file:com.openbravo.pos.util.JRViewer400.java

/**
*//*  w ww  .j  av  a 2s. co m*/
protected void refreshTabs() {
    pnlTabsChangeListenerEnabled = false;

    pnlTabs.removeAll();
    pnlMain.removeAll();

    if (jasperPrint == null || !jasperPrint.hasParts()) {
        pnlMain.add(scrollPane, java.awt.BorderLayout.CENTER);
    } else {
        PrintParts parts = jasperPrint.getParts();
        if (!parts.startsAtZero()) {
            JPanel partTab = new JPanel();
            partTab.setLayout(new BorderLayout());
            partTab.setName(jasperPrint.getName());
            pnlTabs.add(partTab);
        }

        for (Iterator<Map.Entry<Integer, PrintPart>> it = parts.partsIterator(); it.hasNext();) {
            PrintPart part = it.next().getValue();
            JPanel partTab = new JPanel();
            partTab.setLayout(new BorderLayout());
            partTab.setName(part.getName());
            pnlTabs.add(partTab);
        }

        pnlMain.add(pnlTabs, java.awt.BorderLayout.CENTER);
    }

    pnlTabsChangeListenerEnabled = true;
}

From source file:com.haulmont.cuba.desktop.App.java

protected JComponent createBottomPane() {
    JPanel panel = new JPanel(new BorderLayout());
    panel.setBorder(BorderFactory.createLineBorder(Color.gray));
    panel.setPreferredSize(new Dimension(0, 20));

    ServerSelector serverSelector = AppBeans.get(ServerSelector.NAME);
    String url = serverSelector.getUrl(serverSelector.initContext());
    if (url == null)
        url = "?";

    final JLabel connectionStateLab = new JLabel(
            messages.formatMainMessage("statusBar.connected", getUserFriendlyConnectionUrl(url)));

    panel.add(connectionStateLab, BorderLayout.WEST);

    JPanel rightPanel = new JPanel();
    BoxLayout rightLayout = new BoxLayout(rightPanel, BoxLayout.LINE_AXIS);
    rightPanel.setLayout(rightLayout);//from  www  . j a v  a2 s  . c  o m

    UserSession session = connection.getSession();

    JLabel userInfoLabel = new JLabel();
    String userInfo = messages.formatMainMessage("statusBar.user", session.getUser().getName(),
            session.getUser().getLogin());
    userInfoLabel.setText(userInfo);

    rightPanel.add(userInfoLabel);

    JLabel timeZoneLabel = null;
    if (session.getTimeZone() != null) {
        timeZoneLabel = new JLabel();
        String timeZone = messages.formatMainMessage("statusBar.timeZone",
                AppBeans.get(TimeZones.class).getDisplayNameShort(session.getTimeZone()));
        timeZoneLabel.setText(timeZone);

        rightPanel.add(Box.createRigidArea(new Dimension(5, 0)));
        rightPanel.add(timeZoneLabel);
    }

    panel.add(rightPanel, BorderLayout.EAST);

    if (isTestMode()) {
        panel.setName("bottomPane");
        userInfoLabel.setName("userInfoLabel");
        if (timeZoneLabel != null)
            timeZoneLabel.setName("timeZoneLabel");
        connectionStateLab.setName("connectionStateLab");
    }

    return panel;
}

From source file:com.isencia.passerelle.hmi.generic.GenericHMI.java

private JPanel createCompositePanel(final JPanel b, final JComponent c, final String name) {
    final JPanel compositeBox = new JPanel(new VerticalLayout(5));
    int r = b.getBackground().getRed() - 20;
    if (r < 1) {
        r = 0;//w w w .  j a va2s  . c  om
    }
    if (r > 254) {
        r = 255;
    }
    int g = b.getBackground().getGreen() - 20;
    if (g < 1) {
        g = 0;
    }
    if (g > 254) {
        g = 255;
    }
    int bl = b.getBackground().getBlue() - 20;
    if (bl < 1) {
        bl = 0;
    }
    if (bl > 254) {
        bl = 255;
    }

    compositeBox.setBackground(new Color(r, g, bl));
    final JPanel title = new JPanel(new BorderLayout());
    title.setBackground(new Color(r, g, bl));
    /*
     * ImageIcon icon = new ImageIcon( Toolkit .getDefaultToolkit()
     * .getImage( (getClass()
     * .getResource("/com/isencia/passerelle/hmi/resources/composite.gif"
     * )))); JLabel lab = new JLabel(icon);
     * 
     * title.add(lab, BorderLayout.LINE_START);
     */
    final JLabel lab2 = new JLabel(name);
    final Font f = lab2.getFont();
    lab2.setFont(new Font(f.getName(), f.getStyle(), f.getSize() + 6));
    lab2.setForeground(new Color(49, 106, 196));
    title.add(lab2);
    compositeBox.add(title);
    final Border loweredbevel = BorderFactory.createLoweredBevelBorder();
    final TitledBorder border = BorderFactory.createTitledBorder(loweredbevel);

    compositeBox.setBorder(border);
    compositeBox.setName(name);
    c.setBackground(new Color(r, g, bl));
    compositeBox.add(c);
    return compositeBox;
}

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

/**
 * Metodo adibito alla creazione dinamica ricorsiva dell'interfaccia dei
 * metadati/*from  ww  w.  j  a va 2s  .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:org.gumtree.vis.awt.time.TimePlotChartEditor.java

private JPanel createCordinatePanel() {
    JPanel wrap = new JPanel(new BorderLayout());
    JPanel coordinate = new JPanel(new GridLayout(2, 1));
    coordinate.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));

    //Horizontal group
    JPanel horizontal = new JPanel(new BorderLayout());
    horizontal.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Time Axis"));

    JPanel inner = new JPanel(new LCBLayout(6));
    inner.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
    ButtonGroup axisControlGroup = new ButtonGroup();

    showAllHistory = new JRadioButton("Show all history");
    showAllHistory.setActionCommand(SHOW_ALL_HISTORY_COMMAND);
    showAllHistory.addActionListener(this);
    inner.add(showAllHistory);//w  ww. j  a va  2 s  .  c  o m
    inner.add(new JLabel());
    inner.add(new JLabel());
    //
    showPartHistory = new JRadioButton("Fix time range");
    showPartHistory.setActionCommand(FIXED_LENGTH_HISTORY_COMMAND);
    showPartHistory.addActionListener(this);
    inner.add(showPartHistory);
    timeField = new JTextField(5);
    inner.add(timeField);
    inner.add(new JLabel("seconds"));
    axisControlGroup.add(showAllHistory);
    axisControlGroup.add(showPartHistory);

    horizontal.add(inner, BorderLayout.NORTH);

    //Vertical group
    //       JPanel vertical = new JPanel(new BorderLayout());
    //       vertical.setBorder(BorderFactory.createTitledBorder(
    //            BorderFactory.createEtchedBorder(), "Vertical Axis"));
    //
    //       inner = new JPanel(new LCBLayout(6));
    //      inner.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));

    //      inner.add(new JLabel("Logarithm Y Axis"));
    //      logarithmY = new JCheckBox();
    //      logarithmY.setActionCommand(LOGARITHM_Y_AXIS_COMMAND);
    //      logarithmY.addActionListener(this);
    //      inner.add(logarithmY);
    //      inner.add(new JLabel());
    //
    //      inner.add(new JLabel("Flip Y Axis"));
    //      flipY = new JCheckBox();
    //      flipY.setActionCommand(FLIP_Y_AXIS_COMMAND);
    //      flipY.addActionListener(this);
    //      inner.add(flipY);
    //      inner.add(new JLabel());

    //       vertical.add(inner, BorderLayout.NORTH);

    coordinate.add(horizontal, BorderLayout.NORTH);
    //      coordinate.add(vertical);
    wrap.setName("Coordinate");
    wrap.add(coordinate, BorderLayout.NORTH);
    return wrap;
}

From source file:com.nikonhacker.gui.EmulatorUI.java

private void openUIOptionsDialog() {
    JPanel options = new JPanel(new GridLayout(0, 1));
    options.setName("User Interface");
    // Button size
    ActionListener buttonSizeRadioListener = new ActionListener() {
        @Override/*from   w  w  w.  j av  a  2 s. c om*/
        public void actionPerformed(ActionEvent e) {
            prefs.setButtonSize(e.getActionCommand());
        }
    };
    JRadioButton small = new JRadioButton("Small");
    small.setActionCommand(BUTTON_SIZE_SMALL);
    small.addActionListener(buttonSizeRadioListener);
    if (BUTTON_SIZE_SMALL.equals(prefs.getButtonSize()))
        small.setSelected(true);
    JRadioButton medium = new JRadioButton("Medium");
    medium.setActionCommand(BUTTON_SIZE_MEDIUM);
    medium.addActionListener(buttonSizeRadioListener);
    if (BUTTON_SIZE_MEDIUM.equals(prefs.getButtonSize()))
        medium.setSelected(true);
    JRadioButton large = new JRadioButton("Large");
    large.setActionCommand(BUTTON_SIZE_LARGE);
    large.addActionListener(buttonSizeRadioListener);
    if (BUTTON_SIZE_LARGE.equals(prefs.getButtonSize()))
        large.setSelected(true);

    ButtonGroup group = new ButtonGroup();
    group.add(small);
    group.add(medium);
    group.add(large);

    // Close windows on stop
    final JCheckBox closeAllWindowsOnStopCheckBox = new JCheckBox("Close all windows on Stop");
    closeAllWindowsOnStopCheckBox.setSelected(prefs.isCloseAllWindowsOnStop());

    // Refresh interval
    JPanel refreshIntervalPanel = new JPanel();
    final JTextField refreshIntervalField = new JTextField(5);
    refreshIntervalPanel.add(new JLabel("Refresh interval for cpu, screen, etc. (ms):"));

    refreshIntervalField.setText("" + prefs.getRefreshIntervalMs());
    refreshIntervalPanel.add(refreshIntervalField);

    // Setup panel
    options.add(new JLabel("Button size :"));
    options.add(small);
    options.add(medium);
    options.add(large);
    options.add(closeAllWindowsOnStopCheckBox);
    options.add(refreshIntervalPanel);
    options.add(new JLabel("Larger value greatly increases emulation speed"));

    if (JOptionPane.OK_OPTION == JOptionPane.showOptionDialog(this, options, "Preferences",
            JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, null, JOptionPane.DEFAULT_OPTION)) {
        // save
        prefs.setButtonSize(group.getSelection().getActionCommand());
        prefs.setCloseAllWindowsOnStop(closeAllWindowsOnStopCheckBox.isSelected());
        int refreshIntervalMs = 0;
        try {
            refreshIntervalMs = Integer.parseInt(refreshIntervalField.getText());
        } catch (NumberFormatException e) {
            // noop
        }
        refreshIntervalMs = Math.max(Math.min(refreshIntervalMs, 10000), 10);
        prefs.setRefreshIntervalMs(refreshIntervalMs);
        applyPrefsToUI();
    }
}

From source file:org.gumtree.vis.plot1d.Plot1DChartEditor.java

private JPanel createCordinatePanel() {
    JPanel wrap = new JPanel(new BorderLayout());
    JPanel coordinate = new JPanel(new GridLayout(2, 1));
    coordinate.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));

    //Horizontal group
    JPanel horizontal = new JPanel(new BorderLayout());
    horizontal/*  w  w  w. j  a v  a  2s .c o  m*/
            .setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Horizontal Axis"));

    JPanel inner = new JPanel(new LCBLayout(6));
    inner.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));

    inner.add(new JLabel("Logarithm X Axis"));
    logarithmX = new JCheckBox();
    logarithmX.setActionCommand(LOGARITHM_X_AXIS_COMMAND);
    logarithmX.addActionListener(this);
    inner.add(logarithmX);
    inner.add(new JLabel());

    inner.add(new JLabel("Flip X Axis"));
    flipX = new JCheckBox();
    flipX.setActionCommand(FLIP_X_AXIS_COMMAND);
    flipX.addActionListener(this);
    inner.add(flipX);
    inner.add(new JLabel());

    inner.add(new JLabel("X Axis Margin Percentage"));
    horizontalMargin = new JTextField();
    horizontalMargin.setActionCommand(X_AXIS_MARGIN_COMMAND);
    horizontalMargin.addActionListener(this);
    inner.add(horizontalMargin);
    inner.add(new JLabel());

    horizontal.add(inner, BorderLayout.NORTH);

    //Vertical group
    JPanel vertical = new JPanel(new BorderLayout());
    vertical.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Vertical Axis"));

    inner = new JPanel(new LCBLayout(6));
    inner.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));

    inner.add(new JLabel("Logarithm Y Axis"));
    logarithmY = new JCheckBox();
    logarithmY.setActionCommand(LOGARITHM_Y_AXIS_COMMAND);
    logarithmY.addActionListener(this);
    inner.add(logarithmY);
    inner.add(new JLabel());

    inner.add(new JLabel("Flip Y Axis"));
    flipY = new JCheckBox();
    flipY.setActionCommand(FLIP_Y_AXIS_COMMAND);
    flipY.addActionListener(this);
    inner.add(flipY);
    inner.add(new JLabel());

    vertical.add(inner, BorderLayout.NORTH);

    coordinate.add(horizontal, BorderLayout.NORTH);
    coordinate.add(vertical);
    wrap.setName("Coordinate");
    wrap.add(coordinate, BorderLayout.NORTH);
    return wrap;
}

From source file:org.gumtree.vis.hist2d.Hist2DChartEditor.java

private JPanel createCordinatePanel() {
    JPanel wrap = new JPanel(new BorderLayout());

    JPanel coordinate = new JPanel(new GridLayout(3, 1));
    coordinate.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));

    //Horizontal group
    JPanel horizontal = new JPanel(new BorderLayout());
    horizontal// w  ww  .ja v  a  2s . co m
            .setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Horizontal Axis"));

    JPanel inner = new JPanel(new LCBLayout(6));
    inner.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));

    inner.add(new JLabel("Flip X Axis"));
    flipX = new JCheckBox();
    flipX.setActionCommand(FLIP_X_AXIS_COMMAND);
    flipX.addActionListener(this);
    inner.add(flipX);
    inner.add(new JLabel());

    horizontal.add(inner, BorderLayout.NORTH);

    //Vertical group
    JPanel vertical = new JPanel(new BorderLayout());
    vertical.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Vertical Axis"));

    inner = new JPanel(new LCBLayout(6));
    inner.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));

    inner.add(new JLabel("Flip Y Axis"));
    flipY = new JCheckBox();
    flipY.setActionCommand(FLIP_Y_AXIS_COMMAND);
    flipY.addActionListener(this);
    inner.add(flipY);
    inner.add(new JLabel());

    vertical.add(inner, BorderLayout.NORTH);

    //Color scale group
    JPanel colorScale = new JPanel(new BorderLayout());
    colorScale.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Color Scale"));

    inner = new JPanel(new LCBLayout(6));
    inner.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));

    inner.add(new JLabel("Show Color Scale"));
    showColorScale = new JCheckBox();
    showColorScale.setActionCommand(SHOW_SCALE_COMMAND);
    showColorScale.addActionListener(this);
    inner.add(showColorScale);
    inner.add(new JLabel());

    inner.add(new JLabel("Select Theme"));
    ColorScale[] scales = ColorScale.values();
    colourScaleCombo = new JComboBox(scales);
    //      colourScaleCombo.setMaximumRowCount(7);
    colourScaleCombo.setActionCommand(CHANGE_COLOUR_SCALE_COMMAND);
    colourScaleCombo.addActionListener(this);
    inner.add(colourScaleCombo);
    inner.add(new JLabel());

    inner.add(new JLabel("Use Logarithmic Scale"));
    logarithmScale = new JCheckBox();
    logarithmScale.setActionCommand(LOGARITHM_SCALE_COMMAND);
    logarithmScale.addActionListener(this);
    inner.add(logarithmScale);
    inner.add(new JLabel());

    colorScale.add(inner, BorderLayout.NORTH);

    coordinate.add(horizontal);
    coordinate.add(vertical);
    coordinate.add(colorScale);
    wrap.setName("Coordinate");

    wrap.add(coordinate, BorderLayout.NORTH);
    return wrap;
}

From source file:de.cismet.cids.custom.objecteditors.wunda_blau.WebDavPicturePanel.java

/**
 * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The
 * content of this method is always regenerated by the Form Editor.
 *///from  ww  w .  ja  v  a  2 s  . com
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
    GridBagConstraints gridBagConstraints;
    bindingGroup = new BindingGroup();

    final RoundedPanel pnlFotos = new RoundedPanel();
    final SemiRoundedPanel pnlHeaderFotos = new SemiRoundedPanel();
    final JLabel lblHeaderFotos = new JLabel();
    final JPanel jPanel2 = new JPanel();
    final JPanel jPanel1 = new JPanel();
    final JScrollPane jspFotoList = new JScrollPane();
    lstFotos = new JList();
    final JPanel pnlCtrlButtons = new JPanel();
    btnAddImg = new JButton();
    btnRemoveImg = new JButton();
    final JPanel pnlMap = new JPanel();
    final RoundedPanel pnlVorschau = new RoundedPanel();
    final SemiRoundedPanel semiRoundedPanel2 = new SemiRoundedPanel();
    final JLabel lblVorschau = new JLabel();
    final JPanel jPanel3 = new JPanel();
    pnlFoto = new JPanel();
    lblPicture = new JLabel();
    lblBusy = new JXBusyLabel(new Dimension(75, 75));
    final JPanel pnlCtrlBtn = new JPanel();
    btnPrevImg = new JButton();
    btnNextImg = new JButton();

    final FormListener formListener = new FormListener();

    setName("Form"); // NOI18N
    setOpaque(false);
    setLayout(new GridBagLayout());

    pnlFotos.setMinimumSize(new Dimension(400, 200));
    pnlFotos.setName("pnlFotos"); // NOI18N
    pnlFotos.setPreferredSize(new Dimension(400, 200));
    pnlFotos.setLayout(new GridBagLayout());

    pnlHeaderFotos.setBackground(new Color(51, 51, 51));
    pnlHeaderFotos.setForeground(new Color(51, 51, 51));
    pnlHeaderFotos.setName("pnlHeaderFotos"); // NOI18N
    pnlHeaderFotos.setLayout(new FlowLayout());

    lblHeaderFotos.setForeground(new Color(255, 255, 255));
    Mnemonics.setLocalizedText(lblHeaderFotos,
            NbBundle.getMessage(WebDavPicturePanel.class, "WebDavPicturePanel.lblHeaderFotos.text")); // NOI18N
    lblHeaderFotos.setName("lblHeaderFotos"); // NOI18N
    pnlHeaderFotos.add(lblHeaderFotos);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    pnlFotos.add(pnlHeaderFotos, gridBagConstraints);

    jPanel2.setName("jPanel2"); // NOI18N
    jPanel2.setOpaque(false);
    jPanel2.setLayout(new GridBagLayout());

    jPanel1.setName("jPanel1"); // NOI18N
    jPanel1.setOpaque(false);
    jPanel1.setLayout(new GridBagLayout());

    jspFotoList.setMinimumSize(new Dimension(250, 130));
    jspFotoList.setName("jspFotoList"); // NOI18N

    lstFotos.setMinimumSize(new Dimension(250, 130));
    lstFotos.setName("lstFotos"); // NOI18N
    lstFotos.setPreferredSize(new Dimension(250, 130));

    final ELProperty eLProperty = ELProperty.create("${cidsBean." + beanCollProp + "}");
    final JListBinding jListBinding = SwingBindings.createJListBinding(AutoBinding.UpdateStrategy.READ_WRITE,
            this, eLProperty, lstFotos);
    bindingGroup.addBinding(jListBinding);

    lstFotos.addListSelectionListener(formListener);
    jspFotoList.setViewportView(lstFotos);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridheight = 2;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    jPanel1.add(jspFotoList, gridBagConstraints);

    pnlCtrlButtons.setName("pnlCtrlButtons"); // NOI18N
    pnlCtrlButtons.setOpaque(false);
    pnlCtrlButtons.setLayout(new GridBagLayout());

    btnAddImg.setIcon(new ImageIcon(
            getClass().getResource("/de/cismet/cids/custom/objecteditors/wunda_blau/edit_add_mini.png"))); // NOI18N
    Mnemonics.setLocalizedText(btnAddImg,
            NbBundle.getMessage(WebDavPicturePanel.class, "WebDavPicturePanel.btnAddImg.text")); // NOI18N
    btnAddImg.setBorderPainted(false);
    btnAddImg.setContentAreaFilled(false);
    btnAddImg.setName("btnAddImg"); // NOI18N
    btnAddImg.addActionListener(formListener);
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.insets = new Insets(0, 0, 5, 0);
    pnlCtrlButtons.add(btnAddImg, gridBagConstraints);

    btnRemoveImg.setIcon(new ImageIcon(
            getClass().getResource("/de/cismet/cids/custom/objecteditors/wunda_blau/edit_remove_mini.png"))); // NOI18N
    Mnemonics.setLocalizedText(btnRemoveImg,
            NbBundle.getMessage(WebDavPicturePanel.class, "WebDavPicturePanel.btnRemoveImg.text")); // NOI18N
    btnRemoveImg.setBorderPainted(false);
    btnRemoveImg.setContentAreaFilled(false);
    btnRemoveImg.setName("btnRemoveImg"); // NOI18N
    btnRemoveImg.addActionListener(formListener);
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridy = 1;
    gridBagConstraints.insets = new Insets(5, 0, 0, 0);
    pnlCtrlButtons.add(btnRemoveImg, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.anchor = GridBagConstraints.NORTH;
    gridBagConstraints.insets = new Insets(0, 5, 0, 0);
    jPanel1.add(pnlCtrlButtons, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new Insets(10, 10, 10, 0);
    jPanel2.add(jPanel1, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new Insets(0, 0, 2, 0);
    pnlFotos.add(jPanel2, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.anchor = GridBagConstraints.NORTH;
    gridBagConstraints.insets = new Insets(0, 0, 5, 5);
    add(pnlFotos, gridBagConstraints);

    pnlMap.setBorder(BorderFactory.createEtchedBorder());
    pnlMap.setMinimumSize(new Dimension(400, 200));
    pnlMap.setName("pnlMap"); // NOI18N
    pnlMap.setPreferredSize(new Dimension(400, 200));
    pnlMap.setLayout(new BorderLayout());
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = GridBagConstraints.VERTICAL;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new Insets(5, 0, 0, 5);
    add(pnlMap, gridBagConstraints);
    pnlMap.add(map, BorderLayout.CENTER);

    pnlVorschau.setName("pnlVorschau"); // NOI18N
    pnlVorschau.setLayout(new GridBagLayout());

    semiRoundedPanel2.setBackground(new Color(51, 51, 51));
    semiRoundedPanel2.setName("semiRoundedPanel2"); // NOI18N
    semiRoundedPanel2.setLayout(new FlowLayout());

    lblVorschau.setForeground(new Color(255, 255, 255));
    Mnemonics.setLocalizedText(lblVorschau,
            NbBundle.getMessage(WebDavPicturePanel.class, "WebDavPicturePanel.lblVorschau.text")); // NOI18N
    lblVorschau.setName("lblVorschau"); // NOI18N
    semiRoundedPanel2.add(lblVorschau);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    pnlVorschau.add(semiRoundedPanel2, gridBagConstraints);

    jPanel3.setName("jPanel3"); // NOI18N
    jPanel3.setOpaque(false);
    jPanel3.setLayout(new GridBagLayout());

    pnlFoto.setName("pnlFoto"); // NOI18N
    pnlFoto.setOpaque(false);
    pnlFoto.setLayout(new GridBagLayout());

    lblPicture.setHorizontalAlignment(SwingConstants.CENTER);
    Mnemonics.setLocalizedText(lblPicture,
            NbBundle.getMessage(WebDavPicturePanel.class, "WebDavPicturePanel.lblPicture.text")); // NOI18N
    lblPicture.setName("lblPicture"); // NOI18N
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    pnlFoto.add(lblPicture, gridBagConstraints);

    lblBusy.setHorizontalAlignment(SwingConstants.CENTER);
    lblBusy.setMaximumSize(new Dimension(140, 40));
    lblBusy.setMinimumSize(new Dimension(140, 60));
    lblBusy.setName("lblBusy"); // NOI18N
    lblBusy.setPreferredSize(new Dimension(140, 60));
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    pnlFoto.add(lblBusy, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new Insets(10, 10, 0, 10);
    jPanel3.add(pnlFoto, gridBagConstraints);

    pnlCtrlBtn.setName("pnlCtrlBtn"); // NOI18N
    pnlCtrlBtn.setOpaque(false);
    pnlCtrlBtn.setPreferredSize(new Dimension(100, 50));
    pnlCtrlBtn.setLayout(new GridBagLayout());

    btnPrevImg.setIcon(new ImageIcon(getClass().getResource("/res/arrow-left.png"))); // NOI18N
    Mnemonics.setLocalizedText(btnPrevImg,
            NbBundle.getMessage(WebDavPicturePanel.class, "WebDavPicturePanel.btnPrevImg.text")); // NOI18N
    btnPrevImg.setBorderPainted(false);
    btnPrevImg.setFocusPainted(false);
    btnPrevImg.setName("btnPrevImg"); // NOI18N
    btnPrevImg.addActionListener(formListener);
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    pnlCtrlBtn.add(btnPrevImg, gridBagConstraints);

    btnNextImg.setIcon(new ImageIcon(getClass().getResource("/res/arrow-right.png"))); // NOI18N
    Mnemonics.setLocalizedText(btnNextImg,
            NbBundle.getMessage(WebDavPicturePanel.class, "WebDavPicturePanel.btnNextImg.text")); // NOI18N
    btnNextImg.setBorderPainted(false);
    btnNextImg.setFocusPainted(false);
    btnNextImg.setName("btnNextImg"); // NOI18N
    btnNextImg.addActionListener(formListener);
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    pnlCtrlBtn.add(btnNextImg, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.insets = new Insets(0, 10, 10, 10);
    jPanel3.add(pnlCtrlBtn, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    pnlVorschau.add(jPanel3, gridBagConstraints);

    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridheight = 2;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new Insets(0, 5, 0, 0);
    add(pnlVorschau, gridBagConstraints);

    bindingGroup.bind();
}

From source file:org.gumtree.vis.awt.AbstractPlotEditor.java

private JPanel createHelpPanel() {
    JPanel wrap = new JPanel(new GridLayout(1, 1));

    JPanel helpPanel = new JPanel(new GridLayout(1, 1));
    helpPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    //       helpPanel.setBorder(BorderFactory.createTitledBorder(
    //            BorderFactory.createEtchedBorder(), "Help Topics"));

    SpringLayout spring = new SpringLayout();
    JPanel inner = new JPanel(spring);
    inner.setBorder(BorderFactory.createEmptyBorder());

    final IHelpProvider provider = plot.getHelpProvider();
    final JList list = new JList(provider.getHelpMap().keySet().toArray());
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    //      list.setBorder(BorderFactory.createEtchedBorder());
    JScrollPane listPane1 = new JScrollPane(list);
    inner.add(listPane1);//from w ww .  j  ava2  s  . c  om
    listPane1.setMaximumSize(new Dimension(140, 0));
    listPane1.setMinimumSize(new Dimension(70, 0));
    //      JPanel contentPanel = new JPanel(new GridLayout(2, 1));
    //      inner.add(list);
    final JTextField keyField = new JTextField();
    keyField.setMaximumSize(new Dimension(400, 20));
    keyField.setEditable(false);
    //      keyField.setMaximumSize();
    //      keyArea.setLineWrap(true);
    //      keyArea.setWrapStyleWord(true);
    //      keyArea.setBorder(BorderFactory.createEtchedBorder());
    inner.add(keyField);
    //      contentPanel.add(new JLabel());
    //      contentPanel.add(new JLabel());
    final JTextArea helpArea = new JTextArea();
    JScrollPane areaPane = new JScrollPane(helpArea);
    helpArea.setEditable(false);
    helpArea.setLineWrap(true);
    helpArea.setWrapStyleWord(true);
    //      helpArea.setBorder(BorderFactory.createEtchedBorder());
    inner.add(areaPane);
    //      contentPanel.add(new JLabel());
    //      contentPanel.add(new JLabel());
    //      inner.add(contentPanel);
    spring.putConstraint(SpringLayout.WEST, listPane1, 2, SpringLayout.WEST, inner);
    spring.putConstraint(SpringLayout.NORTH, listPane1, 2, SpringLayout.NORTH, inner);
    spring.putConstraint(SpringLayout.WEST, keyField, 4, SpringLayout.EAST, listPane1);
    spring.putConstraint(SpringLayout.NORTH, keyField, 2, SpringLayout.NORTH, inner);
    spring.putConstraint(SpringLayout.EAST, inner, 2, SpringLayout.EAST, keyField);
    spring.putConstraint(SpringLayout.WEST, areaPane, 4, SpringLayout.EAST, listPane1);
    spring.putConstraint(SpringLayout.NORTH, areaPane, 4, SpringLayout.SOUTH, keyField);
    spring.putConstraint(SpringLayout.EAST, areaPane, -2, SpringLayout.EAST, inner);
    spring.putConstraint(SpringLayout.SOUTH, inner, 2, SpringLayout.SOUTH, areaPane);
    spring.putConstraint(SpringLayout.SOUTH, listPane1, -2, SpringLayout.SOUTH, inner);

    list.addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent e) {
            Object[] selected = list.getSelectedValues();
            if (selected.length >= 0) {
                HelpObject help = provider.getHelpMap().get(selected[0]);
                if (help != null) {
                    keyField.setText(help.getKey());
                    helpArea.setText(help.getDiscription());
                }
            }
        }
    });

    helpPanel.add(inner, BorderLayout.NORTH);
    wrap.setName("Help");

    wrap.add(helpPanel, BorderLayout.NORTH);
    return wrap;
}