Example usage for javax.swing.border LineBorder LineBorder

List of usage examples for javax.swing.border LineBorder LineBorder

Introduction

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

Prototype

public LineBorder(Color color) 

Source Link

Document

Creates a line border with the specified color and a thickness = 1.

Usage

From source file:com.juanhg.pattern.PatternApplet.java

private void autogeneratedCode() {
    JPanel panel_control = new JPanel();
    panel_control.setBorder(new CompoundBorder(new EtchedBorder(EtchedBorder.RAISED, null, null),
            new BevelBorder(BevelBorder.RAISED, null, null, null, null)));

    JPanel panelInputs = new JPanel();
    panelInputs.setToolTipText("");
    panelInputs.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0)));

    JPanel panelOutputs = new JPanel();
    panelOutputs.setToolTipText("");
    panelOutputs.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0)));

    JPanel panelTitleOutputs = new JPanel();
    panelTitleOutputs.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null));

    JLabel labelOutputData = new JLabel("Datos de la Simulaci\u00F3n");
    labelOutputData.setFont(new Font("Tahoma", Font.PLAIN, 14));
    panelTitleOutputs.add(labelOutputData);

    lblO1 = new JLabel("O1:");
    lblO1.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblO1Value = new JLabel();
    lblO1Value.setText("0");
    lblO1Value.setFont(new Font("Tahoma", Font.PLAIN, 14));

    JLabel lblO2 = new JLabel("O2:");
    lblO2.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblO2Value = new JLabel();
    lblO2Value.setText("0");
    lblO2Value.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblO3 = new JLabel("O3:");
    lblO3.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblO3Value = new JLabel();
    lblO3Value.setText("0");
    lblO3Value.setFont(new Font("Tahoma", Font.PLAIN, 14));

    GroupLayout gl_panelOutputs = new GroupLayout(panelOutputs);
    gl_panelOutputs.setHorizontalGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING)
            .addComponent(panelTitleOutputs, GroupLayout.DEFAULT_SIZE, 344, Short.MAX_VALUE)
            .addGroup(gl_panelOutputs.createSequentialGroup().addGap(22).addGroup(gl_panelOutputs
                    .createParallelGroup(Alignment.LEADING)
                    .addGroup(gl_panelOutputs.createSequentialGroup()
                            .addComponent(lblO3, GroupLayout.PREFERRED_SIZE, 84, GroupLayout.PREFERRED_SIZE)
                            .addGap(26)/*from  ww w.ja  va  2  s  .  c  om*/
                            .addComponent(lblO3Value, GroupLayout.DEFAULT_SIZE, 103, Short.MAX_VALUE))
                    .addGroup(gl_panelOutputs.createSequentialGroup()
                            .addGroup(gl_panelOutputs.createParallelGroup(Alignment.TRAILING)
                                    .addGroup(gl_panelOutputs.createSequentialGroup()
                                            .addComponent(lblO1, GroupLayout.DEFAULT_SIZE,
                                                    GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addGap(26))
                                    .addGroup(gl_panelOutputs.createSequentialGroup()
                                            .addComponent(lblO2, GroupLayout.PREFERRED_SIZE, 81,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addGap(29)))
                            .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING, false)
                                    .addComponent(lblO2Value, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(lblO1Value, GroupLayout.PREFERRED_SIZE, 103,
                                            GroupLayout.PREFERRED_SIZE))))
                    .addGap(109)));
    gl_panelOutputs
            .setVerticalGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING)
                    .addGroup(gl_panelOutputs.createSequentialGroup()
                            .addComponent(panelTitleOutputs, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(ComponentPlacement.UNRELATED)
                            .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE)
                                    .addComponent(lblO1Value).addComponent(lblO1))
                            .addPreferredGap(ComponentPlacement.UNRELATED)
                            .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE)
                                    .addComponent(lblO2, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblO2Value, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(ComponentPlacement.UNRELATED)
                            .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING)
                                    .addComponent(lblO3, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblO3Value, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE))
                            .addGap(79)));
    panelOutputs.setLayout(gl_panelOutputs);

    JPanel panelLicense = new JPanel();
    panelLicense.setBorder(new LineBorder(new Color(0, 0, 0)));

    JPanel panel_6 = new JPanel();
    panel_6.setBorder(new LineBorder(new Color(0, 0, 0)));
    GroupLayout gl_panel_control = new GroupLayout(panel_control);
    gl_panel_control.setHorizontalGroup(gl_panel_control.createParallelGroup(Alignment.TRAILING)
            .addGroup(gl_panel_control.createSequentialGroup().addContainerGap().addGroup(gl_panel_control
                    .createParallelGroup(Alignment.LEADING)
                    .addComponent(panelInputs, GroupLayout.PREFERRED_SIZE, 346, Short.MAX_VALUE)
                    .addComponent(panelOutputs, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(panel_6, Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 346, Short.MAX_VALUE)
                    .addComponent(panelLicense, GroupLayout.DEFAULT_SIZE, 346, Short.MAX_VALUE))
                    .addContainerGap()));
    gl_panel_control.setVerticalGroup(gl_panel_control.createParallelGroup(Alignment.TRAILING)
            .addGroup(gl_panel_control.createSequentialGroup().addContainerGap()
                    .addComponent(panelInputs, GroupLayout.PREFERRED_SIZE, 213, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(panelOutputs, GroupLayout.PREFERRED_SIZE, 129, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(panel_6, GroupLayout.PREFERRED_SIZE, 146, Short.MAX_VALUE)
                    .addPreferredGap(ComponentPlacement.RELATED).addComponent(panelLicense,
                            GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                    .addGap(24)));

    btnLaunchSimulation = new JButton("Iniciar");
    btnLaunchSimulation.setFont(new Font("Tahoma", Font.PLAIN, 16));
    btnLaunchSimulation.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            btnLaunchSimulationEvent(event);
        }
    });
    GroupLayout gl_panel_6 = new GroupLayout(panel_6);
    gl_panel_6.setHorizontalGroup(gl_panel_6.createParallelGroup(Alignment.TRAILING).addGroup(Alignment.LEADING,
            gl_panel_6.createSequentialGroup().addContainerGap()
                    .addComponent(btnLaunchSimulation, GroupLayout.DEFAULT_SIZE, 324, Short.MAX_VALUE)
                    .addContainerGap()));
    gl_panel_6.setVerticalGroup(gl_panel_6.createParallelGroup(Alignment.TRAILING).addGroup(Alignment.LEADING,
            gl_panel_6.createSequentialGroup().addGap(80)
                    .addComponent(btnLaunchSimulation, GroupLayout.PREFERRED_SIZE, 55,
                            GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    panel_6.setLayout(gl_panel_6);

    JLabel lblNewLabel = new JLabel("GNU GENERAL PUBLIC LICENSE");
    panelLicense.add(lblNewLabel);

    JLabel LabelI1 = new JLabel("I1");
    LabelI1.setFont(new Font("Tahoma", Font.PLAIN, 14));

    JLabel labelI2 = new JLabel("I2");
    labelI2.setFont(new Font("Tahoma", Font.PLAIN, 14));

    JLabel labelI3 = new JLabel("I3");
    labelI3.setFont(new Font("Tahoma", Font.PLAIN, 14));

    JPanel panelTitle = new JPanel();
    panelTitle.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null));

    lblI2Value = new JLabel("5");
    lblI2Value.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblI3Value = new JLabel("5");
    lblI3Value.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblI1Value = new JLabel("5");
    lblI1Value.setFont(new Font("Tahoma", Font.PLAIN, 14));

    sliderI1 = new JSlider();
    sliderI1.setMaximum(10);
    sliderI1.setMinorTickSpacing(1);
    sliderI1.setValue(5);
    sliderI1.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent event) {
            sliderI1Event();
        }
    });

    sliderI2 = new JSlider();
    sliderI2.setMaximum(10);
    sliderI2.setMinorTickSpacing(1);
    sliderI2.setValue(5);
    sliderI2.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            sliderI2Event();
        }
    });

    sliderI3 = new JSlider();
    sliderI3.setMaximum(10);
    sliderI3.setValue(5);
    sliderI3.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            sliderI3Event();
        }
    });

    JLabel lblI4 = new JLabel("I4");
    lblI4.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblI4Value = new JLabel("5");
    lblI4Value.setFont(new Font("Tahoma", Font.PLAIN, 14));

    sliderI4 = new JSlider();
    sliderI4.setMaximum(10);
    sliderI4.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent arg0) {
            sliderI4Event();
        }
    });
    sliderI4.setValue(5);
    sliderI4.setMinorTickSpacing(1);

    JLabel lblI5 = new JLabel("I5");
    lblI5.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblI5Value = new JLabel("5");
    lblI5Value.setFont(new Font("Tahoma", Font.PLAIN, 14));

    sliderI5 = new JSlider();
    sliderI5.setMaximum(10);
    sliderI5.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            sliderI5Event();
        }
    });
    sliderI5.setValue(5);
    sliderI5.setMinorTickSpacing(1);

    GroupLayout gl_panelInputs = new GroupLayout(panelInputs);
    gl_panelInputs.setHorizontalGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING)
            .addGroup(gl_panelInputs.createSequentialGroup().addGroup(gl_panelInputs
                    .createParallelGroup(Alignment.LEADING)
                    .addGroup(gl_panelInputs.createSequentialGroup()
                            .addGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING, false)
                                    .addComponent(labelI3, Alignment.LEADING, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(LabelI1, Alignment.LEADING, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(labelI2, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 120,
                                            GroupLayout.PREFERRED_SIZE))
                            .addGap(18)
                            .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                                    .addComponent(lblI1Value, GroupLayout.PREFERRED_SIZE, 42,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblI2Value, GroupLayout.PREFERRED_SIZE, 56,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblI3Value, GroupLayout.PREFERRED_SIZE, 56,
                                            GroupLayout.PREFERRED_SIZE))
                            .addGap(18)
                            .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING, false)
                                    .addComponent(sliderI1, 0, 0, Short.MAX_VALUE)
                                    .addComponent(sliderI2, 0, 0, Short.MAX_VALUE).addComponent(
                                            sliderI3, GroupLayout.PREFERRED_SIZE, 88,
                                            GroupLayout.PREFERRED_SIZE)))
                    .addGroup(gl_panelInputs.createSequentialGroup()
                            .addComponent(lblI4, GroupLayout.PREFERRED_SIZE, 120, GroupLayout.PREFERRED_SIZE)
                            .addGap(18)
                            .addComponent(lblI4Value, GroupLayout.PREFERRED_SIZE, 56,
                                    GroupLayout.PREFERRED_SIZE)
                            .addGap(18)
                            .addComponent(sliderI4, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE))
                    .addGroup(gl_panelInputs.createSequentialGroup()
                            .addComponent(lblI5, GroupLayout.PREFERRED_SIZE, 120, GroupLayout.PREFERRED_SIZE)
                            .addGap(18)
                            .addComponent(lblI5Value, GroupLayout.PREFERRED_SIZE, 56,
                                    GroupLayout.PREFERRED_SIZE)
                            .addGap(18).addComponent(sliderI5, GroupLayout.PREFERRED_SIZE, 88,
                                    GroupLayout.PREFERRED_SIZE)))
                    .addGap(19))
            .addComponent(panelTitle, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 352, Short.MAX_VALUE));
    gl_panelInputs.setVerticalGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panelInputs.createSequentialGroup()
                    .addComponent(panelTitle, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addGap(18)
                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                            .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE)
                                    .addComponent(LabelI1).addComponent(lblI1Value, GroupLayout.PREFERRED_SIZE,
                                            17, GroupLayout.PREFERRED_SIZE))
                            .addComponent(sliderI1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                            .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE)
                                    .addComponent(labelI2).addComponent(lblI2Value, GroupLayout.PREFERRED_SIZE,
                                            17, GroupLayout.PREFERRED_SIZE))
                            .addComponent(sliderI2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE))
                    .addGap(11)
                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING).addComponent(labelI3)
                            .addComponent(lblI3Value, GroupLayout.PREFERRED_SIZE, 17,
                                    GroupLayout.PREFERRED_SIZE)
                            .addComponent(sliderI3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(ComponentPlacement.UNRELATED)
                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                            .addComponent(lblI4, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblI4Value, GroupLayout.PREFERRED_SIZE, 17,
                                    GroupLayout.PREFERRED_SIZE)
                            .addComponent(sliderI4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(ComponentPlacement.UNRELATED)
                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                            .addComponent(lblI5, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblI5Value, GroupLayout.PREFERRED_SIZE, 17,
                                    GroupLayout.PREFERRED_SIZE)
                            .addComponent(sliderI5, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE))
                    .addGap(429)));

    JLabel lblDatosDeEntrada = new JLabel("Datos de Entrada");
    lblDatosDeEntrada.setFont(new Font("Tahoma", Font.PLAIN, 14));
    panelTitle.add(lblDatosDeEntrada);
    panelInputs.setLayout(gl_panelInputs);
    panel_control.setLayout(gl_panel_control);

    JPanel panel_visualizar = new JPanel();
    panel_visualizar.setBackground(Color.WHITE);

    GroupLayout groupLayout = new GroupLayout(getContentPane());
    groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(groupLayout.createSequentialGroup().addContainerGap()
                    .addComponent(panel_control, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(panel_visualizar, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addContainerGap()));
    groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.TRAILING).addGroup(groupLayout
            .createSequentialGroup()
            .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
                    .addGroup(groupLayout.createSequentialGroup().addContainerGap().addComponent(panel_control,
                            GroupLayout.PREFERRED_SIZE, 568, GroupLayout.PREFERRED_SIZE))
                    .addGroup(groupLayout.createSequentialGroup().addGap(12).addComponent(panel_visualizar,
                            GroupLayout.DEFAULT_SIZE, 567, Short.MAX_VALUE)))
            .addContainerGap()));
    GroupLayout gl_panel_visualizar = new GroupLayout(panel_visualizar);
    gl_panel_visualizar.setHorizontalGroup(
            gl_panel_visualizar.createParallelGroup(Alignment.LEADING).addGap(0, 845, Short.MAX_VALUE));
    gl_panel_visualizar.setVerticalGroup(
            gl_panel_visualizar.createParallelGroup(Alignment.LEADING).addGap(0, 567, Short.MAX_VALUE));

    panel_visualizar.setLayout(gl_panel_visualizar);

    getContentPane().setLayout(groupLayout);
}

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

