Example usage for javax.swing JTree JTree

List of usage examples for javax.swing JTree JTree

Introduction

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

Prototype

public JTree() 

Source Link

Document

Returns a JTree with a sample model.

Usage

From source file:com.peterbochs.sourceleveldebugger.SourceLevelDebugger3.java

private void initGUI() {
    try {/*ww w .j a  v a 2 s  . c om*/
        this.setPreferredSize(new java.awt.Dimension(975, 563));
        {
            jMainSplitPane = new JSplitPane();
            this.add(getJErrorLabel(), "errorLabel");
            this.add(jMainSplitPane, "MAIN");
            jMainSplitPane.setDividerLocation(200);
            {
                jPanel4 = new JPanel();
                jMainSplitPane.add(jPanel4, JSplitPane.RIGHT);
                BorderLayout jPanel4Layout = new BorderLayout();
                jPanel4.setLayout(jPanel4Layout);
                {
                    jSplitPane3 = new JSplitPane();
                    jPanel4.add(jSplitPane3, BorderLayout.CENTER);
                    jSplitPane3.setOrientation(JSplitPane.VERTICAL_SPLIT);
                    jSplitPane3.setDividerLocation(500);
                    {
                        jPanel6 = new JPanel();
                        jSplitPane3.add(jPanel6, JSplitPane.TOP);
                        jSplitPane3.add(getJInfoTabbedPane(), JSplitPane.BOTTOM);
                        BorderLayout jPanel6Layout = new BorderLayout();
                        jPanel6.setLayout(jPanel6Layout);
                        {
                            jMainTabbedPane = new JMaximizableTabbedPane();
                            jPanel6.add(jMainTabbedPane, BorderLayout.CENTER);
                            {
                                jASMPanel = new JPanel();
                                jMainTabbedPane.addTab(MyLanguage.getString("ASM/C"), null, jASMPanel, null);
                                jMainTabbedPane.addTab("Dwarf", null, getJDwarfPanel(), null);
                                jMainTabbedPane.addTab("Code base", null, getCodeBasePanel(), null);
                                jMainTabbedPane.addTab("Call Graph", null, getCallGraphPanel(), null);
                                BorderLayout jASMPanelLayout = new BorderLayout();
                                jASMPanel.setLayout(jASMPanelLayout);
                                {
                                    instructionTableScrollPane = new JScrollPane();
                                    instructionTableScrollPane.getVerticalScrollBar()
                                            .addAdjustmentListener(new AdjustmentListener() {
                                                boolean isRunning;

                                                public void adjustmentValueChanged(AdjustmentEvent evt) {
                                                    /*   JScrollBar vbar = (JScrollBar) evt.getSource();
                                                            
                                                       if (evt.getValueIsAdjusting()) {
                                                          return;
                                                       }
                                                       if ((vbar.getValue() + vbar.getVisibleAmount()) == vbar.getMaximum()) {
                                                          if (!isRunning) {
                                                             try {
                                                                isRunning = true;
                                                                final CardLayout cl = (CardLayout) (peterBochsDebugger.jMainPanel.getLayout());
                                                                cl.show(peterBochsDebugger.jMainPanel, "Running Label");
                                                                //                                             new Thread("update instruction thread") {
                                                                //                                                public void run() {
                                                                //                                                   long address = Long.parseLong(instructionTable.getValueAt(instructionTable.getRowCount() - 1, 1).toString()
                                                                //                                                         .substring(2), 16);
                                                                //                                                   peterBochsDebugger.updateInstruction(address, true);
                                                                //                                                   peterBochsDebugger.updateBreakpointTableColor();
                                                                ////                                                   cl.show(peterBochsDebugger.jMainPanel, peterBochsDebugger.currentPanel);
                                                                //
                                                                //                                                   isRunning = false;
                                                                //                                                }
                                                                //                                             }.start();
                                                            
                                                             } catch (Exception ex) {
                                                             }
                                                          }
                                                            
                                                       }*/
                                                }

                                            });
                                    jASMPanel.add(instructionTableScrollPane, BorderLayout.CENTER);
                                    {
                                        instructionTable = new JTable();
                                        instructionTableScrollPane.setViewportView(instructionTable);
                                        instructionTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
                                        instructionTable
                                                .setModel(PeterBochsDebugger.instructionTable.getModel());
                                        instructionTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
                                        instructionTable.getTableHeader().setReorderingAllowed(false);
                                        instructionTable.getColumnModel().getColumn(0).setMaxWidth(20);
                                        instructionTable.getColumnModel().getColumn(1).setPreferredWidth(40);
                                        instructionTable.getColumnModel().getColumn(2).setPreferredWidth(200);
                                        instructionTable.getColumnModel().getColumn(3).setPreferredWidth(40);
                                        instructionTable.setShowGrid(false);
                                        instructionTable.setDefaultRenderer(String.class,
                                                new InstructionTableCellRenderer());
                                        instructionTable.addMouseListener(new MouseAdapter() {
                                            public void mouseClicked(MouseEvent evt) {
                                                instructionTableMouseClicked(evt);
                                            }
                                        });
                                    }
                                }
                                {
                                    jInstructionControlPanel = new JPanel();
                                    jASMPanel.add(jInstructionControlPanel, BorderLayout.NORTH);
                                    {
                                        jInstructionComboBox = new JComboBox();
                                        jInstructionControlPanel.add(jInstructionComboBox);
                                        jInstructionComboBox.setEditable(true);
                                        jInstructionComboBox.addActionListener(new ActionListener() {
                                            public void actionPerformed(ActionEvent evt) {
                                                jInstructionComboBoxActionPerformed(evt);
                                            }
                                        });
                                    }
                                    {
                                        disassembleButton = new JButton();
                                        jInstructionControlPanel.add(disassembleButton);
                                        disassembleButton.setText(MyLanguage.getString("Disassemble"));
                                        disassembleButton.addActionListener(new ActionListener() {
                                            public void actionPerformed(ActionEvent evt) {
                                                disassembleButtonActionPerformed(evt);
                                            }
                                        });
                                    }
                                    {
                                        disassembleCSEIPButton = new JButton();
                                        jInstructionControlPanel.add(disassembleCSEIPButton);
                                        disassembleCSEIPButton
                                                .setText(MyLanguage.getString("Disassemble") + " cs:eip");
                                        disassembleCSEIPButton.setEnabled(true);
                                        disassembleCSEIPButton.addActionListener(new ActionListener() {
                                            public void actionPerformed(ActionEvent evt) {
                                                disassembleCSEIPButtonActionPerformed(evt);
                                            }
                                        });
                                    }
                                    {
                                        jInstructionUpTenButton = new JButton();
                                        jInstructionControlPanel.add(jInstructionUpTenButton);
                                        jInstructionUpTenButton
                                                .setIcon(new ImageIcon(getClass().getClassLoader().getResource(
                                                        "com/peterbochs/icons/famfam_icons/arrow_up10.png")));
                                        jInstructionUpTenButton.addActionListener(new ActionListener() {
                                            public void actionPerformed(ActionEvent evt) {
                                                jInstructionUpTenButtonActionPerformed(evt);
                                            }
                                        });
                                    }
                                    {
                                        jInstructionUpButton = new JButton();
                                        jInstructionControlPanel.add(jInstructionUpButton);
                                        jInstructionUpButton
                                                .setIcon(new ImageIcon(getClass().getClassLoader().getResource(
                                                        "com/peterbochs/icons/famfam_icons/arrow_up1.png")));
                                        jInstructionUpButton.addActionListener(new ActionListener() {
                                            public void actionPerformed(ActionEvent evt) {
                                                jInstructionUpButtonActionPerformed(evt);
                                            }
                                        });
                                    }
                                    {
                                        jInstructionDownButton = new JButton();
                                        jInstructionControlPanel.add(jInstructionDownButton);
                                        jInstructionDownButton
                                                .setIcon(new ImageIcon(getClass().getClassLoader().getResource(
                                                        "com/peterbochs/icons/famfam_icons/arrow_down.png")));
                                        jInstructionDownButton.addActionListener(new ActionListener() {
                                            public void actionPerformed(ActionEvent evt) {
                                                jInstructionDownButtonActionPerformed(evt);
                                            }
                                        });
                                    }
                                    {
                                        jDiskButton = new JButton();
                                        jInstructionControlPanel.add(jDiskButton);
                                        jDiskButton.setIcon(new ImageIcon(getClass().getClassLoader()
                                                .getResource("com/peterbochs/icons/famfam_icons/disk.png")));
                                        jDiskButton.addActionListener(new ActionListener() {
                                            public void actionPerformed(ActionEvent evt) {
                                                jButton3ActionPerformed(evt);
                                            }
                                        });
                                    }
                                    {
                                        jExcelButton = new JButton();
                                        jInstructionControlPanel.add(jExcelButton);
                                        jInstructionControlPanel.add(getJSearchTextField());
                                        jExcelButton.setIcon(new ImageIcon(getClass().getClassLoader()
                                                .getResource("com/peterbochs/icons/famfam_icons/excel.gif")));
                                        {
                                            btnSearch = new JButton("Search");
                                            jInstructionControlPanel.add(btnSearch);
                                            btnSearch.addActionListener(new ActionListener() {
                                                public void actionPerformed(ActionEvent evt) {
                                                    btnSearchActionPerformed(evt);
                                                }
                                            });
                                        }
                                        {
                                            onOffButton = new OnOffButton();
                                            onOffButton.setSelected(true);
                                            onOffButton.addItemListener(new ItemListener() {
                                                public void itemStateChanged(ItemEvent e) {
                                                    InstructionTableModel model = (InstructionTableModel) PeterBochsDebugger.instructionTable
                                                            .getModel();
                                                    if (e.getStateChange() == ItemEvent.SELECTED) {
                                                        model.showAsmLevel = true;
                                                    } else {
                                                        model.showAsmLevel = false;
                                                    }
                                                    model.fireTableDataChanged();
                                                }
                                            });
                                            onOffButton.setPreferredSize(new Dimension(53, 18));
                                            jInstructionControlPanel.add(onOffButton);
                                        }
                                        jExcelButton.addActionListener(new ActionListener() {
                                            public void actionPerformed(ActionEvent evt) {
                                                jButton12ActionPerformed(evt);
                                            }
                                        });
                                    }
                                }
                            }
                        }
                    }
                }
            }
            {
                jPanel1 = new JPanel();
                jMainSplitPane.add(jPanel1, JSplitPane.LEFT);
                BorderLayout jPanel1Layout = new BorderLayout();
                jPanel1.setLayout(jPanel1Layout);
                {
                    jTabbedPane1 = new JMaximizableTabbedPane();
                    jPanel1.add(jTabbedPane1, BorderLayout.CENTER);
                    jTabbedPane1.addChangeListener(new ChangeListener() {
                        public void stateChanged(ChangeEvent evt) {
                            jTabbedPane1StateChanged(evt);
                        }
                    });
                    {
                        jPanel3 = new JPanel();
                        BorderLayout jPanel3Layout = new BorderLayout();
                        jPanel3.setLayout(jPanel3Layout);
                        jTabbedPane1.addTab("Symbol", null, getSymbolTablePanel(), null);
                        jTabbedPane1.addTab(MyLanguage.getString("Project"), null, jPanel3, null);
                        {
                            jScrollPane1 = new JScrollPane();
                            jPanel3.add(jScrollPane1, BorderLayout.CENTER);
                            jPanel3.add(getJProjectToolBar(), BorderLayout.NORTH);
                            {
                                projectTree = new JTree();
                                jScrollPane1.setViewportView(projectTree);
                                projectTree.setModel(projectFilterTreeModel);
                                projectTree.setShowsRootHandles(true);
                                projectTree.setCellRenderer(new ProjectTreeRenderer());
                                projectTree.addMouseListener(new MouseAdapter() {
                                    public void mouseClicked(MouseEvent evt) {
                                        projectTreeMouseClicked(evt);
                                    }
                                });
                            }
                        }
                    }
                }
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

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  .ja  v  a 2s .  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:net.sf.jabref.gui.FindUnlinkedFilesDialog.java

/**
 * Initializes the visible components in this dialog.
 *///from   ww  w . j  a v  a  2 s  . co m
private void initComponents() {

    this.addComponentListener(dialogPositionListener);
    /* Interrupts the searchThread by setting the State-Array to 0 */
    this.addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent e) {
            threadState.set(false);
        }
    });

    panelDirectory = new JPanel();
    panelSearchArea = new JPanel();
    panelFiles = new JPanel();
    panelOptions = new JPanel();
    panelEntryTypesSelection = new JPanel();
    panelButtons = new JPanel();
    panelImportArea = new JPanel();

    buttonBrowse = new JButton(Localization.lang("Browse"));
    buttonBrowse.setMnemonic('B');
    buttonBrowse.setToolTipText(Localization.lang("Opens the file browser."));
    buttonScan = new JButton(Localization.lang("Scan directory"));
    buttonScan.setMnemonic('S');
    buttonScan.setToolTipText(Localization.lang("Searches the selected directory for unlinked files."));
    buttonApply = new JButton(Localization.lang("Apply"));
    buttonApply.setMnemonic('I');
    buttonApply.setToolTipText(Localization.lang("Starts the import of BibTeX entries."));
    buttonClose = new JButton(Localization.lang("Close"));
    buttonClose.setToolTipText(Localization.lang("Leave this dialog."));
    buttonClose.setMnemonic('C');

    /* Options for the TreeView */
    buttonOptionSelectAll = new JButton();
    buttonOptionSelectAll.setMnemonic('A');
    buttonOptionSelectAll.setAction(actionSelectAll);
    buttonOptionUnselectAll = new JButton();
    buttonOptionUnselectAll.setMnemonic('U');
    buttonOptionUnselectAll.setAction(actionUnselectAll);
    buttonOptionExpandAll = new JButton();
    buttonOptionExpandAll.setMnemonic('E');
    buttonOptionExpandAll.setAction(actionExpandTree);
    buttonOptionCollapseAll = new JButton();
    buttonOptionCollapseAll.setMnemonic('L');
    buttonOptionCollapseAll.setAction(actionCollapseTree);

    checkboxCreateKeywords = new JCheckBox(Localization.lang("Create directory based keywords"));
    checkboxCreateKeywords
            .setToolTipText(Localization.lang("Creates keywords in created entrys with directory pathnames"));
    checkboxCreateKeywords.setSelected(checkBoxWhyIsThereNoGetSelectedStupidSwing);
    checkboxCreateKeywords.addItemListener(
            e -> checkBoxWhyIsThereNoGetSelectedStupidSwing = !checkBoxWhyIsThereNoGetSelectedStupidSwing);

    textfieldDirectoryPath = new JTextField();
    textfieldDirectoryPath
            .setText(lastSelectedDirectory == null ? "" : lastSelectedDirectory.toAbsolutePath().toString());

    labelDirectoryDescription = new JLabel(
            Localization.lang("Select a directory where the search shall start."));
    labelFileTypesDescription = new JLabel(Localization.lang("Select file type:"));
    labelFilesDescription = new JLabel(Localization.lang("These files are not linked in the active database."));
    labelEntryTypeDescription = new JLabel(Localization.lang("Entry type to be created:"));
    labelSearchingDirectoryInfo = new JLabel(Localization.lang("Searching file system..."));
    labelSearchingDirectoryInfo.setHorizontalAlignment(JTextField.CENTER);
    labelSearchingDirectoryInfo.setVisible(false);
    labelImportingInfo = new JLabel(Localization.lang("Importing into Database..."));
    labelImportingInfo.setHorizontalAlignment(JTextField.CENTER);
    labelImportingInfo.setVisible(false);

    tree = new JTree();
    scrollpaneTree = new JScrollPane(tree);
    scrollpaneTree.setWheelScrollingEnabled(true);

    progressBarSearching = new JProgressBar();
    progressBarSearching.setIndeterminate(true);
    progressBarSearching.setVisible(false);
    progressBarSearching.setStringPainted(true);

    progressBarImporting = new JProgressBar();
    progressBarImporting.setIndeterminate(false);
    progressBarImporting.setVisible(false);
    progressBarImporting.setStringPainted(true);

}

From source file:com.t3.client.ui.T3Frame.java

private JComponent createTokenTreePanel() {
    final JTree tree = new JTree();
    tokenPanelTreeModel = new TokenPanelTreeModel(tree);
    tree.setModel(tokenPanelTreeModel);/*from   w  ww.j  a va2 s  .  c o m*/
    tree.setCellRenderer(new TokenPanelTreeCellRenderer());
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
    tree.addMouseListener(new MouseAdapter() {
        // TODO: Make this a handler class, not an aic
        @Override
        public void mousePressed(MouseEvent e) {
            // tree.setSelectionPath(tree.getPathForLocation(e.getX(), e.getY()));
            TreePath path = tree.getPathForLocation(e.getX(), e.getY());
            if (path == null) {
                return;
            }
            Object row = path.getLastPathComponent();
            int rowIndex = tree.getRowForLocation(e.getX(), e.getY());
            if (SwingUtilities.isLeftMouseButton(e)) {
                if (!SwingUtil.isShiftDown(e)) {
                    tree.clearSelection();
                }
                tree.addSelectionInterval(rowIndex, rowIndex);

                if (row instanceof Token) {
                    if (e.getClickCount() == 2) {
                        Token token = (Token) row;
                        getCurrentZoneRenderer().clearSelectedTokens();
                        getCurrentZoneRenderer().centerOn(new ZonePoint(token.getX(), token.getY()));

                        // Pick an appropriate tool
                        getToolbox().setSelectedTool(token.isToken() ? PointerTool.class : StampTool.class);
                        getCurrentZoneRenderer().setActiveLayer(token.getLayer());
                        getCurrentZoneRenderer().selectToken(token.getId());
                        getCurrentZoneRenderer().requestFocusInWindow();
                    }
                }
            }
            if (SwingUtilities.isRightMouseButton(e)) {
                if (!isRowSelected(tree.getSelectionRows(), rowIndex) && !SwingUtil.isShiftDown(e)) {
                    tree.clearSelection();
                    tree.addSelectionInterval(rowIndex, rowIndex);
                }
                final int x = e.getX();
                final int y = e.getY();
                EventQueue.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        Token firstToken = null;
                        Set<GUID> selectedTokenSet = new HashSet<GUID>();
                        for (TreePath path : tree.getSelectionPaths()) {
                            if (path.getLastPathComponent() instanceof Token) {
                                Token token = (Token) path.getLastPathComponent();
                                if (firstToken == null) {
                                    firstToken = token;
                                }
                                if (AppUtil.playerOwns(token)) {
                                    selectedTokenSet.add(token.getId());
                                }
                            }
                        }
                        if (!selectedTokenSet.isEmpty()) {
                            try {
                                if (firstToken.isStamp()) {
                                    new StampPopupMenu(selectedTokenSet, x, y, getCurrentZoneRenderer(),
                                            firstToken).showPopup(tree);
                                } else {
                                    new TokenPopupMenu(selectedTokenSet, x, y, getCurrentZoneRenderer(),
                                            firstToken).showPopup(tree);
                                }
                            } catch (IllegalComponentStateException icse) {
                                log.info(tree.toString(), icse);
                            }
                        }
                    }
                });
            }
        }
    });
    TabletopTool.getEventDispatcher().addListener(new AppEventListener() {
        @Override
        public void handleAppEvent(AppEvent event) {
            tokenPanelTreeModel.setZone((Zone) event.getNewValue());
        }
    }, TabletopTool.ZoneEvent.Activated);
    return tree;
}

