Example usage for javax.swing.border TitledBorder LEADING

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

Introduction

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

Prototype

int LEADING

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

Click Source Link

Document

Position title text at the left side of the border line for left to right orientation, at the right side of the border line for right to left orientation.

Usage

From source file:it.isislab.dmason.util.SystemManagement.Master.thrower.DMasonMaster.java

private void initComponents() {
    menuBar1 = new JMenuBar();
    jMenuFile = new JMenu();
    //menuItemOpen = new JMenuItem();
    menuItemExit = new JMenuItem();
    jMenuAbout = new JMenu();
    menuItemInfo = new JMenuItem();
    menuItemHelp = new JMenuItem();
    panelMain = new JPanel();
    jPanelContainerConnection = new JPanel();
    jPanelConnection = new JPanel();
    jLabelAddress = new JLabel();
    textFieldAddress = new JTextField();
    jLabelPort = new JLabel();
    textFieldPort = new JTextField();
    refreshServerLabel = new JLabel();
    buttonRefreshServerLabel = new JButton();
    jPanelContainerSettings = new JPanel();
    jPanelSetDistribution = new JPanel();
    jPanelSettings = new JPanel();
    jLabelHorizontal = new JLabel();
    jLabelSquare = new JLabel();
    jLabelMaxDistance = new JLabel();
    jLabelWidth = new JLabel();
    jLabelInsertSteps = new JLabel();
    textFieldMaxDistance = new JTextField();
    textFieldWidth = new JTextField();
    jLabelHeight = new JLabel();
    textFieldHeight = new JTextField();
    jLabelAgents = new JLabel();
    textFieldAgents = new JTextField();
    textFieldColumns = new JTextField();
    textFieldRows = new JTextField();
    textFieldSteps = new JTextField();
    jLabelChooseSimulation = new JLabel();
    jComboBoxChooseSimulation = new JComboBox();
    jComboBoxNumRegionXPeer = new JComboBox();
    jPanelContainerTabbedPane = new JPanel();
    tabbedPane2 = new JTabbedPane();
    jPanelDefault = new JPanel();
    jPanelSimulation = new ModelPanel(tabbedPane2);
    labelSimulationConfigSet = new JLabel();
    labelRegionsResume = new JLabel();
    labelNumOfPeerResume = new JLabel();
    labelRegForPeerResume = new JLabel();
    labelWriteReg = new JLabel();
    labelWriteNumOfPeer = new JLabel();
    labelWriteRegForPeer = new JLabel();
    labelWidthRegion = new JLabel();
    labelheightRegion = new JLabel();
    labelDistrMode = new JLabel();
    labelWriteRegWidth = new JLabel();
    labelWriteRegHeight = new JLabel();
    labelWriteDistrMode = new JLabel();
    graphicONcheckBox2 = new JCheckBox();
    jPanelSetButton = new JPanel();
    buttonSetConfigDefault = new JButton();
    jPanelAdvanced = new JPanel();
    jPanelAdvancedMain = new JPanel();
    peerInfoStatus = new JDesktopPane();
    internalFrame1 = new JInternalFrame();
    architectureLabel = new JTextArea();
    architectureLabel.setBackground(Color.BLACK);
    architectureLabel.setForeground(Color.GREEN);
    architectureLabel.setEditable(false);
    advancedConfirmBut = new JLabel();
    graphicONcheckBox = new JCheckBox();
    jCheckBoxLoadBalancing = new JCheckBox("Load Balancing", false);
    jCheckBoxLoadBalancing.setEnabled(true);
    jCheckBoxLoadBalancing.setSelected(false);

    jCheckBoxMPI = new JCheckBox("Enable MPI", false);
    jCheckBoxMPI.setEnabled(true);/*from  w w w . j  av  a 2  s .  c  o  m*/
    jCheckBoxMPI.setSelected(false);

    scrollPaneTree = new JScrollPane();
    tree1 = new JTree();
    buttonSetConfigAdvanced = new JButton();
    jLabelPlayButton = new JLabel();
    jLabelPauseButton = new JLabel();
    jPanelNumStep = new JPanel();
    jLabelStep = new JLabel();
    jLabelStep.setHorizontalAlignment(SwingConstants.LEFT);
    jLabelStopButton = new JLabel();
    scrollPane1 = new JScrollPane();
    peerInfoStatus1 = new JDesktopPane();
    root = new DefaultMutableTreeNode("Simulation");
    ButtonGroup b = new ButtonGroup();
    ip = textFieldAddress.getText();
    port = textFieldPort.getText();
    menuBar1 = new JMenuBar();
    jMenuFile = new JMenu();
    menuItemExit = new JMenuItem();
    menuNewSim = new JMenuItem();
    jMenuAbout = new JMenu();
    menuItemInfo = new JMenuItem();
    menuItemHelp = new JMenuItem();
    scrollPane3 = new JScrollPane();
    scrollPane4 = new JScrollPane();
    notifyArea = new JTextArea();
    panelConsole = new JPanel();
    buttonSetConfigDefault2 = new JButton();
    jPanelSetButton2 = new JPanel();
    graphicONcheckBox = new JCheckBox();
    graphicONcheckBox.setEnabled(false);
    graphicONcheckBox.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            withGui = graphicONcheckBox.isSelected();
        }
    });

    jLabelChooseSimulation = new JLabel();
    jComboBoxChooseSimulation = new JComboBox();

    loadSimulation();

    selectedSimulation = ((SimComboEntry) jComboBoxChooseSimulation.getSelectedItem()).fullSimName;
    jPanelSimulation.updateHTML(selectedSimulation);
    jComboBoxChooseSimulation.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            // Prevent executing listener's actions two times
            if (e.getStateChange() != ItemEvent.SELECTED)
                return;
            selectedSimulation = ((SimComboEntry) jComboBoxChooseSimulation.getSelectedItem()).fullSimName;
            jPanelSimulation.updateHTML(selectedSimulation);
            isThin = isThinSimulation(selectedSimulation);
            jCheckBoxLoadBalancing.setSelected(false);
            jCheckBoxLoadBalancing.setEnabled(!isThin);
            initializeDefaultLabel();
        }
    });

    /*for(int i=2;i<100;i++)
       jComboRegions.addItem(i);*/

    buttonRefreshServerLabel.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            connect();
        }
    });

    refreshServerLabel.addMouseListener(new MouseListener() {

        @Override
        public void mouseReleased(MouseEvent arg0) {
            if (starter.isConnected())
                starter.execute("restart");
            else
                JOptionPane.showMessageDialog(null, "Not connected to the Server!");
        }

        @Override
        public void mousePressed(MouseEvent arg0) {
        }

        @Override
        public void mouseExited(MouseEvent arg0) {
        }

        @Override
        public void mouseEntered(MouseEvent arg0) {
        }

        @Override
        public void mouseClicked(MouseEvent arg0) {
        }
    });

    jCheckBoxLoadBalancing.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            if (!isHorizontal) {
                if (jCheckBoxLoadBalancing.isSelected())
                    labelWriteDistrMode.setText("SQUARE BALANCED MODE");
                else
                    labelWriteDistrMode.setText("SQUARE MODE");
            }

            if (isHorizontal) {
                if (jCheckBoxLoadBalancing.isSelected())
                    labelWriteDistrMode.setText("HORIZONTAL BALANCED MODE");
                else
                    labelWriteDistrMode.setText("HORIZONTAL MODE");
            }

        }
    });

    buttonSetConfigDefault2.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (initializeDefaultLabel())
                submitCustomizeMode();
            else
                JOptionPane.showMessageDialog(null, "To start a simulation must fill in all fields...!");
        }
    });

    buttonSetConfigDefault.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (initializeDefaultLabel())
                submitDefaultMode();
            else
                JOptionPane.showMessageDialog(null, "To start a simulation must fill in all fields...!");
        }
    });

    advancedConfirmBut.addMouseListener(new MouseListener() {

        @Override
        public void mouseReleased(MouseEvent arg0) {
            confirm();
            res -= (Integer) jComboBoxNumRegionXPeer.getSelectedItem();

            withGui = graphicONcheckBox.isSelected();

            jComboBoxNumRegionXPeer.removeAllItems();
            graphicONcheckBox.setSelected(false);
            for (int i = 1; i <= res; i++)
                jComboBoxNumRegionXPeer.addItem(i);

            JOptionPane.showMessageDialog(null, "Region assigned !");

        }

        @Override
        public void mousePressed(MouseEvent arg0) {
        }

        @Override
        public void mouseExited(MouseEvent arg0) {
        }

        @Override
        public void mouseEntered(MouseEvent arg0) {
        }

        @Override
        public void mouseClicked(MouseEvent arg0) {
        }
    });

    //======== this ========

    Container contentPane = getContentPane();

    //======== menuBar1 ========
    {
        {
            jMenuFile.setText("    File    ");

            menuNewSim.setText("New    ");
            menuNewSim.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    me.dispose();
                    me = null;
                    DMasonMaster p = new DMasonMaster();
                    p.setVisible(true);
                }
            });

            jMenuFile.add(menuNewSim);

            //---- menuItemExit ----
            menuItemExit.setText("Exit");
            menuItemExit.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    me.dispose();
                }
            });

            jMenuFile.add(menuItemExit);
        }
        menuBar1.add(jMenuFile);
        menuBar1.add(getJMenuSystem());

        //======== jMenuAbout ========
        {
            jMenuAbout.setText(" ?  ");

            //---- menuItemInfo ----
            menuItemInfo.setText("Info");
            menuItemInfo.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    JOptionPane.showMessageDialog(null, Release.PRODUCT_RELEASE, "Info", 1);

                }
            });

            jMenuAbout.add(menuItemInfo);

            //---- menuItenHelp ----
            menuItemHelp.setText("Help");
            menuItemHelp.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent arg0) {
                    try {
                        java.net.URI uri = new java.net.URI(
                                "http://isis.dia.unisa.it/projects/it.isislab.dmason/");
                        try {
                            java.awt.Desktop.getDesktop().browse(uri);
                        } catch (IOException e) {
                            e.printStackTrace();
                        }
                    } catch (URISyntaxException e) {
                        e.printStackTrace();
                    }

                }
            });

            jMenuAbout.add(menuItemHelp);

        }
        menuBar1.add(jMenuAbout);
    }

    setJMenuBar(menuBar1);

    //======== panelMain ========
    {

        //======== jPanelContainerConnection ========
        {

            //======== jPanelConnection ========
            {
                jPanelConnection.setBorder(new TitledBorder("Connection"));
                jPanelConnection.setPreferredSize(new Dimension(215, 125));

                //---- jLabelAddress ----
                jLabelAddress.setText("IP Address :");

                //---- textFieldAddress ----
                textFieldAddress.setText("127.0.0.1");

                //---- jLabelPort ----
                jLabelPort.setText("Port :");

                //---- textFieldPort ----
                textFieldPort.setText("61616");

                //---- refreshServerLabel ----

                refreshServerLabel.setIcon(new ImageIcon("resources/image/refresh.png"));

                //---- buttonRefreshServerLabel ----
                buttonRefreshServerLabel.setText("OK");

                JLabel lblStatus = new JLabel("Communication Server status :");

                lblStatusIcon = new JLabel("");
                lblStatusIcon.setIcon(new ImageIcon("resources/image/status-down.png"));

                buttonActiveMQRestart = new JButton("");
                buttonActiveMQRestart.setEnabled(false);
                buttonActiveMQRestart.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent arg0) {

                        notifyArea.append("ActiveMQ restarting...\n");
                        if (csManager.restartActiveMQ())
                            notifyArea.append("ActiveMQ restarted!\n");

                        checkCommunicationServerStatus();

                    }
                });
                buttonActiveMQRestart.setMinimumSize(new Dimension(24, 24));
                buttonActiveMQRestart.setMaximumSize(new Dimension(24, 24));
                buttonActiveMQRestart.setPreferredSize(new Dimension(24, 24));
                buttonActiveMQRestart.setIcon(new ImageIcon("resources/image/LH2 - Restart.png"));

                buttonActiveMQStart = new JButton("");
                buttonActiveMQStart.setEnabled(false);
                buttonActiveMQStart.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent arg0) {
                        notifyArea.append("ActiveMQ starting...\n");
                        if (csManager.startActiveMQ())
                            notifyArea.append("ActiveMQ started!\n");

                        checkCommunicationServerStatus();
                    }
                });
                buttonActiveMQStart.setPreferredSize(new Dimension(24, 24));
                buttonActiveMQStart.setMinimumSize(new Dimension(24, 24));
                buttonActiveMQStart.setMaximumSize(new Dimension(24, 24));
                buttonActiveMQStart.setIcon(new ImageIcon("resources/image/LH2 - Shutdown.png"));

                buttonActiveMQStop = new JButton("");
                buttonActiveMQStop.setEnabled(false);
                buttonActiveMQStop.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent arg0) {
                        notifyArea.append("ActiveMQ stopping...\n");
                        if (csManager.stopActiveMQ())
                            notifyArea.append("ActiveMQ stopped!\n");

                        checkCommunicationServerStatus();
                    }
                });
                buttonActiveMQStop.setPreferredSize(new Dimension(24, 24));
                buttonActiveMQStop.setMinimumSize(new Dimension(24, 24));
                buttonActiveMQStop.setMaximumSize(new Dimension(24, 24));
                buttonActiveMQStop.setIcon(new ImageIcon("resources/image/LH2 - Stop.png"));

                btnCheckPeers = new JButton("Check Peers");
                btnCheckPeers.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        try {
                            checkPeers();
                        } catch (Exception e1) {
                            // TODO Auto-generated catch block
                            e1.printStackTrace();
                        }
                    }
                });

                GroupLayout jPanelConnectionLayout = new GroupLayout(jPanelConnection);
                jPanelConnectionLayout.setHorizontalGroup(jPanelConnectionLayout
                        .createParallelGroup(Alignment.LEADING)
                        .addGroup(jPanelConnectionLayout.createSequentialGroup().addGroup(jPanelConnectionLayout
                                .createParallelGroup(Alignment.LEADING)
                                .addGroup(jPanelConnectionLayout.createSequentialGroup()
                                        .addGroup(jPanelConnectionLayout.createParallelGroup(Alignment.TRAILING)
                                                .addComponent(refreshServerLabel)
                                                .addGroup(jPanelConnectionLayout.createSequentialGroup()
                                                        .addComponent(buttonActiveMQStart,
                                                                GroupLayout.PREFERRED_SIZE,
                                                                GroupLayout.DEFAULT_SIZE,
                                                                GroupLayout.PREFERRED_SIZE)
                                                        .addPreferredGap(ComponentPlacement.RELATED)
                                                        .addComponent(buttonActiveMQRestart,
                                                                GroupLayout.PREFERRED_SIZE,
                                                                GroupLayout.DEFAULT_SIZE,
                                                                GroupLayout.PREFERRED_SIZE)
                                                        .addPreferredGap(ComponentPlacement.RELATED)
                                                        .addComponent(buttonActiveMQStop,
                                                                GroupLayout.PREFERRED_SIZE,
                                                                GroupLayout.DEFAULT_SIZE,
                                                                GroupLayout.PREFERRED_SIZE)
                                                        .addGap(111).addComponent(jLabelAddress).addGap(18)
                                                        .addComponent(textFieldAddress,
                                                                GroupLayout.PREFERRED_SIZE, 91,
                                                                GroupLayout.PREFERRED_SIZE)
                                                        .addGap(18).addComponent(jLabelPort).addGap(18)
                                                        .addComponent(textFieldPort, GroupLayout.PREFERRED_SIZE,
                                                                85, GroupLayout.PREFERRED_SIZE)
                                                        .addGap(46).addComponent(buttonRefreshServerLabel)))
                                        .addGap(51).addComponent(btnCheckPeers))
                                .addGroup(jPanelConnectionLayout.createSequentialGroup().addComponent(lblStatus)
                                        .addPreferredGap(ComponentPlacement.RELATED)
                                        .addComponent(lblStatusIcon)))
                                .addContainerGap(71, Short.MAX_VALUE)));
                jPanelConnectionLayout.setVerticalGroup(jPanelConnectionLayout
                        .createParallelGroup(Alignment.TRAILING)
                        .addGroup(jPanelConnectionLayout.createSequentialGroup().addGroup(jPanelConnectionLayout
                                .createParallelGroup(Alignment.LEADING)
                                .addGroup(jPanelConnectionLayout.createSequentialGroup()
                                        .addGroup(jPanelConnectionLayout.createParallelGroup(Alignment.LEADING)
                                                .addComponent(lblStatus).addComponent(lblStatusIcon))
                                        .addPreferredGap(ComponentPlacement.RELATED)
                                        .addGroup(jPanelConnectionLayout.createParallelGroup(Alignment.LEADING)
                                                .addComponent(buttonActiveMQRestart, GroupLayout.PREFERRED_SIZE,
                                                        GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                                .addComponent(buttonActiveMQStart, GroupLayout.PREFERRED_SIZE,
                                                        GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                                .addComponent(buttonActiveMQStop, GroupLayout.PREFERRED_SIZE,
                                                        GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                                        .addPreferredGap(ComponentPlacement.RELATED, 1, Short.MAX_VALUE))
                                .addGroup(jPanelConnectionLayout.createSequentialGroup()
                                        .addContainerGap(18, Short.MAX_VALUE).addComponent(refreshServerLabel)
                                        .addPreferredGap(ComponentPlacement.RELATED)
                                        .addGroup(jPanelConnectionLayout.createParallelGroup(Alignment.BASELINE)
                                                .addComponent(buttonRefreshServerLabel).addComponent(jLabelPort)
                                                .addComponent(textFieldPort, GroupLayout.PREFERRED_SIZE, 22,
                                                        GroupLayout.PREFERRED_SIZE)
                                                .addComponent(jLabelAddress)
                                                .addComponent(textFieldAddress, GroupLayout.PREFERRED_SIZE, 22,
                                                        GroupLayout.PREFERRED_SIZE)
                                                .addComponent(btnCheckPeers))))
                                .addGap(10)));
                jPanelConnectionLayout.linkSize(SwingConstants.HORIZONTAL,
                        new Component[] { buttonActiveMQRestart, buttonActiveMQStart, buttonActiveMQStop });
                jPanelConnection.setLayout(jPanelConnectionLayout);
            }

            GroupLayout jPanelContainerConnectionLayout = new GroupLayout(jPanelContainerConnection);
            jPanelContainerConnection.setLayout(jPanelContainerConnectionLayout);
            jPanelContainerConnectionLayout
                    .setHorizontalGroup(jPanelContainerConnectionLayout.createParallelGroup()
                            .addGroup(jPanelContainerConnectionLayout
                                    .createSequentialGroup().addContainerGap().addComponent(jPanelConnection,
                                            GroupLayout.PREFERRED_SIZE, 829, GroupLayout.PREFERRED_SIZE)
                                    .addContainerGap(153, Short.MAX_VALUE)));
            jPanelContainerConnectionLayout.setVerticalGroup(
                    jPanelContainerConnectionLayout.createParallelGroup().addComponent(jPanelConnection,
                            GroupLayout.PREFERRED_SIZE, 71, GroupLayout.PREFERRED_SIZE));
        }

        //======== jPanelContainerSettings ========
        {

            GroupLayout jPanelContainerSettingsLayout = new GroupLayout(jPanelContainerSettings);
            jPanelContainerSettings.setLayout(jPanelContainerSettingsLayout);
            jPanelContainerSettingsLayout.setHorizontalGroup(
                    jPanelContainerSettingsLayout.createParallelGroup().addGap(0, 1, Short.MAX_VALUE));
            jPanelContainerSettingsLayout.setVerticalGroup(
                    jPanelContainerSettingsLayout.createParallelGroup().addGap(0, 481, Short.MAX_VALUE));
        }

        //======== jPanelSetDistribution ========
        {
            jPanelSetDistribution.setBorder(new TitledBorder("Settings"));

            //======== jPanelSettings ========
            {

                //jLabelHorizontal.setIcon(new ImageIcon("it.isislab.dmason/resources/image/hori.png")));

                //---- jLabelSquare ----
                //jLabelSquare.setIcon(new ImageIcon("it.isislab.dmason/resources/image/square.png")));

                //---- jLabelMaxDistance ----
                jLabelMaxDistance.setText("MAX_DISTANCE :");

                //---- jLabelWidth ----
                jLabelWidth.setText("WIDTH :");

                //---- jLabelInsertSteps ----
                jLabelInsertSteps.setText("STEPS :");

                //---- textFieldMaxDistance ----
                textFieldMaxDistance.setText("1");

                //---- textFieldWidth ----
                textFieldWidth.setText("200");

                //---- jLabelHeight ----
                jLabelHeight.setText("HEIGHT :");

                //---- textFieldHeight ----
                textFieldHeight.setText("200");

                //---- jLabelAgents ----
                jLabelAgents.setText("AGENTS :");

                //---- textFieldAgents ----
                textFieldAgents.setText("15");

                //---- textFieldSteps
                textFieldSteps.setText("100");

                MouseListener textFieldMouseListener = new MouseListener() {

                    @Override
                    public void mouseReleased(MouseEvent e) {
                        // TODO Auto-generated method stub

                    }

                    @Override
                    public void mousePressed(MouseEvent e) {
                        // TODO Auto-generated method stub

                    }

                    @Override
                    public void mouseExited(MouseEvent e) {
                        initializeDefaultLabel();
                    }

                    @Override
                    public void mouseEntered(MouseEvent e) {
                        // TODO Auto-generated method stub

                    }

                    @Override
                    public void mouseClicked(MouseEvent e) {
                        // TODO Auto-generated method stub

                    }
                };

                textFieldAgents.addMouseListener(textFieldMouseListener);
                textFieldAgents.addKeyListener(new KeyListener() {

                    @Override
                    public void keyTyped(KeyEvent e) {
                        char v = e.getKeyChar();
                        if (!(Character.isDigit(v)) || v == KeyEvent.VK_BACK_SPACE) {
                            e.consume();
                        }
                        if (textFieldAgents.getText().length() > 0)
                            initializeDefaultLabel();
                    }

                    @Override
                    public void keyReleased(KeyEvent e) {
                        //initializeDefaultLabel();
                    }

                    @Override
                    public void keyPressed(KeyEvent e) {
                    }
                });

                textFieldColumns.addMouseListener(textFieldMouseListener);
                textFieldColumns.addKeyListener(new KeyListener() {

                    @Override
                    public void keyTyped(KeyEvent e) {
                        // TODO Auto-generated method stub
                        char v = e.getKeyChar();
                        if (!(Character.isDigit(v)) || v == KeyEvent.VK_BACK_SPACE) {
                            e.consume();
                        }
                        if (textFieldColumns.getText().length() > 0)
                            initializeDefaultLabel();
                    }

                    @Override
                    public void keyReleased(KeyEvent e) {
                        // TODO Auto-generated method stub

                    }

                    @Override
                    public void keyPressed(KeyEvent e) {
                        // TODO Auto-generated method stub
                    }
                });

                textFieldMaxDistance.addMouseListener(textFieldMouseListener);
                textFieldMaxDistance.addKeyListener(new KeyListener() {

                    @Override
                    public void keyTyped(KeyEvent e) {
                        char v = e.getKeyChar();
                        if (!(Character.isDigit(v)) || v == KeyEvent.VK_BACK_SPACE) {
                            e.consume();
                        }
                        if (textFieldMaxDistance.getText().length() > 0)
                            initializeDefaultLabel();
                    }

                    @Override
                    public void keyReleased(KeyEvent e) {
                        //initializeDefaultLabel();
                    }

                    @Override
                    public void keyPressed(KeyEvent e) {
                    }
                });

                textFieldWidth.addMouseListener(textFieldMouseListener);
                textFieldWidth.addKeyListener(new KeyListener() {

                    @Override
                    public void keyTyped(KeyEvent e) {
                        char v = e.getKeyChar();
                        if (!(Character.isDigit(v)) || v == KeyEvent.VK_BACK_SPACE) {
                            e.consume();
                        }
                        if (textFieldWidth.getText().length() > 0)
                            initializeDefaultLabel();
                    }

                    @Override
                    public void keyReleased(KeyEvent e) {
                        //initializeDefaultLabel();
                    }

                    @Override
                    public void keyPressed(KeyEvent e) {
                    }
                });

                textFieldRows.addMouseListener(textFieldMouseListener);
                textFieldRows.addKeyListener(new KeyListener() {

                    @Override
                    public void keyTyped(KeyEvent e) {
                        char v = e.getKeyChar();
                        if (!(Character.isDigit(v)) || v == KeyEvent.VK_BACK_SPACE) {
                            e.consume();
                        }
                        if (textFieldRows.getText().length() > 0)
                            initializeDefaultLabel();
                    }

                    @Override
                    public void keyReleased(KeyEvent e) {

                    }

                    @Override
                    public void keyPressed(KeyEvent e) {
                    }
                });

                textFieldHeight.addMouseListener(textFieldMouseListener);
                textFieldHeight.addKeyListener(new KeyListener() {

                    @Override
                    public void keyTyped(KeyEvent e) {
                        char v = e.getKeyChar();
                        if (!(Character.isDigit(v)) || v == KeyEvent.VK_BACK_SPACE) {
                            e.consume();
                        }
                        if (textFieldHeight.getText().length() > 0)
                            initializeDefaultLabel();
                    }

                    @Override
                    public void keyReleased(KeyEvent arg0) {
                        //initializeDefaultLabel();
                    }

                    @Override
                    public void keyPressed(KeyEvent arg0) {
                    }
                });

                textFieldSteps.addMouseListener(textFieldMouseListener);
                textFieldSteps.addKeyListener(new KeyListener() {

                    @Override
                    public void keyTyped(KeyEvent e) {
                        char v = e.getKeyChar();
                        if (!(Character.isDigit(v)) || v == KeyEvent.VK_BACK_SPACE) {
                            e.consume();
                        }
                        if (textFieldSteps.getText().length() > 0)
                            initializeDefaultLabel();
                    }

                    @Override
                    public void keyReleased(KeyEvent e) {
                        // TODO Auto-generated method stub

                    }

                    @Override
                    public void keyPressed(KeyEvent e) {
                        // TODO Auto-generated method stub

                    }
                });

                //---- jLabelChooseSimulation ----
                jLabelChooseSimulation.setText("Choose your simulation:");

                //---- jComboBoxChooseSimulation ----
                jComboBoxChooseSimulation.setMaximumRowCount(10);

                JLabel lblRows = new JLabel("ROWS :");

                JLabel lblColumns = new JLabel("COLUMNS :");

                textFieldRows.setText("1");
                textFieldRows.setEnabled(false);
                textFieldRows.setColumns(10);

                rows = Integer.parseInt(textFieldRows.getText());

                textFieldColumns.setText("2");
                textFieldColumns.setEnabled(false);
                textFieldColumns.setColumns(10);
                columns = Integer.parseInt(textFieldColumns.getText());

                textFieldSteps.setText("100");
                textFieldSteps.setEnabled(false);
                textFieldSteps.setColumns(10);
                steps = 100;

                GroupLayout jPanelSettingsLayout = new GroupLayout(jPanelSettings);
                jPanelSettingsLayout.setHorizontalGroup(jPanelSettingsLayout
                        .createParallelGroup(Alignment.LEADING)
                        .addGroup(jPanelSettingsLayout.createSequentialGroup().addGap(17)
                                .addGroup(jPanelSettingsLayout.createParallelGroup(Alignment.LEADING)
                                        .addComponent(jLabelChooseSimulation, GroupLayout.PREFERRED_SIZE, 245,
                                                GroupLayout.PREFERRED_SIZE)
                                        .addGroup(jPanelSettingsLayout.createSequentialGroup().addGap(119)
                                                .addComponent(jLabelHorizontal))
                                        .addComponent(jComboBoxChooseSimulation, GroupLayout.PREFERRED_SIZE,
                                                214, GroupLayout.PREFERRED_SIZE)
                                        .addGroup(jPanelSettingsLayout.createSequentialGroup()
                                                .addGroup(jPanelSettingsLayout
                                                        .createParallelGroup(Alignment.TRAILING)
                                                        .addGroup(Alignment.LEADING, jPanelSettingsLayout
                                                                .createSequentialGroup()
                                                                .addGroup(jPanelSettingsLayout
                                                                        .createParallelGroup(Alignment.LEADING)
                                                                        .addComponent(lblRows,
                                                                                GroupLayout.PREFERRED_SIZE, 59,
                                                                                GroupLayout.PREFERRED_SIZE)
                                                                        .addComponent(lblColumns))
                                                                .addGap(60)
                                                                .addGroup(jPanelSettingsLayout
                                                                        .createParallelGroup(Alignment.LEADING)
                                                                        .addComponent(jLabelSquare)
                                                                        .addComponent(textFieldColumns,
                                                                                GroupLayout.DEFAULT_SIZE, 94,
                                                                                Short.MAX_VALUE)
                                                                        .addComponent(textFieldRows,
                                                                                GroupLayout.DEFAULT_SIZE, 94,
                                                                                Short.MAX_VALUE)))
                                                        .addGroup(Alignment.LEADING, jPanelSettingsLayout
                                                                .createSequentialGroup()
                                                                .addGroup(jPanelSettingsLayout
                                                                        .createParallelGroup(Alignment.LEADING)
                                                                        .addComponent(jLabelMaxDistance)
                                                                        .addComponent(jLabelWidth)
                                                                        .addComponent(jLabelHeight)
                                                                        .addComponent(jLabelAgents)
                                                                        .addComponent(jLabelInsertSteps)
                                                                        .addGap(132))
                                                                .addGroup(jPanelSettingsLayout
                                                                        .createParallelGroup(Alignment.LEADING)
                                                                        .addComponent(textFieldAgents,
                                                                                GroupLayout.PREFERRED_SIZE, 94,
                                                                                GroupLayout.PREFERRED_SIZE)
                                                                        .addComponent(textFieldHeight,
                                                                                GroupLayout.PREFERRED_SIZE, 94,
                                                                                GroupLayout.PREFERRED_SIZE)
                                                                        .addComponent(textFieldWidth,
                                                                                GroupLayout.PREFERRED_SIZE, 94,
                                                                                GroupLayout.PREFERRED_SIZE)
                                                                        .addComponent(textFieldMaxDistance,
                                                                                GroupLayout.PREFERRED_SIZE, 94,
                                                                                GroupLayout.PREFERRED_SIZE)
                                                                        .addComponent(textFieldSteps,
                                                                                GroupLayout.PREFERRED_SIZE, 94,
                                                                                GroupLayout.PREFERRED_SIZE)
                                                                        .addGap(20))))

                                                .addGap(20)))));
                jPanelSettingsLayout.setVerticalGroup(jPanelSettingsLayout
                        .createParallelGroup(Alignment.LEADING)
                        .addGroup(jPanelSettingsLayout.createSequentialGroup().addContainerGap()
                                .addComponent(jLabelHorizontal).addGap(41)
                                .addGroup(jPanelSettingsLayout.createParallelGroup(Alignment.LEADING)
                                        .addComponent(jLabelSquare)
                                        .addGroup(jPanelSettingsLayout.createParallelGroup(Alignment.BASELINE)
                                                .addComponent(lblRows, GroupLayout.PREFERRED_SIZE, 22,
                                                        GroupLayout.PREFERRED_SIZE)
                                                .addComponent(textFieldRows, GroupLayout.PREFERRED_SIZE,
                                                        GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
                                .addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE,
                                        Short.MAX_VALUE)
                                .addGroup(jPanelSettingsLayout.createParallelGroup(Alignment.BASELINE)
                                        .addComponent(textFieldColumns, GroupLayout.PREFERRED_SIZE,
                                                GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                        .addComponent(lblColumns))
                                .addGap(18)
                                .addGroup(jPanelSettingsLayout.createParallelGroup(Alignment.BASELINE)
                                        .addComponent(jLabelMaxDistance).addComponent(textFieldMaxDistance,
                                                GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(ComponentPlacement.RELATED)
                                .addGroup(jPanelSettingsLayout.createParallelGroup(Alignment.BASELINE)
                                        .addComponent(jLabelWidth, GroupLayout.PREFERRED_SIZE, 16,
                                                GroupLayout.PREFERRED_SIZE)
                                        .addComponent(textFieldWidth, GroupLayout.PREFERRED_SIZE, 19,
                                                GroupLayout.PREFERRED_SIZE))
                                .addGap(10)
                                .addGroup(jPanelSettingsLayout.createParallelGroup(Alignment.BASELINE)
                                        .addComponent(jLabelHeight, GroupLayout.PREFERRED_SIZE, 16,
                                                GroupLayout.PREFERRED_SIZE)
                                        .addComponent(textFieldHeight, GroupLayout.PREFERRED_SIZE, 19,
                                                GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(ComponentPlacement.RELATED)
                                .addGroup(jPanelSettingsLayout.createParallelGroup(Alignment.BASELINE)
                                        .addComponent(jLabelAgents).addComponent(textFieldAgents,
                                                GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(ComponentPlacement.RELATED)
                                //.addGap(10)
                                .addGroup(jPanelSettingsLayout.createParallelGroup(Alignment.BASELINE)
                                        .addComponent(jLabelInsertSteps, GroupLayout.PREFERRED_SIZE, 16,
                                                GroupLayout.PREFERRED_SIZE)
                                        .addComponent(textFieldSteps, GroupLayout.PREFERRED_SIZE, 19,
                                                GroupLayout.PREFERRED_SIZE))
                                .addGap(35).addComponent(jLabelChooseSimulation)
                                .addPreferredGap(ComponentPlacement.UNRELATED)
                                .addComponent(jComboBoxChooseSimulation, GroupLayout.PREFERRED_SIZE,
                                        GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                .addGap(52)));
                jPanelSettings.setLayout(jPanelSettingsLayout);
            }

            //======== jPanelContainerTabbedPane ========
            {

                //======== tabbedPane2 ========
                {

                    //======== jPanelDefault ========
                    {
                        jPanelDefault.setBorder(new EtchedBorder());
                        jPanelDefault.setPreferredSize(new Dimension(350, 331));

                        //---- labelSimulationConfigSet ----
                        labelSimulationConfigSet.setText("Simulation Configuration Settings");
                        labelSimulationConfigSet.setFont(labelSimulationConfigSet.getFont().deriveFont(
                                labelSimulationConfigSet.getFont().getStyle() | Font.BOLD,
                                labelSimulationConfigSet.getFont().getSize() + 8f));

                        //---- labelRegionsResume ----
                        labelRegionsResume.setText("REGIONS :");

                        //---- labelNumOfPeerResume ----
                        labelNumOfPeerResume.setText("NUMBER OF PEERS :");

                        //---- labelRegForPeerResume ----
                        labelRegForPeerResume.setText("REGIONS FOR PEER :");

                        //---- labelWriteReg ----
                        labelWriteReg.setText("text");

                        //---- labelWriteNumOfPeer ----
                        labelWriteNumOfPeer.setText("text");

                        //---- labelWriteRegForPeer ----
                        labelWriteRegForPeer.setText("text");

                        //---- labelWidthRegion ----
                        labelWidthRegion.setText("REGION WIDTH :");

                        //---- labelheightRegion ----
                        labelheightRegion.setText("REGION HEIGHT :");

                        //---- labelDistrMode ----
                        labelDistrMode.setText("DISTRIBUTION MODE :");

                        //---- labelWriteRegWidth ----
                        labelWriteRegWidth.setText("text");

                        //---- labelWriteRegHeight ----
                        labelWriteRegHeight.setText("text");

                        //---- labelWriteDistrMode ----
                        labelWriteDistrMode.setText("text");

                        //---- graphicONcheckBox2 ----
                        graphicONcheckBox2.setText("Graphic ON");

                        //======== jPanelSetButton ========
                        {

                            //---- buttonSetConfigDefault ----
                            buttonSetConfigDefault.setText("Set");
                            {
                                jCheckBoxLoadBalancing.setText("Load Balancing");
                            }

                            GroupLayout jPanelSetButtonLayout = new GroupLayout(jPanelSetButton);
                            jPanelSetButton.setLayout(jPanelSetButtonLayout);
                            jPanelSetButtonLayout.setVerticalGroup(jPanelSetButtonLayout.createSequentialGroup()

                                    .addGroup(jPanelSetButtonLayout.createParallelGroup().addGroup(
                                            GroupLayout.Alignment.TRAILING,
                                            jPanelSetButtonLayout.createSequentialGroup().addComponent(
                                                    jCheckBoxMPI, GroupLayout.PREFERRED_SIZE, 20,
                                                    GroupLayout.PREFERRED_SIZE)))
                                    .addGroup(jPanelSetButtonLayout.createParallelGroup()
                                            .addGroup(GroupLayout.Alignment.LEADING,
                                                    jPanelSetButtonLayout.createSequentialGroup().addComponent(
                                                            jCheckBoxLoadBalancing, GroupLayout.PREFERRED_SIZE,
                                                            20, GroupLayout.PREFERRED_SIZE))
                                            .addGroup(GroupLayout.Alignment.LEADING, jPanelSetButtonLayout
                                                    .createSequentialGroup()
                                                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 0,
                                                            Short.MAX_VALUE)
                                                    .addComponent(buttonSetConfigDefault,
                                                            GroupLayout.PREFERRED_SIZE,
                                                            GroupLayout.PREFERRED_SIZE,
                                                            GroupLayout.PREFERRED_SIZE)))

                                    .addContainerGap());

                            jPanelSetButtonLayout.setHorizontalGroup(jPanelSetButtonLayout
                                    .createSequentialGroup()
                                    .addComponent(jCheckBoxMPI, GroupLayout.PREFERRED_SIZE, 120,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addContainerGap(0, 0)
                                    .addComponent(jCheckBoxLoadBalancing, GroupLayout.PREFERRED_SIZE, 114,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addGap(0, 150, Short.MAX_VALUE).addComponent(buttonSetConfigDefault,
                                            GroupLayout.PREFERRED_SIZE, 76, GroupLayout.PREFERRED_SIZE)
                                    .addContainerGap(0, 0));

                            FlowLayout lsetbutt = new FlowLayout();
                            lsetbutt.addLayoutComponent("", jCheckBoxMPI);
                            lsetbutt.addLayoutComponent("", jCheckBoxLoadBalancing);
                            lsetbutt.addLayoutComponent("", buttonSetConfigDefault);
                            jPanelSetButton.setLayout(lsetbutt);

                        }

                        GroupLayout jPanelDefaultLayout = new GroupLayout(jPanelDefault);
                        jPanelDefaultLayout.setHorizontalGroup(jPanelDefaultLayout
                                .createParallelGroup(Alignment.LEADING)
                                .addGroup(jPanelDefaultLayout.createSequentialGroup().addContainerGap()
                                        .addGroup(jPanelDefaultLayout.createParallelGroup(Alignment.LEADING)
                                                .addComponent(labelSimulationConfigSet,
                                                        GroupLayout.DEFAULT_SIZE, 478, Short.MAX_VALUE)
                                                .addGroup(jPanelDefaultLayout.createSequentialGroup().addGap(6)
                                                        .addGroup(jPanelDefaultLayout
                                                                .createParallelGroup(Alignment.LEADING)
                                                                .addGroup(jPanelDefaultLayout
                                                                        .createSequentialGroup()
                                                                        .addGroup(jPanelDefaultLayout
                                                                                .createParallelGroup(
                                                                                        Alignment.LEADING)
                                                                                .addComponent(
                                                                                        labelNumOfPeerResume)
                                                                                .addComponent(
                                                                                        labelRegForPeerResume)
                                                                                .addComponent(labelWidthRegion)
                                                                                .addComponent(labelheightRegion)
                                                                                .addComponent(labelDistrMode)
                                                                                .addComponent(
                                                                                        labelRegionsResume))
                                                                        .addPreferredGap(
                                                                                ComponentPlacement.RELATED, 218,
                                                                                Short.MAX_VALUE)
                                                                        .addGroup(jPanelDefaultLayout
                                                                                .createParallelGroup(
                                                                                        Alignment.LEADING)
                                                                                .addComponent(
                                                                                        labelWriteNumOfPeer,
                                                                                        GroupLayout.PREFERRED_SIZE,
                                                                                        25,
                                                                                        GroupLayout.PREFERRED_SIZE)
                                                                                .addComponent(labelWriteReg)
                                                                                .addComponent(
                                                                                        labelWriteRegForPeer)
                                                                                .addComponent(
                                                                                        labelWriteRegWidth)
                                                                                .addComponent(
                                                                                        labelWriteRegHeight)
                                                                                .addComponent(
                                                                                        labelWriteDistrMode))
                                                                        .addGap(118))
                                                                .addComponent(graphicONcheckBox2))))
                                        .addGap(211))
                                .addGroup(jPanelDefaultLayout.createSequentialGroup()
                                        .addComponent(jPanelSetButton, GroupLayout.PREFERRED_SIZE,
                                                GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                        .addContainerGap(23, Short.MAX_VALUE)));
                        jPanelDefaultLayout.setVerticalGroup(jPanelDefaultLayout
                                .createParallelGroup(Alignment.LEADING)
                                .addGroup(jPanelDefaultLayout.createSequentialGroup().addContainerGap()
                                        .addComponent(labelSimulationConfigSet, GroupLayout.PREFERRED_SIZE, 31,
                                                GroupLayout.PREFERRED_SIZE)
                                        .addGap(28)
                                        .addGroup(jPanelDefaultLayout.createParallelGroup(Alignment.TRAILING)
                                                .addGroup(jPanelDefaultLayout.createSequentialGroup()
                                                        .addComponent(labelRegionsResume)
                                                        .addPreferredGap(ComponentPlacement.RELATED)
                                                        .addComponent(labelNumOfPeerResume)
                                                        .addPreferredGap(ComponentPlacement.RELATED)
                                                        .addComponent(labelRegForPeerResume).addGap(6)
                                                        .addComponent(labelWidthRegion).addGap(6)
                                                        .addComponent(labelheightRegion)
                                                        .addPreferredGap(ComponentPlacement.RELATED)
                                                        .addComponent(labelDistrMode))
                                                .addGroup(jPanelDefaultLayout.createSequentialGroup()
                                                        .addComponent(labelWriteReg)
                                                        .addPreferredGap(ComponentPlacement.RELATED)
                                                        .addComponent(labelWriteNumOfPeer)
                                                        .addPreferredGap(ComponentPlacement.RELATED)
                                                        .addComponent(labelWriteRegForPeer).addGap(6)
                                                        .addComponent(labelWriteRegWidth).addGap(6)
                                                        .addComponent(labelWriteRegHeight)
                                                        .addPreferredGap(ComponentPlacement.RELATED)
                                                        .addComponent(labelWriteDistrMode,
                                                                GroupLayout.PREFERRED_SIZE, 16,
                                                                GroupLayout.PREFERRED_SIZE)
                                                        .addGap(8)))
                                        .addPreferredGap(ComponentPlacement.UNRELATED)
                                        .addComponent(graphicONcheckBox2)
                                        .addPreferredGap(ComponentPlacement.RELATED, 82, Short.MAX_VALUE)
                                        .addComponent(jPanelSetButton, GroupLayout.PREFERRED_SIZE,
                                                GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)));
                        jPanelDefault.setLayout(jPanelDefaultLayout);
                    }
                    tabbedPane2.addTab("Default", jPanelDefault);

                    //======== jPanelSimulation ========

                    tabbedPane2.addTab("Simulation", jPanelSimulation);
                    //======== End jPanelSimulation ========
                    //======== jPanelAdvanced ========
                    {
                        jPanelAdvanced.setBorder(new EtchedBorder());

                        //======== jPanelAdvancedMain ========
                        {

                            //======== scrollPaneTree ========
                            {

                                //---- tree1 ----
                                tree1.setModel(new DefaultTreeModel(root));
                                DefaultTreeCellRenderer render = new DefaultTreeCellRenderer();

                                render.setOpenIcon(new ImageIcon("resources/image/network.png"));

                                render.setLeafIcon(new ImageIcon("esource/image/computer.gif"));

                                render.setClosedIcon(new ImageIcon("resources/image/network.png"));
                                tree1.setCellRenderer(render);
                                tree1.setRowHeight(25);
                                scrollPaneTree.setViewportView(tree1);
                                tree1.addTreeSelectionListener(new TreeSelectionListener() {

                                    @Override
                                    public void valueChanged(TreeSelectionEvent arg0) {
                                        if (arg0.getPath().getLastPathComponent().equals(root)) {
                                            jComboBoxNumRegionXPeer.setEnabled(true);
                                            advancedConfirmBut.setEnabled(true);
                                            graphicONcheckBox.setEnabled(true);
                                            total = Integer.parseInt(textFieldRows.getText())
                                                    * Integer.parseInt(textFieldColumns.getText()); //(Integer)jComboRegions.getSelectedItem();
                                            res = total;
                                            jComboBoxNumRegionXPeer.removeAllItems();
                                            for (int i = 1; i < res; i++)
                                                jComboBoxNumRegionXPeer.addItem(i);
                                        } else
                                            clickTreeListener();
                                    }
                                });

                            }

                            //======== peerInfoStatus ========
                            {
                                peerInfoStatus.setBorder(new TitledBorder("Settings"));
                                peerInfoStatus.setBackground(Color.lightGray);

                                //======== peerInfoStatus1 ========
                                {
                                    peerInfoStatus1.setBackground(Color.lightGray);
                                    peerInfoStatus1.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
                                    peerInfoStatus1.setBorder(null);

                                    //======== internalFrame1 ========
                                    {
                                        internalFrame1.setVisible(true);
                                        Container internalFrame1ContentPane = internalFrame1.getContentPane();

                                        //======== scrollPane1 ========
                                        {

                                            //---- label8 ----
                                            architectureLabel.setText("Architecture Information");
                                            scrollPane1.setViewportView(architectureLabel);
                                        }

                                        GroupLayout internalFrame1ContentPaneLayout = new GroupLayout(
                                                internalFrame1ContentPane);
                                        internalFrame1ContentPane.setLayout(internalFrame1ContentPaneLayout);
                                        internalFrame1ContentPaneLayout.setHorizontalGroup(
                                                internalFrame1ContentPaneLayout.createParallelGroup()
                                                        .addGroup(internalFrame1ContentPaneLayout
                                                                .createSequentialGroup().addContainerGap()
                                                                .addComponent(scrollPane1,
                                                                        GroupLayout.DEFAULT_SIZE, 0,
                                                                        Short.MAX_VALUE)
                                                                .addContainerGap()));
                                        internalFrame1ContentPaneLayout.setVerticalGroup(
                                                internalFrame1ContentPaneLayout.createParallelGroup()
                                                        .addGroup(internalFrame1ContentPaneLayout
                                                                .createSequentialGroup().addContainerGap()
                                                                .addComponent(scrollPane1,
                                                                        GroupLayout.DEFAULT_SIZE, 0,
                                                                        Short.MAX_VALUE)
                                                                .addContainerGap()));
                                    }
                                    peerInfoStatus1.add(internalFrame1, JLayeredPane.DEFAULT_LAYER);
                                    internalFrame1.setBounds(15, 0, 365, 160);
                                }

                                //---- graphicONcheckBox ----
                                graphicONcheckBox.setText("Graphic ON");

                                //---- advancedConfirmBut ----
                                advancedConfirmBut.setIcon(new ImageIcon("resources/image/ok.png"));

                                GroupLayout peerInfoStatusLayout = new GroupLayout(peerInfoStatus);
                                peerInfoStatus.setLayout(peerInfoStatusLayout);
                                peerInfoStatusLayout.setHorizontalGroup(peerInfoStatusLayout
                                        .createParallelGroup()
                                        .addGroup(peerInfoStatusLayout.createSequentialGroup()
                                                .addGroup(peerInfoStatusLayout.createParallelGroup()
                                                        .addGroup(peerInfoStatusLayout.createSequentialGroup()
                                                                .addGap(26, 26, 26)
                                                                .addComponent(graphicONcheckBox)
                                                                .addGap(73, 73, 73)
                                                                .addComponent(jComboBoxNumRegionXPeer,
                                                                        GroupLayout.PREFERRED_SIZE,
                                                                        GroupLayout.DEFAULT_SIZE,
                                                                        GroupLayout.PREFERRED_SIZE)
                                                                .addGap(80, 80, 80)
                                                                .addComponent(advancedConfirmBut,
                                                                        GroupLayout.PREFERRED_SIZE, 33,
                                                                        GroupLayout.PREFERRED_SIZE))
                                                        .addGroup(peerInfoStatusLayout.createSequentialGroup()
                                                                .addContainerGap().addComponent(peerInfoStatus1,
                                                                        GroupLayout.DEFAULT_SIZE, 387,
                                                                        Short.MAX_VALUE)))
                                                .addContainerGap()));
                                peerInfoStatusLayout.setVerticalGroup(peerInfoStatusLayout.createParallelGroup()
                                        .addGroup(peerInfoStatusLayout.createSequentialGroup()
                                                .addComponent(peerInfoStatus1, GroupLayout.PREFERRED_SIZE, 175,
                                                        GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                                                .addGroup(peerInfoStatusLayout
                                                        .createParallelGroup(GroupLayout.Alignment.TRAILING)
                                                        .addGroup(GroupLayout.Alignment.LEADING,
                                                                peerInfoStatusLayout
                                                                        .createParallelGroup(
                                                                                GroupLayout.Alignment.BASELINE)
                                                                        .addComponent(graphicONcheckBox)
                                                                        .addComponent(jComboBoxNumRegionXPeer,
                                                                                GroupLayout.PREFERRED_SIZE,
                                                                                GroupLayout.DEFAULT_SIZE,
                                                                                GroupLayout.PREFERRED_SIZE))
                                                        .addComponent(advancedConfirmBut,
                                                                GroupLayout.Alignment.LEADING,
                                                                GroupLayout.PREFERRED_SIZE, 28,
                                                                GroupLayout.PREFERRED_SIZE))
                                                .addContainerGap(16, Short.MAX_VALUE)));
                            }

                            GroupLayout jPanelAdvancedMainLayout = new GroupLayout(jPanelAdvancedMain);
                            jPanelAdvancedMain.setLayout(jPanelAdvancedMainLayout);
                            jPanelAdvancedMainLayout.setHorizontalGroup(jPanelAdvancedMainLayout
                                    .createParallelGroup()
                                    .addGroup(jPanelAdvancedMainLayout.createSequentialGroup().addContainerGap()
                                            .addComponent(scrollPaneTree, GroupLayout.PREFERRED_SIZE, 207,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                                            .addComponent(peerInfoStatus, GroupLayout.DEFAULT_SIZE,
                                                    GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addContainerGap()));
                            jPanelAdvancedMainLayout.setVerticalGroup(jPanelAdvancedMainLayout
                                    .createParallelGroup()
                                    .addGroup(GroupLayout.Alignment.TRAILING, jPanelAdvancedMainLayout
                                            .createSequentialGroup().addContainerGap()
                                            .addGroup(jPanelAdvancedMainLayout
                                                    .createParallelGroup(GroupLayout.Alignment.TRAILING)
                                                    .addComponent(peerInfoStatus, GroupLayout.Alignment.LEADING,
                                                            GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
                                                            Short.MAX_VALUE)
                                                    .addComponent(scrollPaneTree, GroupLayout.Alignment.LEADING,
                                                            GroupLayout.DEFAULT_SIZE, 255, Short.MAX_VALUE))
                                            .addContainerGap()));
                        }

                        //======== jPanelSetButton2 ========
                        {

                            //---- buttonSetConfigDefault2 ----
                            buttonSetConfigDefault2.setText("Set");

                            GroupLayout jPanelSetButton2Layout = new GroupLayout(jPanelSetButton2);
                            jPanelSetButton2.setLayout(jPanelSetButton2Layout);
                            jPanelSetButton2Layout.setHorizontalGroup(jPanelSetButton2Layout
                                    .createParallelGroup().addGroup(GroupLayout.Alignment.TRAILING,
                                            jPanelSetButton2Layout.createSequentialGroup()
                                                    .addContainerGap(522, Short.MAX_VALUE)
                                                    .addComponent(buttonSetConfigDefault2,
                                                            GroupLayout.PREFERRED_SIZE, 76,
                                                            GroupLayout.PREFERRED_SIZE)
                                                    .addGap(72, 72, 72)));
                            jPanelSetButton2Layout.setVerticalGroup(jPanelSetButton2Layout.createParallelGroup()
                                    .addGroup(GroupLayout.Alignment.TRAILING,
                                            jPanelSetButton2Layout.createSequentialGroup()
                                                    .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                    .addComponent(buttonSetConfigDefault2).addContainerGap()));
                        }

                        GroupLayout jPanelAdvancedLayout = new GroupLayout(jPanelAdvanced);
                        jPanelAdvancedLayout.setHorizontalGroup(jPanelAdvancedLayout
                                .createParallelGroup(Alignment.LEADING)
                                .addGroup(jPanelAdvancedLayout.createSequentialGroup()
                                        .addGroup(jPanelAdvancedLayout.createParallelGroup(Alignment.LEADING)
                                                .addComponent(jPanelAdvancedMain, GroupLayout.DEFAULT_SIZE, 689,
                                                        Short.MAX_VALUE)
                                                .addComponent(jPanelSetButton2, GroupLayout.PREFERRED_SIZE, 681,
                                                        GroupLayout.PREFERRED_SIZE))
                                        .addContainerGap()));
                        jPanelAdvancedLayout.setVerticalGroup(jPanelAdvancedLayout
                                .createParallelGroup(Alignment.TRAILING)
                                .addGroup(jPanelAdvancedLayout.createSequentialGroup().addContainerGap()
                                        .addComponent(jPanelAdvancedMain, GroupLayout.PREFERRED_SIZE,
                                                GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                        .addGap(18).addComponent(jPanelSetButton2, GroupLayout.PREFERRED_SIZE,
                                                GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)));
                        jPanelAdvanced.setLayout(jPanelAdvancedLayout);
                    }
                    tabbedPane2.addTab("Advanced", jPanelAdvanced);

                }

                //======== panelConsole ========
                {

                    //======== scrollPane3 ========
                    {

                        //---- textField1 ----
                        notifyArea.setEditable(false);
                        DefaultCaret caret = (DefaultCaret) notifyArea.getCaret();
                        caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
                        scrollPane3.setViewportView(notifyArea);
                    }

                    GroupLayout panelConsoleLayout = new GroupLayout(panelConsole);
                    panelConsole.setLayout(panelConsoleLayout);
                    panelConsoleLayout.setHorizontalGroup(panelConsoleLayout.createParallelGroup()
                            .addGroup(panelConsoleLayout.createParallelGroup()
                                    .addGroup(panelConsoleLayout.createSequentialGroup()
                                            .addGap(0, 0, Short.MAX_VALUE)
                                            .addComponent(scrollPane3, GroupLayout.PREFERRED_SIZE, 679,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addGap(0, 0, Short.MAX_VALUE)))
                            .addGap(0, 679, Short.MAX_VALUE));
                    panelConsoleLayout.setVerticalGroup(panelConsoleLayout.createParallelGroup()
                            .addGroup(panelConsoleLayout.createParallelGroup()
                                    .addGroup(panelConsoleLayout.createSequentialGroup()
                                            .addGap(0, 0, Short.MAX_VALUE)
                                            .addComponent(scrollPane3, GroupLayout.PREFERRED_SIZE, 76,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addGap(0, 0, Short.MAX_VALUE)))
                            .addGap(0, 76, Short.MAX_VALUE));
                }

                GroupLayout jPanelContainerTabbedPaneLayout = new GroupLayout(jPanelContainerTabbedPane);
                jPanelContainerTabbedPaneLayout.setHorizontalGroup(jPanelContainerTabbedPaneLayout
                        .createParallelGroup(Alignment.LEADING)
                        .addGroup(jPanelContainerTabbedPaneLayout.createSequentialGroup().addContainerGap()
                                .addGroup(jPanelContainerTabbedPaneLayout.createParallelGroup(Alignment.LEADING)
                                        .addComponent(tabbedPane2, GroupLayout.PREFERRED_SIZE, 686,
                                                GroupLayout.PREFERRED_SIZE)
                                        .addComponent(panelConsole, GroupLayout.DEFAULT_SIZE, 708,
                                                Short.MAX_VALUE))
                                .addContainerGap()));
                jPanelContainerTabbedPaneLayout.setVerticalGroup(jPanelContainerTabbedPaneLayout
                        .createParallelGroup(Alignment.LEADING)
                        .addGroup(jPanelContainerTabbedPaneLayout.createSequentialGroup().addGap(3)
                                .addComponent(tabbedPane2, GroupLayout.PREFERRED_SIZE, 384,
                                        GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(ComponentPlacement.RELATED)
                                .addComponent(panelConsole, GroupLayout.DEFAULT_SIZE, 87, Short.MAX_VALUE)));
                jPanelContainerTabbedPane.setLayout(jPanelContainerTabbedPaneLayout);
            }
            {
                jPanelDeploying = new JPanel();
                tabbedPane2.addTab("Simulation Jar", null, jPanelDeploying, null);
                GroupLayout jPanelDeployingLayout = new GroupLayout(jPanelDeploying);
                jPanelDeploying.setLayout(jPanelDeployingLayout);
                {
                    jButtonLoadJar = new JButton();
                    jButtonLoadJar.setText("Load Jar");
                    jButtonLoadJar.addActionListener(new ActionListener() {
                        @Override
                        public void actionPerformed(ActionEvent evt) {

                            if (simulationFile != null) {

                                File dest = new File(FTP_HOME + dirSeparator + SIMULATION_DIR + dirSeparator
                                        + simulationFile.getName());
                                try {
                                    FileUtils.copyFile(simulationFile, dest);

                                    Digester dg = new Digester(DigestAlgorithm.MD5);

                                    InputStream in = new FileInputStream(dest);

                                    Properties prop = new Properties();

                                    try {

                                        prop.setProperty("MD5", dg.getDigest(in));

                                        String fileName = FilenameUtils
                                                .removeExtension(simulationFile.getName());
                                        //save properties to project root folder
                                        prop.store(new FileOutputStream(FTP_HOME + dirSeparator + SIMULATION_DIR
                                                + dirSeparator + fileName + ".hash"), null);

                                    } catch (IOException ex) {
                                        ex.printStackTrace();
                                    }

                                    System.out.println("MD5: " + dg.getDigest(in));

                                    loadSimulation();
                                } catch (IOException e) {
                                    // TODO Auto-generated catch block
                                    e.printStackTrace();
                                }
                            }
                        }
                    });

                }

                jPanelDeployingLayout.setVerticalGroup(jPanelDeployingLayout.createSequentialGroup()
                        .addGap(22, 22, 22)
                        .addGroup(jPanelDeployingLayout.createParallelGroup().addGroup(
                                GroupLayout.Alignment.LEADING,
                                jPanelDeployingLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                        .addComponent(jButtonLoadJar, GroupLayout.Alignment.BASELINE,
                                                GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE,
                                                GroupLayout.PREFERRED_SIZE)
                                        .addComponent(getJTextFieldPathSimJar(), GroupLayout.Alignment.BASELINE,
                                                GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE,
                                                GroupLayout.PREFERRED_SIZE))
                                .addComponent(getJButtonChoseSimJar(), GroupLayout.Alignment.LEADING,
                                        GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE,
                                        GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 286,
                                GroupLayout.PREFERRED_SIZE));
                jPanelDeployingLayout
                        .setHorizontalGroup(jPanelDeployingLayout.createSequentialGroup().addGap(22, 22, 22)
                                .addComponent(getJTextFieldPathSimJar(), GroupLayout.PREFERRED_SIZE, 202,
                                        GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(getJButtonChoseSimJar(), GroupLayout.PREFERRED_SIZE, 27,
                                        GroupLayout.PREFERRED_SIZE)
                                .addGap(24)
                                .addComponent(jButtonLoadJar, GroupLayout.PREFERRED_SIZE, 146,
                                        GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 155, Short.MAX_VALUE));
            }

            jPanelRunBatchTests = new JPanel();
            tabbedPane2.addTab("Run batch tests", null, jPanelRunBatchTests, null);

            JLabel lblSelectConfigurationFile = new JLabel("Select configuration file:");

            textFieldConfigFilePath = new JTextField();
            textFieldConfigFilePath.setColumns(10);

            JButton buttonChooseConfigFile = new JButton();
            buttonChooseConfigFile.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent arg0) {

                    configFile = showFileChooser();
                    if (configFile != null)
                        textFieldConfigFilePath.setText(configFile.getAbsolutePath());
                }
            });
            buttonChooseConfigFile.setIcon(new ImageIcon("it/isislab/dmason/resources/image/openFolder.png"));

            JButton buttonLoadConfig = new JButton("Start");
            buttonLoadConfig.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {

                    try {
                        if (configFile.getName().contains(".xml")) {
                            ClassLoader.getSystemClassLoader();
                            //File xsd = new File(xsdFilename);
                            InputStream xsd = new FileInputStream("resources/batch/batchSchema.xsd");

                            if (xsd != null) {
                                if (validateXML(configFile, xsd)) {

                                    Batch batch = loadConfigFromXML(configFile);

                                    if (batch != null) {
                                        textAreaBatchInfo.append(configFile.getName() + " loaded.\n");
                                        if (batch.getNeededWorkers() > peers.size()
                                                || batch.getNeededWorkers() == 0)
                                            JOptionPane.showMessageDialog(DMasonMaster.this,
                                                    "There are not enough workers to start the simulation");
                                        else {
                                            textAreaBatchInfo
                                                    .append("Simulation: " + batch.getSimulationName() + "\n");
                                            textAreaBatchInfo.append(
                                                    "Needed Worker: " + batch.getNeededWorkers() + "\n");
                                            textAreaBatchInfo.append("Balance: " + batch.isBalanced() + "\n");

                                            Set<List<EntryParam<String, Object>>> testList = generateTestsFrom(
                                                    batch);

                                            textAreaBatchInfo
                                                    .append("--------------------------------------\n");
                                            textAreaBatchInfo
                                                    .append("Number of experiments: " + testList.size() + "\n");
                                            ConcurrentLinkedQueue<List<EntryParam<String, Object>>> testQueue = new ConcurrentLinkedQueue<List<EntryParam<String, Object>>>();

                                            for (List<EntryParam<String, Object>> test : testList)
                                                testQueue.offer(test);

                                            //System.out.println("Test queue: "+testQueue.size());

                                            try {

                                                List<List<EntryWorkerScore<Integer, String>>> workersPartition = Util
                                                        .chopped(scoreList, batch.getNeededWorkers());

                                                //System.out.println(workersPartition.toString());

                                                testCount.set(0);
                                                totalTests = testList.size();

                                                progressBarBatchTest.setValue(0);
                                                progressBarBatchTest.setString("0 %");
                                                progressBarBatchTest.setStringPainted(true);

                                                batchLogger = Logger
                                                        .getLogger(BatchExecutor.class.getCanonicalName());
                                                batchStartedTime = System.currentTimeMillis();

                                                textAreaBatchInfo.append("Batch started at: "
                                                        + Util.getCurrentDateTime(batchStartedTime) + "\n");
                                                textAreaBatchInfo
                                                        .append("--------------------------------------\n");
                                                batchLogger.debug("Started at: " + batchStartedTime);
                                                int i = 1;
                                                BatchExecutor batchExec;
                                                for (List<EntryWorkerScore<Integer, String>> workers : workersPartition) {
                                                    try {

                                                        batchExec = new BatchExecutor(batch.getSimulationName(),
                                                                batch.isBalanced(), testQueue, master,
                                                                connection, root.getChildCount(),
                                                                getFPTAddress(), workers, "Batch" + i, 1,
                                                                textAreaBatchInfo);

                                                        batchExec.getObservable()
                                                                .addObserver(DMasonMaster.this);
                                                        batchExec.start();

                                                        //Thread.sleep(2000);
                                                        //textAreaBatchInfo.append("Batch Executor "+i+" started\n");

                                                        i++;

                                                        //not paraller simulation, I use only one batch executor
                                                        if (!chckbxParallelBatch.isSelected())
                                                            break;
                                                    } catch (Exception e1) {
                                                        // TODO Auto-generated catch block
                                                        e1.printStackTrace();
                                                    }

                                                }

                                            } catch (Exception e3) {
                                                // TODO Auto-generated catch block
                                                e3.printStackTrace();
                                            }

                                        }

                                    } else
                                        JOptionPane.showMessageDialog(DMasonMaster.this,
                                                "Error when loading config file");
                                } else
                                    JOptionPane.showMessageDialog(DMasonMaster.this,
                                            "The configuration file is not a valid file");
                            } else
                                JOptionPane.showMessageDialog(DMasonMaster.this,
                                        xsdFilename + " not exists, can't validate configuration file.");
                        } else
                            JOptionPane.showMessageDialog(DMasonMaster.this,
                                    "The file " + configFile.getName() + "is not a configuration file.");
                    } catch (HeadlessException e1) {
                        // TODO Auto-generated catch block
                        e1.printStackTrace();
                    } catch (IOException e1) {
                        // TODO Auto-generated catch block
                        e1.printStackTrace();
                    }

                }

            });

            JPanel panel = new JPanel();
            panel.setBorder(
                    new TitledBorder(null, "Batch Status", TitledBorder.LEADING, TitledBorder.TOP, null, null));

            chckbxParallelBatch = new JCheckBox("Parallel Batch");

            GroupLayout gl_jPanelRunBatchTests = new GroupLayout(jPanelRunBatchTests);
            gl_jPanelRunBatchTests.setHorizontalGroup(gl_jPanelRunBatchTests
                    .createParallelGroup(Alignment.LEADING)
                    .addGroup(gl_jPanelRunBatchTests.createSequentialGroup().addContainerGap()
                            .addGroup(gl_jPanelRunBatchTests.createParallelGroup(Alignment.LEADING)
                                    .addGroup(gl_jPanelRunBatchTests.createSequentialGroup()
                                            .addComponent(lblSelectConfigurationFile,
                                                    GroupLayout.PREFERRED_SIZE, 139, GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(ComponentPlacement.RELATED)
                                            .addComponent(textFieldConfigFilePath, GroupLayout.PREFERRED_SIZE,
                                                    250, GroupLayout.PREFERRED_SIZE)
                                            .addGap(10).addComponent(buttonChooseConfigFile,
                                                    GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE))
                                    .addGroup(gl_jPanelRunBatchTests.createSequentialGroup()
                                            .addComponent(chckbxParallelBatch).addGap(18)
                                            .addComponent(buttonLoadConfig))
                                    .addComponent(panel, GroupLayout.PREFERRED_SIZE, 666,
                                            GroupLayout.PREFERRED_SIZE))
                            .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
            gl_jPanelRunBatchTests.setVerticalGroup(gl_jPanelRunBatchTests
                    .createParallelGroup(Alignment.LEADING)
                    .addGroup(gl_jPanelRunBatchTests.createSequentialGroup().addContainerGap()
                            .addGroup(gl_jPanelRunBatchTests.createParallelGroup(Alignment.TRAILING)
                                    .addComponent(buttonChooseConfigFile, GroupLayout.PREFERRED_SIZE, 25,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(textFieldConfigFilePath, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblSelectConfigurationFile))
                            .addPreferredGap(ComponentPlacement.UNRELATED)
                            .addGroup(gl_jPanelRunBatchTests.createParallelGroup(Alignment.BASELINE)
                                    .addComponent(chckbxParallelBatch).addComponent(buttonLoadConfig))
                            .addPreferredGap(ComponentPlacement.RELATED, 14, Short.MAX_VALUE)
                            .addComponent(panel, GroupLayout.PREFERRED_SIZE, 261, GroupLayout.PREFERRED_SIZE)
                            .addContainerGap()));

            progressBarBatchTest = new JProgressBar();

            JLabel lblProgress = new JLabel("Progress:");
            GroupLayout gl_panel = new GroupLayout(panel);
            gl_panel.setHorizontalGroup(gl_panel.createParallelGroup(Alignment.LEADING).addGroup(gl_panel
                    .createSequentialGroup().addContainerGap()
                    .addGroup(gl_panel.createParallelGroup(Alignment.LEADING)
                            .addComponent(scrollPane4, GroupLayout.DEFAULT_SIZE, 641, Short.MAX_VALUE)
                            .addGroup(gl_panel.createSequentialGroup().addComponent(lblProgress).addGap(18)
                                    .addComponent(progressBarBatchTest, GroupLayout.PREFERRED_SIZE, 169,
                                            GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap()));
            gl_panel.setVerticalGroup(gl_panel.createParallelGroup(Alignment.LEADING)
                    .addGroup(gl_panel.createSequentialGroup().addContainerGap()
                            .addGroup(gl_panel.createParallelGroup(Alignment.LEADING).addComponent(lblProgress)
                                    .addComponent(progressBarBatchTest, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(ComponentPlacement.RELATED)
                            .addComponent(scrollPane4, GroupLayout.PREFERRED_SIZE, 202,
                                    GroupLayout.PREFERRED_SIZE)
                            .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
            panel.setLayout(gl_panel);
            jPanelRunBatchTests.setLayout(gl_jPanelRunBatchTests);
            GroupLayout jPanelSetDistributionLayout = new GroupLayout(jPanelSetDistribution);
            jPanelSetDistributionLayout
                    .setHorizontalGroup(
                            jPanelSetDistributionLayout.createParallelGroup(Alignment.LEADING)
                                    .addGroup(jPanelSetDistributionLayout.createSequentialGroup()
                                            .addComponent(jPanelSettings, GroupLayout.PREFERRED_SIZE, 254,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(ComponentPlacement.RELATED)
                                            .addComponent(jPanelContainerTabbedPane, GroupLayout.PREFERRED_SIZE,
                                                    707, GroupLayout.PREFERRED_SIZE)
                                            .addContainerGap(21, Short.MAX_VALUE)));
            jPanelSetDistributionLayout.setVerticalGroup(jPanelSetDistributionLayout
                    .createParallelGroup(Alignment.LEADING)
                    .addGroup(jPanelSetDistributionLayout.createSequentialGroup()
                            .addGroup(jPanelSetDistributionLayout.createParallelGroup(Alignment.LEADING)
                                    .addComponent(jPanelSettings, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jPanelContainerTabbedPane, GroupLayout.DEFAULT_SIZE,
                                            GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addContainerGap()));
            jPanelSetDistribution.setLayout(jPanelSetDistributionLayout);
        }

        textAreaBatchInfo = new JTextArea();
        textAreaBatchInfo.setEditable(false);
        DefaultCaret caret = (DefaultCaret) textAreaBatchInfo.getCaret();
        caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
        scrollPane4.setViewportView(textAreaBatchInfo);

        //---- jLabelPlayButton ----
        jLabelPlayButton.setIcon(new ImageIcon("resources/image/NotStopped.png"));

        //---- jLabelPauseButton ----
        jLabelPauseButton.setIcon(new ImageIcon("resources/image/PauseOff.png"));

        //---- labelStopButton ----
        jLabelPlayButton.setIcon(new ImageIcon("image/NotPlaying.png"));

        jLabelPlayButton.addMouseListener(new MouseListener() {

            @Override
            public void mouseReleased(MouseEvent arg0) {
            }

            @Override
            public void mousePressed(MouseEvent arg0) {
            }

            @Override
            public void mouseExited(MouseEvent arg0) {
            }

            @Override
            public void mouseEntered(MouseEvent arg0) {
            }

            @Override
            public void mouseClicked(MouseEvent arg0) {

                jLabelPlayButton.setIcon(new ImageIcon("resources/image/Playing.png"));
                jLabelPauseButton.setIcon(new ImageIcon("resources/image/PauseOff.png"));
                jLabelStopButton.setIcon(new ImageIcon("resources/image/NotStopped.png"));
                jLabelResetButton.setIcon(new ImageIcon("resources/image/NotReload.png"));
                try {

                    master.play();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });

        //---- labelStopButton2 ----   
        jLabelStopButton.setIcon(new ImageIcon("resources/image/NotStopped.png"));
        jLabelStopButton.addMouseListener(new MouseListener() {

            @Override
            public void mouseReleased(MouseEvent e) {
            }

            @Override
            public void mousePressed(MouseEvent e) {
            }

            @Override
            public void mouseExited(MouseEvent e) {
            }

            @Override
            public void mouseEntered(MouseEvent e) {
            }

            @Override
            public void mouseClicked(MouseEvent e) {
                jLabelStopButton.setIcon(new ImageIcon("resources/image/Stopped.png"));
                jLabelPlayButton.setIcon(new ImageIcon("resources/image/NotPlaying.png"));
                jLabelPauseButton.setIcon(new ImageIcon("resources/image/PauseOff.png"));

                try {

                    Address FTPAddress = getFPTAddress();

                    if (FTPAddress != null) {
                        UpdateData ud = new UpdateData("", FTPAddress);
                        master.stop(ud);
                    }

                } catch (Exception e1) {
                    e1.printStackTrace();
                }
            }
        });

        //---- labelPauseButton ----
        jLabelPauseButton.setIcon(new ImageIcon("resources/image/PauseOff.png"));
        jLabelPauseButton.addMouseListener(new MouseListener() {

            @Override
            public void mouseReleased(MouseEvent e) {
            }

            @Override
            public void mousePressed(MouseEvent e) {
            }

            @Override
            public void mouseExited(MouseEvent e) {
            }

            @Override
            public void mouseEntered(MouseEvent e) {
            }

            @Override
            public void mouseClicked(MouseEvent e) {
                jLabelPauseButton.setIcon(new ImageIcon("resources/image/PauseOn.png"));
                jLabelStopButton.setIcon(new ImageIcon("resources/image/NotStopped.png"));
                jLabelPlayButton.setIcon(new ImageIcon("resources/image/NotPlaying.png"));
                try {
                    master.pause();
                } catch (Exception e1) {
                    e1.printStackTrace();
                }
            }
        });

        //======== jPanelNumStep ========
        {

            GroupLayout jPanelNumStepLayout = new GroupLayout(jPanelNumStep);
            jPanelNumStepLayout.setHorizontalGroup(
                    jPanelNumStepLayout.createParallelGroup(Alignment.TRAILING).addGap(0, 25, Short.MAX_VALUE));
            jPanelNumStepLayout.setVerticalGroup(
                    jPanelNumStepLayout.createParallelGroup(Alignment.LEADING).addGap(0, 28, Short.MAX_VALUE));
            jPanelNumStep.setLayout(jPanelNumStepLayout);
            jPanelNumStep.setPreferredSize(new java.awt.Dimension(89, 23));
        }
        {
            jLabelResetButton = new JLabel();
            jLabelResetButton.setIcon(new ImageIcon("resources/image/NotReload.png"));
            jLabelResetButton.setPreferredSize(new java.awt.Dimension(20, 20));

            jLabelResetButton.setVisible(enableReset);
        }

        // for resetting simulation
        jLabelResetButton.addMouseListener(new MouseListener() {

            @Override
            public void mouseClicked(MouseEvent arg0) {

                if (connected) {
                    jLabelStopButton.setIcon(new ImageIcon("resources/image/NotStopped.png"));
                    jLabelPlayButton.setIcon(new ImageIcon("resources/image/NotPlaying.png"));
                    jLabelPauseButton.setIcon(new ImageIcon("resources/image/PauseOff.png"));
                    jLabelResetButton.setIcon(new ImageIcon("resources/image/Reload.png"));

                    //send message to workers for resetting simulation
                    try {
                        master.reset();

                    } catch (Exception e1) {
                        e1.printStackTrace();
                    }

                    //clean up topic from AcitveMQ
                    connection.resetTopic();

                    setSystemSettingsEnabled(true);

                    notifyArea.append("Simulation resetted\n");

                }

            }

            @Override
            public void mouseEntered(MouseEvent arg0) {
                // TODO Auto-generated method stub

            }

            @Override
            public void mouseExited(MouseEvent arg0) {
                // TODO Auto-generated method stub

            }

            @Override
            public void mousePressed(MouseEvent arg0) {
                // TODO Auto-generated method stub

            }

            @Override
            public void mouseReleased(MouseEvent arg0) {
                // TODO Auto-generated method stub

            }
        });
        writeStepLabel = new JLabel();
        writeStepLabel.setText("0");

        lblTotalSteps = new JLabel("Steps:");

        GroupLayout panelMainLayout = new GroupLayout(panelMain);
        panelMainLayout.setHorizontalGroup(panelMainLayout.createParallelGroup(Alignment.LEADING)
                .addGroup(panelMainLayout.createSequentialGroup()
                        .addComponent(jPanelContainerSettings, GroupLayout.PREFERRED_SIZE, 0,
                                GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(ComponentPlacement.RELATED)
                        .addGroup(panelMainLayout.createParallelGroup(Alignment.LEADING)
                                .addComponent(jPanelSetDistribution, 0, 986, Short.MAX_VALUE)
                                .addGroup(panelMainLayout.createSequentialGroup().addGap(636)
                                        .addGroup(panelMainLayout.createParallelGroup(Alignment.TRAILING)
                                                .addComponent(jLabelStep, GroupLayout.PREFERRED_SIZE,
                                                        GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
                                                .addGroup(panelMainLayout.createSequentialGroup()
                                                        .addComponent(lblTotalSteps)
                                                        .addPreferredGap(ComponentPlacement.UNRELATED)
                                                        .addComponent(writeStepLabel)))
                                        .addPreferredGap(ComponentPlacement.RELATED)
                                        .addComponent(jPanelNumStep, GroupLayout.PREFERRED_SIZE, 25,
                                                GroupLayout.PREFERRED_SIZE)
                                        .addGroup(panelMainLayout.createParallelGroup(Alignment.LEADING)
                                                .addGroup(panelMainLayout.createSequentialGroup().addGap(24)
                                                        .addComponent(jLabelPlayButton,
                                                                GroupLayout.PREFERRED_SIZE,
                                                                GroupLayout.PREFERRED_SIZE,
                                                                GroupLayout.PREFERRED_SIZE)
                                                        .addPreferredGap(ComponentPlacement.UNRELATED)
                                                        .addComponent(jLabelPauseButton,
                                                                GroupLayout.PREFERRED_SIZE,
                                                                GroupLayout.PREFERRED_SIZE,
                                                                GroupLayout.PREFERRED_SIZE)
                                                        .addPreferredGap(ComponentPlacement.UNRELATED)
                                                        .addComponent(jLabelStopButton,
                                                                GroupLayout.PREFERRED_SIZE,
                                                                GroupLayout.PREFERRED_SIZE,
                                                                GroupLayout.PREFERRED_SIZE))
                                                .addGroup(panelMainLayout.createSequentialGroup().addGap(116)
                                                        .addComponent(jLabelResetButton,
                                                                GroupLayout.PREFERRED_SIZE, 30,
                                                                GroupLayout.PREFERRED_SIZE)))))
                        .addGap(12))
                .addComponent(jPanelContainerConnection, 0, 1004, Short.MAX_VALUE));
        panelMainLayout.setVerticalGroup(panelMainLayout.createParallelGroup(Alignment.LEADING)
                .addGroup(panelMainLayout.createSequentialGroup()
                        .addComponent(jPanelContainerConnection, GroupLayout.PREFERRED_SIZE, 71,
                                GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(ComponentPlacement.RELATED)
                        .addGroup(panelMainLayout.createParallelGroup(Alignment.LEADING)
                                .addComponent(jPanelSetDistribution, GroupLayout.PREFERRED_SIZE, 518,
                                        GroupLayout.PREFERRED_SIZE)
                                .addGroup(panelMainLayout.createSequentialGroup().addGap(29).addComponent(
                                        jPanelContainerSettings, GroupLayout.PREFERRED_SIZE, 489,
                                        GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(ComponentPlacement.RELATED)
                        .addGroup(panelMainLayout.createParallelGroup(Alignment.LEADING)
                                .addComponent(jLabelStopButton, GroupLayout.PREFERRED_SIZE,
                                        GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabelPlayButton, GroupLayout.PREFERRED_SIZE,
                                        GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabelPauseButton, GroupLayout.PREFERRED_SIZE,
                                        GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabelResetButton, GroupLayout.PREFERRED_SIZE, 24,
                                        GroupLayout.PREFERRED_SIZE)
                                .addGroup(panelMainLayout.createParallelGroup(Alignment.BASELINE)
                                        .addComponent(writeStepLabel, GroupLayout.PREFERRED_SIZE, 16,
                                                GroupLayout.PREFERRED_SIZE)
                                        .addComponent(lblTotalSteps))
                                .addGroup(panelMainLayout.createSequentialGroup()
                                        .addComponent(jLabelStep, GroupLayout.PREFERRED_SIZE,
                                                GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(ComponentPlacement.RELATED).addComponent(jPanelNumStep,
                                                GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE)))
                        .addContainerGap(13, Short.MAX_VALUE)));
        panelMain.setLayout(panelMainLayout);
    }

    GroupLayout contentPaneLayout = new GroupLayout(contentPane);
    contentPaneLayout.setHorizontalGroup(
            contentPaneLayout.createParallelGroup(Alignment.LEADING).addGroup(Alignment.TRAILING,
                    contentPaneLayout
                            .createSequentialGroup().addContainerGap().addComponent(panelMain,
                                    GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addContainerGap()));
    contentPaneLayout.setVerticalGroup(
            contentPaneLayout.createParallelGroup(Alignment.LEADING).addGroup(Alignment.TRAILING,
                    contentPaneLayout.createSequentialGroup().addContainerGap().addComponent(panelMain,
                            GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    contentPane.setLayout(contentPaneLayout);
    pack();
    setLocationRelativeTo(null);

    refreshServerLabel.setVisible(false);

    jButtonChoseSimJar.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            simulationFile = showFileChooser();
            if (simulationFile != null)
                jTextFieldPathSimJar.setText(simulationFile.getAbsolutePath());
        }
    });

}

From source file:op.care.nursingprocess.PnlEval.java

/**
 * This method is called from within the constructor to
 * initialize the form.// w  ww.java 2  s  .c  o m
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the PrinterForm Editor.
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
    pnlReason = new JPanel();
    jScrollPane1 = new JScrollPane();
    txtBemerkung = new JTextArea();
    panel2 = new JPanel();
    lblNextEval = new JLabel();
    jdcNextEval = new JDateChooser();
    panel1 = new JPanel();
    btnOK = new JButton();

    //======== this ========
    setLayout(new FormLayout("default, default:grow, $lcgap, default",
            "default, $lgap, fill:default:grow, 3*($lgap, default)"));

    //======== pnlReason ========
    {
        pnlReason.setBorder(new TitledBorder(null, "text", TitledBorder.LEADING, TitledBorder.DEFAULT_POSITION,
                new Font("Arial", Font.PLAIN, 14)));
        pnlReason.setFont(new Font("Arial", Font.PLAIN, 14));
        pnlReason.setLayout(new BoxLayout(pnlReason, BoxLayout.X_AXIS));

        //======== jScrollPane1 ========
        {

            //---- txtBemerkung ----
            txtBemerkung.setColumns(20);
            txtBemerkung.setRows(5);
            txtBemerkung.setFont(new Font("Arial", Font.PLAIN, 14));
            jScrollPane1.setViewportView(txtBemerkung);
        }
        pnlReason.add(jScrollPane1);
    }
    add(pnlReason, CC.xy(2, 3, CC.FILL, CC.FILL));

    //======== panel2 ========
    {
        panel2.setLayout(new BoxLayout(panel2, BoxLayout.X_AXIS));

        //---- lblNextEval ----
        lblNextEval.setText("text ");
        lblNextEval.setFont(new Font("Arial", Font.PLAIN, 14));
        panel2.add(lblNextEval);

        //---- jdcNextEval ----
        jdcNextEval.setFont(new Font("Arial", Font.PLAIN, 14));
        panel2.add(jdcNextEval);
    }
    add(panel2, CC.xy(2, 5, CC.FILL, CC.DEFAULT));

    //======== panel1 ========
    {
        panel1.setLayout(new BoxLayout(panel1, BoxLayout.X_AXIS));

        //---- btnOK ----
        btnOK.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/apply.png")));
        btnOK.setText(null);
        btnOK.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                btnOKActionPerformed(e);
            }
        });
        panel1.add(btnOK);
    }
    add(panel1, CC.xy(2, 7, CC.RIGHT, CC.DEFAULT));
}

From source file:op.care.nursingprocess.PnlSchedule.java

/**
 * This method is called from within the constructor to
 * initialize the form./*ww w  .  j a va  2 s .  c o  m*/
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the PrinterForm Editor.
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
    panelMain = new JPanel();
    splitRegular = new JSplitPane();
    pnlTageszeit = new JPanel();
    jLabel6 = new JideLabel();
    jLabel1 = new JideLabel();
    jLabel2 = new JideLabel();
    jLabel11 = new JideLabel();
    jLabel3 = new JideLabel();
    jLabel4 = new JideLabel();
    txtNachtMo = new JTextField();
    txtMorgens = new JTextField();
    txtMittags = new JTextField();
    txtNachmittags = new JTextField();
    txtAbends = new JTextField();
    txtNachtAb = new JTextField();
    btnToTime = new JButton();
    pnlUhrzeit = new JPanel();
    lblUhrzeit = new JideLabel();
    btnToTimeOfDay = new JButton();
    txtUhrzeit = new JTextField();
    cmbUhrzeit = new JComboBox();
    tabWdh = new JideTabbedPane();
    pnlDaily = new JPanel();
    label3 = new JLabel();
    spinTaeglich = new JSpinner();
    jLabel7 = new JLabel();
    btnJedenTag = new JButton();
    pnlWeekly = new JPanel();
    panel3 = new JPanel();
    btnJedeWoche = new JButton();
    label2 = new JLabel();
    spinWoche = new JSpinner();
    jLabel8 = new JLabel();
    lblUhrzeit2 = new JideLabel();
    lblUhrzeit3 = new JideLabel();
    lblUhrzeit4 = new JideLabel();
    lblUhrzeit5 = new JideLabel();
    lblUhrzeit6 = new JideLabel();
    lblUhrzeit7 = new JideLabel();
    lblUhrzeit8 = new JideLabel();
    cbMon = new JCheckBox();
    cbDie = new JCheckBox();
    cbMit = new JCheckBox();
    cbDon = new JCheckBox();
    cbFre = new JCheckBox();
    cbSam = new JCheckBox();
    cbSon = new JCheckBox();
    pnlMonthly = new JPanel();
    label4 = new JLabel();
    spinMonat = new JSpinner();
    label6 = new JLabel();
    btnJedenMonat = new JButton();
    label5 = new JLabel();
    spinMonatTag = new JSpinner();
    cmbTag = new JComboBox<>();
    panel2 = new JPanel();
    jLabel13 = new JLabel();
    txtLDate = new JTextField();
    lblMinutes = new JLabel();
    txtMinutes = new JTextField();
    pnlBemerkung = new JPanel();
    jScrollPane1 = new JScrollPane();
    txtBemerkung = new JTextArea();
    btnSave = new JButton();

    //======== this ========
    setLayout(new BorderLayout());

    //======== panelMain ========
    {
        panelMain.setBorder(new LineBorder(Color.black, 2, true));
        panelMain.addComponentListener(new ComponentAdapter() {
            @Override
            public void componentResized(ComponentEvent e) {
                panelMainComponentResized(e);
            }
        });
        panelMain.setLayout(new FormLayout("$rgap, $lcgap, 223dlu:grow, $lcgap, $rgap",
                "$rgap, $lgap, pref, $lgap, default, $lgap, pref, $lgap, default, $lgap, 72dlu:grow, 2*($lgap, default)"));

        //======== splitRegular ========
        {
            splitRegular.setDividerSize(0);
            splitRegular.setEnabled(false);
            splitRegular.setDividerLocation(150);
            splitRegular.setDoubleBuffered(true);

            //======== pnlTageszeit ========
            {
                pnlTageszeit.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlTageszeit.setBorder(new EtchedBorder());
                pnlTageszeit.setLayout(
                        new FormLayout("6*(28dlu, $lcgap), default", "fill:default, $lgap, fill:default"));

                //---- jLabel6 ----
                jLabel6.setText("Nachts, fr\u00fch morgens");
                jLabel6.setOrientation(1);
                jLabel6.setFont(new Font("Arial", Font.PLAIN, 14));
                jLabel6.setClockwise(false);
                jLabel6.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlTageszeit.add(jLabel6, CC.xy(1, 1));

                //---- jLabel1 ----
                jLabel1.setForeground(new Color(0, 0, 204));
                jLabel1.setText("Morgens");
                jLabel1.setOrientation(1);
                jLabel1.setFont(new Font("Arial", Font.PLAIN, 14));
                jLabel1.setClockwise(false);
                jLabel1.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlTageszeit.add(jLabel1, CC.xy(3, 1));

                //---- jLabel2 ----
                jLabel2.setForeground(new Color(255, 102, 0));
                jLabel2.setText("Mittags");
                jLabel2.setOrientation(1);
                jLabel2.setFont(new Font("Arial", Font.PLAIN, 14));
                jLabel2.setClockwise(false);
                jLabel2.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlTageszeit.add(jLabel2, CC.xy(5, 1));

                //---- jLabel11 ----
                jLabel11.setForeground(new Color(0, 153, 51));
                jLabel11.setText("Nachmittag");
                jLabel11.setOrientation(1);
                jLabel11.setFont(new Font("Arial", Font.PLAIN, 14));
                jLabel11.setClockwise(false);
                jLabel11.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlTageszeit.add(jLabel11, CC.xy(7, 1));

                //---- jLabel3 ----
                jLabel3.setForeground(new Color(255, 0, 51));
                jLabel3.setText("Abends");
                jLabel3.setOrientation(1);
                jLabel3.setFont(new Font("Arial", Font.PLAIN, 14));
                jLabel3.setClockwise(false);
                jLabel3.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlTageszeit.add(jLabel3, CC.xy(9, 1));

                //---- jLabel4 ----
                jLabel4.setText("Nacht, sp\u00e4t abends");
                jLabel4.setOrientation(1);
                jLabel4.setFont(new Font("Arial", Font.PLAIN, 14));
                jLabel4.setClockwise(false);
                jLabel4.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlTageszeit.add(jLabel4, CC.xy(11, 1));

                //---- txtNachtMo ----
                txtNachtMo.setHorizontalAlignment(SwingConstants.RIGHT);
                txtNachtMo.setText("0.0");
                txtNachtMo.setFont(new Font("Arial", Font.PLAIN, 14));
                txtNachtMo.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        txtNachtMoActionPerformed(e);
                    }
                });
                txtNachtMo.addFocusListener(new FocusAdapter() {
                    @Override
                    public void focusGained(FocusEvent e) {
                        txtFocusGained(e);
                    }

                    @Override
                    public void focusLost(FocusEvent e) {
                        txtIntegerFocusLost(e);
                    }
                });
                pnlTageszeit.add(txtNachtMo, CC.xy(1, 3));

                //---- txtMorgens ----
                txtMorgens.setHorizontalAlignment(SwingConstants.RIGHT);
                txtMorgens.setText("1.0");
                txtMorgens.setFont(new Font("Arial", Font.PLAIN, 14));
                txtMorgens.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        txtMorgensActionPerformed(e);
                    }
                });
                txtMorgens.addFocusListener(new FocusAdapter() {
                    @Override
                    public void focusGained(FocusEvent e) {
                        txtFocusGained(e);
                    }

                    @Override
                    public void focusLost(FocusEvent e) {
                        txtIntegerFocusLost(e);
                    }
                });
                pnlTageszeit.add(txtMorgens, CC.xy(3, 3));

                //---- txtMittags ----
                txtMittags.setHorizontalAlignment(SwingConstants.RIGHT);
                txtMittags.setText("0.0");
                txtMittags.setFont(new Font("Arial", Font.PLAIN, 14));
                txtMittags.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        txtMittagsActionPerformed(e);
                    }
                });
                txtMittags.addFocusListener(new FocusAdapter() {
                    @Override
                    public void focusGained(FocusEvent e) {
                        txtFocusGained(e);
                    }

                    @Override
                    public void focusLost(FocusEvent e) {
                        txtIntegerFocusLost(e);
                    }
                });
                pnlTageszeit.add(txtMittags, CC.xy(5, 3));

                //---- txtNachmittags ----
                txtNachmittags.setHorizontalAlignment(SwingConstants.RIGHT);
                txtNachmittags.setText("0.0");
                txtNachmittags.setFont(new Font("Arial", Font.PLAIN, 14));
                txtNachmittags.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        txtNachmittagsActionPerformed(e);
                    }
                });
                txtNachmittags.addFocusListener(new FocusAdapter() {
                    @Override
                    public void focusGained(FocusEvent e) {
                        txtFocusGained(e);
                    }

                    @Override
                    public void focusLost(FocusEvent e) {
                        txtIntegerFocusLost(e);
                    }
                });
                pnlTageszeit.add(txtNachmittags, CC.xy(7, 3));

                //---- txtAbends ----
                txtAbends.setHorizontalAlignment(SwingConstants.RIGHT);
                txtAbends.setText("0.0");
                txtAbends.setFont(new Font("Arial", Font.PLAIN, 14));
                txtAbends.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        txtAbendsActionPerformed(e);
                    }
                });
                txtAbends.addFocusListener(new FocusAdapter() {
                    @Override
                    public void focusGained(FocusEvent e) {
                        txtFocusGained(e);
                    }

                    @Override
                    public void focusLost(FocusEvent e) {
                        txtIntegerFocusLost(e);
                    }
                });
                pnlTageszeit.add(txtAbends, CC.xy(9, 3));

                //---- txtNachtAb ----
                txtNachtAb.setHorizontalAlignment(SwingConstants.RIGHT);
                txtNachtAb.setText("0.0");
                txtNachtAb.setFont(new Font("Arial", Font.PLAIN, 14));
                txtNachtAb.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        txtNachtAbActionPerformed(e);
                    }
                });
                txtNachtAb.addFocusListener(new FocusAdapter() {
                    @Override
                    public void focusGained(FocusEvent e) {
                        txtFocusGained(e);
                    }

                    @Override
                    public void focusLost(FocusEvent e) {
                        txtIntegerFocusLost(e);
                    }
                });
                pnlTageszeit.add(txtNachtAb, CC.xy(11, 3));

                //---- btnToTime ----
                btnToTime.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/1rightarrow.png")));
                btnToTime.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        btnToTimeActionPerformed(e);
                    }
                });
                pnlTageszeit.add(btnToTime, CC.xy(13, 3));
            }
            splitRegular.setLeftComponent(pnlTageszeit);

            //======== pnlUhrzeit ========
            {
                pnlUhrzeit.setBorder(new EtchedBorder());
                pnlUhrzeit.setLayout(
                        new FormLayout("default, $ugap, 75dlu, $ugap, pref", "default:grow, $rgap, default"));

                //---- lblUhrzeit ----
                lblUhrzeit.setText("Anzahl Massnahmen");
                lblUhrzeit.setOrientation(2);
                lblUhrzeit.setFont(new Font("Arial", Font.PLAIN, 14));
                lblUhrzeit.setClockwise(false);
                lblUhrzeit.setHorizontalTextPosition(SwingConstants.LEFT);
                lblUhrzeit.setVerticalAlignment(SwingConstants.BOTTOM);
                pnlUhrzeit.add(lblUhrzeit, CC.xy(3, 1, CC.DEFAULT, CC.BOTTOM));

                //---- btnToTimeOfDay ----
                btnToTimeOfDay
                        .setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/1leftarrow.png")));
                btnToTimeOfDay.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        btnToTimeOfDayActionPerformed(e);
                    }
                });
                pnlUhrzeit.add(btnToTimeOfDay, CC.xy(1, 3));

                //---- txtUhrzeit ----
                txtUhrzeit.setHorizontalAlignment(SwingConstants.RIGHT);
                txtUhrzeit.setText("0.0");
                txtUhrzeit.setFont(new Font("Arial", Font.PLAIN, 14));
                txtUhrzeit.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        txtUhrzeitActionPerformed(e);
                    }
                });
                txtUhrzeit.addFocusListener(new FocusAdapter() {
                    @Override
                    public void focusGained(FocusEvent e) {
                        txtFocusGained(e);
                    }

                    @Override
                    public void focusLost(FocusEvent e) {
                        txtIntegerFocusLost(e);
                    }
                });
                pnlUhrzeit.add(txtUhrzeit, CC.xy(3, 3));

                //---- cmbUhrzeit ----
                cmbUhrzeit.addItemListener(new ItemListener() {
                    @Override
                    public void itemStateChanged(ItemEvent e) {
                        cmbUhrzeitItemStateChanged(e);
                    }
                });
                pnlUhrzeit.add(cmbUhrzeit, CC.xy(5, 3));
            }
            splitRegular.setRightComponent(pnlUhrzeit);
        }
        panelMain.add(splitRegular, CC.xy(3, 3));

        //======== tabWdh ========
        {

            //======== pnlDaily ========
            {
                pnlDaily.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlDaily.setLayout(new FormLayout("2*(default), $rgap, $lcgap, 40dlu, $rgap, default",
                        "default, $lgap, pref, $lgap, default"));

                //---- label3 ----
                label3.setText("alle");
                label3.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlDaily.add(label3, CC.xy(2, 3));

                //---- spinTaeglich ----
                spinTaeglich.setFont(new Font("Arial", Font.PLAIN, 14));
                spinTaeglich.setModel(new SpinnerNumberModel(1, null, null, 1));
                pnlDaily.add(spinTaeglich, CC.xy(5, 3));

                //---- jLabel7 ----
                jLabel7.setText("Tage");
                jLabel7.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlDaily.add(jLabel7, CC.xy(7, 3));

                //---- btnJedenTag ----
                btnJedenTag.setText("Jeden Tag");
                btnJedenTag.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        btnJedenTagActionPerformed(e);
                    }
                });
                pnlDaily.add(btnJedenTag, CC.xywh(2, 5, 6, 1));
            }
            tabWdh.addTab("T\u00e4glich", pnlDaily);

            //======== pnlWeekly ========
            {
                pnlWeekly.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlWeekly.setLayout(new FormLayout("default, 7*(13dlu), $lcgap, default:grow",
                        "$ugap, $lgap, default, $lgap, pref, default:grow, $lgap, $rgap"));

                //======== panel3 ========
                {
                    panel3.setLayout(
                            new FormLayout("default, $rgap, 40dlu, $rgap, 2*(default), $lcgap, default, $lcgap",
                                    "default:grow, $lgap, default"));

                    //---- btnJedeWoche ----
                    btnJedeWoche.setText("Jede Woche");
                    btnJedeWoche.setFont(new Font("Arial", Font.PLAIN, 14));
                    btnJedeWoche.addActionListener(new ActionListener() {
                        @Override
                        public void actionPerformed(ActionEvent e) {
                            btnJedeWocheActionPerformed(e);
                        }
                    });
                    panel3.add(btnJedeWoche, CC.xywh(3, 3, 3, 1));

                    //---- label2 ----
                    label2.setText("alle");
                    label2.setFont(new Font("Arial", Font.PLAIN, 14));
                    panel3.add(label2, CC.xy(1, 1));
                    panel3.add(spinWoche, CC.xy(3, 1));

                    //---- jLabel8 ----
                    jLabel8.setText("Wochen am");
                    jLabel8.setFont(new Font("Arial", Font.PLAIN, 14));
                    panel3.add(jLabel8, CC.xy(5, 1));
                }
                pnlWeekly.add(panel3, CC.xywh(2, 3, 9, 1));

                //---- lblUhrzeit2 ----
                lblUhrzeit2.setText("montags");
                lblUhrzeit2.setOrientation(1);
                lblUhrzeit2.setFont(new Font("Arial", Font.PLAIN, 14));
                lblUhrzeit2.setClockwise(false);
                lblUhrzeit2.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlWeekly.add(lblUhrzeit2, CC.xy(2, 5, CC.CENTER, CC.BOTTOM));

                //---- lblUhrzeit3 ----
                lblUhrzeit3.setText("dienstags");
                lblUhrzeit3.setOrientation(1);
                lblUhrzeit3.setFont(new Font("Arial", Font.PLAIN, 14));
                lblUhrzeit3.setClockwise(false);
                lblUhrzeit3.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlWeekly.add(lblUhrzeit3, CC.xy(3, 5, CC.CENTER, CC.BOTTOM));

                //---- lblUhrzeit4 ----
                lblUhrzeit4.setText("mittwochs");
                lblUhrzeit4.setOrientation(1);
                lblUhrzeit4.setFont(new Font("Arial", Font.PLAIN, 14));
                lblUhrzeit4.setClockwise(false);
                lblUhrzeit4.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlWeekly.add(lblUhrzeit4, CC.xy(4, 5, CC.CENTER, CC.BOTTOM));

                //---- lblUhrzeit5 ----
                lblUhrzeit5.setText("donnerstags");
                lblUhrzeit5.setOrientation(1);
                lblUhrzeit5.setFont(new Font("Arial", Font.PLAIN, 14));
                lblUhrzeit5.setClockwise(false);
                lblUhrzeit5.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlWeekly.add(lblUhrzeit5, CC.xy(5, 5, CC.CENTER, CC.BOTTOM));

                //---- lblUhrzeit6 ----
                lblUhrzeit6.setText("freitags");
                lblUhrzeit6.setOrientation(1);
                lblUhrzeit6.setFont(new Font("Arial", Font.PLAIN, 14));
                lblUhrzeit6.setClockwise(false);
                lblUhrzeit6.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlWeekly.add(lblUhrzeit6, CC.xy(6, 5, CC.CENTER, CC.BOTTOM));

                //---- lblUhrzeit7 ----
                lblUhrzeit7.setText("samstags");
                lblUhrzeit7.setOrientation(1);
                lblUhrzeit7.setFont(new Font("Arial", Font.PLAIN, 14));
                lblUhrzeit7.setClockwise(false);
                lblUhrzeit7.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlWeekly.add(lblUhrzeit7, CC.xy(7, 5, CC.CENTER, CC.BOTTOM));

                //---- lblUhrzeit8 ----
                lblUhrzeit8.setText("sonntags");
                lblUhrzeit8.setOrientation(1);
                lblUhrzeit8.setFont(new Font("Arial", Font.PLAIN, 14));
                lblUhrzeit8.setClockwise(false);
                lblUhrzeit8.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlWeekly.add(lblUhrzeit8, CC.xy(8, 5, CC.CENTER, CC.BOTTOM));

                //---- cbMon ----
                cbMon.setBorder(BorderFactory.createEmptyBorder());
                cbMon.setMargin(new Insets(0, 0, 0, 0));
                cbMon.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cbMonActionPerformed(e);
                    }
                });
                pnlWeekly.add(cbMon, CC.xy(2, 6, CC.CENTER, CC.DEFAULT));

                //---- cbDie ----
                cbDie.setBorder(BorderFactory.createEmptyBorder());
                cbDie.setMargin(new Insets(0, 0, 0, 0));
                cbDie.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cbDieActionPerformed(e);
                    }
                });
                pnlWeekly.add(cbDie, CC.xy(3, 6, CC.CENTER, CC.DEFAULT));

                //---- cbMit ----
                cbMit.setBorder(BorderFactory.createEmptyBorder());
                cbMit.setMargin(new Insets(0, 0, 0, 0));
                cbMit.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cbMitActionPerformed(e);
                    }
                });
                pnlWeekly.add(cbMit, CC.xy(4, 6, CC.CENTER, CC.DEFAULT));

                //---- cbDon ----
                cbDon.setBorder(BorderFactory.createEmptyBorder());
                cbDon.setMargin(new Insets(0, 0, 0, 0));
                cbDon.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cbDonActionPerformed(e);
                    }
                });
                pnlWeekly.add(cbDon, CC.xy(5, 6, CC.CENTER, CC.DEFAULT));

                //---- cbFre ----
                cbFre.setBorder(BorderFactory.createEmptyBorder());
                cbFre.setMargin(new Insets(0, 0, 0, 0));
                cbFre.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cbFreActionPerformed(e);
                    }
                });
                pnlWeekly.add(cbFre, CC.xy(6, 6, CC.CENTER, CC.DEFAULT));

                //---- cbSam ----
                cbSam.setBorder(BorderFactory.createEmptyBorder());
                cbSam.setMargin(new Insets(0, 0, 0, 0));
                cbSam.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cbSamActionPerformed(e);
                    }
                });
                pnlWeekly.add(cbSam, CC.xy(7, 6, CC.CENTER, CC.DEFAULT));

                //---- cbSon ----
                cbSon.setBorder(BorderFactory.createEmptyBorder());
                cbSon.setMargin(new Insets(0, 0, 0, 0));
                cbSon.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cbSonActionPerformed(e);
                    }
                });
                pnlWeekly.add(cbSon, CC.xy(8, 6, CC.CENTER, CC.DEFAULT));
            }
            tabWdh.addTab("W\u00f6chentlich", pnlWeekly);

            //======== pnlMonthly ========
            {
                pnlMonthly.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlMonthly.setLayout(
                        new FormLayout("default, $lcgap, pref, $lcgap, 40dlu, $lcgap, pref, $lcgap, 61dlu",
                                "3*(default, $lgap), default"));

                //---- label4 ----
                label4.setText("jeden");
                label4.setFont(new Font("Arial", Font.PLAIN, 14));
                label4.setHorizontalAlignment(SwingConstants.TRAILING);
                pnlMonthly.add(label4, CC.xy(3, 3));

                //---- spinMonat ----
                spinMonat.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlMonthly.add(spinMonat, CC.xy(5, 3));

                //---- label6 ----
                label6.setText("Monat");
                label6.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlMonthly.add(label6, CC.xy(7, 3));

                //---- btnJedenMonat ----
                btnJedenMonat.setText("Jeden Monat");
                btnJedenMonat.setFont(new Font("Arial", Font.PLAIN, 14));
                btnJedenMonat.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        btnJedenMonatActionPerformed(e);
                    }
                });
                pnlMonthly.add(btnJedenMonat, CC.xywh(3, 5, 5, 1));

                //---- label5 ----
                label5.setText("jeweils am");
                label5.setFont(new Font("Arial", Font.PLAIN, 14));
                label5.setHorizontalAlignment(SwingConstants.TRAILING);
                pnlMonthly.add(label5, CC.xy(3, 7));

                //---- spinMonatTag ----
                spinMonatTag.setFont(new Font("Arial", Font.PLAIN, 14));
                spinMonatTag.addChangeListener(new ChangeListener() {
                    @Override
                    public void stateChanged(ChangeEvent e) {
                        spinMonatTagStateChanged(e);
                    }
                });
                pnlMonthly.add(spinMonatTag, CC.xy(5, 7));

                //---- cmbTag ----
                cmbTag.setModel(new DefaultComboBoxModel<>(new String[] { "Tag des Monats", "Montag",
                        "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag" }));
                cmbTag.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlMonthly.add(cmbTag, CC.xywh(7, 7, 3, 1));
            }
            tabWdh.addTab("Monatlich", pnlMonthly);
        }
        panelMain.add(tabWdh, CC.xy(3, 7, CC.FILL, CC.FILL));

        //======== panel2 ========
        {
            panel2.setLayout(new FormLayout(
                    "default, $lcgap, default:grow, $ugap, default, $lcgap, default:grow", "default:grow"));

            //---- jLabel13 ----
            jLabel13.setText("Erst einplanen ab dem");
            jLabel13.setFont(new Font("Arial", Font.PLAIN, 14));
            panel2.add(jLabel13, CC.xy(1, 1));

            //---- txtLDate ----
            txtLDate.setFont(new Font("Arial", Font.PLAIN, 14));
            txtLDate.addFocusListener(new FocusAdapter() {
                @Override
                public void focusLost(FocusEvent e) {
                    txtLDateFocusLost(e);
                }
            });
            panel2.add(txtLDate, CC.xy(3, 1));

            //---- lblMinutes ----
            lblMinutes.setText("text");
            lblMinutes.setFont(new Font("Arial", Font.PLAIN, 14));
            panel2.add(lblMinutes, CC.xy(5, 1));

            //---- txtMinutes ----
            txtMinutes.setFont(new Font("Arial", Font.PLAIN, 14));
            txtMinutes.addFocusListener(new FocusAdapter() {
                @Override
                public void focusLost(FocusEvent e) {
                    txtMinutesFocusLost(e);
                }
            });
            panel2.add(txtMinutes, CC.xy(7, 1));
        }
        panelMain.add(panel2, CC.xy(3, 9));

        //======== pnlBemerkung ========
        {
            pnlBemerkung.setBorder(new TitledBorder(null, "Kommentar zur Anwendung (Erscheint im DFN)",
                    TitledBorder.LEADING, TitledBorder.DEFAULT_POSITION, new Font("Arial", Font.PLAIN, 14)));
            pnlBemerkung.setLayout(new BoxLayout(pnlBemerkung, BoxLayout.X_AXIS));

            //======== jScrollPane1 ========
            {

                //---- txtBemerkung ----
                txtBemerkung.setColumns(20);
                txtBemerkung.setRows(5);
                jScrollPane1.setViewportView(txtBemerkung);
            }
            pnlBemerkung.add(jScrollPane1);
        }
        panelMain.add(pnlBemerkung, CC.xy(3, 11, CC.FILL, CC.FILL));

        //---- btnSave ----
        btnSave.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/apply.png")));
        btnSave.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                btnSaveActionPerformed(e);
            }
        });
        panelMain.add(btnSave, CC.xy(3, 13, CC.RIGHT, CC.DEFAULT));
    }
    add(panelMain, BorderLayout.CENTER);
}