private Component createMainTab() {

    String s;/*from ww  w.j a  v  a  2 s  .  com*/

    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:com.net2plan.gui.GUINet2Plan.java

private void start() {
    setExtendedState(JFrame.MAXIMIZED_BOTH);
    setMinimumSize(new Dimension(800, 600));

    itemObject = new DualHashBidiMap<JMenuItem, Object>();

    URL iconURL = GUINet2Plan.class.getResource("/resources/gui/icon.png");
    ImageIcon icon = new ImageIcon(iconURL);
    setIconImage(icon.getImage());/*from w w w  . ja  va 2  s .  c  om*/
    setTitle("Net2Plan");
    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    addWindowListener(CLOSE_NET2PLAN);

    getContentPane().setLayout(new MigLayout("insets 0 0 0 0", "[grow]", "[grow]"));
    container = new JPanel(new MigLayout("", "[]", "[]"));
    container.setBorder(new LineBorder(Color.BLACK));
    container.setLayout(new MigLayout("fill"));
    getContentPane().add(container, "grow");

    /* Create menu bar */
    menu = new JMenuBar();
    setJMenuBar(menu);

    /* File menu */
    JMenu file = new JMenu("File");
    file.setMnemonic('F');
    menu.add(file);

    optionsItem = new JMenuItem("Options");
    optionsItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.ALT_DOWN_MASK));
    optionsItem.addActionListener(this);
    file.add(optionsItem);

    classPathEditorItem = new JMenuItem("Classpath editor");
    classPathEditorItem.addActionListener(this);
    file.add(classPathEditorItem);

    errorConsoleItem = new JMenuItem("Show Java console");
    errorConsoleItem.addActionListener(this);
    errorConsoleItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F12, InputEvent.ALT_DOWN_MASK));
    file.add(errorConsoleItem);

    exitItem = new JMenuItem("Exit");
    exitItem.addActionListener(this);
    exitItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, InputEvent.ALT_DOWN_MASK));
    file.add(exitItem);

    /* Help menu */
    JMenu help = new JMenu("Help");
    help.setMnemonic('H');
    menu.add(help);

    aboutItem = new JMenuItem("About");
    aboutItem.addActionListener(this);
    help.add(aboutItem);
    itemObject.put(aboutItem, showAbout());

    helpItem = new JMenuItem("User's guide");
    helpItem.addActionListener(this);
    helpItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, KeyEvent.VK_UNDEFINED));
    help.add(helpItem);

    javadocItem = new JMenuItem("Library API Javadoc");
    javadocItem.addActionListener(this);
    help.add(javadocItem);

    javadocExamplesItem = new JMenuItem("Built-in Examples Javadoc");
    javadocExamplesItem.addActionListener(this);
    help.add(javadocExamplesItem);

    keyCombinationItem = new JMenuItem("Show tool key combinations");
    keyCombinationItem.addActionListener(this);
    keyCombinationItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_K, KeyEvent.ALT_DOWN_MASK));
    help.add(keyCombinationItem);

    usedKeyStrokes = new LinkedHashSet<KeyStroke>();
    refreshMenu();

    container.add(showAbout(), "align center");
    container.revalidate();

    new JFileChooser(); /* Do not remove! It is used to avoid slow JFileChooser first-time loading once Net2Plan is shown to the user */

    setVisible(true);
}

From source file:de.dmarcini.submatix.pclogger.gui.ProgramProperetysDialog.java

/**
 * Initialisiere das Fenster Project: SubmatixBTForPC Package: de.dmarcini.submatix.pclogger.gui
 * //  w  w w  .j  av a  2 s  . c  om
 * @author Dirk Marciniak (dirk_marciniak@arcor.de) Stand: 03.08.2012
 */