From source file:net.rptools.maptool.client.ui.MapToolFrame.java

private JComponent createDrawTreePanel() {
    final JTree tree = new JTree();
    drawablesPanel = new DrawablesPanel();
    drawPanelTreeModel = new DrawPanelTreeModel(tree);
    tree.setModel(drawPanelTreeModel);/*from   w  w  w .j  a  v a 2 s.c om*/
    tree.setCellRenderer(new DrawPanelTreeCellRenderer());
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);

    JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    splitPane.setContinuousLayout(true);

    splitPane.setTopComponent(new JScrollPane(tree));
    splitPane.setBottomComponent(drawablesPanel);
    splitPane.setDividerLocation(100);
    // Add mouse Event for right click menu
    tree.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent e) {
            TreePath path = tree.getPathForLocation(e.getX(), e.getY());
            if (path == null) {
                return;
            }
            Object row = path.getLastPathComponent();
            int rowIndex = tree.getRowForLocation(e.getX(), e.getY());
            if (SwingUtilities.isLeftMouseButton(e)) {
                if (!SwingUtil.isShiftDown(e) && !SwingUtil.isControlDown(e)) {
                    tree.clearSelection();
                }
                tree.addSelectionInterval(rowIndex, rowIndex);
                if (row instanceof DrawnElement) {
                    if (e.getClickCount() == 2) {
                        DrawnElement de = (DrawnElement) row;
                        getCurrentZoneRenderer()
                                .centerOn(new ZonePoint((int) de.getDrawable().getBounds().getCenterX(),
                                        (int) de.getDrawable().getBounds().getCenterY()));
                    }
                }

                int[] treeRows = tree.getSelectionRows();
                java.util.Arrays.sort(treeRows);
                drawablesPanel.clearSelectedIds();
                for (int i = 0; i < treeRows.length; i++) {
                    TreePath p = tree.getPathForRow(treeRows[i]);
                    if (p.getLastPathComponent() instanceof DrawnElement) {
                        DrawnElement de = (DrawnElement) p.getLastPathComponent();
                        drawablesPanel.addSelectedId(de.getDrawable().getId());
                    }
                }
            }
            if (SwingUtilities.isRightMouseButton(e)) {
                if (!isRowSelected(tree.getSelectionRows(), rowIndex) && !SwingUtil.isShiftDown(e)) {
                    tree.clearSelection();
                    tree.addSelectionInterval(rowIndex, rowIndex);
                    drawablesPanel.clearSelectedIds();
                }
                final int x = e.getX();
                final int y = e.getY();
                EventQueue.invokeLater(new Runnable() {
                    public void run() {
                        DrawnElement firstElement = null;
                        Set<GUID> selectedDrawSet = new HashSet<GUID>();
                        for (TreePath path : tree.getSelectionPaths()) {
                            if (path.getLastPathComponent() instanceof DrawnElement) {
                                DrawnElement de = (DrawnElement) path.getLastPathComponent();
                                if (firstElement == null) {
                                    firstElement = de;
                                }
                                selectedDrawSet.add(de.getDrawable().getId());
                            }
                        }
                        if (!selectedDrawSet.isEmpty()) {
                            try {
                                new DrawPanelPopupMenu(selectedDrawSet, x, y, getCurrentZoneRenderer(),
                                        firstElement).showPopup(tree);
                            } catch (IllegalComponentStateException icse) {
                                log.info(tree.toString(), icse);
                            }
                        }
                    }
                });
            }
        }

    });
    // Add Zone Change event
    MapTool.getEventDispatcher().addListener(new AppEventListener() {
        public void handleAppEvent(AppEvent event) {
            drawPanelTreeModel.setZone((Zone) event.getNewValue());
        }
    }, MapTool.ZoneEvent.Activated);
    return splitPane;
}