From source file:op.care.prescription.DlgRegular.java

/**
 * This method is called from within the constructor to
 * initialize the form.// ww  w .ja  va2s.c  o m
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the PrinterForm Editor.
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
    jPanel1 = new JPanel();
    txtMed = new JXSearchField();
    cmbMed = new JComboBox<>();
    panel4 = new JPanel();
    btnMed = new JButton();
    cmbIntervention = new JComboBox<>();
    txtIntervention = new JXSearchField();
    jPanel8 = new JPanel();
    jspDosis = new JScrollPane();
    tblDosis = new JTable();
    panel2 = new JPanel();
    btnAddDosis = new JButton();
    jPanel3 = new JPanel();
    pnlOFF = new JPanel();
    rbActive = new JRadioButton();
    rbDate = new JRadioButton();
    txtTo = new JTextField();
    rbEndOfPackage = new JRadioButton();
    jScrollPane3 = new JScrollPane();
    txtBemerkung = new JTextPane();
    lblText = new JLabel();
    pnlON = new JPanel();
    cmbDocON = new JComboBox<>();
    btnAddGP = new JButton();
    cmbHospitalON = new JComboBox<>();
    btnAddHospital = new JButton();
    panel1 = new JPanel();
    btnClose = new JButton();
    btnSave = new JButton();
    lblTX = new JLabel();

    //======== this ========
    setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
    setResizable(false);
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    Container contentPane = getContentPane();
    contentPane.setLayout(new FormLayout("$rgap, $lcgap, default, $lcgap, pref, $lcgap, $rgap",
            "$rgap, $lgap, fill:default:grow, $lgap, fill:default, $lgap, $rgap"));

    //======== jPanel1 ========
    {
        jPanel1.setBorder(null);
        jPanel1.setLayout(new FormLayout("68dlu, $lcgap, 284dlu, $lcgap, pref",
                "2*(16dlu, $lgap), default, $lgap, fill:default:grow"));

        //---- txtMed ----
        txtMed.setFont(new Font("Arial", Font.PLAIN, 14));
        txtMed.setPrompt("Medikamente");
        txtMed.setFocusBehavior(PromptSupport.FocusBehavior.HIGHLIGHT_PROMPT);
        txtMed.addActionListener(e -> txtMedActionPerformed(e));
        txtMed.addFocusListener(new FocusAdapter() {
            @Override
            public void focusGained(FocusEvent e) {
                txtMedFocusGained(e);
            }
        });
        jPanel1.add(txtMed, CC.xy(1, 1));

        //---- cmbMed ----
        cmbMed.setModel(new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        cmbMed.setFont(new Font("Arial", Font.PLAIN, 14));
        cmbMed.addItemListener(e -> cmbMedItemStateChanged(e));
        jPanel1.add(cmbMed, CC.xy(3, 1));

        //======== panel4 ========
        {
            panel4.setLayout(new BoxLayout(panel4, BoxLayout.LINE_AXIS));

            //---- btnMed ----
            btnMed.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png")));
            btnMed.setBorderPainted(false);
            btnMed.setBorder(null);
            btnMed.setContentAreaFilled(false);
            btnMed.setToolTipText("Neues Medikament eintragen");
            btnMed.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            btnMed.setSelectedIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add-pressed.png")));
            btnMed.addActionListener(e -> btnMedActionPerformed(e));
            panel4.add(btnMed);
        }
        jPanel1.add(panel4, CC.xy(5, 1));

        //---- cmbIntervention ----
        cmbIntervention
                .setModel(new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        cmbIntervention.setFont(new Font("Arial", Font.PLAIN, 14));
        jPanel1.add(cmbIntervention, CC.xywh(3, 3, 3, 1));

        //---- txtIntervention ----
        txtIntervention.setFont(new Font("Arial", Font.PLAIN, 14));
        txtIntervention.setPrompt("Massnahmen");
        txtIntervention.addActionListener(e -> txtMassActionPerformed(e));
        jPanel1.add(txtIntervention, CC.xy(1, 3));

        //======== jPanel8 ========
        {
            jPanel8.setBorder(new TitledBorder(null, "Dosis / H\u00e4ufigkeit", TitledBorder.LEADING,
                    TitledBorder.DEFAULT_POSITION, new Font("Arial", Font.PLAIN, 14)));
            jPanel8.setFont(new Font("Arial", Font.PLAIN, 14));
            jPanel8.setLayout(new FormLayout("370dlu", "fill:default:grow, $lgap, pref"));

            //======== jspDosis ========
            {
                jspDosis.setToolTipText(null);

                //---- tblDosis ----
                tblDosis.setModel(new DefaultTableModel(
                        new Object[][] { { null, null, null, null }, { null, null, null, null },
                                { null, null, null, null }, { null, null, null, null }, },
                        new String[] { "Title 1", "Title 2", "Title 3", "Title 4" }));
                tblDosis.setSurrendersFocusOnKeystroke(true);
                tblDosis.setToolTipText(null);
                tblDosis.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mousePressed(MouseEvent e) {
                        tblDosisMousePressed(e);
                    }
                });
                jspDosis.setViewportView(tblDosis);
            }
            jPanel8.add(jspDosis, CC.xy(1, 1));

            //======== panel2 ========
            {
                panel2.setLayout(new BoxLayout(panel2, BoxLayout.LINE_AXIS));

                //---- btnAddDosis ----
                btnAddDosis.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png")));
                btnAddDosis.setBorderPainted(false);
                btnAddDosis.setBorder(null);
                btnAddDosis.setContentAreaFilled(false);
                btnAddDosis.setToolTipText("Neue Dosierung eintragen");
                btnAddDosis.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
                btnAddDosis.setSelectedIcon(
                        new ImageIcon(getClass().getResource("/artwork/22x22/bw/add-pressed.png")));
                btnAddDosis.addActionListener(e -> btnAddDosisActionPerformed(e));
                panel2.add(btnAddDosis);
            }
            jPanel8.add(panel2, CC.xy(1, 3, CC.LEFT, CC.DEFAULT));
        }
        jPanel1.add(jPanel8, CC.xywh(1, 7, 5, 1));
    }
    contentPane.add(jPanel1, CC.xy(5, 3));

    //======== jPanel3 ========
    {
        jPanel3.setBorder(null);
        jPanel3.setLayout(new FormLayout("149dlu", "3*(fill:default, $lgap), fill:108dlu:grow, $lgap, 60dlu"));

        //======== pnlOFF ========
        {
            pnlOFF.setBorder(new TitledBorder("Absetzung"));
            pnlOFF.setLayout(new FormLayout("pref, 86dlu:grow", "2*(fill:17dlu, $lgap), fill:17dlu"));

            //---- rbActive ----
            rbActive.setText("text");
            rbActive.setSelected(true);
            rbActive.addItemListener(e -> rbActiveItemStateChanged(e));
            pnlOFF.add(rbActive, CC.xywh(1, 1, 2, 1));

            //---- rbDate ----
            rbDate.setText(null);
            rbDate.addItemListener(e -> rbDateItemStateChanged(e));
            pnlOFF.add(rbDate, CC.xy(1, 3));

            //---- txtTo ----
            txtTo.addFocusListener(new FocusAdapter() {
                @Override
                public void focusLost(FocusEvent e) {
                    txtToFocusLost(e);
                }
            });
            pnlOFF.add(txtTo, CC.xy(2, 3));

            //---- rbEndOfPackage ----
            rbEndOfPackage.setText("text");
            rbEndOfPackage.addItemListener(e -> rbEndOfPackageItemStateChanged(e));
            pnlOFF.add(rbEndOfPackage, CC.xywh(1, 5, 2, 1));
        }
        jPanel3.add(pnlOFF, CC.xy(1, 3));

        //======== jScrollPane3 ========
        {

            //---- txtBemerkung ----
            txtBemerkung.addCaretListener(e -> txtBemerkungCaretUpdate(e));
            jScrollPane3.setViewportView(txtBemerkung);
        }
        jPanel3.add(jScrollPane3, CC.xy(1, 7));

        //---- lblText ----
        lblText.setText("Bemerkung:");
        jPanel3.add(lblText, CC.xy(1, 5));

        //======== pnlON ========
        {
            pnlON.setBorder(new TitledBorder("Ansetzung"));
            pnlON.setLayout(new FormLayout("119dlu:grow, $lcgap, default", "default, $lgap, default"));

            //---- cmbDocON ----
            cmbDocON.setModel(
                    new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
            cmbDocON.addKeyListener(new KeyAdapter() {
                @Override
                public void keyPressed(KeyEvent e) {
                    cmbDocONKeyPressed(e);
                }
            });
            pnlON.add(cmbDocON, CC.xy(1, 1));

            //---- btnAddGP ----
            btnAddGP.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png")));
            btnAddGP.setBorderPainted(false);
            btnAddGP.setBorder(null);
            btnAddGP.setContentAreaFilled(false);
            btnAddGP.setToolTipText("Neues Medikament eintragen");
            btnAddGP.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            btnAddGP.setSelectedIcon(
                    new ImageIcon(getClass().getResource("/artwork/22x22/bw/add-pressed.png")));
            btnAddGP.addActionListener(e -> btnAddGPActionPerformed(e));
            pnlON.add(btnAddGP, CC.xy(3, 1));

            //---- cmbHospitalON ----
            cmbHospitalON.setModel(
                    new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
            pnlON.add(cmbHospitalON, CC.xy(1, 3));

            //---- btnAddHospital ----
            btnAddHospital.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png")));
            btnAddHospital.setBorderPainted(false);
            btnAddHospital.setBorder(null);
            btnAddHospital.setContentAreaFilled(false);
            btnAddHospital.setToolTipText("Neues Medikament eintragen");
            btnAddHospital.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            btnAddHospital.setSelectedIcon(
                    new ImageIcon(getClass().getResource("/artwork/22x22/bw/add-pressed.png")));
            btnAddHospital.addActionListener(e -> btnAddHospitalActionPerformed(e));
            pnlON.add(btnAddHospital, CC.xy(3, 3));
        }
        jPanel3.add(pnlON, CC.xy(1, 1));
    }
    contentPane.add(jPanel3, CC.xy(3, 3));

    //======== panel1 ========
    {
        panel1.setLayout(new BoxLayout(panel1, BoxLayout.LINE_AXIS));

        //---- btnClose ----
        btnClose.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/cancel.png")));
        btnClose.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        btnClose.addActionListener(e -> btnCloseActionPerformed(e));
        panel1.add(btnClose);

        //---- btnSave ----
        btnSave.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/apply.png")));
        btnSave.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        btnSave.addActionListener(e -> btnSaveActionPerformed(e));
        panel1.add(btnSave);
    }
    contentPane.add(panel1, CC.xy(5, 5, CC.RIGHT, CC.DEFAULT));

    //---- lblTX ----
    lblTX.setText(null);
    lblTX.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/ambulance2.png")));
    contentPane.add(lblTX, CC.xy(3, 5));
    setSize(1015, 640);
    setLocationRelativeTo(getOwner());

    //---- bgMedikament ----
    ButtonGroup bgMedikament = new ButtonGroup();
    bgMedikament.add(rbActive);
    bgMedikament.add(rbDate);
    bgMedikament.add(rbEndOfPackage);
}

From source file:org.fhaes.gui.AnalysisResultsPanel.java

/**
 * Set up the AnalysisResults GUI//from   w  w w.j a  v  a 2  s.  c om
 */