private void initDialog() {
    setResizable(false);
    setIconImage(Toolkit.getDefaultToolkit().getImage(
            ProgramProperetysDialog.class.getResource("/de/dmarcini/submatix/pclogger/res/search.png")));
    // setVisible( true );
    setBounds(100, 100, 750, 417);
    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.SOUTH);
    {
        btnCancel = new JButton(LangStrings.getString("ProgramProperetysDialog.btnCancel.text")); //$NON-NLS-1$
        btnCancel.setIcon(new ImageIcon(
                ProgramProperetysDialog.class.getResource("/de/dmarcini/submatix/pclogger/res/114.png")));
        btnCancel.setHorizontalAlignment(SwingConstants.LEFT);
        btnCancel.setIconTextGap(15);
        btnCancel.setPreferredSize(new Dimension(180, 40));
        btnCancel.setMaximumSize(new Dimension(160, 40));
        btnCancel.setMargin(new Insets(6, 30, 6, 30));
        btnCancel.setForeground(Color.RED);
        btnCancel.setBackground(new Color(255, 192, 203));
        btnCancel.setActionCommand("cancel");
        btnCancel.addActionListener(this);
        btnCancel.addMouseMotionListener(this);
    }
    {
        btnOk = new JButton(LangStrings.getString("ProgramProperetysDialog.btnOk.text")); //$NON-NLS-1$
        btnOk.setIconTextGap(15);
        btnOk.setHorizontalAlignment(SwingConstants.LEFT);
        btnOk.setIcon(new ImageIcon(
                ProgramProperetysDialog.class.getResource("/de/dmarcini/submatix/pclogger/res/31.png")));
        btnOk.setPreferredSize(new Dimension(180, 40));
        btnOk.setMaximumSize(new Dimension(160, 40));
        btnOk.setMargin(new Insets(6, 30, 6, 30));
        btnOk.setForeground(new Color(0, 100, 0));
        btnOk.setBackground(new Color(152, 251, 152));
        btnOk.setActionCommand("set_propertys");
        btnOk.addActionListener(this);
        btnOk.addMouseMotionListener(this);
    }
    unitsPanel = new JPanel();
    unitsPanel.setBorder(new TitledBorder(new LineBorder(new Color(0, 0, 0)), " UNITS ", TitledBorder.LEADING,
            TitledBorder.TOP, null, null));
    pahtsPanel = new JPanel();
    pahtsPanel.setBorder(new TitledBorder(new LineBorder(new Color(0, 0, 0)), " DIRECTORYS ",
            TitledBorder.LEADING, TitledBorder.TOP, null, null));
    GroupLayout gl_contentPanel = new GroupLayout(contentPanel);
    gl_contentPanel.setHorizontalGroup(gl_contentPanel.createParallelGroup(Alignment.TRAILING).addGroup(
            Alignment.LEADING,
            gl_contentPanel.createSequentialGroup().addContainerGap().addGroup(gl_contentPanel
                    .createParallelGroup(Alignment.LEADING)
                    .addComponent(pahtsPanel, GroupLayout.PREFERRED_SIZE, 714, GroupLayout.PREFERRED_SIZE)
                    .addGroup(gl_contentPanel.createSequentialGroup()
                            .addComponent(btnCancel, GroupLayout.PREFERRED_SIZE, 160,
                                    GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(ComponentPlacement.RELATED, 394, Short.MAX_VALUE)
                            .addComponent(btnOk, GroupLayout.PREFERRED_SIZE, 160, GroupLayout.PREFERRED_SIZE))
                    .addComponent(unitsPanel, GroupLayout.DEFAULT_SIZE, 714, Short.MAX_VALUE))
                    .addContainerGap()));
    gl_contentPanel.setVerticalGroup(gl_contentPanel.createParallelGroup(Alignment.TRAILING)
            .addGroup(gl_contentPanel.createSequentialGroup()
                    .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(pahtsPanel, GroupLayout.PREFERRED_SIZE, 225, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.UNRELATED)
                    .addComponent(unitsPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addGroup(gl_contentPanel.createParallelGroup(Alignment.BASELINE)
                            .addComponent(btnOk, GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE)
                            .addComponent(btnCancel, GroupLayout.PREFERRED_SIZE, 28,
                                    GroupLayout.PREFERRED_SIZE))));
    databaseDirLabel = new JLabel(LangStrings.getString("ProgramProperetysDialog.databaseDirLabel.text")); //$NON-NLS-1$
    databaseDirTextField = new JTextField();
    databaseDirTextField.setEditable(false);
    databaseDirTextField.addMouseMotionListener(this);
    databaseDirTextField.setColumns(10);
    logfileLabel = new JLabel(LangStrings.getString("ProgramProperetysDialog.logFileLabel.text")); //$NON-NLS-1$
    logfileNameTextField = new JTextField();
    logfileNameTextField.setEditable(false);
    logfileNameTextField.addMouseMotionListener(this);
    logfileNameTextField.setColumns(10);
    moveDataCheckBox = new JCheckBox(LangStrings.getString("ProgramProperetysDialog.moveDataCheckBox.text")); //$NON-NLS-1$
    moveDataCheckBox.addMouseMotionListener(this);
    databaseDirFileButton = new JButton("");
    databaseDirFileButton.setIcon(new ImageIcon(
            ProgramProperetysDialog.class.getResource("/javax/swing/plaf/metal/icons/ocean/directory.gif")));
    databaseDirFileButton.addActionListener(this);
    databaseDirFileButton.setActionCommand("choose_datadir");
    databaseDirFileButton.addMouseMotionListener(this);
    logfileNameButton = new JButton("");
    logfileNameButton.setIcon(new ImageIcon(
            ProgramProperetysDialog.class.getResource("/javax/swing/plaf/metal/icons/ocean/directory.gif")));
    logfileNameButton.addActionListener(this);
    logfileNameButton.setActionCommand("choose_logfile");
    logfileNameButton.addMouseMotionListener(this);
    exportDirLabel = new JLabel(LangStrings.getString("ProgramProperetysDialog.exportDirLabel.text")); //$NON-NLS-1$
    exportDirTextField = new JTextField();
    exportDirTextField.setEditable(false);
    exportDirTextField.setColumns(10);
    exportDirButton = new JButton("");
    exportDirButton.setIcon(new ImageIcon(
            ProgramProperetysDialog.class.getResource("/javax/swing/plaf/metal/icons/ocean/directory.gif")));
    exportDirButton.setActionCommand("choose_exportdir");
    exportDirButton.addActionListener(this);
    exportDirButton.addMouseMotionListener(this);
    GroupLayout gl_pahtsPanel = new GroupLayout(pahtsPanel);
    gl_pahtsPanel.setHorizontalGroup(gl_pahtsPanel.createParallelGroup(Alignment.LEADING).addGroup(gl_pahtsPanel
            .createSequentialGroup().addContainerGap()
            .addGroup(gl_pahtsPanel.createParallelGroup(Alignment.LEADING)
                    .addGroup(Alignment.TRAILING, gl_pahtsPanel.createSequentialGroup().addGroup(gl_pahtsPanel
                            .createParallelGroup(Alignment.LEADING)
                            .addGroup(gl_pahtsPanel.createSequentialGroup()
                                    .addComponent(databaseDirLabel, GroupLayout.DEFAULT_SIZE, 419,
                                            Short.MAX_VALUE)
                                    .addGap(193))
                            .addGroup(gl_pahtsPanel.createSequentialGroup()
                                    .addComponent(databaseDirTextField, GroupLayout.DEFAULT_SIZE, 606,
                                            Short.MAX_VALUE)
                                    .addPreferredGap(ComponentPlacement.RELATED)))
                            .addComponent(databaseDirFileButton, GroupLayout.PREFERRED_SIZE, 72,
                                    GroupLayout.PREFERRED_SIZE))
                    .addComponent(moveDataCheckBox, Alignment.TRAILING)
                    .addGroup(Alignment.TRAILING, gl_pahtsPanel.createSequentialGroup()
                            .addGroup(gl_pahtsPanel.createParallelGroup(Alignment.LEADING)
                                    .addGroup(gl_pahtsPanel.createSequentialGroup()
                                            .addComponent(logfileLabel, GroupLayout.DEFAULT_SIZE, 345,
                                                    Short.MAX_VALUE)
                                            .addGap(267))
                                    .addGroup(Alignment.TRAILING, gl_pahtsPanel.createSequentialGroup()
                                            .addGroup(gl_pahtsPanel.createParallelGroup(Alignment.TRAILING)
                                                    .addComponent(exportDirLabel, Alignment.LEADING,
                                                            GroupLayout.DEFAULT_SIZE, 606, Short.MAX_VALUE)
                                                    .addComponent(logfileNameTextField,
                                                            GroupLayout.DEFAULT_SIZE, 606, Short.MAX_VALUE)
                                                    .addComponent(exportDirTextField, Alignment.LEADING,
                                                            GroupLayout.DEFAULT_SIZE, 606, Short.MAX_VALUE))
                                            .addPreferredGap(ComponentPlacement.RELATED)))
                            .addGroup(gl_pahtsPanel.createParallelGroup(Alignment.LEADING)
                                    .addComponent(logfileNameButton, GroupLayout.PREFERRED_SIZE, 72,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(exportDirButton, GroupLayout.PREFERRED_SIZE, 72,
                                            GroupLayout.PREFERRED_SIZE))))
            .addContainerGap()));
    gl_pahtsPanel.setVerticalGroup(gl_pahtsPanel.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_pahtsPanel.createSequentialGroup()
                    .addGroup(gl_pahtsPanel.createParallelGroup(Alignment.TRAILING)
                            .addComponent(databaseDirFileButton, GroupLayout.PREFERRED_SIZE, 20,
                                    GroupLayout.PREFERRED_SIZE)
                            .addGroup(gl_pahtsPanel.createSequentialGroup().addComponent(databaseDirLabel)
                                    .addPreferredGap(ComponentPlacement.RELATED)
                                    .addComponent(databaseDirTextField, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(ComponentPlacement.RELATED)))
                    .addGap(1).addComponent(moveDataCheckBox).addGap(18)
                    .addGroup(gl_pahtsPanel.createParallelGroup(Alignment.TRAILING)
                            .addComponent(logfileNameButton, GroupLayout.PREFERRED_SIZE, 20,
                                    GroupLayout.PREFERRED_SIZE)
                            .addGroup(gl_pahtsPanel.createSequentialGroup().addComponent(logfileLabel)
                                    .addPreferredGap(ComponentPlacement.RELATED)
                                    .addComponent(logfileNameTextField, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
                    .addGap(18).addComponent(exportDirLabel).addPreferredGap(ComponentPlacement.RELATED)
                    .addGroup(gl_pahtsPanel.createParallelGroup(Alignment.BASELINE)
                            .addComponent(exportDirTextField, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                            .addComponent(exportDirButton, GroupLayout.PREFERRED_SIZE, 20,
                                    GroupLayout.PREFERRED_SIZE))
                    .addGap(24)));
    pahtsPanel.setLayout(gl_pahtsPanel);
    defaultUnitsRadioButton = new JRadioButton(
            LangStrings.getString("ProgramPropertysDialog.defaultUnitsRadioButton.text")); //$NON-NLS-1$
    defaultUnitsRadioButton.setSelected(true);
    defaultUnitsRadioButton.setActionCommand("rbutton");
    defaultUnitsRadioButton.addActionListener(this);
    metricUnitsRadioButton = new JRadioButton(
            LangStrings.getString("ProgramPropertysDialog.metricUnitsRadioButton.text")); //$NON-NLS-1$
    metricUnitsRadioButton.setActionCommand("rbutton");
    metricUnitsRadioButton.addActionListener(this);
    imperialUnitsRadioButton = new JRadioButton(
            LangStrings.getString("ProgramPropertysDialog.imperialUnitsRadioButton.text")); //$NON-NLS-1$
    imperialUnitsRadioButton.addActionListener(this);
    imperialUnitsRadioButton.setActionCommand("rbutton");
    defaultUnitsLabel = new JLabel(LangStrings.getString("ProgramProperetysDialog.defaultUnitsLabel.text")); //$NON-NLS-1$
    metricUnitsLabel = new JLabel(LangStrings.getString("ProgramProperetysDialog.metricUnitsLabel.text")); //$NON-NLS-1$
    imperialUnitsLabel = new JLabel(LangStrings.getString("ProgramProperetysDialog.imperialUnitsLabel.text")); //$NON-NLS-1$
    GroupLayout gl_untitsPanel = new GroupLayout(unitsPanel);
    gl_untitsPanel.setHorizontalGroup(gl_untitsPanel.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_untitsPanel.createSequentialGroup().addContainerGap()
                    .addGroup(gl_untitsPanel.createParallelGroup(Alignment.LEADING, false)
                            .addComponent(metricUnitsRadioButton, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(imperialUnitsRadioButton, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(defaultUnitsRadioButton, GroupLayout.PREFERRED_SIZE, 132,
                                    GroupLayout.PREFERRED_SIZE))
                    .addGap(18)
                    .addGroup(gl_untitsPanel.createParallelGroup(Alignment.LEADING)
                            .addComponent(metricUnitsLabel, GroupLayout.DEFAULT_SIZE, 174, Short.MAX_VALUE)
                            .addComponent(defaultUnitsLabel, GroupLayout.DEFAULT_SIZE, 174, Short.MAX_VALUE)
                            .addComponent(imperialUnitsLabel, GroupLayout.DEFAULT_SIZE, 174, Short.MAX_VALUE))
                    .addContainerGap()));
    gl_untitsPanel.setVerticalGroup(gl_untitsPanel.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_untitsPanel.createSequentialGroup()
                    .addGroup(gl_untitsPanel.createParallelGroup(Alignment.BASELINE)
                            .addComponent(defaultUnitsRadioButton).addComponent(defaultUnitsLabel))
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addGroup(gl_untitsPanel.createParallelGroup(Alignment.BASELINE)
                            .addComponent(metricUnitsRadioButton).addComponent(metricUnitsLabel))
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addGroup(gl_untitsPanel.createParallelGroup(Alignment.BASELINE)
                            .addComponent(imperialUnitsRadioButton).addComponent(imperialUnitsLabel))
                    .addContainerGap(10, Short.MAX_VALUE)));
    unitsPanel.setLayout(gl_untitsPanel);
    contentPanel.setLayout(gl_contentPanel);
    unitsButtonGroup = new ButtonGroup();
    unitsButtonGroup.add(defaultUnitsRadioButton);
    unitsButtonGroup.add(metricUnitsRadioButton);
    unitsButtonGroup.add(imperialUnitsRadioButton);
}

From source file:com.net2plan.gui.tools.GUINetworkDesign.java

private JPanel configureLeftBottomPanel() {
    this.focusPanel = new FocusPane(this);
    final JPanel focusPanelContainer = new JPanel(new BorderLayout());
    final JToolBar navigationToolbar = new JToolBar(JToolBar.VERTICAL);
    navigationToolbar.setRollover(true);
    navigationToolbar.setFloatable(false);
    navigationToolbar.setOpaque(false);/*from  w w  w. j  a  v  a2s. co  m*/

    final JButton btn_pickNavigationUndo, btn_pickNavigationRedo;

    btn_pickNavigationUndo = new JButton("");
    btn_pickNavigationUndo
            .setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/undoPick.png")));
    btn_pickNavigationUndo.setToolTipText("Navigate back to the previous element picked");
    btn_pickNavigationRedo = new JButton("");
    btn_pickNavigationRedo
            .setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/redoPick.png")));
    btn_pickNavigationRedo.setToolTipText("Navigate forward to the next element picked");

    final ActionListener action = e -> {
        Pair<NetworkElement, Pair<Demand, Link>> backOrForward;
        do {
            backOrForward = (e.getSource() == btn_pickNavigationUndo)
                    ? GUINetworkDesign.this.getVisualizationState().getPickNavigationBackElement()
                    : GUINetworkDesign.this.getVisualizationState().getPickNavigationForwardElement();
            if (backOrForward == null)
                break;
            final NetworkElement ne = backOrForward.getFirst(); // For network elements
            final Pair<Demand, Link> fr = backOrForward.getSecond(); // For forwarding rules
            if (ne != null) {
                if (ne.getNetPlan() != GUINetworkDesign.this.getDesign())
                    continue;
                if (ne.getNetPlan() == null)
                    continue;
                break;
            } else if (fr != null) {
                if (fr.getFirst().getNetPlan() != GUINetworkDesign.this.getDesign())
                    continue;
                if (fr.getFirst().getNetPlan() == null)
                    continue;
                if (fr.getSecond().getNetPlan() != GUINetworkDesign.this.getDesign())
                    continue;
                if (fr.getSecond().getNetPlan() == null)
                    continue;
                break;
            } else
                break; // null,null => reset picked state
        } while (true);
        if (backOrForward != null) {
            if (backOrForward.getFirst() != null)
                GUINetworkDesign.this.getVisualizationState().pickElement(backOrForward.getFirst());
            else if (backOrForward.getSecond() != null)
                GUINetworkDesign.this.getVisualizationState().pickForwardingRule(backOrForward.getSecond());
            else
                GUINetworkDesign.this.getVisualizationState().resetPickedState();

            GUINetworkDesign.this.updateVisualizationAfterPick();
        }
    };

    btn_pickNavigationUndo.addActionListener(action);
    btn_pickNavigationRedo.addActionListener(action);

    btn_pickNavigationRedo.setFocusable(false);
    btn_pickNavigationUndo.setFocusable(false);

    navigationToolbar.add(btn_pickNavigationUndo);
    navigationToolbar.add(btn_pickNavigationRedo);

    final JScrollPane scPane = new JScrollPane(focusPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scPane.getVerticalScrollBar().setUnitIncrement(20);
    scPane.getHorizontalScrollBar().setUnitIncrement(20);
    scPane.setBorder(BorderFactory.createEmptyBorder());

    // Control the scroll
    scPane.getHorizontalScrollBar().addAdjustmentListener(e -> {
        // Repaints the panel each time the horizontal scroll bar is moves, in order to avoid ghosting.
        focusPanelContainer.revalidate();
        focusPanelContainer.repaint();
    });

    focusPanelContainer.add(navigationToolbar, BorderLayout.WEST);
    focusPanelContainer.add(scPane, BorderLayout.CENTER);

    JPanel pane = new JPanel(new MigLayout("fill, insets 0 0 0 0"));
    pane.setBorder(BorderFactory.createTitledBorder(new LineBorder(Color.BLACK), "Focus panel"));

    pane.add(focusPanelContainer, "grow");
    return pane;
}

From source file:com.net2plan.gui.utils.topologyPane.TopologyPanel.java

/**
 * Default constructor.//w  w w  .j a v  a  2s. c o m
 *
 * @param callback               Topology callback listening plugin events
 * @param defaultDesignDirectory Default location for design {@code .n2p} files (it may be null, then default is equal to {@code net2planFolder/workspace/data/networkTopologies})
 * @param defaultDemandDirectory Default location for design {@code .n2p} files (it may be null, then default is equal to {@code net2planFolder/workspace/data/trafficMatrices})
 * @param canvasType             Canvas type (i.e. JUNG)
 * @param plugins                List of plugins to be included (it may be null)
 */
public TopologyPanel(final IVisualizationCallback callback, File defaultDesignDirectory,
        File defaultDemandDirectory, Class<? extends ITopologyCanvas> canvasType,
        List<ITopologyCanvasPlugin> plugins) {
    File currentDir = SystemUtils.getCurrentDir();

    this.callback = callback;
    this.defaultDesignDirectory = defaultDesignDirectory == null ? new File(
            currentDir + SystemUtils.getDirectorySeparator() + "workspace" + SystemUtils.getDirectorySeparator()
                    + "data" + SystemUtils.getDirectorySeparator() + "networkTopologies")
            : defaultDesignDirectory;
    this.defaultDemandDirectory = defaultDemandDirectory == null ? new File(
            currentDir + SystemUtils.getDirectorySeparator() + "workspace" + SystemUtils.getDirectorySeparator()
                    + "data" + SystemUtils.getDirectorySeparator() + "trafficMatrices")
            : defaultDemandDirectory;
    this.multilayerControlPanel = new MultiLayerControlPanel(callback);

    try {
        canvas = canvasType.getDeclaredConstructor(IVisualizationCallback.class, TopologyPanel.class)
                .newInstance(callback, this);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }

    if (plugins != null)
        for (ITopologyCanvasPlugin plugin : plugins)
            addPlugin(plugin);

    setLayout(new BorderLayout());

    JToolBar toolbar = new JToolBar();
    toolbar.setRollover(true);
    toolbar.setFloatable(false);
    toolbar.setOpaque(false);
    toolbar.setBorderPainted(false);

    JPanel topPanel = new JPanel(new BorderLayout());
    topPanel.add(toolbar, BorderLayout.NORTH);

    add(topPanel, BorderLayout.NORTH);

    JComponent canvasComponent = canvas.getCanvasComponent();

    canvasPanel = new JPanel(new BorderLayout());
    canvasComponent.setBorder(LineBorder.createBlackLineBorder());

    JToolBar multiLayerToolbar = new JToolBar(JToolBar.VERTICAL);
    multiLayerToolbar.setRollover(true);
    multiLayerToolbar.setFloatable(false);
    multiLayerToolbar.setOpaque(false);

    canvasPanel.add(canvasComponent, BorderLayout.CENTER);
    canvasPanel.add(multiLayerToolbar, BorderLayout.WEST);
    add(canvasPanel, BorderLayout.CENTER);

    btn_load = new JButton();
    btn_load.setToolTipText("Load a network design");
    btn_loadDemand = new JButton();
    btn_loadDemand.setToolTipText("Load a traffic demand set");
    btn_save = new JButton();
    btn_save.setToolTipText("Save current state to a file");
    btn_zoomIn = new JButton();
    btn_zoomIn.setToolTipText("Zoom in");
    btn_zoomOut = new JButton();
    btn_zoomOut.setToolTipText("Zoom out");
    btn_zoomAll = new JButton();
    btn_zoomAll.setToolTipText("Zoom all");
    btn_takeSnapshot = new JButton();
    btn_takeSnapshot.setToolTipText("Take a snapshot of the canvas");
    btn_showNodeNames = new JToggleButton();
    btn_showNodeNames.setToolTipText("Show/hide node names");
    btn_showLinkIds = new JToggleButton();
    btn_showLinkIds.setToolTipText(
            "Show/hide link utilization, measured as the ratio between the total traffic in the link (including that in protection segments) and total link capacity (including that reserved by protection segments)");
    btn_showNonConnectedNodes = new JToggleButton();
    btn_showNonConnectedNodes.setToolTipText("Show/hide non-connected nodes");
    btn_increaseNodeSize = new JButton();
    btn_increaseNodeSize.setToolTipText("Increase node size");
    btn_decreaseNodeSize = new JButton();
    btn_decreaseNodeSize.setToolTipText("Decrease node size");
    btn_increaseFontSize = new JButton();
    btn_increaseFontSize.setToolTipText("Increase font size");
    btn_decreaseFontSize = new JButton();
    btn_decreaseFontSize.setToolTipText("Decrease font size");
    /* Multilayer buttons */
    btn_increaseInterLayerDistance = new JButton();
    btn_increaseInterLayerDistance
            .setToolTipText("Increase the distance between layers (when more than one layer is visible)");
    btn_decreaseInterLayerDistance = new JButton();
    btn_decreaseInterLayerDistance
            .setToolTipText("Decrease the distance between layers (when more than one layer is visible)");
    btn_showLowerLayerInfo = new JToggleButton();
    btn_showLowerLayerInfo
            .setToolTipText("Shows the links in lower layers that carry traffic of the picked element");
    btn_showLowerLayerInfo.setSelected(getVisualizationState().isShowInCanvasLowerLayerPropagation());
    btn_showUpperLayerInfo = new JToggleButton();
    btn_showUpperLayerInfo.setToolTipText(
            "Shows the links in upper layers that carry traffic that appears in the picked element");
    btn_showUpperLayerInfo.setSelected(getVisualizationState().isShowInCanvasUpperLayerPropagation());
    btn_showThisLayerInfo = new JToggleButton();
    btn_showThisLayerInfo.setToolTipText(
            "Shows the links in the same layer as the picked element, that carry traffic that appears in the picked element");
    btn_showThisLayerInfo.setSelected(getVisualizationState().isShowInCanvasThisLayerPropagation());
    btn_npChangeUndo = new JButton();
    btn_npChangeUndo.setToolTipText(
            "Navigate back to the previous state of the network (last time the network design was changed)");
    btn_npChangeRedo = new JButton();
    btn_npChangeRedo.setToolTipText(
            "Navigate forward to the next state of the network (when network design was changed");

    btn_osmMap = new JToggleButton();
    btn_osmMap.setToolTipText(
            "Toggle between on/off the OSM support. An internet connection is required in order for this to work.");
    btn_tableControlWindow = new JButton();
    btn_tableControlWindow.setToolTipText("Show the network topology control window.");

    // MultiLayer control window
    JPopupMenu multiLayerPopUp = new JPopupMenu();
    multiLayerPopUp.add(multilayerControlPanel);
    JPopUpButton btn_multilayer = new JPopUpButton("", multiLayerPopUp);

    btn_reset = new JButton("Reset");
    btn_reset.setToolTipText("Reset the user interface");
    btn_reset.setMnemonic(KeyEvent.VK_R);

    btn_load.setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/loadDesign.png")));
    btn_loadDemand.setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/loadDemand.png")));
    btn_save.setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/saveDesign.png")));
    btn_showNodeNames
            .setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/showNodeName.png")));
    btn_showLinkIds
            .setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/showLinkUtilization.png")));
    btn_showNonConnectedNodes.setIcon(
            new ImageIcon(TopologyPanel.class.getResource("/resources/gui/showNonConnectedNodes.png")));
    //btn_whatIfActivated.setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/showNonConnectedNodes.png")));
    btn_zoomIn.setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/zoomIn.png")));
    btn_zoomOut.setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/zoomOut.png")));
    btn_zoomAll.setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/zoomAll.png")));
    btn_takeSnapshot.setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/takeSnapshot.png")));
    btn_increaseNodeSize
            .setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/increaseNode.png")));
    btn_decreaseNodeSize
            .setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/decreaseNode.png")));
    btn_increaseFontSize
            .setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/increaseFont.png")));
    btn_decreaseFontSize
            .setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/decreaseFont.png")));
    btn_increaseInterLayerDistance.setIcon(
            new ImageIcon(TopologyPanel.class.getResource("/resources/gui/increaseLayerDistance.png")));
    btn_decreaseInterLayerDistance.setIcon(
            new ImageIcon(TopologyPanel.class.getResource("/resources/gui/decreaseLayerDistance.png")));
    btn_multilayer
            .setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/showLayerControl.png")));
    btn_showThisLayerInfo
            .setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/showLayerPropagation.png")));
    btn_showUpperLayerInfo.setIcon(
            new ImageIcon(TopologyPanel.class.getResource("/resources/gui/showLayerUpperPropagation.png")));
    btn_showLowerLayerInfo.setIcon(
            new ImageIcon(TopologyPanel.class.getResource("/resources/gui/showLayerLowerPropagation.png")));
    btn_tableControlWindow
            .setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/showControl.png")));
    btn_osmMap.setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/showOSM.png")));
    btn_npChangeUndo.setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/undoButton.png")));
    btn_npChangeRedo.setIcon(new ImageIcon(TopologyPanel.class.getResource("/resources/gui/redoButton.png")));

    btn_load.addActionListener(this);
    btn_loadDemand.addActionListener(this);
    btn_save.addActionListener(this);
    btn_showNodeNames.addActionListener(this);
    btn_showLinkIds.addActionListener(this);
    btn_showNonConnectedNodes.addActionListener(this);
    btn_zoomIn.addActionListener(this);
    btn_zoomOut.addActionListener(this);
    btn_zoomAll.addActionListener(this);
    btn_takeSnapshot.addActionListener(this);
    btn_reset.addActionListener(this);
    btn_increaseInterLayerDistance.addActionListener(this);
    btn_decreaseInterLayerDistance.addActionListener(this);
    btn_showLowerLayerInfo.addActionListener(this);
    btn_showUpperLayerInfo.addActionListener(this);
    btn_showThisLayerInfo.addActionListener(this);
    btn_increaseNodeSize.addActionListener(this);
    btn_decreaseNodeSize.addActionListener(this);
    btn_increaseFontSize.addActionListener(this);
    btn_decreaseFontSize.addActionListener(this);
    btn_npChangeUndo.addActionListener(this);
    btn_npChangeRedo.addActionListener(this);
    btn_osmMap.addActionListener(this);
    btn_tableControlWindow.addActionListener(this);

    toolbar.add(btn_load);
    toolbar.add(btn_loadDemand);
    toolbar.add(btn_save);
    toolbar.add(new JToolBar.Separator());
    toolbar.add(btn_zoomIn);
    toolbar.add(btn_zoomOut);
    toolbar.add(btn_zoomAll);
    toolbar.add(btn_takeSnapshot);
    toolbar.add(new JToolBar.Separator());
    toolbar.add(btn_showNodeNames);
    toolbar.add(btn_showLinkIds);
    toolbar.add(btn_showNonConnectedNodes);
    toolbar.add(new JToolBar.Separator());
    toolbar.add(btn_increaseNodeSize);
    toolbar.add(btn_decreaseNodeSize);
    toolbar.add(btn_increaseFontSize);
    toolbar.add(btn_decreaseFontSize);
    toolbar.add(new JToolBar.Separator());
    toolbar.add(Box.createHorizontalGlue());
    toolbar.add(btn_osmMap);
    toolbar.add(btn_tableControlWindow);
    toolbar.add(btn_reset);

    multiLayerToolbar.add(new JToolBar.Separator());
    multiLayerToolbar.add(btn_multilayer);
    multiLayerToolbar.add(btn_increaseInterLayerDistance);
    multiLayerToolbar.add(btn_decreaseInterLayerDistance);
    multiLayerToolbar.add(btn_showLowerLayerInfo);
    multiLayerToolbar.add(btn_showUpperLayerInfo);
    multiLayerToolbar.add(btn_showThisLayerInfo);
    multiLayerToolbar.add(Box.createVerticalGlue());
    multiLayerToolbar.add(btn_npChangeUndo);
    multiLayerToolbar.add(btn_npChangeRedo);

    this.addComponentListener(new ComponentAdapter() {
        @Override
        public void componentResized(ComponentEvent e) {
            if (e.getComponent().getSize().getHeight() != 0 && e.getComponent().getSize().getWidth() != 0) {
                canvas.zoomAll();
            }
        }
    });

    List<Component> children = SwingUtils.getAllComponents(this);
    for (Component component : children)
        if (component instanceof AbstractButton)
            component.setFocusable(false);

    if (ErrorHandling.isDebugEnabled()) {
        canvas.getCanvasComponent().addMouseMotionListener(new MouseMotionAdapter() {
            @Override
            public void mouseMoved(MouseEvent e) {
                Point point = e.getPoint();
                position.setText("view = " + point + ", NetPlan coord = "
                        + canvas.getCanvasPointFromNetPlanPoint(point));
            }
        });

        position = new JLabel();
        add(position, BorderLayout.SOUTH);
    } else {
        position = null;
    }

    new FileDrop(canvasComponent, new LineBorder(Color.BLACK), new FileDrop.Listener() {
        @Override
        public void filesDropped(File[] files) {
            for (File file : files) {
                try {
                    if (!file.getName().toLowerCase(Locale.getDefault()).endsWith(".n2p"))
                        return;
                    loadDesignFromFile(file);
                    break;
                } catch (Throwable e) {
                    break;
                }
            }
        }
    });

    btn_showNodeNames.setSelected(getVisualizationState().isCanvasShowNodeNames());
    btn_showLinkIds.setSelected(getVisualizationState().isCanvasShowLinkLabels());
    btn_showNonConnectedNodes.setSelected(getVisualizationState().isCanvasShowNonConnectedNodes());

    final ITopologyCanvasPlugin popupPlugin = new PopupMenuPlugin(callback, this.canvas);
    addPlugin(new PanGraphPlugin(callback, canvas, MouseEvent.BUTTON1_MASK));
    if (callback.getVisualizationState().isNetPlanEditable() && getCanvas() instanceof JUNGCanvas)
        addPlugin(new AddLinkGraphPlugin(callback, canvas, MouseEvent.BUTTON1_MASK,
                MouseEvent.BUTTON1_MASK | MouseEvent.SHIFT_MASK));
    addPlugin(popupPlugin);
    if (callback.getVisualizationState().isNetPlanEditable())
        addPlugin(new MoveNodePlugin(callback, canvas, MouseEvent.BUTTON1_MASK | MouseEvent.CTRL_MASK));

    setBorder(BorderFactory.createTitledBorder(new LineBorder(Color.BLACK), "Network topology"));
    //        setAllowLoadTrafficDemand(callback.allowLoadTrafficDemands());
}

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

private Component createMainTab() {

    // bernahme der Eigenschaften
    String s = "";

    String appSchemaStr;/*from w  w w .  j av a 2  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:com.juanhg.fridge.FridgeApplet.java

private void autogeneratedCode() {
    JPanel panel_control = new JPanel();
    panel_control.setBorder(new CompoundBorder(new EtchedBorder(EtchedBorder.RAISED, null, null),
            new BevelBorder(BevelBorder.RAISED, null, null, null, null)));

    JPanel panelInputs = new JPanel();
    panelInputs.setToolTipText("");
    panelInputs.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0)));

    JPanel panelOutputs = new JPanel();
    panelOutputs.setToolTipText("");
    panelOutputs.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0)));

    JPanel panelTitleOutputs = new JPanel();
    panelTitleOutputs.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null));

    JLabel labelOutputData = new JLabel("Datos de la Simulaci\u00F3n");
    labelOutputData.setFont(new Font("Tahoma", Font.PLAIN, 14));
    panelTitleOutputs.add(labelOutputData);

    lblO1 = new JLabel("Tiempo On:");
    lblO1.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblTValue = new JLabel();
    lblTValue.setText("0");
    lblTValue.setFont(new Font("Tahoma", Font.PLAIN, 14));

    JLabel lblO2 = new JLabel("Eficiencia:");
    lblO2.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblEValue = new JLabel();
    lblEValue.setText("0");
    lblEValue.setFont(new Font("Tahoma", Font.PLAIN, 14));

    JLabel lblTiempoOff = new JLabel("Tiempo Off:");
    lblTiempoOff.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblOffValue = new JLabel();
    lblOffValue.setText("0");
    lblOffValue.setFont(new Font("Tahoma", Font.PLAIN, 14));

    GroupLayout gl_panelOutputs = new GroupLayout(panelOutputs);
    gl_panelOutputs.setHorizontalGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING)
            .addComponent(panelTitleOutputs, GroupLayout.DEFAULT_SIZE, 351, Short.MAX_VALUE)
            .addGroup(gl_panelOutputs.createSequentialGroup().addGap(22)
                    .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING)
                            .addComponent(lblO2, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblO1, GroupLayout.PREFERRED_SIZE, 77, GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(ComponentPlacement.UNRELATED)
                    .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING)
                            .addComponent(lblEValue, GroupLayout.PREFERRED_SIZE, 65, GroupLayout.PREFERRED_SIZE)
                            .addGroup(gl_panelOutputs.createSequentialGroup()
                                    .addComponent(lblTValue, GroupLayout.PREFERRED_SIZE, 52,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addGap(31)
                                    .addComponent(lblTiempoOff, GroupLayout.PREFERRED_SIZE, 77,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(ComponentPlacement.UNRELATED)
                                    .addComponent(lblOffValue, GroupLayout.DEFAULT_SIZE, 62, Short.MAX_VALUE)))
                    .addContainerGap()));
    gl_panelOutputs/*from   w  w w . j  av  a 2 s  .  co m*/
            .setVerticalGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING)
                    .addGroup(gl_panelOutputs.createSequentialGroup()
                            .addComponent(panelTitleOutputs, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(ComponentPlacement.UNRELATED)
                            .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING)
                                    .addComponent(lblOffValue, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblTiempoOff, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addGroup(gl_panelOutputs.createSequentialGroup()
                                            .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE)
                                                    .addComponent(lblO1).addComponent(lblTValue))
                                            .addPreferredGap(ComponentPlacement.RELATED)
                                            .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE)
                                                    .addComponent(lblO2, GroupLayout.PREFERRED_SIZE, 17,
                                                            GroupLayout.PREFERRED_SIZE)
                                                    .addComponent(lblEValue, GroupLayout.PREFERRED_SIZE, 17,
                                                            GroupLayout.PREFERRED_SIZE))))));
    panelOutputs.setLayout(gl_panelOutputs);

    JPanel panelLicense = new JPanel();
    panelLicense.setBorder(new LineBorder(new Color(0, 0, 0)));

    JPanel panel_6 = new JPanel();
    panel_6.setBorder(new LineBorder(new Color(0, 0, 0)));
    GroupLayout gl_panel_control = new GroupLayout(panel_control);
    gl_panel_control
            .setHorizontalGroup(gl_panel_control.createParallelGroup(Alignment.TRAILING)
                    .addGroup(Alignment.LEADING, gl_panel_control.createSequentialGroup().addContainerGap()
                            .addGroup(gl_panel_control.createParallelGroup(Alignment.LEADING)
                                    .addComponent(panelOutputs, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(panelInputs, GroupLayout.PREFERRED_SIZE, 346, Short.MAX_VALUE)
                                    .addComponent(panel_6, Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 346,
                                            Short.MAX_VALUE)
                                    .addComponent(panelLicense, GroupLayout.DEFAULT_SIZE, 346, Short.MAX_VALUE))
                            .addContainerGap()));
    gl_panel_control.setVerticalGroup(gl_panel_control.createParallelGroup(Alignment.TRAILING)
            .addGroup(gl_panel_control.createSequentialGroup().addContainerGap()
                    .addComponent(panelInputs, GroupLayout.PREFERRED_SIZE, 305, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(panelOutputs, GroupLayout.PREFERRED_SIZE, 100, Short.MAX_VALUE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(panel_6, GroupLayout.PREFERRED_SIZE, 76, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED).addComponent(panelLicense,
                            GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                    .addGap(24)));

    btnLaunchSimulation = new JButton("Iniciar");
    btnLaunchSimulation.setFont(new Font("Tahoma", Font.PLAIN, 16));
    btnLaunchSimulation.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            btnLaunchSimulationEvent(event);
        }
    });
    GroupLayout gl_panel_6 = new GroupLayout(panel_6);
    gl_panel_6.setHorizontalGroup(gl_panel_6.createParallelGroup(Alignment.LEADING).addGroup(Alignment.TRAILING,
            gl_panel_6.createSequentialGroup().addContainerGap()
                    .addComponent(btnLaunchSimulation, GroupLayout.DEFAULT_SIZE, 324, Short.MAX_VALUE)
                    .addContainerGap()));
    gl_panel_6.setVerticalGroup(gl_panel_6.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panel_6
                    .createSequentialGroup().addContainerGap().addComponent(btnLaunchSimulation,
                            GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(69, Short.MAX_VALUE)));
    panel_6.setLayout(gl_panel_6);

    JLabel lblNewLabel = new JLabel("GNU GENERAL PUBLIC LICENSE");
    panelLicense.add(lblNewLabel);

    JLabel LabelI1 = new JLabel("Potencia");
    LabelI1.setFont(new Font("Tahoma", Font.PLAIN, 14));

    JLabel labelI2 = new JLabel("T1");
    labelI2.setFont(new Font("Tahoma", Font.PLAIN, 14));

    JLabel labelI3 = new JLabel("T2");
    labelI3.setFont(new Font("Tahoma", Font.PLAIN, 14));

    JPanel panelTitle = new JPanel();
    panelTitle.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null));

    lblT1Value = new JLabel("20");
    lblT1Value.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblT2Value = new JLabel("-15");
    lblT2Value.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblPValue = new JLabel("700");
    lblPValue.setFont(new Font("Tahoma", Font.PLAIN, 14));

    sliderP = new JSlider();
    sliderP.setMinimum(500);
    sliderP.setMaximum(1000);
    sliderP.setMinorTickSpacing(50);
    sliderP.setValue(700);
    sliderP.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent event) {
            sliderI1Event();
        }
    });

    sliderT1 = new JSlider();
    sliderT1.setMinimum(18);
    sliderT1.setMaximum(30);
    sliderT1.setMinorTickSpacing(1);
    sliderT1.setValue(20);
    sliderT1.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            sliderI2Event();
        }
    });

    sliderT2 = new JSlider();
    sliderT2.setMinimum(10);
    sliderT2.setMaximum(30);
    sliderT2.setValue(15);
    sliderT2.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            sliderI3Event();
        }
    });

    JLabel lblQo = new JLabel("Qo");
    lblQo.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblQcValue = new JLabel("25");
    lblQcValue.setFont(new Font("Tahoma", Font.PLAIN, 14));

    sliderQc = new JSlider();
    sliderQc.setMinimum(10);
    sliderQc.setMaximum(50);
    sliderQc.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent arg0) {
            sliderI4Event();
        }
    });
    sliderQc.setValue(25);
    sliderQc.setMinorTickSpacing(1);

    btn1 = new JButton("1");
    btn1.setFont(new Font("Tahoma", Font.PLAIN, 21));
    btn1.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            btnMilk.setEnabled(false);
            btnFish.setEnabled(false);
            btnMetal.setEnabled(false);
            btn1.setEnabled(false);
            btn2.setEnabled(true);
            sliderQc.setEnabled(true);
            lblQcValue.setText("" + sliderQc.getValue());

        }
    });

    btn2 = new JButton("2");
    btn2.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            btnMilk.setEnabled(true);
            btnFish.setEnabled(true);
            btnMetal.setEnabled(true);
            btn1.setEnabled(true);
            btn2.setEnabled(false);
            phase = 2;
            sliderQc.setEnabled(false);
            lblQcValue.setText("-");

        }
    });
    btn2.setFont(new Font("Tahoma", Font.PLAIN, 21));

    fishImage = loadImage(fish);
    btnFish = new JButton(new ImageIcon(fishImage));
    btnFish.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            btnFishFunction();
        }
    });

    milkImage = loadImage(milk);
    btnMilk = new JButton(new ImageIcon(milkImage));
    btnMilk.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            btnMilkFunction();
        }
    });

    metalImage = loadImage(metal);
    btnMetal = new JButton(new ImageIcon(metalImage));
    btnMetal.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            btnMetalFunction();
        }
    });

    GroupLayout gl_panelInputs = new GroupLayout(panelInputs);
    gl_panelInputs
            .setHorizontalGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                    .addComponent(panelTitle, GroupLayout.DEFAULT_SIZE, 344, Short.MAX_VALUE)
                    .addGroup(gl_panelInputs.createSequentialGroup().addGap(38).addGroup(gl_panelInputs
                            .createParallelGroup(Alignment.LEADING).addGroup(
                                    gl_panelInputs.createSequentialGroup().addGap(36)
                                            .addComponent(btn1, GroupLayout.PREFERRED_SIZE, 80,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(ComponentPlacement.UNRELATED)
                                            .addComponent(btn2, GroupLayout.PREFERRED_SIZE, 80,
                                                    GroupLayout.PREFERRED_SIZE))
                            .addGroup(gl_panelInputs.createSequentialGroup().addGroup(gl_panelInputs
                                    .createParallelGroup(Alignment.LEADING, false)
                                    .addComponent(lblQo, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(labelI3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
                                            Short.MAX_VALUE)
                                    .addComponent(labelI2, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
                                            Short.MAX_VALUE)
                                    .addComponent(LabelI1, GroupLayout.DEFAULT_SIZE, 66, Short.MAX_VALUE))
                                    .addGap(18)
                                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING, false)
                                            .addGroup(gl_panelInputs.createSequentialGroup()
                                                    .addGroup(gl_panelInputs
                                                            .createParallelGroup(Alignment.LEADING)
                                                            .addComponent(lblPValue, GroupLayout.PREFERRED_SIZE,
                                                                    42, GroupLayout.PREFERRED_SIZE)
                                                            .addComponent(lblT1Value,
                                                                    GroupLayout.PREFERRED_SIZE, 56,
                                                                    GroupLayout.PREFERRED_SIZE)
                                                            .addComponent(lblT2Value,
                                                                    GroupLayout.PREFERRED_SIZE, 56,
                                                                    GroupLayout.PREFERRED_SIZE))
                                                    .addGap(18)
                                                    .addGroup(gl_panelInputs
                                                            .createParallelGroup(Alignment.LEADING, false)
                                                            .addComponent(sliderT1, 0, 0, Short.MAX_VALUE)
                                                            .addComponent(sliderP, GroupLayout.DEFAULT_SIZE,
                                                                    134, Short.MAX_VALUE)
                                                            .addComponent(sliderT2, 0, 0, Short.MAX_VALUE)))
                                            .addGroup(gl_panelInputs.createSequentialGroup()
                                                    .addComponent(lblQcValue, GroupLayout.PREFERRED_SIZE, 56,
                                                            GroupLayout.PREFERRED_SIZE)
                                                    .addGap(18)
                                                    .addComponent(sliderQc, 0, 0, Short.MAX_VALUE)))))
                            .addContainerGap(14, Short.MAX_VALUE))
                    .addGroup(Alignment.TRAILING, gl_panelInputs.createSequentialGroup()
                            .addContainerGap(28, Short.MAX_VALUE)
                            .addComponent(btnFish, GroupLayout.PREFERRED_SIZE, 93, GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(ComponentPlacement.RELATED)
                            .addComponent(btnMilk, GroupLayout.PREFERRED_SIZE, 93, GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(ComponentPlacement.RELATED)
                            .addComponent(btnMetal, GroupLayout.PREFERRED_SIZE, 93, GroupLayout.PREFERRED_SIZE)
                            .addGap(25)));
    gl_panelInputs.setVerticalGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panelInputs.createSequentialGroup()
                    .addComponent(panelTitle, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addGap(18)
                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                            .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE)
                                    .addComponent(LabelI1).addComponent(lblPValue, GroupLayout.PREFERRED_SIZE,
                                            17, GroupLayout.PREFERRED_SIZE))
                            .addComponent(sliderP, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                            .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE)
                                    .addComponent(labelI2).addComponent(lblT1Value, GroupLayout.PREFERRED_SIZE,
                                            17, GroupLayout.PREFERRED_SIZE))
                            .addComponent(sliderT1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE))
                    .addGap(11)
                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING).addComponent(labelI3)
                            .addComponent(lblT2Value, GroupLayout.PREFERRED_SIZE, 17,
                                    GroupLayout.PREFERRED_SIZE)
                            .addComponent(sliderT2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(ComponentPlacement.UNRELATED)
                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                            .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE)
                                    .addComponent(lblQo, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblQcValue, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE))
                            .addComponent(sliderQc, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE))
                    .addGap(18)
                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                            .addComponent(btn1, GroupLayout.PREFERRED_SIZE, 49, GroupLayout.PREFERRED_SIZE)
                            .addComponent(btn2, GroupLayout.PREFERRED_SIZE, 49, GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING, false)
                            .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                                    .addComponent(btnMetal, GroupLayout.PREFERRED_SIZE, 72,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(btnMilk, GroupLayout.PREFERRED_SIZE, 72,
                                            GroupLayout.PREFERRED_SIZE))
                            .addGroup(gl_panelInputs.createSequentialGroup().addGap(1).addComponent(btnFish,
                                    GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                    .addContainerGap(12, Short.MAX_VALUE)));

    JLabel lblDatosDeEntrada = new JLabel("Datos de Entrada");
    lblDatosDeEntrada.setFont(new Font("Tahoma", Font.PLAIN, 14));
    panelTitle.add(lblDatosDeEntrada);
    panelInputs.setLayout(gl_panelInputs);
    panel_control.setLayout(gl_panel_control);

    JPanel panel_visualizar = new JPanel();
    panel_visualizar.setBackground(Color.WHITE);

    GroupLayout groupLayout = new GroupLayout(getContentPane());
    groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(groupLayout.createSequentialGroup().addContainerGap()
                    .addComponent(panel_control, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(panel_visualizar, GroupLayout.PREFERRED_SIZE, 398, GroupLayout.PREFERRED_SIZE)
                    .addGap(452)));
    groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.TRAILING).addGroup(groupLayout
            .createSequentialGroup()
            .addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
                    .addGroup(Alignment.LEADING,
                            groupLayout.createSequentialGroup().addGap(12).addComponent(panel_visualizar,
                                    GroupLayout.DEFAULT_SIZE, 567, Short.MAX_VALUE))
                    .addGroup(groupLayout.createSequentialGroup().addContainerGap().addComponent(panel_control,
                            GroupLayout.PREFERRED_SIZE, 568, GroupLayout.PREFERRED_SIZE)))
            .addContainerGap()));

    JPanel panel = new JPanel();

    panelGrafica = new JPanelGrafica();
    GroupLayout gl_panel = new GroupLayout(panel);
    gl_panel.setHorizontalGroup(gl_panel.createParallelGroup(Alignment.LEADING).addGap(0, 384, Short.MAX_VALUE)
            .addComponent(panelGrafica, GroupLayout.DEFAULT_SIZE, 384, Short.MAX_VALUE));
    gl_panel.setVerticalGroup(gl_panel.createParallelGroup(Alignment.LEADING).addGap(0, 241, Short.MAX_VALUE)
            .addComponent(panelGrafica, GroupLayout.DEFAULT_SIZE, 241, Short.MAX_VALUE));
    panel.setLayout(gl_panel);
    GroupLayout gl_panel_visualizar = new GroupLayout(panel_visualizar);
    gl_panel_visualizar.setHorizontalGroup(gl_panel_visualizar.createParallelGroup(Alignment.LEADING)
            .addComponent(panel, GroupLayout.DEFAULT_SIZE, 398, Short.MAX_VALUE));
    gl_panel_visualizar.setVerticalGroup(gl_panel_visualizar.createParallelGroup(Alignment.LEADING)
            .addComponent(panel, GroupLayout.DEFAULT_SIZE, 567, Short.MAX_VALUE));

    panel_visualizar.setLayout(gl_panel_visualizar);

    getContentPane().setLayout(groupLayout);
}