From source file:net.rptools.maptool.client.ui.MapToolFrame.java

private JComponent createTokenTreePanel() {
    final JTree tree = new JTree();
    tokenPanelTreeModel = new TokenPanelTreeModel(tree);
    tree.setModel(tokenPanelTreeModel);/*from ww w .  j av  a  2  s .  c o m*/
    tree.setCellRenderer(new TokenPanelTreeCellRenderer());
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
    tree.addMouseListener(new MouseAdapter() {
        // TODO: Make this a handler class, not an aic
        @Override
        public void mousePressed(MouseEvent e) {
            // tree.setSelectionPath(tree.getPathForLocation(e.getX(), e.getY()));
            TreePath path = tree.getPathForLocation(e.getX(), e.getY());
            if (path == null) {
                return;
            }
            Object row = path.getLastPathComponent();
            int rowIndex = tree.getRowForLocation(e.getX(), e.getY());
            if (SwingUtilities.isLeftMouseButton(e)) {
                if (!SwingUtil.isShiftDown(e) && !SwingUtil.isControlDown(e)) {
                    tree.clearSelection();
                }
                tree.addSelectionInterval(rowIndex, rowIndex);

                if (row instanceof Token) {
                    if (e.getClickCount() == 2) {
                        Token token = (Token) row;
                        getCurrentZoneRenderer().clearSelectedTokens();
                        getCurrentZoneRenderer().centerOn(new ZonePoint(token.getX(), token.getY()));

                        // Pick an appropriate tool
                        getToolbox().setSelectedTool(token.isToken() ? PointerTool.class : StampTool.class);
                        getCurrentZoneRenderer().setActiveLayer(token.getLayer());
                        getCurrentZoneRenderer().selectToken(token.getId());
                        getCurrentZoneRenderer().requestFocusInWindow();
                    }
                }
            }
            if (SwingUtilities.isRightMouseButton(e)) {
                if (!isRowSelected(tree.getSelectionRows(), rowIndex) && !SwingUtil.isShiftDown(e)) {
                    tree.clearSelection();
                    tree.addSelectionInterval(rowIndex, rowIndex);
                }
                final int x = e.getX();
                final int y = e.getY();
                EventQueue.invokeLater(new Runnable() {
                    public void run() {
                        Token firstToken = null;
                        Set<GUID> selectedTokenSet = new HashSet<GUID>();
                        for (TreePath path : tree.getSelectionPaths()) {
                            if (path.getLastPathComponent() instanceof Token) {
                                Token token = (Token) path.getLastPathComponent();
                                if (firstToken == null) {
                                    firstToken = token;
                                }
                                if (AppUtil.playerOwns(token)) {
                                    selectedTokenSet.add(token.getId());
                                }
                            }
                        }
                        if (!selectedTokenSet.isEmpty()) {
                            try {
                                if (firstToken.isStamp()) {
                                    new StampPopupMenu(selectedTokenSet, x, y, getCurrentZoneRenderer(),
                                            firstToken).showPopup(tree);
                                } else {
                                    new TokenPopupMenu(selectedTokenSet, x, y, getCurrentZoneRenderer(),
                                            firstToken).showPopup(tree);
                                }
                            } catch (IllegalComponentStateException icse) {
                                log.info(tree.toString(), icse);
                            }
                        }
                    }
                });
            }
        }
    });
    MapTool.getEventDispatcher().addListener(new AppEventListener() {
        public void handleAppEvent(AppEvent event) {
            tokenPanelTreeModel.setZone((Zone) event.getNewValue());
        }
    }, MapTool.ZoneEvent.Activated);
    return tree;
}