private void initGUI() {

    setLayout(new BorderLayout(0, 0));
    if (Platform.isOSX())
        setBackground(MainWindow.MAC_BACKGROUND_COLOR);

    ImageIcon iconMultipleTables = Builder.getImageIcon("multipletables16.png");
    ImageIcon iconTable = Builder.getImageIcon("table16.png");

    // ImageIcon iconChart = Builder.getImageIcon("chart16.png");

    // Categories
    rootNode = new FHAESCategoryTreeNode("FHAES analysis results");
    categoryGeneral = new FHAESCategoryTreeNode("Descriptive summaries",
            Builder.getImageIcon("interval16.png"));
    categoryInterval = new FHAESCategoryTreeNode("Interval analysis", Builder.getImageIcon("interval16.png"));
    categorySeasonality = new FHAESCategoryTreeNode("Seasonality", Builder.getImageIcon("seasonality16.png"));
    categoryBinarySummaryMatrices = new FHAESCategoryTreeNode("Binary summary matrices",
            Builder.getImageIcon("matrix16.png"));
    categoryBinaryMatrices = new FHAESCategoryTreeNode("Binary comparison matrices",
            Builder.getImageIcon("matrix16.png"));
    categorySimMatrices = new FHAESCategoryTreeNode("Similarity matrices",
            Builder.getImageIcon("matrix16.png"));
    categoryDisSimMatrices = new FHAESCategoryTreeNode("Dissimilarity matrices",
            Builder.getImageIcon("matrix16.png"));

    // Menu actions

    // Results

    itemJaccard = new FHAESResultTreeNode(FHAESResult.JACCARD_SIMILARITY_MATRIX, iconMultipleTables);
    itemJaccard.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(SJACFile, new CSVFileFilter());
        }
    });

    itemCohen = new FHAESResultTreeNode(FHAESResult.COHEN_SIMILARITITY_MATRIX, iconMultipleTables);
    itemCohen.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(SCOHFile, new CSVFileFilter());
        }
    });

    itemJaccardD = new FHAESResultTreeNode(FHAESResult.JACCARD_SIMILARITY_MATRIX_D, iconMultipleTables);
    itemJaccardD.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(DSJACFile, new CSVFileFilter());
        }
    });

    itemCohenD = new FHAESResultTreeNode(FHAESResult.COHEN_SIMILARITITY_MATRIX_D, iconMultipleTables);
    itemCohenD.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(DSCOHFile, new CSVFileFilter());
        }
    });

    itemIntervalSummary = new FHAESResultTreeNode(FHAESResult.INTERVAL_SUMMARY, iconMultipleTables);
    itemIntervalSummary.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(intervalsSummaryFile, new CSVFileFilter());
        }
    });

    itemExceedence = new FHAESResultTreeNode(FHAESResult.INTERVAL_EXCEEDENCE_TABLE, iconMultipleTables);
    itemExceedence.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(intervalsExceedenceFile, new CSVFileFilter());
        }
    });

    itemSeasonalitySummary = new FHAESResultTreeNode(FHAESResult.SEASONALITY_SUMMARY, iconMultipleTables);
    itemSeasonalitySummary.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(seasonalitySummaryFile, new CSVFileFilter());
        }
    });

    itemBin00 = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_00, iconMultipleTables);
    itemBin00.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(bin00File, new CSVFileFilter());
        }
    });

    itemBin01 = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_01, iconMultipleTables);
    itemBin01.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(bin01File, new CSVFileFilter());
        }
    });

    itemBin10 = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_10, iconMultipleTables);
    itemBin10.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(bin10File, new CSVFileFilter());
        }
    });

    itemBin11 = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_11, iconMultipleTables);
    itemBin11.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(bin11File, new CSVFileFilter());
        }
    });

    itemBinSum = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_SUM, iconMultipleTables);
    itemBinSum.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(binSumFile, new CSVFileFilter());
        }

    });
    itemBinSiteSummary = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_SITE, iconMultipleTables);
    itemBinSiteSummary.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(siteSummaryFile, new CSVFileFilter());
        }
    });
    itemBinSiteSummary.addAction(new FHAESAction("Export to shapefile", "formatshp.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            new ShapeFileDialog(App.mainFrame, fhm);

        }
    });

    itemBinTreeSummary = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_TREE, iconMultipleTables);
    itemBinTreeSummary.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(treeSummaryFile, new CSVFileFilter());
        }
    });

    itemNTP = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_NTP, iconMultipleTables);
    itemNTP.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(NTPFile, new CSVFileFilter());
        }
    });

    this.itemGeneralSummary = new FHAESResultTreeNode(FHAESResult.GENERAL_SUMMARY, iconMultipleTables);
    itemGeneralSummary.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(generalSummaryFile, new CSVFileFilter());
        }

    });

    this.itemSingleFileSummary = new FHAESResultTreeNode(FHAESResult.SINGLE_FILE_SUMMARY, iconTable);
    itemSingleFileSummary.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(singleFileSummaryFile, new CSVFileFilter());
        }

    });

    this.itemSingleEventSummary = new FHAESResultTreeNode(FHAESResult.SINGLE_EVENT_SUMMARY, iconTable);
    itemSingleEventSummary.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(singleEventSummaryFile, new CSVFileFilter());
        }

    });

    // Add results to categories
    categoryGeneral.add(itemGeneralSummary);
    categoryGeneral.add(itemSingleFileSummary);
    categoryGeneral.add(itemSingleEventSummary);
    categorySimMatrices.add(itemJaccard);
    categorySimMatrices.add(itemCohen);
    categoryDisSimMatrices.add(itemJaccardD);
    categoryDisSimMatrices.add(itemCohenD);
    categoryInterval.add(itemIntervalSummary);
    categoryInterval.add(itemExceedence);
    categorySeasonality.add(itemSeasonalitySummary);
    categoryBinaryMatrices.add(itemBin11);
    categoryBinaryMatrices.add(itemBin01);
    categoryBinaryMatrices.add(itemBin10);
    categoryBinaryMatrices.add(itemBin00);
    categoryBinaryMatrices.add(itemBinSum);
    categoryBinarySummaryMatrices.add(itemBinSiteSummary);
    categoryBinarySummaryMatrices.add(itemBinTreeSummary);
    categoryBinarySummaryMatrices.add(itemNTP);

    // Add categories to root of tree
    rootNode.add(categoryGeneral);
    rootNode.add(categoryInterval);
    rootNode.add(categorySeasonality);
    rootNode.add(categoryBinarySummaryMatrices);
    rootNode.add(categoryBinaryMatrices);
    rootNode.add(categorySimMatrices);
    rootNode.add(categoryDisSimMatrices);

    treeModel = new DefaultTreeModel(rootNode);

    splitPane = new JSplitPane();
    if (Platform.isOSX())
        splitPane.setBackground(MainWindow.MAC_BACKGROUND_COLOR);

    splitPane.setResizeWeight(0.9);
    add(splitPane, BorderLayout.CENTER);

    JPanel panelTree = new JPanel();
    splitPane.setRightComponent(panelTree);
    panelTree.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    panelTree.setLayout(new BorderLayout(0, 0));

    // Build tree
    treeResults = new JTree();
    panelTree.add(treeResults);
    treeResults.setModel(treeModel);

    treeResults.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    treeResults.setCellRenderer(new FHAESResultTreeRenderer());

    pickResultPanel = new PickResultPanel();
    runAnalysisPanel = new RunAnalysisPanel();

    cards = new JPanel();
    cl = new CardLayout();
    cards.setLayout(cl);
    cards.add(pickResultPanel, PICKRESULTPANEL);
    cards.add(runAnalysisPanel, RUNANALYSIS);
    cards.add(emptyPanel, EMPTYPANEL);

    splitPane.setLeftComponent(cards);

    cl.show(cards, RUNANALYSIS);

    splitPaneResult = new JSplitPane();
    splitPaneResult.setOneTouchExpandable(true);
    splitPaneResult.setOrientation(JSplitPane.VERTICAL_SPLIT);
    cards.add(splitPaneResult, RESULTSPANEL);

    panelResult = new JPanel();

    panelResult.setBorder(new TitledBorder(null, "", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panelResult.setLayout(new BorderLayout(0, 0));

    goldFishPanel = new GoldFishPanel();
    splitPaneResult.setRightComponent(goldFishPanel);

    // Build table
    scrollPane = new JScrollPane();

    panelResult.add(scrollPane);
    table = new JXTable();
    adapter = new JTableSpreadsheetByRowAdapter(table);

    table.setModel(new DefaultTableModel());
    table.setHorizontalScrollEnabled(true);
    scrollPane.setViewportView(table);
    splitPaneResult.setLeftComponent(panelResult);

    // OSX Style hack
    if (Platform.isOSX())
        panelResult.setBackground(MainWindow.MAC_BACKGROUND_COLOR);
    if (Platform.isOSX())
        scrollPane.setBackground(MainWindow.MAC_BACKGROUND_COLOR);

    // Expand all nodes
    for (int i = 0; i < treeResults.getRowCount(); i++) {
        treeResults.expandRow(i);
    }

    treeResults.addTreeSelectionListener(this);

    treeResults.addMouseListener(new MouseListener() {

        @Override
        public void mouseClicked(MouseEvent e) {

            if (SwingUtilities.isRightMouseButton(e)) {
                int x = e.getX();
                int y = e.getY();
                JTree tree = (JTree) e.getSource();
                TreePath path = tree.getPathForLocation(x, y);
                if (path == null)
                    return;
                if (!tree.isEnabled())
                    return;

                tree.setSelectionPath(path);
                Component mc = e.getComponent();

                if (path != null && path.getLastPathComponent() instanceof FHAESResultTreeNode) {
                    FHAESResultTreeNode node = (FHAESResultTreeNode) path.getLastPathComponent();

                    if (!node.isEnabled())
                        return;

                    FHAESResultPopupMenu popupMenu = new FHAESResultPopupMenu(node.getArrayOfActions());
                    popupMenu.show(mc, e.getX(), e.getY());
                }
            }
        }

        @Override
        public void mouseEntered(MouseEvent arg0) {

        }

        @Override
        public void mouseExited(MouseEvent arg0) {

        }

        @Override
        public void mousePressed(MouseEvent arg0) {

        }

        @Override
        public void mouseReleased(MouseEvent arg0) {

        }

    });

    this.splitPaneResult.setDividerLocation(10000);
    this.splitPaneResult.setDividerSize(3);
    this.splitPaneResult.setResizeWeight(1);
}

From source file:org.fhaes.gui.AnalysisResultsPanel.java

/**
 * Clear the analysis results table and show the relevant instructional card page, either 'pick analysis' or 'run analysis' depending on
 * whether we have analyses to show//from  w  w  w. java 2  s. c  om
 */
private void clearTable() {

    panelResult.setBorder(new TitledBorder(null, "", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    table.setModel(new DefaultTableModel());

    MainWindow.getInstance().getReportPanel().actionResultsHelp.setEnabled(false);

    if (this.generalSummaryModel == null) {
        // No general sumamry model so analyses have NOT been run
        // Show 'run analysis' card
        cl.show(cards, RUNANALYSIS);
    } else {
        // If there is a general summary model then the analysis have been run.
        // Show the 'pick results' card
        cl.show(cards, PICKRESULTPANEL);
    }

    this.repaint();
}

From source file:org.fhaes.gui.AnalysisResultsPanel.java

/**
 * Draw the analysis results table depending on the current tree-node forcing the GUI to refresh regardless
 * //from ww w.  j  a v  a 2s . com
 * @param forceRefresh
 */
public void setupTable(Boolean forceRefresh) {

    cl.show(cards, RESULTSPANEL);
    MainWindow.getInstance().getReportPanel().actionResultsHelp.setEnabled(true);

    goldFishPanel.setParamsText();

    try {
        log.debug("Setting cursor to wait");
        table.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        treeResults.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

        DefaultMutableTreeNode selectednode = (DefaultMutableTreeNode) treeResults
                .getLastSelectedPathComponent();

        if (selectednode == null) {
            clearTable();
            return;
        }

        log.debug("Node selected: " + selectednode.toString());

        // If selection hasn't changed don't do anything
        if (previouslySelectedNode != null && selectednode.equals(previouslySelectedNode) && !forceRefresh) {
            log.debug("Node selection hasn't changed so not doing anything");
            return;
        }

        previouslySelectedNode = selectednode;

        if (!(selectednode instanceof FHAESResultTreeNode)) {
            clearTable();
            return;
        }

        FHAESResultTreeNode resultnode = (FHAESResultTreeNode) treeResults.getLastSelectedPathComponent();

        FHAESResult result = resultnode.getFHAESResult();
        panelResult.setBorder(new TitledBorder(null, result.getFullName(), TitledBorder.LEADING,
                TitledBorder.TOP, null, null));

        if (result.equals(FHAESResult.SEASONALITY_SUMMARY)) {

            log.debug("Seasonality summary node selected");

            if (seasonalitySummaryModel == null) {
                clearTable();
                return;
            }

            table.setModel(seasonalitySummaryModel);
            // table.setSortOrder(0, SortOrder.ASCENDING);
            setDefaultTableAlignment(SwingConstants.RIGHT);
        }

        else if (result.equals(FHAESResult.INTERVAL_SUMMARY)) {

            log.debug("Interval summary node selected");

            if (intervalsSummaryModel == null) {
                clearTable();
                return;
            }

            table.setModel(intervalsSummaryModel);
            // table.setSortOrder(0, SortOrder.ASCENDING);
            setDefaultTableAlignment(SwingConstants.RIGHT);

        }

        else if (result.equals(FHAESResult.INTERVAL_EXCEEDENCE_TABLE)) {

            log.debug("Interval exceedence node selected");

            if (intervalsExceedenceModel == null) {
                clearTable();
                return;
            }

            table.setModel(intervalsExceedenceModel);
            // table.setSortOrder(0, SortOrder.ASCENDING);
            setDefaultTableAlignment(SwingConstants.RIGHT);
        }

        else if (result.equals(FHAESResult.BINARY_MATRIX_00)) {

            if (this.bin00Model == null) {
                clearTable();
                return;
            }

            table.setModel(bin00Model);
            // table.setSortOrder(0, SortOrder.ASCENDING);
            setDefaultTableAlignment(SwingConstants.RIGHT);
        }

        else if (result.equals(FHAESResult.BINARY_MATRIX_01)) {

            if (this.bin01Model == null) {
                clearTable();
                return;
            }

            table.setModel(bin01Model);
            // table.setSortOrder(0, SortOrder.ASCENDING);
            setDefaultTableAlignment(SwingConstants.RIGHT);
        }

        else if (result.equals(FHAESResult.BINARY_MATRIX_10)) {

            if (this.bin10Model == null) {
                clearTable();
                return;
            }

            table.setModel(bin10Model);
            // table.setSortOrder(0, SortOrder.ASCENDING);
            setDefaultTableAlignment(SwingConstants.RIGHT);
        } else if (result.equals(FHAESResult.BINARY_MATRIX_11)) {

            if (this.bin11Model == null) {
                clearTable();
                return;
            }

            table.setModel(bin11Model);
            // table.setSortOrder(0, SortOrder.ASCENDING);
            setDefaultTableAlignment(SwingConstants.RIGHT);
        } else if (result.equals(FHAESResult.BINARY_MATRIX_SUM)) {

            if (this.binSumModel == null) {
                clearTable();
                return;
            }
            table.setModel(binSumModel);
            setDefaultTableAlignment(SwingConstants.RIGHT);
        } else if (result.equals(FHAESResult.JACCARD_SIMILARITY_MATRIX)) {

            if (this.SJACModel == null) {
                clearTable();
                return;
            }
            table.setModel(SJACModel);
            setDefaultTableAlignment(SwingConstants.RIGHT);
        } else if (result.equals(FHAESResult.COHEN_SIMILARITITY_MATRIX)) {

            if (this.SCOHModel == null) {
                clearTable();
                return;
            }
            table.setModel(SCOHModel);
            setDefaultTableAlignment(SwingConstants.RIGHT);
        } else if (result.equals(FHAESResult.JACCARD_SIMILARITY_MATRIX_D)) {

            if (this.DSJACModel == null) {
                clearTable();
                return;
            }
            table.setModel(DSJACModel);
            setDefaultTableAlignment(SwingConstants.RIGHT);
        } else if (result.equals(FHAESResult.COHEN_SIMILARITITY_MATRIX_D)) {

            if (this.DSCOHModel == null) {
                clearTable();
                return;
            }
            table.setModel(DSCOHModel);
            setDefaultTableAlignment(SwingConstants.RIGHT);
        } else if (result.equals(FHAESResult.BINARY_MATRIX_NTP)) {

            log.debug("doing NTP");
            if (this.NTPModel == null) {
                log.debug("fileNTP is null so clearing table");

                clearTable();
                return;
            }
            table.setModel(NTPModel);
            setDefaultTableAlignment(SwingConstants.RIGHT);
        } else if (result.equals(FHAESResult.BINARY_MATRIX_SITE)) {

            if (this.siteSummaryModel == null) {
                clearTable();
                return;
            }
            table.setModel(siteSummaryModel);
            setDefaultTableAlignment(SwingConstants.RIGHT);
        } else if (result.equals(FHAESResult.BINARY_MATRIX_TREE)) {

            if (this.treeSummaryModel == null) {
                clearTable();
                return;
            }
            table.setModel(treeSummaryModel);
            setDefaultTableAlignment(SwingConstants.RIGHT);
        }

        else if (result.equals(FHAESResult.GENERAL_SUMMARY)) {

            if (this.generalSummaryModel == null) {
                clearTable();
                return;
            }
            table.setModel(generalSummaryModel);
            setDefaultTableAlignment(SwingConstants.RIGHT);
        }

        else if (result.equals(FHAESResult.SINGLE_FILE_SUMMARY)) {

            if (this.singleFileSummaryModel == null) {
                clearTable();
                return;
            }
            table.setModel(singleFileSummaryModel);
            setDefaultTableAlignment(SwingConstants.RIGHT);
        }

        else if (result.equals(FHAESResult.SINGLE_EVENT_SUMMARY)) {

            if (this.singleEventSummaryModel == null) {
                clearTable();
                return;
            }
            table.setModel(singleEventSummaryModel);
            setDefaultTableAlignment(SwingConstants.RIGHT);
            setTableColumnAlignment(SwingConstants.LEFT, 2);
        }

        else {
            log.warn("Unhandled FHAESResult type");
            clearTable();
        }

        table.packAll();

        table.setColumnControlVisible(true);
        table.setAutoCreateRowSorter(true);

    } catch (Exception e) {
        log.debug("Caught exception loading table data");

    } finally {
        log.debug("Clearing cursor");

        table.setCursor(Cursor.getDefaultCursor());
        treeResults.setCursor(Cursor.getDefaultCursor());
    }

}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

From source file:org.p_vcd.ui.VcdDialog.java

public VcdDialog() {
    setSize(700, 450);//  w w  w  .  j a  v a  2s.c  o m
    setTitle("P-VCD - Video Copy Detection");
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    this.currentStep = 1;

    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    contentPanel.setLayout(new CardLayout(0, 0));
    {
        JPanel panel_Step1 = new JPanel();
        contentPanel.add(panel_Step1, "card_step1");
        panel_Step1.setLayout(new BorderLayout(0, 0));
        JLabel lblTitle = new JLabel("STEP 1 - Video Database (the \"known\")");
        panel_Step1.add(lblTitle, BorderLayout.NORTH);
        lblTitle.setHorizontalAlignment(SwingConstants.CENTER);
        lblTitle.setFont(new Font("Tahoma", Font.PLAIN, 18));

        JPanel panel_1 = new JPanel();
        panel_Step1.add(panel_1, BorderLayout.CENTER);
        panel_1.setLayout(new MigLayout("", "[250px,grow][20px][250px,grow]", "[][][230px,grow][][][]"));

        JLabel lblNewLabel = new JLabel("Please select the video databases to search in:");
        panel_1.add(lblNewLabel, "cell 0 0");

        panel_1.add(lbl_refDbTitle, "cell 2 1");

        JScrollPane scrollPane_1 = new JScrollPane();
        panel_1.add(scrollPane_1, "cell 0 1 1 3,grow");
        panel_refDatabasesList.setBackground(Color.WHITE);

        scrollPane_1.setViewportView(panel_refDatabasesList);
        panel_refDatabasesList.setLayout(new MigLayout("gapy 10", "[200px]", "[][]"));

        JScrollPane scrollPane = new JScrollPane();
        scrollPane.setBorder(null);
        panel_1.add(scrollPane, "cell 2 2,grow");

        scrollPane.setViewportView(lbl_refDbFiles);

        panel_1.add(lbl_refDbMetadata, "cell 2 3");

        JButton btnNewDatabase = new JButton("New database...");
        panel_1.add(btnNewDatabase, "cell 0 4");
        btnNewDatabase.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                newDatabaseButton();
            }
        });
    }
    {
        JPanel panel_Step2 = new JPanel();
        contentPanel.add(panel_Step2, "card_step2");
        panel_Step2.setLayout(new BorderLayout(0, 0));
        JLabel lblTitle = new JLabel("STEP 2 - Query (the \"unknown\")");
        panel_Step2.add(lblTitle, BorderLayout.NORTH);
        lblTitle.setHorizontalAlignment(SwingConstants.CENTER);
        lblTitle.setFont(new Font("Tahoma", Font.PLAIN, 18));

        JPanel panel = new JPanel();
        panel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Query",
                TitledBorder.LEADING, TitledBorder.TOP, null, null));
        panel_Step2.add(panel, BorderLayout.CENTER);
        panel.setLayout(
                new MigLayout("", "[160px][grow]", "[25px][grow,top][25px][grow,top][25px][grow,top][grow]"));

        ButtonGroup queryButtonGroup = new ButtonGroup();

        queryButtonGroup.add(radio_queryFile);
        radio_queryFile.setFont(new Font("Tahoma", Font.PLAIN, 13));
        panel.add(radio_queryFile, "cell 0 0");

        lbl_queryFile.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                radio_queryFile.setSelected(true);
            }
        });
        panel.add(lbl_queryFile, "flowy,cell 1 0");

        JButton btnSelectFile = new JButton("Select File...");
        btnSelectFile.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                selectFileButton();
            }
        });
        panel.add(btnSelectFile, "cell 1 0");

        JLabel lblIumageOrVideo = new JLabel("Select an image or video in the local machine.");
        panel.add(lblIumageOrVideo, "cell 1 1");

        queryButtonGroup.add(radio_queryUrl);
        radio_queryUrl.setFont(new Font("Tahoma", Font.PLAIN, 13));
        panel.add(radio_queryUrl, "cell 0 2");

        txt_queryUrl.addKeyListener(new KeyAdapter() {
            @Override
            public void keyReleased(KeyEvent e) {
                radio_queryUrl.setSelected(true);
            }
        });
        txt_queryUrl.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                radio_queryUrl.setSelected(true);
            }
        });
        txt_queryUrl.addFocusListener(new FocusAdapter() {
            @Override
            public void focusGained(FocusEvent e) {
                radio_queryUrl.setSelected(true);
            }
        });
        txt_queryUrl.setText("http://");
        panel.add(txt_queryUrl, "flowy,cell 1 2");
        txt_queryUrl.setColumns(50);

        JLabel lblUrlToA = new JLabel(
                "<html>Enter the URL to download an image or video.<br>You can use a URL like: http://www.youtube.com/watch?v=... </html>");
        panel.add(lblUrlToA, "flowy,cell 1 3");

        queryButtonGroup.add(radio_queryDb);
        radio_queryDb.setFont(new Font("Tahoma", Font.PLAIN, 13));
        panel.add(radio_queryDb, "cell 0 4");

        comboBox_queryDb.setMaximumRowCount(12);
        comboBox_queryDb.setPreferredSize(new Dimension(100, 20));
        comboBox_queryDb.setMinimumSize(new Dimension(100, 20));
        comboBox_queryDb.addPropertyChangeListener(new PropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent evt) {
                if (comboBox_queryDb.getSelectedIndex() > 0)
                    radio_queryDb.setSelected(true);
                updateQueryDbDetail();
            }
        });
        comboBox_queryDb.addKeyListener(new KeyAdapter() {
            @Override
            public void keyReleased(KeyEvent e) {
                if (comboBox_queryDb.getSelectedIndex() > 0)
                    radio_queryDb.setSelected(true);
                updateQueryDbDetail();
            }
        });

        panel.add(comboBox_queryDb, "flowx,cell 1 4");

        panel.add(lbl_queryDb, "cell 1 4");

        JLabel lblPleaseNopteThe = new JLabel("<html>A search is run for each video in the database.</html>");
        panel.add(lblPleaseNopteThe, "cell 1 5");

    }
    {
        JPanel panel_Step3 = new JPanel();
        contentPanel.add(panel_Step3, "card_step3");
        panel_Step3.setLayout(new BorderLayout(0, 0));

        JLabel lblTitle = new JLabel("STEP 3 - Search Options");
        lblTitle.setFont(new Font("Tahoma", Font.PLAIN, 18));
        lblTitle.setHorizontalAlignment(SwingConstants.CENTER);
        panel_Step3.add(lblTitle, BorderLayout.NORTH);

        JPanel panel2 = new JPanel();
        panel2.setLayout(new FlowLayout());
        panel_Step3.add(panel2, BorderLayout.CENTER);
        JPanel panel = new JPanel();
        panel2.add(panel);
        panel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Basic Options",
                TitledBorder.LEADING, TitledBorder.TOP, null, null));
        panel.setLayout(new MigLayout("gapy 5px", "[30px][101px]", "[][][][][][][20px]"));

        ButtonGroup buttonGroup = new ButtonGroup();

        buttonGroup.add(radio_searchByGlobal);
        radio_searchByGlobal.setFont(new Font("Tahoma", Font.PLAIN, 13));
        radio_searchByGlobal.setSelected(true);
        panel.add(radio_searchByGlobal, "cell 0 0 2 1,alignx left,aligny top");

        JLabel lblNewLabel_2 = new JLabel(
                "Detects most of the copies that are visually alike to the original.");
        panel.add(lblNewLabel_2, "cell 1 1");

        JButton btnOptions = new JButton("Advanced Options...");
        btnOptions.setEnabled(false);
        panel.add(btnOptions, "cell 1 2");

        buttonGroup.add(radio_searchByLocal);
        radio_searchByLocal.setFont(new Font("Tahoma", Font.PLAIN, 13));
        panel.add(radio_searchByLocal, "cell 0 4 2 1,alignx left,aligny top");

        JLabel lblNewLabel_3 = new JLabel(
                "Requires more resources (disk space, search time, memory) but can detect more copies.");
        panel.add(lblNewLabel_3, "cell 1 5");

        JButton btnOptions_1 = new JButton("Advanced Options...");
        btnOptions_1.setEnabled(false);
        panel.add(btnOptions_1, "cell 1 6");

    }
    {
        JPanel panel_Step4 = new JPanel();
        contentPanel.add(panel_Step4, "card_step4");
        panel_Step4.setLayout(new BorderLayout(0, 0));

        JLabel lblTitle = new JLabel("STEP 4 - Search");
        lblTitle.setHorizontalAlignment(SwingConstants.CENTER);
        lblTitle.setFont(new Font("Tahoma", Font.PLAIN, 18));
        panel_Step4.add(lblTitle, BorderLayout.NORTH);

        JScrollPane scrollPane = new JScrollPane();
        panel_Step4.add(scrollPane, BorderLayout.CENTER);

        textConsole.setFont(new Font("Monospaced", Font.PLAIN, 11));
        textConsole.setForeground(Color.WHITE);
        textConsole.setBackground(Color.BLACK);
        textConsole.setEditable(false);
        textConsole.setCursor(new Cursor(Cursor.TEXT_CURSOR));
        textConsole.setText(
                "Press 'Next' button to start the search...\nNote: Depending on the selected options, the search may take up to several hours.");
        scrollPane.setViewportView(textConsole);

        JPanel panel = new JPanel();
        panel_Step4.add(panel, BorderLayout.SOUTH);
        panel.setLayout(new GridLayout(0, 1, 0, 0));

        JSeparator separator = new JSeparator();
        separator.setPreferredSize(new Dimension(0, 1));
        panel.add(separator);
        progressBar.setStringPainted(true);
        progressBar.setPreferredSize(new Dimension(350, 20));
        panel.add(progressBar);

        lblProgress.setHorizontalAlignment(SwingConstants.CENTER);
        lblProgress.setFont(new Font("Tahoma", Font.PLAIN, 14));
        panel.add(lblProgress);
    }
    {
        JPanel panel_Step5 = new JPanel();
        contentPanel.add(panel_Step5, "card_step5");
        panel_Step5.setLayout(new BorderLayout(0, 0));

        JLabel lblTitle = new JLabel("STEP 5 - Results");
        lblTitle.setHorizontalAlignment(SwingConstants.CENTER);
        lblTitle.setFont(new Font("Tahoma", Font.PLAIN, 18));
        panel_Step5.add(lblTitle, BorderLayout.NORTH);

        JScrollPane scrollPane = new JScrollPane();
        panel_Step5.add(scrollPane, BorderLayout.CENTER);

        scrollPane.setViewportView(panelResults);
        panelResults.setLayout(new MigLayout("gapy 10, gapx 20",
                "[120px,center][150px,center,grow][150px,center,grow]", "[25px][]"));

    }
    {
        JPanel buttonPane = new JPanel();
        buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
        getContentPane().add(buttonPane, BorderLayout.SOUTH);
        {
            JButton prevButton = new JButton("Previous");
            prevButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    previousButton();
                }
            });
            prevButton.setActionCommand("Previous");
            buttonPane.add(prevButton);
        }
        {
            JButton okButton = new JButton("Next");
            okButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    nextButton();
                }
            });
            okButton.setActionCommand("OK");
            buttonPane.add(okButton);
            getRootPane().setDefaultButton(okButton);
        }
        {
            JButton cancelButton = new JButton("Cancel");
            cancelButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    cancelButton();
                }
            });
            cancelButton.setActionCommand("Cancel");
            buttonPane.add(cancelButton);
        }
    }
    this.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosed(WindowEvent e) {
            closeWindow();
        }
    });
    updateDatabases(null);
}