From source file:com.juanhg.icewalker.IceWalkerApplet.java

private void autogeneratedCode() {
    JPanel panel_control = new JPanel();
    panel_control.setBorder(new CompoundBorder(new EtchedBorder(EtchedBorder.RAISED, null, null),
            new BevelBorder(BevelBorder.RAISED, null, null, null, null)));

    JPanel panelInputs = new JPanel();
    panelInputs.setToolTipText("");
    panelInputs.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0)));

    JPanel panelTiempo = new JPanel();
    panelTiempo.setToolTipText("");
    panelTiempo.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0)));

    JPanel panelOutputs = new JPanel();
    panelOutputs.setToolTipText("");
    panelOutputs.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0)));

    JPanel panelTitleOutputs = new JPanel();
    panelTitleOutputs.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null));

    JLabel labelOutputData = new JLabel("Datos de la Simulaci\u00F3n");
    labelOutputData.setFont(new Font("Tahoma", Font.PLAIN, 14));
    panelTitleOutputs.add(labelOutputData);

    lblPhase = new JLabel("Velocidad:");
    lblPhase.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblVValue = new JLabel();
    lblVValue.setText("0");
    lblVValue.setFont(new Font("Tahoma", Font.PLAIN, 14));

    JLabel lblPosicion = new JLabel("Posici\u00F3n:");
    lblPosicion.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblPositionValue = new JLabel();
    lblPositionValue.setText("0");
    lblPositionValue.setFont(new Font("Tahoma", Font.PLAIN, 14));
    GroupLayout gl_panelOutputs = new GroupLayout(panelOutputs);
    gl_panelOutputs/*from w w  w.  j  a v  a2 s .  c  o  m*/
            .setHorizontalGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING)
                    .addComponent(panelTitleOutputs, GroupLayout.DEFAULT_SIZE, 394, Short.MAX_VALUE)
                    .addGroup(gl_panelOutputs.createSequentialGroup().addContainerGap()
                            .addComponent(lblPhase, GroupLayout.DEFAULT_SIZE, 81, Short.MAX_VALUE).addGap(26)
                            .addComponent(lblVValue, GroupLayout.PREFERRED_SIZE, 147,
                                    GroupLayout.PREFERRED_SIZE)
                            .addContainerGap(130, Short.MAX_VALUE))
                    .addGroup(gl_panelOutputs.createSequentialGroup().addContainerGap()
                            .addComponent(lblPosicion, GroupLayout.PREFERRED_SIZE, 81,
                                    GroupLayout.PREFERRED_SIZE)
                            .addGap(26).addComponent(lblPositionValue, GroupLayout.PREFERRED_SIZE, 147,
                                    GroupLayout.PREFERRED_SIZE)
                            .addContainerGap(130, Short.MAX_VALUE)));
    gl_panelOutputs
            .setVerticalGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING)
                    .addGroup(gl_panelOutputs.createSequentialGroup()
                            .addComponent(panelTitleOutputs, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(ComponentPlacement.UNRELATED)
                            .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE)
                                    .addComponent(lblPhase).addComponent(lblVValue))
                            .addPreferredGap(ComponentPlacement.UNRELATED)
                            .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING)
                                    .addComponent(lblPosicion, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblPositionValue, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE))
                            .addGap(63)));
    panelOutputs.setLayout(gl_panelOutputs);

    panel_1 = new JPanel();
    panel_1.setBorder(new LineBorder(new Color(0, 0, 0)));
    GroupLayout gl_panel_control = new GroupLayout(panel_control);
    gl_panel_control.setHorizontalGroup(gl_panel_control.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panel_control.createSequentialGroup().addContainerGap().addGroup(gl_panel_control
                    .createParallelGroup(Alignment.LEADING)
                    .addGroup(gl_panel_control.createSequentialGroup()
                            .addGroup(gl_panel_control.createParallelGroup(Alignment.TRAILING, false)
                                    .addComponent(panelOutputs, Alignment.LEADING, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(panelInputs, Alignment.LEADING, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addContainerGap())
                    .addGroup(Alignment.TRAILING, gl_panel_control.createSequentialGroup()
                            .addGroup(gl_panel_control.createParallelGroup(Alignment.TRAILING)
                                    .addComponent(panel_1, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 404,
                                            Short.MAX_VALUE)
                                    .addComponent(panelTiempo, GroupLayout.DEFAULT_SIZE, 404, Short.MAX_VALUE))
                            .addContainerGap()))));
    gl_panel_control.setVerticalGroup(gl_panel_control.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panel_control.createSequentialGroup().addContainerGap()
                    .addComponent(panelInputs, GroupLayout.PREFERRED_SIZE, 141, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(panelOutputs, GroupLayout.PREFERRED_SIZE, 103, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(panelTiempo, GroupLayout.PREFERRED_SIZE, 271, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED, 15, Short.MAX_VALUE).addComponent(panel_1,
                            GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                    .addContainerGap()));

    JLabel lblNewLabel = new JLabel("GNU GENERAL PUBLIC LICENSE");
    panel_1.add(lblNewLabel);

    btnLaunchSimulation = new JButton("Iniciar");
    btnLaunchSimulation.setFont(new Font("Tahoma", Font.PLAIN, 16));
    btnLaunchSimulation.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            btnLaunchSimulationEvent(event);
        }
    });

    panel = new JPanel();
    panel.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null));

    label = new JLabel("Datos de la Simulaci\u00F3n");
    label.setFont(new Font("Tahoma", Font.PLAIN, 14));
    panel.add(label);

    btnBanana = new JButton("");
    btnBanana.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            btnBananaEvent();
        }
    });
    bananaImage = loadImage(banana);
    btnBanana.setIcon(new ImageIcon(bananaImage));

    btnBurger = new JButton("");
    btnBurger.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            btnBurgerEvent();
        }
    });
    burgerImage = loadImage(burger);
    btnBurger.setIcon(new ImageIcon(burgerImage));

    btnCookie = new JButton("");
    btnCookie.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            btnCookieEvent();
        }
    });
    cookieImage = loadImage(cookie);
    btnCookie.setIcon(new ImageIcon(cookieImage));

    btnCarrot = new JButton("");
    carrotImage = loadImage(carrot);
    btnCarrot.setIcon(new ImageIcon(carrotImage));
    btnCarrot.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            btnCarrotEvent();
        }
    });

    JLabel lblNewLabel_1 = new JLabel("30 cal/100g");

    JLabel lblCalg_2 = new JLabel("734 cal/100g");

    lblCalg = new JLabel("90 cal/100g");

    lblCalg_1 = new JLabel("433 cal/100g");

    GroupLayout gl_panelTiempo = new GroupLayout(panelTiempo);
    gl_panelTiempo.setHorizontalGroup(gl_panelTiempo.createParallelGroup(Alignment.LEADING)
            .addComponent(panel, GroupLayout.DEFAULT_SIZE, 402, Short.MAX_VALUE)
            .addGroup(gl_panelTiempo.createSequentialGroup().addGap(17).addGroup(gl_panelTiempo
                    .createParallelGroup(Alignment.LEADING, false)
                    .addComponent(btnLaunchSimulation, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(gl_panelTiempo.createSequentialGroup()
                            .addGroup(gl_panelTiempo.createParallelGroup(Alignment.TRAILING)
                                    .addComponent(btnCarrot, GroupLayout.PREFERRED_SIZE, 81,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblNewLabel_1, GroupLayout.PREFERRED_SIZE, 72,
                                            GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(ComponentPlacement.UNRELATED)
                            .addGroup(gl_panelTiempo.createParallelGroup(Alignment.TRAILING)
                                    .addComponent(btnBanana).addComponent(lblCalg, GroupLayout.PREFERRED_SIZE,
                                            72, GroupLayout.PREFERRED_SIZE))
                            .addGap(18)
                            .addGroup(gl_panelTiempo.createParallelGroup(Alignment.TRAILING)
                                    .addComponent(btnCookie, GroupLayout.PREFERRED_SIZE, 81,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblCalg_1, GroupLayout.PREFERRED_SIZE, 72,
                                            GroupLayout.PREFERRED_SIZE))
                            .addGroup(gl_panelTiempo.createParallelGroup(Alignment.LEADING)
                                    .addGroup(gl_panelTiempo.createSequentialGroup().addGap(6).addComponent(
                                            btnBurger, GroupLayout.PREFERRED_SIZE, 81,
                                            GroupLayout.PREFERRED_SIZE))
                                    .addGroup(gl_panelTiempo.createSequentialGroup().addGap(18).addComponent(
                                            lblCalg_2, GroupLayout.PREFERRED_SIZE, 72,
                                            GroupLayout.PREFERRED_SIZE)))))
                    .addContainerGap(24, Short.MAX_VALUE)));
    gl_panelTiempo.setVerticalGroup(gl_panelTiempo.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panelTiempo.createSequentialGroup()
                    .addComponent(panel, GroupLayout.PREFERRED_SIZE, 31, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.UNRELATED)
                    .addGroup(gl_panelTiempo.createParallelGroup(Alignment.LEADING).addGroup(gl_panelTiempo
                            .createSequentialGroup()
                            .addGroup(gl_panelTiempo.createParallelGroup(Alignment.LEADING)
                                    .addComponent(btnCarrot, GroupLayout.PREFERRED_SIZE, 69,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(btnCookie, GroupLayout.PREFERRED_SIZE, 69,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(btnBurger, GroupLayout.PREFERRED_SIZE, 69,
                                            GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(ComponentPlacement.RELATED)
                            .addGroup(gl_panelTiempo.createParallelGroup(Alignment.LEADING, false)
                                    .addComponent(lblNewLabel_1, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addGroup(gl_panelTiempo.createParallelGroup(Alignment.BASELINE)
                                            .addComponent(lblCalg_2, GroupLayout.DEFAULT_SIZE,
                                                    GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(lblCalg_1, GroupLayout.DEFAULT_SIZE, 27,
                                                    Short.MAX_VALUE))
                                    .addComponent(lblCalg, GroupLayout.DEFAULT_SIZE, 27, Short.MAX_VALUE)))
                            .addComponent(btnBanana, GroupLayout.PREFERRED_SIZE, 69,
                                    GroupLayout.PREFERRED_SIZE))
                    .addGap(30).addComponent(btnLaunchSimulation, GroupLayout.PREFERRED_SIZE, 62,
                            GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(33, Short.MAX_VALUE)));
    panelTiempo.setLayout(gl_panelTiempo);

    JLabel LabelStrength = new JLabel("Fuerza");
    LabelStrength.setFont(new Font("Tahoma", Font.PLAIN, 14));

    JLabel labelStaticFriction = new JLabel("Roz. Est\u00E1tico");
    labelStaticFriction.setFont(new Font("Tahoma", Font.PLAIN, 14));

    JLabel labelDynamicFriction = new JLabel("Roz. Din\u00E1mico");
    labelDynamicFriction.setFont(new Font("Tahoma", Font.PLAIN, 14));

    JPanel panelTitle = new JPanel();
    panelTitle.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null));

    lblStaticFrictionValue = new JLabel("0.2");
    lblStaticFrictionValue.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblDynamicFrictionValue = new JLabel("0.1");
    lblDynamicFrictionValue.setFont(new Font("Tahoma", Font.PLAIN, 14));

    lblStregthValue = new JLabel("100");
    lblStregthValue.setFont(new Font("Tahoma", Font.PLAIN, 14));

    sliderStrength = new JSlider();
    sliderStrength.setMinorTickSpacing(1);
    sliderStrength.setMinimum(1);
    sliderStrength.setMaximum(300);
    sliderStrength.setValue(100);
    sliderStrength.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent event) {
            sliderStrenghtEvent();
        }
    });

    sliderStaticFriction = new JSlider();
    sliderStaticFriction.setMinimum(15);
    sliderStaticFriction.setMaximum(80);
    sliderStaticFriction.setMinorTickSpacing(1);
    sliderStaticFriction.setValue(20);
    sliderStaticFriction.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            sliderStaticFrictionEvent();
        }
    });

    sliderDynamicFriction = new JSlider();
    sliderDynamicFriction.setValue(10);
    sliderDynamicFriction.setMaximum(15);
    sliderDynamicFriction.setMinimum(5);
    sliderDynamicFriction.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            sliderDynamicFrictionEvent();
        }
    });
    sliderDynamicFriction.setMinorTickSpacing(1);

    GroupLayout gl_panelInputs = new GroupLayout(panelInputs);
    gl_panelInputs.setHorizontalGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING)
            .addGroup(gl_panelInputs.createSequentialGroup().addContainerGap()
                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING, false)
                            .addComponent(labelDynamicFriction, Alignment.LEADING, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(LabelStrength, Alignment.LEADING, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(labelStaticFriction, Alignment.LEADING, GroupLayout.PREFERRED_SIZE,
                                    120, Short.MAX_VALUE))
                    .addGap(18)
                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                            .addComponent(lblStregthValue, GroupLayout.PREFERRED_SIZE, 42,
                                    GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblStaticFrictionValue, GroupLayout.PREFERRED_SIZE, 56,
                                    GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblDynamicFrictionValue, GroupLayout.PREFERRED_SIZE, 56,
                                    GroupLayout.PREFERRED_SIZE))
                    .addGap(18)
                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                            .addComponent(sliderStaticFriction, GroupLayout.PREFERRED_SIZE, 146,
                                    GroupLayout.PREFERRED_SIZE)
                            .addComponent(sliderStrength, GroupLayout.PREFERRED_SIZE, 146,
                                    GroupLayout.PREFERRED_SIZE)
                            .addComponent(sliderDynamicFriction, GroupLayout.PREFERRED_SIZE, 146,
                                    GroupLayout.PREFERRED_SIZE))
                    .addGap(26))
            .addComponent(panelTitle, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 394, Short.MAX_VALUE));
    gl_panelInputs
            .setVerticalGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                    .addGroup(gl_panelInputs.createSequentialGroup()
                            .addComponent(panelTitle, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE)
                            .addGap(8)
                            .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE)
                                            .addComponent(LabelStrength).addComponent(lblStregthValue,
                                                    GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE))
                                    .addComponent(sliderStrength, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(ComponentPlacement.RELATED)
                            .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                                    .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE)
                                            .addComponent(labelStaticFriction)
                                            .addComponent(lblStaticFrictionValue, GroupLayout.PREFERRED_SIZE,
                                                    17, GroupLayout.PREFERRED_SIZE))
                                    .addComponent(sliderStaticFriction, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                            .addGap(11)
                            .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING)
                                    .addComponent(labelDynamicFriction)
                                    .addComponent(lblDynamicFrictionValue, GroupLayout.PREFERRED_SIZE, 17,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(sliderDynamicFriction, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                            .addGap(75)));

    JLabel lblDatosDeEntrada = new JLabel("Datos de Entrada");
    lblDatosDeEntrada.setFont(new Font("Tahoma", Font.PLAIN, 14));
    panelTitle.add(lblDatosDeEntrada);
    panelInputs.setLayout(gl_panelInputs);
    panel_control.setLayout(gl_panel_control);

    JPanel panel_visualizar = new JPanel();

    GroupLayout groupLayout = new GroupLayout(getContentPane());
    groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(groupLayout.createSequentialGroup().addContainerGap()
                    .addComponent(panel_control, GroupLayout.PREFERRED_SIZE, 432, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(panel_visualizar, GroupLayout.DEFAULT_SIZE, 592, Short.MAX_VALUE)
                    .addContainerGap()));
    groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
            .addGroup(groupLayout.createSequentialGroup().addContainerGap()
                    .addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
                            .addComponent(panel_visualizar, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 598,
                                    Short.MAX_VALUE)
                            .addComponent(panel_control, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 598,
                                    Short.MAX_VALUE))
                    .addContainerGap()));
    GridBagLayout gbl_panel_visualizar = new GridBagLayout();
    gbl_panel_visualizar.columnWidths = new int[] { 0, 0 };
    gbl_panel_visualizar.rowHeights = new int[] { 0, 0, 0 };
    gbl_panel_visualizar.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
    gbl_panel_visualizar.rowWeights = new double[] { 1.0, 1.0, Double.MIN_VALUE };
    panel_visualizar.setLayout(gbl_panel_visualizar);

    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    GridBagConstraints gbc_tabbedPane = new GridBagConstraints();
    gbc_tabbedPane.gridheight = 2;
    gbc_tabbedPane.fill = GridBagConstraints.BOTH;
    gbc_tabbedPane.gridx = 0;
    gbc_tabbedPane.gridy = 0;
    panel_visualizar.add(tabbedPane, gbc_tabbedPane);

    panelSimulation = new JPanelGrafica();
    tabbedPane.addTab("Simulacin", null, panelSimulation, null);
    panelSimulation.setBackground(Color.WHITE);

    getContentPane().setLayout(groupLayout);
}