From source file:op.care.med.structure.PnlMed.java

/**
 * This method is called from within the constructor to
 * initialize the form./*from   w  w  w.  j av a 2s  . 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() {
    jScrollPane1 = new JScrollPane();
    treeMed = new JTree();
    panel1 = new JPanel();
    label1 = new JLabel();

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

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

        //---- treeMed ----
        treeMed.setFont(new Font("Arial", Font.PLAIN, 14));
        treeMed.addMouseListener(new MouseAdapter() {
            @Override
            public void mousePressed(MouseEvent e) {
                treeMedMousePressed(e);
            }
        });
        jScrollPane1.setViewportView(treeMed);
    }
    add(jScrollPane1, "card1");

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

        //---- label1 ----
        label1.setText("text");
        label1.setIcon(null);
        panel1.add(label1);
    }
    add(panel1, "card2");
}

From source file:org.apache.jackrabbit.oak.explorer.NodeStoreTree.java

NodeStoreTree(ExplorerBackend backend, JTextArea log, boolean skipSizeCheck) throws IOException {
    super(new GridLayout(1, 0));
    this.backend = backend;
    this.log = log;
    this.skipSizeCheck = skipSizeCheck;

    tree = new JTree();
    tree.getSelectionModel().setSelectionMode(SINGLE_TREE_SELECTION);
    tree.setShowsRootHandles(true);//  w ww .  j  a v  a 2s .c  o m
    tree.addTreeSelectionListener(this);
    tree.setExpandsSelectedPaths(true);

    refreshStore();
    refreshModel();

    JScrollPane scrollPane = new JScrollPane(tree);
    add(scrollPane);
}

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

/**
 * Set up the AnalysisResults GUI//from  w  w  w .j  a  v a 2  s.  c  o  m
 */
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.objectpocket.viewer.Viewer.java