From source file:org.tellervo.desktop.io.ImportDialog.java

private void initGui() {
    setTitle("Import to Database");
    setBounds(100, 100, 804, 734);//  w w  w  .  j av a  2 s  .c om

    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    contentPanel.setLayout(new BorderLayout(0, 0));
    {
        horizSplitPane = new JSplitPane();
        horizSplitPane.setOneTouchExpandable(true);
        horizSplitPane.setBorder(null);
        horizSplitPane.setDividerLocation(0.4);
        contentPanel.add(horizSplitPane);
        {
            splitPaneVert = new JSplitPane();
            splitPaneVert.setOneTouchExpandable(true);
            splitPaneVert.setBorder(null);
            splitPaneVert.setOrientation(JSplitPane.VERTICAL_SPLIT);
            horizSplitPane.setLeftComponent(splitPaneVert);
            {
                panelTreeTable = new JPanel();
                panelTreeTable.setBorder(new TitledBorder(null, "TRiDaS Representation", TitledBorder.LEADING,
                        TitledBorder.TOP, null, null));
                splitPaneVert.setLeftComponent(panelTreeTable);
                panelTreeTable.setLayout(new BorderLayout(0, 0));
                {
                    JButton btnSetFromDB = new JButton("Set current entity from database");
                    panelTreeTable.add(btnSetFromDB, BorderLayout.SOUTH);
                }
            }
            {
                panelWarnings = new JPanel();
                panelWarnings.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null),
                        "Warnings", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
                splitPaneVert.setRightComponent(panelWarnings);
                panelWarnings.setLayout(new BorderLayout(0, 0));
                {
                    JScrollPane scrollPane = new JScrollPane();
                    panelWarnings.add(scrollPane, BorderLayout.CENTER);
                    {
                        tblWarnings = new JTable();
                        scrollPane.setViewportView(tblWarnings);
                    }
                }
            }
        }
        {
            tabbedPane = new JTabbedPane(JTabbedPane.TOP);
            tabbedPane.setBorder(null);
            horizSplitPane.setRightComponent(tabbedPane);
            {
                JPanel panelMetadata = new JPanel();
                panelMetadata.setLayout(new BorderLayout());
                initPropertiesPanel();

                panelMetadata.add(propertiesPanel, BorderLayout.CENTER);
                tabbedPane.addTab("Metadata", null, panelMetadata, null);

            }
            {
                JPanel panelData = new JPanel();
                tabbedPane.addTab("Data", null, panelData, null);
                tabbedPane.setEnabledAt(1, false);
            }
            {
                panelOrigFile = new JPanel();
                tabbedPane.addTab("Original file", null, panelOrigFile, null);
                panelOrigFile.setLayout(new BorderLayout(0, 0));
                {
                    DefaultSyntaxKit.initKit();

                }
                {
                    JScrollPane scrollPane = new JScrollPane();
                    panelOrigFile.add(scrollPane, BorderLayout.CENTER);

                    originalFilePane = new JTextArea();
                    scrollPane.setViewportView(originalFilePane);
                    originalFilePane.setEditable(false);
                    originalFilePane.setFont(new java.awt.Font("Courier", 0, 12));
                }
            }
        }
    }
    {
        JPanel buttonPane = new JPanel();
        buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
        getContentPane().add(buttonPane, BorderLayout.SOUTH);
        {
            JButton button = new JButton("Finish");
            buttonPane.add(button);
        }
    }
}