From source file:edu.ku.brc.specify.tools.StrLocalizerApp.java

/**
 * /*from ww w  .ja va 2  s.co  m*/
 */
private void createUI() {
    IconManager.setApplicationClass(Specify.class);
    IconManager.loadIcons(XMLHelper.getConfigDir("icons_datamodel.xml")); //$NON-NLS-1$
    IconManager.loadIcons(XMLHelper.getConfigDir("icons_plugins.xml")); //$NON-NLS-1$
    IconManager.loadIcons(XMLHelper.getConfigDir("icons_disciplines.xml")); //$NON-NLS-1$

    System.setProperty("edu.ku.brc.ui.db.PickListDBAdapterFactory", //$NON-NLS-1$
            "edu.ku.brc.specify.tools.StrLocPickListFactory"); // Needed By the Auto Cosmplete UI  //$NON-NLS-1$

    CellConstraints cc = new CellConstraints();

    PanelBuilder pb = new PanelBuilder(new FormLayout("f:p:g,10px,f:p:g", "p,4px,f:p:g,4px,p"), this);

    pb.addSeparator("Localize", cc.xyw(1, 1, 3));

    termList = new JList(new ItemModel(srcFile));
    newTermList = new JList(newKeyList);

    srcLbl = UIHelper.createTextArea(3, 40);
    srcLbl.setBorder(new LineBorder(srcLbl.getForeground()));
    textField = UIHelper.createTextField(40);

    textField.getDocument().addDocumentListener(new DocumentAdaptor() {
        @Override
        protected void changed(DocumentEvent e) {
            hasChanged = true;
        }
    });

    statusBar = new JStatusBar();
    statusBar.setSectionText(1, "     "); //$NON-NLS-1$ //$NON-NLS-2$
    UIRegistry.setStatusBar(statusBar);

    srcLbl.setEditable(false);

    rsController = new ResultSetController(null, false, false, false, "", 1, true);

    //transBtn = UIHelper.createButton(getResourceString("StrLocalizerApp.Translate"));

    PanelBuilder pbr = new PanelBuilder(
            new FormLayout("r:p,2px,f:p:g", "p, 4px, c:p,4px,p,4px,p,4px,p,4px,p,10px,p,2px,f:p:g"));

    pbr.add(UIHelper.createLabel(getResourceString("StrLocalizerApp.FileLbl")), cc.xy(1, 1));
    fileLbl = UIHelper.createLabel("   ");
    pbr.add(fileLbl, cc.xy(3, 1));

    pbr.add(UIHelper.createLabel("English:"), cc.xy(1, 3));
    pbr.add(srcLbl, cc.xy(3, 3));

    destLbl = UIHelper.createFormLabel(destLanguage.getEnglishName());
    pbr.add(destLbl, cc.xy(1, 5));
    pbr.add(textField, cc.xy(3, 5));

    pbr.add(rsController.getPanel(), cc.xyw(1, 7, 3));
    //pbr.add(transBtn,                         cc.xy(1,  9));
    pbr.addSeparator("Searching", cc.xyw(1, 11, 3));

    searchBtn = createButton(getResourceString("SEARCH"));
    searchBtn.setToolTipText(getResourceString("ExpressSearchTT"));
    searchText = new JAutoCompTextField(15,
            PickListDBAdapterFactory.getInstance().create("ExpressSearch", true));
    searchText.setAskBeforeSave(false);
    searchBox = new SearchBox(searchText, null, true);

    searchText.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_ENTER) {
                fndKeyHash.clear();
                results.clear();
                String txt = searchText.getText();
                if (!txt.isEmpty()) {
                    doSearch(txt, "key");
                    doSearch(txt, "src");
                    doSearch(txt, "dst");
                }
                model.fireChanges();
            }
        }
    });
    pbr.add(searchBox, cc.xyw(1, 13, 3));

    model = new SearchResultsModel();
    searchResultsTbl = new JTable(model);
    pbr.add(UIHelper.createScrollPane(searchResultsTbl), cc.xyw(1, 15, 3));

    searchResultsTbl.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            //tableRowSelected();
            if (results != null && results.size() > 0 && searchResultsTbl.getSelectedRow() > -1) {
                StrLocaleEntry entry = (StrLocaleEntry) results.get(searchResultsTbl.getSelectedRow());
                if (entry != null) {
                    int listIndex = srcFile.getInxForKey(entry.getKey());
                    termList.setSelectedIndex(listIndex);
                    termList.ensureIndexIsVisible(listIndex);
                }
            }
        }
    });

    PanelBuilder pbl = new PanelBuilder(new FormLayout("f:p:g", "f:p:g,10px,p,4px,f:p:g"));

    JScrollPane sp = UIHelper.createScrollPane(termList);
    JScrollPane nsp = UIHelper.createScrollPane(newTermList);
    pbl.add(sp, cc.xy(1, 1));
    pbl.addSeparator("New Items", cc.xy(1, 3));
    pbl.add(nsp, cc.xy(1, 5));

    pb.add(pbl.getPanel(), cc.xy(1, 3));
    pb.add(pbr.getPanel(), cc.xy(3, 3));
    pb.add(statusBar, cc.xyw(1, 5, 3));

    ResultSetController.setBackStopRS(rsController);

    pb.setDefaultDialogBorder();

    mainPane = pb.getPanel();

    termList.addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            listSelected();
        }
    });

    newTermList.addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            newListSelected();
        }
    });

    transBtn.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            String txt = srcLbl.getText();

            String newText = translate(txt);
            if (StringUtils.isNotEmpty(newText)) {
                newText = newText.replace("&#039;", "'");
                textField.setText(newText);
                StrLocaleEntry entry = srcFile.getKey(termList.getSelectedIndex());
                entry.setDstStr(textField.getText());
            }
        }
    });

    rscListener = new ResultSetControllerListener() {
        @Override
        public void newRecordAdded() {
        }

        @Override
        public void indexChanged(int newIndex) {
            termList.setSelectedIndex(newIndex);
        }

        @Override
        public boolean indexAboutToChange(int oldIndex, int newIndex) {
            return true;
        }
    };

    rsController.addListener(rscListener);

    frame.pack();
}