/**
 * Initialize the contents of the frame.
 *//*from   w ww  . j a v a2  s  .  c  o  m*/
private void initialize() {
    viewerFrame = new JFrame();
    viewerFrame.setTitle("ObjectPocketViewer");
    viewerFrame.setBounds(100, 100, 1427, 524);
    viewerFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    splitPane = new JSplitPane();
    splitPane.setResizeWeight(0.2);
    viewerFrame.getContentPane().add(splitPane, BorderLayout.CENTER);

    classTree = new JTree();
    classTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    classTree.addTreeSelectionListener(new TreeSelectionListener() {
        public void valueChanged(TreeSelectionEvent e) {
            updateTable();
        }
    });
    splitPane.setLeftComponent(classTree);

    panel = new JPanel();
    splitPane.setRightComponent(panel);
    panel.setLayout(new BorderLayout(0, 0));

    scrollPane = new JScrollPane();
    panel.add(scrollPane);
    objectTable = new JTable();
    objectTable.setAutoCreateRowSorter(true);
    objectTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    scrollPane.setViewportView(objectTable);
    panel.add(scrollPane, BorderLayout.CENTER);

    filterPanel = new JPanel();
    panel.add(filterPanel, BorderLayout.NORTH);
    filterPanel.setLayout(new BorderLayout(0, 0));

    filterTextField = new JTextField();
    filterTextField.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            if (e.getKeyChar() == KeyEvent.VK_ENTER) {
                updateTable();
            }
        }
    });
    filterPanel.add(filterTextField, BorderLayout.CENTER);
    filterTextField.setColumns(10);

    filterButton = new JButton("apply filter");
    filterButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updateTable();
        }
    });
    filterPanel.add(filterButton, BorderLayout.EAST);

    statusLabel = new JLabel("");
    panel.add(statusLabel, BorderLayout.SOUTH);

}