Example usage for javax.swing SwingConstants CENTER

List of usage examples for javax.swing SwingConstants CENTER

Introduction

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

Prototype

int CENTER

To view the source code for javax.swing SwingConstants CENTER.

Click Source Link

Document

The central position in an area.

Usage

From source file:cool.pandora.modeller.ui.jpanel.base.BagView.java

/**
 * createBagTagButtonPanel./*from ww w.j a  v  a 2 s . c  o  m*/
 *
 * @return buttonPanel
 */
private JPanel createBagTagButtonPanel() {

    final JPanel buttonPanel = new JPanel();

    final ShowTagFilesHandler showTageFileHandler = new ShowTagFilesHandler(this);
    addTagFileHandler = new AddTagFileHandler(this);
    removeTagFileHandler = new RemoveTagFileHandler(this);

    buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 2, 2));

    viewTagFilesToolbarAction = new JLabel("");
    viewTagFilesToolbarAction.setEnabled(false);
    viewTagFilesToolbarAction.setHorizontalAlignment(SwingConstants.CENTER);
    viewTagFilesToolbarAction.setBorder(new LineBorder(viewTagFilesToolbarAction.getBackground(), 1));
    viewTagFilesToolbarAction.setIcon(getPropertyImage("Bag_ViewTagFile.icon"));
    viewTagFilesToolbarAction.setToolTipText(getMessage("bagView.TagFilesTree.viewfile" + ".tooltip"));

    viewTagFilesToolbarAction.addMouseListener(new MouseAdapter() {

        @Override
        public void mousePressed(final MouseEvent e) {
            if (viewTagFilesToolbarAction.isEnabled()) {
                showTageFileHandler.actionPerformed(null);
            }
        }

        @Override
        public void mouseExited(final MouseEvent e) {
            viewTagFilesToolbarAction.setBorder(new LineBorder(viewTagFilesToolbarAction.getBackground(), 1));
        }

        @Override
        public void mouseEntered(final MouseEvent e) {
            if (viewTagFilesToolbarAction.isEnabled()) {
                viewTagFilesToolbarAction.setBorder(new LineBorder(Color.GRAY, 1));
            }
        }
    });
    buttonPanel.add(viewTagFilesToolbarAction);

    addTagFileToolBarAction = new JLabel("");
    addTagFileToolBarAction.setEnabled(false);
    addTagFileToolBarAction.setHorizontalAlignment(SwingConstants.CENTER);
    addTagFileToolBarAction.setBorder(new LineBorder(addTagFileToolBarAction.getBackground(), 1));
    addTagFileToolBarAction.setIcon(getPropertyImage("Bag_Content.add.icon"));
    addTagFileToolBarAction.setToolTipText(getMessage("bagView.TagFilesTree.addbutton" + ".tooltip"));

    addTagFileToolBarAction.addMouseListener(new MouseAdapter() {

        @Override
        public void mousePressed(final MouseEvent e) {
            if (addTagFileToolBarAction.isEnabled()) {
                addTagFileHandler.actionPerformed(null);
            }
        }

        @Override
        public void mouseExited(final MouseEvent e) {
            addTagFileToolBarAction.setBorder(new LineBorder(addTagFileToolBarAction.getBackground(), 1));
        }

        @Override
        public void mouseEntered(final MouseEvent e) {
            if (addTagFileToolBarAction.isEnabled()) {
                addTagFileToolBarAction.setBorder(new LineBorder(Color.GRAY, 1));
            }
        }
    });
    buttonPanel.add(addTagFileToolBarAction);

    removeTagFileToolbarAction = new JLabel("");
    removeTagFileToolbarAction.setEnabled(false);
    removeTagFileToolbarAction.setHorizontalAlignment(SwingConstants.CENTER);
    removeTagFileToolbarAction.setBorder(new LineBorder(removeTagFileToolbarAction.getBackground(), 1));
    removeTagFileToolbarAction.setIcon(getPropertyImage("Bag_Content.minus.icon"));
    removeTagFileToolbarAction.setToolTipText(getMessage("bagView.TagFilesTree.remove" + ".tooltip"));

    buttonPanel.add(removeTagFileToolbarAction);
    removeTagFileToolbarAction.addMouseListener(new MouseAdapter() {

        @Override
        public void mousePressed(final MouseEvent e) {
            if (removeTagFileToolbarAction.isEnabled()) {
                removeTagFileHandler.actionPerformed(null);
            }
        }

        @Override
        public void mouseExited(final MouseEvent e) {
            removeTagFileToolbarAction.setBorder(new LineBorder(removeTagFileToolbarAction.getBackground(), 1));
        }

        @Override
        public void mouseEntered(final MouseEvent e) {
            if (removeTagFileToolbarAction.isEnabled()) {
                removeTagFileToolbarAction.setBorder(new LineBorder(Color.GRAY, 1));
            }
        }
    });

    final JLabel spacerLabel = new JLabel("    ");
    buttonPanel.add(spacerLabel);

    addTagFileHandler = new AddTagFileHandler(this);
    removeTagFileHandler = new RemoveTagFileHandler(this);

    return buttonPanel;
}

From source file:dictionary.GUI.GUI_Main.java

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor.//  ww  w  .j  av a2  s. co m
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    frameMean = new javax.swing.JFrame();
    jScrollPane1 = new javax.swing.JScrollPane();
    fieldMean = new javax.swing.JEditorPane();
    buttonEdit = new javax.swing.JButton();
    buttonSave = new javax.swing.JButton();
    buttonDelete = new javax.swing.JButton();
    buttonExit = new javax.swing.JButton();
    frameEntries = new javax.swing.JFrame();
    jScrollPane3 = new javax.swing.JScrollPane();
    listEntries = new javax.swing.JList();
    frameAdd = new javax.swing.JFrame();
    fieldAddWord = new javax.swing.JTextField();
    jScrollPane2 = new javax.swing.JScrollPane();
    fieldAddMean = new javax.swing.JEditorPane();
    buttonAdd2 = new javax.swing.JButton();
    labelWord = new javax.swing.JLabel();
    buttonCloseAdd = new javax.swing.JButton();
    frameSetting = new javax.swing.JFrame();
    panelVoice = new javax.swing.JPanel();
    button1 = new javax.swing.JRadioButton();
    button2 = new javax.swing.JRadioButton();
    buttonCloseSetting = new javax.swing.JButton();
    buttonAboutUs = new javax.swing.JButton();
    buttonGroup1 = new javax.swing.ButtonGroup();
    frameCo = new javax.swing.JFrame();
    jLabel3 = new javax.swing.JLabel();
    jLabel4 = new javax.swing.JLabel();
    jLabel5 = new javax.swing.JLabel();
    jLabel6 = new javax.swing.JLabel();
    jLabel7 = new javax.swing.JLabel();
    jLabel8 = new javax.swing.JLabel();
    main = new javax.swing.JPanel();
    comboBoxEV = new javax.swing.JComboBox();
    fieldWord = new javax.swing.JTextField();
    labelDic = new javax.swing.JLabel();
    labelAuthor = new javax.swing.JLabel();
    buttonAdd = new javax.swing.JButton();
    buttonSetting = new javax.swing.JButton();
    traonl = new javax.swing.JButton();
    comboBoxOnl = new javax.swing.JComboBox();
    buttonSpeech = new javax.swing.JButton();
    buttonUndo = new javax.swing.JButton();
    buttonFind = new javax.swing.JButton();

    frameMean.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    frameMean.setTitle("Mean");
    frameMean.setLocation(new java.awt.Point(780, 0));
    frameMean.setName("frameMean"); // NOI18N
    frameMean.setUndecorated(true);
    frameMean.setSize(new java.awt.Dimension(500, 400));

    fieldMean.setEditable(false);
    fieldMean.setBackground(new java.awt.Color(204, 255, 204));
    fieldMean.setContentType("text/html"); // NOI18N
    fieldMean.setAutoscrolls(false);
    fieldMean.addKeyListener(new java.awt.event.KeyAdapter() {
        public void keyPressed(java.awt.event.KeyEvent evt) {
            fieldMeanKeyPressed(evt);
        }
    });
    jScrollPane1.setViewportView(fieldMean);

    buttonEdit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dictionary/images/edit.png"))); // NOI18N
    buttonEdit.setText("Edit");
    buttonEdit.setBorder(null);
    buttonEdit.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonEditActionPerformed(evt);
        }
    });

    buttonSave.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dictionary/images/save.png"))); // NOI18N
    buttonSave.setText("Save");
    buttonSave.setBorder(null);
    buttonSave.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonSaveActionPerformed(evt);
        }
    });

    buttonDelete.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dictionary/images/delete.png"))); // NOI18N
    buttonDelete.setText("Delete");
    buttonDelete.setBorder(null);
    buttonDelete.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonDeleteActionPerformed(evt);
        }
    });

    buttonExit.setText("Thot");
    buttonExit.setBorder(null);
    buttonExit.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonExitActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout frameMeanLayout = new javax.swing.GroupLayout(frameMean.getContentPane());
    frameMean.getContentPane().setLayout(frameMeanLayout);
    frameMeanLayout
            .setHorizontalGroup(
                    frameMeanLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(
                                    frameMeanLayout.createSequentialGroup().addContainerGap()
                                            .addComponent(buttonEdit, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    97, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGap(27, 27, 27)
                                            .addComponent(buttonDelete, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    97, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                    36, Short.MAX_VALUE)
                                            .addComponent(buttonSave, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    97, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGap(18, 18, 18)
                                            .addComponent(buttonExit, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    97, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGap(18, 18, 18))
                            .addComponent(jScrollPane1));
    frameMeanLayout.setVerticalGroup(frameMeanLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(frameMeanLayout.createSequentialGroup()
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 348,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(frameMeanLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(buttonEdit, javax.swing.GroupLayout.PREFERRED_SIZE, 34,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(buttonDelete, javax.swing.GroupLayout.PREFERRED_SIZE, 34,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(buttonSave, javax.swing.GroupLayout.PREFERRED_SIZE, 34,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(buttonExit, javax.swing.GroupLayout.PREFERRED_SIZE, 34,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    frameEntries.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    frameEntries.setTitle("Entries");
    frameEntries.setAlwaysOnTop(true);
    frameEntries.setAutoRequestFocus(false);
    frameEntries.setLocation(new java.awt.Point(320, 300));
    frameEntries.setName("frameEntries"); // NOI18N
    frameEntries.setUndecorated(true);
    frameEntries.setResizable(false);
    frameEntries.setSize(new java.awt.Dimension(180, 220));

    listEntries.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N
    listEntries.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
    listEntries.setAutoscrolls(false);
    listEntries.setVerifyInputWhenFocusTarget(false);
    listEntries.setVisibleRowCount(6);
    listEntries.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            listEntriesMouseClicked(evt);
        }
    });
    listEntries.addKeyListener(new java.awt.event.KeyAdapter() {
        public void keyPressed(java.awt.event.KeyEvent evt) {
            listEntriesKeyPressed(evt);
        }
    });
    jScrollPane3.setViewportView(listEntries);

    javax.swing.GroupLayout frameEntriesLayout = new javax.swing.GroupLayout(frameEntries.getContentPane());
    frameEntries.getContentPane().setLayout(frameEntriesLayout);
    frameEntriesLayout.setHorizontalGroup(
            frameEntriesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(
                    jScrollPane3, javax.swing.GroupLayout.Alignment.TRAILING,
                    javax.swing.GroupLayout.DEFAULT_SIZE, 454, Short.MAX_VALUE));
    frameEntriesLayout
            .setVerticalGroup(frameEntriesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE));

    frameAdd.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    frameAdd.setTitle("Add Word");
    frameAdd.setLocation(new java.awt.Point(300, 100));
    frameAdd.setUndecorated(true);
    frameAdd.setSize(new java.awt.Dimension(451, 375));
    frameAdd.addWindowListener(new java.awt.event.WindowAdapter() {
        public void windowClosed(java.awt.event.WindowEvent evt) {
            frameAddWindowClosed(evt);
        }
    });

    fieldAddMean.setBorder(javax.swing.BorderFactory.createTitledBorder(
            javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), "Mean"));
    jScrollPane2.setViewportView(fieldAddMean);

    buttonAdd2.setText("Add");
    buttonAdd2.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonAdd2ActionPerformed(evt);
        }
    });

    labelWord.setText("Word");

    buttonCloseAdd.setText("Close");
    buttonCloseAdd.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonCloseAddActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout frameAddLayout = new javax.swing.GroupLayout(frameAdd.getContentPane());
    frameAdd.getContentPane().setLayout(frameAddLayout);
    frameAddLayout.setHorizontalGroup(frameAddLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, frameAddLayout.createSequentialGroup()
                    .addContainerGap(33, Short.MAX_VALUE)
                    .addGroup(frameAddLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 409,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(frameAddLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addGroup(frameAddLayout.createSequentialGroup().addComponent(labelWord)
                                            .addGap(29, 29, 29).addComponent(fieldAddWord,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 341,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(frameAddLayout.createSequentialGroup()
                                            .addComponent(buttonAdd2, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    61, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGap(32, 32, 32).addComponent(buttonCloseAdd,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 69,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGap(22, 22, 22)));
    frameAddLayout.setVerticalGroup(frameAddLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(frameAddLayout.createSequentialGroup().addGap(17, 17, 17)
                    .addGroup(frameAddLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(fieldAddWord, javax.swing.GroupLayout.PREFERRED_SIZE, 29,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(labelWord))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 26, Short.MAX_VALUE)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 228,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(18, 18, 18)
                    .addGroup(frameAddLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(buttonAdd2, javax.swing.GroupLayout.PREFERRED_SIZE, 39,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(buttonCloseAdd, javax.swing.GroupLayout.PREFERRED_SIZE, 39,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap()));

    jScrollPane2.getAccessibleContext().setAccessibleName("");
    jScrollPane2.getAccessibleContext().setAccessibleDescription("");
    jScrollPane2.getAccessibleContext().setAccessibleParent(frameMean);

    frameSetting.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    frameSetting.setTitle("Settings");
    frameSetting.setAlwaysOnTop(true);
    frameSetting.setLocation(new java.awt.Point(200, 100));
    frameSetting.setUndecorated(true);
    frameSetting.setSize(new java.awt.Dimension(400, 200));
    frameSetting.addWindowListener(new java.awt.event.WindowAdapter() {
        public void windowClosed(java.awt.event.WindowEvent evt) {
            frameSettingWindowClosed(evt);
        }
    });

    panelVoice.setBorder(javax.swing.BorderFactory.createTitledBorder("Voice"));

    buttonGroup1.add(button1);
    button1.setSelected(true);
    button1.setText("Female");
    button1.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            button1ItemStateChanged(evt);
        }
    });

    buttonGroup1.add(button2);
    button2.setText("Male");
    button2.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            button1ItemStateChanged(evt);
        }
    });

    javax.swing.GroupLayout panelVoiceLayout = new javax.swing.GroupLayout(panelVoice);
    panelVoice.setLayout(panelVoiceLayout);
    panelVoiceLayout.setHorizontalGroup(panelVoiceLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelVoiceLayout.createSequentialGroup().addGap(70, 70, 70).addComponent(button1)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 110, Short.MAX_VALUE)
                    .addComponent(button2).addGap(82, 82, 82)));
    panelVoiceLayout
            .setVerticalGroup(panelVoiceLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                            panelVoiceLayout.createSequentialGroup().addContainerGap(22, Short.MAX_VALUE)
                                    .addGroup(panelVoiceLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(button1).addComponent(button2))
                                    .addGap(36, 36, 36)));

    buttonCloseSetting.setText("Close");
    buttonCloseSetting.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonCloseSettingActionPerformed(evt);
        }
    });

    buttonAboutUs.setText("About Us");
    buttonAboutUs.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
    buttonAboutUs.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonAboutUsActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout frameSettingLayout = new javax.swing.GroupLayout(frameSetting.getContentPane());
    frameSetting.getContentPane().setLayout(frameSettingLayout);
    frameSettingLayout.setHorizontalGroup(frameSettingLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                    frameSettingLayout.createSequentialGroup().addContainerGap()
                            .addComponent(panelVoice, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                    frameSettingLayout.createSequentialGroup().addGap(28, 28, 28)
                            .addComponent(buttonAboutUs, javax.swing.GroupLayout.PREFERRED_SIZE, 81,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(buttonCloseSetting).addGap(31, 31, 31)));
    frameSettingLayout.setVerticalGroup(frameSettingLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(frameSettingLayout.createSequentialGroup().addGap(24, 24, 24)
                    .addComponent(panelVoice, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(frameSettingLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(buttonAboutUs, javax.swing.GroupLayout.PREFERRED_SIZE, 38,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(buttonCloseSetting, javax.swing.GroupLayout.PREFERRED_SIZE, 38,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(23, Short.MAX_VALUE)));

    frameCo.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    frameCo.setTitle("Author");
    frameCo.setAlwaysOnTop(true);
    frameCo.setLocation(new java.awt.Point(200, 100));
    frameCo.setSize(new java.awt.Dimension(433, 255));
    frameCo.addWindowListener(new java.awt.event.WindowAdapter() {
        public void windowClosed(java.awt.event.WindowEvent evt) {
            frameCoWindowClosed(evt);
        }
    });

    jLabel3.setBackground(new java.awt.Color(0, 102, 102));
    jLabel3.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
    jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel3.setText("Dictionary version 1.0");

    jLabel4.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
    jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel4.setText("Trn ?c Ton");

    jLabel5.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
    jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel5.setText("Phm Minh ?c");

    jLabel6.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
    jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel6.setText("Nguyn ?nh Phi");
    jLabel6.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);

    jLabel7.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
    jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel7.setText("Phm Th Thu H?ng");

    jLabel8.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
    jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel8.setText("Trnh Vn Thi");
    jLabel8.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);

    javax.swing.GroupLayout frameCoLayout = new javax.swing.GroupLayout(frameCo.getContentPane());
    frameCo.getContentPane().setLayout(frameCoLayout);
    frameCoLayout.setHorizontalGroup(frameCoLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                    Short.MAX_VALUE)
            .addComponent(jLabel8, javax.swing.GroupLayout.Alignment.TRAILING,
                    javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING,
                    javax.swing.GroupLayout.DEFAULT_SIZE, 433, Short.MAX_VALUE)
            .addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                    Short.MAX_VALUE)
            .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                    Short.MAX_VALUE)
            .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                    Short.MAX_VALUE));
    frameCoLayout.setVerticalGroup(frameCoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(frameCoLayout.createSequentialGroup()
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel3).addGap(24, 24, 24).addComponent(jLabel4)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 29,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(1, 1, 1)
                    .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 29,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(1, 1, 1)
                    .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 29,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel7,
                            javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(24, 24, 24)));

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setTitle("Dictionary English VietNam");
    setBackground(new java.awt.Color(255, 51, 0));
    setLocation(new java.awt.Point(200, 100));
    setResizable(false);
    setType(java.awt.Window.Type.POPUP);
    addWindowListener(new java.awt.event.WindowAdapter() {
        public void windowClosing(java.awt.event.WindowEvent evt) {
            formWindowClosing(evt);
        }
    });

    comboBoxEV.setBackground(new java.awt.Color(240, 240, 240));
    comboBoxEV.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
    comboBoxEV.setModel(
            new javax.swing.DefaultComboBoxModel(new String[] { "English-VietNamese", "VietNamese-English" }));
    comboBoxEV.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
    comboBoxEV.setFocusable(false);
    comboBoxEV.setRequestFocusEnabled(false);
    comboBoxEV.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            comboBoxEVItemStateChanged(evt);
        }
    });

    fieldWord.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
    fieldWord.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR));
    fieldWord.setDoubleBuffered(true);
    fieldWord.setDragEnabled(true);
    fieldWord.setFocusCycleRoot(true);
    fieldWord.setFocusTraversalPolicyProvider(true);
    fieldWord.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            fieldWordMouseClicked(evt);
        }
    });
    fieldWord.addKeyListener(new java.awt.event.KeyAdapter() {
        public void keyPressed(java.awt.event.KeyEvent evt) {
            fieldWordKeyPressed(evt);
        }

        public void keyReleased(java.awt.event.KeyEvent evt) {
            fieldWordKeyReleased(evt);
        }
    });

    labelDic.setFont(new java.awt.Font("Times New Roman", 0, 48)); // NOI18N
    labelDic.setForeground(new java.awt.Color(255, 102, 0));
    labelDic.setText("Dictionary");

    labelAuthor.setForeground(new java.awt.Color(255, 102, 0));
    labelAuthor.setText("by HTTPD");

    buttonAdd.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
    buttonAdd.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dictionary/images/add.png"))); // NOI18N
    buttonAdd.setText("Add");
    buttonAdd.setBorder(null);
    buttonAdd.setFocusPainted(false);
    buttonAdd.setMargin(new java.awt.Insets(0, 14, 0, 14));
    buttonAdd.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonAddActionPerformed(evt);
        }
    });

    buttonSetting.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
    buttonSetting.setText("Settings");
    buttonSetting.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
    buttonSetting.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonSettingActionPerformed(evt);
        }
    });

    traonl.setText("Google Transl");
    traonl.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            traonlActionPerformed(evt);
        }
    });

    comboBoxOnl.setBackground(new java.awt.Color(240, 240, 240));
    comboBoxOnl.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
    comboBoxOnl.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Offline", "Online" }));
    comboBoxOnl.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
    comboBoxOnl.setFocusable(false);
    comboBoxOnl.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            comboBoxOnlItemStateChanged(evt);
        }
    });

    buttonSpeech.setForeground(new java.awt.Color(255, 255, 255));
    buttonSpeech.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dictionary/images/speak.png"))); // NOI18N
    buttonSpeech.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonSpeechActionPerformed(evt);
        }
    });

    buttonUndo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dictionary/images/Undo.png"))); // NOI18N
    buttonUndo.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonUndoActionPerformed(evt);
        }
    });

    buttonFind.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dictionary/images/find.png"))); // NOI18N
    buttonFind.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            buttonFindActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout mainLayout = new javax.swing.GroupLayout(main);
    main.setLayout(mainLayout);
    mainLayout.setHorizontalGroup(mainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainLayout.createSequentialGroup()
                    .addGroup(mainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(buttonSetting, javax.swing.GroupLayout.Alignment.TRAILING,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    Short.MAX_VALUE)
                            .addComponent(buttonAdd, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(traonl, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(mainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(fieldWord, javax.swing.GroupLayout.PREFERRED_SIZE, 270,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(mainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addGroup(mainLayout.createSequentialGroup().addComponent(labelDic)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(labelAuthor))
                                    .addGroup(mainLayout.createSequentialGroup()
                                            .addComponent(comboBoxEV, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    164, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(comboBoxOnl, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    91, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(mainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(mainLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(buttonSpeech, javax.swing.GroupLayout.PREFERRED_SIZE, 49,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(buttonFind, javax.swing.GroupLayout.PREFERRED_SIZE, 0,
                                            Short.MAX_VALUE))
                            .addComponent(buttonUndo, javax.swing.GroupLayout.Alignment.TRAILING,
                                    javax.swing.GroupLayout.PREFERRED_SIZE, 49,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap()));
    mainLayout.setVerticalGroup(mainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainLayout.createSequentialGroup()
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(buttonAdd, javax.swing.GroupLayout.PREFERRED_SIZE, 50,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(buttonSetting, javax.swing.GroupLayout.PREFERRED_SIZE, 49,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(
                            traonl, javax.swing.GroupLayout.PREFERRED_SIZE, 51,
                            javax.swing.GroupLayout.PREFERRED_SIZE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, mainLayout.createSequentialGroup()
                    .addGroup(mainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(labelDic).addComponent(labelAuthor))
                    .addGap(0, 33, Short.MAX_VALUE).addGroup(
                            mainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(mainLayout.createSequentialGroup().addGroup(mainLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(
                                                    comboBoxEV, javax.swing.GroupLayout.PREFERRED_SIZE, 38,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(comboBoxOnl, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    35, javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addGap(0, 0, Short.MAX_VALUE))
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, mainLayout
                                            .createSequentialGroup().addGap(0, 0, Short.MAX_VALUE)
                                            .addGroup(mainLayout
                                                    .createParallelGroup(
                                                            javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                                            mainLayout.createSequentialGroup().addComponent(
                                                                    buttonUndo,
                                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 36,
                                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                    .addGap(6, 6, 6)
                                                                    .addComponent(
                                                                            buttonFind,
                                                                            javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                            38,
                                                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                    .addPreferredGap(
                                                                            javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                                    .addComponent(buttonSpeech,
                                                                            javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                            38,
                                                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                    .addGap(5, 5, 5))
                                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                                            mainLayout.createSequentialGroup().addComponent(
                                                                    fieldWord,
                                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 76,
                                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                    .addContainerGap()))))));

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
            .addComponent(main, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                    javax.swing.GroupLayout.PREFERRED_SIZE));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(
            main, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
            javax.swing.GroupLayout.PREFERRED_SIZE));

    pack();
}

From source file:gov.nih.nci.nbia.StandaloneDMV3.java

/**
 * Create the panel./* w  ww  .j a  v  a  2  s  .  c om*/
 */
private JPanel createloginPanelV2() {
    JPanel contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(36, 36, 36, 36));
    contentPane.setLayout(null);

    JPanel loginUserPanel = new JPanel();
    loginUserPanel.setBounds(40, 91, 825, 306);
    contentPane.add(loginUserPanel);
    loginUserPanel
            .setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, new Color(153, 180, 209), null),
                    "", TitledBorder.CENTER, TitledBorder.TOP, null, new Color(0, 120, 215)));
    loginUserPanel.setLayout(null);

    JLabel lblNewLabel_1 = new JLabel("User Name");
    lblNewLabel_1.setBounds(70, 80, 118, 36);
    loginUserPanel.add(lblNewLabel_1);

    JButton submitBtn = new JButton(SubmitBtnLbl);
    submitBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            userId = userNameFld.getText();
            password = passwdFld.getText();
            if ((userId.length() < 1) || (password.length() < 1)) {
                setStatus(statusLbl, "Please enter a valid user name and password.", Color.red);
            } else {
                setStatus(statusLbl, "Checking your access permission...", Color.blue);
                SwingUtilities.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        submitRequest(userId, password);
                    }
                });
            }
        }
    });
    submitBtn.setBounds(606, 238, 140, 36);
    loginUserPanel.add(submitBtn);

    userNameFld = new JTextField();
    userNameFld.setBounds(200, 80, 333, 36);
    loginUserPanel.add(userNameFld);
    userNameFld.setColumns(10);

    JLabel lblPassword = new JLabel("Password");
    lblPassword.setBounds(70, 156, 118, 36);
    loginUserPanel.add(lblPassword);

    passwdFld = new JPasswordField();
    passwdFld.setBounds(200, 156, 333, 36);
    loginUserPanel.add(passwdFld);

    statusLbl = new JLabel("");
    statusLbl.setBounds(70, 226, 524, 36);
    statusLbl.setFont(new Font("SansSerif", Font.PLAIN, 13));
    statusLbl.setVerticalAlignment(SwingConstants.BOTTOM);
    loginUserPanel.add(statusLbl);

    JLabel versionLabel = new JLabel("Release " + DownloaderProperties.getAppVersion() + " Build \""
            + DownloaderProperties.getBuildTime() + "\"");
    versionLabel.setHorizontalAlignment(SwingConstants.CENTER);
    versionLabel.setForeground(new Color(70, 130, 180));
    versionLabel.setBounds(318, 427, 266, 20);
    contentPane.add(versionLabel);

    JLabel infoLbl = new JLabel(
            "This download contains restricted data. Log in or contact the help desk for access.");
    infoLbl.setForeground(new Color(105, 105, 105));
    infoLbl.setFont(new Font("SansSerif", Font.BOLD, 13));
    infoLbl.setBounds(40, 34, 796, 42);
    contentPane.add(infoLbl);

    JLabel helpDeskLbl;

    helpDeskLbl = new JLabel();
    ImageIcon image = new ImageIcon(this.getClass().getClassLoader().getResource("info.png"));
    helpDeskLbl = new JLabel(image);
    helpDeskLbl.setToolTipText("Click to get phone number/email address of the Help Desk.");
    helpDeskLbl.setBounds(826, 20, 36, 36);
    contentPane.add(helpDeskLbl);

    helpDeskLbl.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            System.out.println("mouse clicked");
            //BrowserLauncher.openUrl(DownloaderProperties.getHelpDeskUrl());
            BrowserLauncher.openUrlForHelpDesk();
        }

    });

    userNameFld.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            passwdFld.requestFocus();
        }
    });

    userNameFld.addFocusListener(new FocusListener() {

        @Override
        public void focusGained(FocusEvent e) {
            statusLbl.setText("");
        }

        @Override
        public void focusLost(FocusEvent e) {
        }
    });

    passwdFld.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            userId = userNameFld.getText();
            password = passwdFld.getText();
            if ((userId.length() < 1) || (password.length() < 1)) {
                setStatus(statusLbl, "Please enter a valid user name and password.", Color.red);
            } else {
                setStatus(statusLbl, "Checking your access permission...", Color.blue);
                SwingUtilities.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        submitRequest(userId, password);
                    }
                });
            }
        }
    });

    passwdFld.addFocusListener(new FocusListener() {

        @Override
        public void focusGained(FocusEvent e) {
            statusLbl.setText("");
        }

        @Override
        public void focusLost(FocusEvent e) {
        }
    });

    return contentPane;
}

From source file:com.mirth.connect.client.ui.ChannelSetup.java

/**
 * Makes the destination table with a parameter that is true if a new destination should be
 * added as well.//from w ww.  j a v a 2  s . c  om
 */
public void makeDestinationTable(boolean addNew) {
    List<Connector> destinationConnectors;
    Object[][] tableData;
    int tableSize;

    destinationConnectors = currentChannel.getDestinationConnectors();
    tableSize = destinationConnectors.size();

    if (addNew) {
        tableSize++;
    }

    int chain = 1;

    tableData = new Object[tableSize][5];

    for (int i = 0; i < tableSize; i++) {
        if (tableSize - 1 == i && addNew) {
            Connector connector = makeNewConnector(true);

            // Set the default inbound and outbound dataType and properties
            String dataType = currentChannel.getSourceConnector().getTransformer().getOutboundDataType();
            // Use a different properties object for the inbound and outbound
            DataTypeProperties defaultInboundProperties = LoadedExtensions.getInstance().getDataTypePlugins()
                    .get(dataType).getDefaultProperties();
            DataTypeProperties defaultOutboundProperties = LoadedExtensions.getInstance().getDataTypePlugins()
                    .get(dataType).getDefaultProperties();
            DataTypeProperties defaultResponseInboundProperties = LoadedExtensions.getInstance()
                    .getDataTypePlugins().get(dataType).getDefaultProperties();
            DataTypeProperties defaultResponseOutboundProperties = LoadedExtensions.getInstance()
                    .getDataTypePlugins().get(dataType).getDefaultProperties();

            connector.getTransformer().setInboundDataType(dataType);
            connector.getTransformer().setInboundProperties(defaultInboundProperties);
            connector.getTransformer().setOutboundDataType(dataType);
            connector.getTransformer().setOutboundProperties(defaultOutboundProperties);
            connector.getResponseTransformer().setInboundDataType(dataType);
            connector.getResponseTransformer().setInboundProperties(defaultResponseInboundProperties);
            connector.getResponseTransformer().setOutboundDataType(dataType);
            connector.getResponseTransformer().setOutboundProperties(defaultResponseOutboundProperties);

            connector.setName(getNewDestinationName(tableSize));
            connector.setTransportName(DESTINATION_DEFAULT);

            // We need to add the destination first so that the metadata ID is initialized.
            currentChannel.addDestination(connector);

            if (connector.isEnabled()) {
                tableData[i][0] = new CellData(
                        new ImageIcon(
                                com.mirth.connect.client.ui.Frame.class.getResource("images/bullet_blue.png")),
                        UIConstants.ENABLED_STATUS);
            } else {
                tableData[i][0] = new CellData(
                        new ImageIcon(
                                com.mirth.connect.client.ui.Frame.class.getResource("images/bullet_black.png")),
                        UIConstants.DISABLED_STATUS);
            }
            tableData[i][1] = connector.getName();
            tableData[i][2] = connector.getMetaDataId();
            tableData[i][3] = new ConnectorTypeData(destinationConnectors.get(i).getTransportName());

            if (i > 0 && !connector.isWaitForPrevious()) {
                chain++;
            }

            tableData[i][4] = chain;
        } else {

            if (destinationConnectors.get(i).isEnabled()) {
                tableData[i][0] = new CellData(
                        new ImageIcon(
                                com.mirth.connect.client.ui.Frame.class.getResource("images/bullet_blue.png")),
                        UIConstants.ENABLED_STATUS);
            } else {
                tableData[i][0] = new CellData(
                        new ImageIcon(
                                com.mirth.connect.client.ui.Frame.class.getResource("images/bullet_black.png")),
                        UIConstants.DISABLED_STATUS);
            }
            tableData[i][1] = destinationConnectors.get(i).getName();
            tableData[i][2] = destinationConnectors.get(i).getMetaDataId();
            tableData[i][3] = new ConnectorTypeData(destinationConnectors.get(i).getTransportName());

            if (i > 0 && !destinationConnectors.get(i).isWaitForPrevious()) {
                chain++;
            }

            tableData[i][4] = chain;
        }
    }

    destinationTable = new MirthTable();

    destinationTable.setModel(new javax.swing.table.DefaultTableModel(tableData,
            new String[] { STATUS_COLUMN_NAME, DESTINATION_COLUMN_NAME, METADATA_COLUMN_NAME,
                    CONNECTOR_TYPE_COLUMN_NAME, DESTINATION_CHAIN_COLUMN_NAME }) {

        boolean[] canEdit = new boolean[] { false, true, false, false, false };

        public boolean isCellEditable(int rowIndex, int columnIndex) {
            return canEdit[columnIndex];
        }
    });

    destinationTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);

    // Set the custom cell editor for the Destination Name column.
    destinationTable.getColumnModel()
            .getColumn(destinationTable.getColumnModel().getColumnIndex(DESTINATION_COLUMN_NAME))
            .setCellEditor(new DestinationTableCellEditor());
    destinationTable.setCustomEditorControls(true);

    // Must set the maximum width on columns that should be packed.
    destinationTable.getColumnExt(STATUS_COLUMN_NAME).setMaxWidth(UIConstants.MAX_WIDTH);
    destinationTable.getColumnExt(STATUS_COLUMN_NAME).setMinWidth(UIConstants.MIN_WIDTH);

    // Set the cell renderer for the status column.
    destinationTable.getColumnExt(STATUS_COLUMN_NAME).setCellRenderer(new ImageCellRenderer());

    // Set the maximum width and cell renderer for the metadata ID column
    destinationTable.getColumnExt(METADATA_COLUMN_NAME).setMaxWidth(UIConstants.METADATA_ID_COLUMN_WIDTH);
    destinationTable.getColumnExt(METADATA_COLUMN_NAME).setMinWidth(UIConstants.METADATA_ID_COLUMN_WIDTH);
    destinationTable.getColumnExt(METADATA_COLUMN_NAME)
            .setCellRenderer(new NumberCellRenderer(SwingConstants.CENTER, false));

    // Set the cell renderer for the destination connector type
    destinationTable.getColumnExt(CONNECTOR_TYPE_COLUMN_NAME).setCellRenderer(new ConnectorTypeCellRenderer());

    // Set the cell renderer and the max width for the destination chain column
    destinationTable.getColumnExt(DESTINATION_CHAIN_COLUMN_NAME)
            .setCellRenderer(new NumberCellRenderer(SwingConstants.CENTER, false));
    destinationTable.getColumnExt(DESTINATION_CHAIN_COLUMN_NAME).setMaxWidth(50);

    destinationTable.setSelectionMode(0);
    destinationTable.setRowSelectionAllowed(true);
    destinationTable.setRowHeight(UIConstants.ROW_HEIGHT);
    destinationTable.setFocusable(true);
    destinationTable.setSortable(false);
    destinationTable.getTableHeader().setReorderingAllowed(false);

    destinationTable.setOpaque(true);

    if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) {
        Highlighter highlighter = HighlighterFactory.createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR,
                UIConstants.BACKGROUND_COLOR);
        destinationTable.setHighlighters(highlighter);
    }

    // This action is called when a new selection is made on the destination
    // table.
    destinationTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent evt) {
            if (!evt.getValueIsAdjusting()) {
                if (lastModelIndex != -1 && lastModelIndex != destinationTable.getRowCount() && !isDeleting) {
                    Connector destinationConnector = currentChannel.getDestinationConnectors()
                            .get(lastModelIndex);

                    ConnectorProperties props = destinationConnectorPanel.getProperties();
                    ((DestinationConnectorPropertiesInterface) props).getDestinationConnectorProperties()
                            .setResourceIds(resourceIds.get(destinationConnector.getMetaDataId()));
                    destinationConnector.setProperties(props);
                }

                if (!loadConnector()) {
                    if (lastModelIndex == destinationTable.getRowCount()) {
                        destinationTable.setRowSelectionInterval(lastModelIndex - 1, lastModelIndex - 1);
                    } else {
                        destinationTable.setRowSelectionInterval(lastModelIndex, lastModelIndex);
                    }
                } else {
                    lastModelIndex = destinationTable.getSelectedModelIndex();
                }

                /*
                 * Loading the connector may have updated the current destination with incorrect
                 * properties, so after updating lastModelIndex we need to update the
                 * destination panel again.
                 */
                saveDestinationPanel();
                checkVisibleDestinationTasks();
            }
        }
    });

    destinationTable.requestFocus();

    // Mouse listener for trigger-button popup on the table.
    destinationTable.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mousePressed(java.awt.event.MouseEvent evt) {
            checkSelectionAndPopupMenu(evt);
        }

        public void mouseReleased(java.awt.event.MouseEvent evt) {
            checkSelectionAndPopupMenu(evt);
        }
    });

    // Checks to see what to set the new row selection to based on
    // last index and if a new destination was added.
    int last = lastModelIndex;

    // Select each destination in turn so that the connector types can be decorated
    for (int row = 0; row < destinationTable.getRowCount(); row++) {
        destinationTable.setRowSelectionInterval(row, row);
        destinationConnectorPanel.decorateConnectorType();
    }

    if (addNew) {
        destinationTable.setRowSelectionInterval(destinationTable.getRowCount() - 1,
                destinationTable.getRowCount() - 1);
    } else if (last == -1) {
        destinationTable.setRowSelectionInterval(0, 0); // Makes sure the
    } // event is called
      // when the table is
      // created.
    else if (last == destinationTable.getRowCount()) {
        destinationTable.setRowSelectionInterval(last - 1, last - 1);
    } else {
        destinationTable.setRowSelectionInterval(last, last);
    }

    destinationTablePane.setViewportView(destinationTable);
    destinationTablePane.setWheelScrollingEnabled(true);

    // Key Listener trigger for DEL
    destinationTable.addKeyListener(new KeyListener() {
        public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_DELETE) {
                parent.doDeleteDestination();
            }
        }

        public void keyReleased(KeyEvent e) {
        }

        public void keyTyped(KeyEvent e) {
        }
    });

    destinationTable.addMouseWheelListener(new MouseWheelListener() {

        public void mouseWheelMoved(MouseWheelEvent e) {
            destinationTablePane.getMouseWheelListeners()[0].mouseWheelMoved(e);
        }
    });
}

From source file:ca.uhn.hl7v2.testpanel.ui.TestPanelWindow.java

/**
 * Initialize the contents of the frame.
 *///from  w  ww  .  j  a v  a 2  s.c o  m
private void initialize() {
    myframe = new JFrame();
    myframe.setVisible(false);

    List<Image> l = new ArrayList<Image>();
    l.add(Toolkit.getDefaultToolkit()
            .getImage(TestPanelWindow.class.getResource("/ca/uhn/hl7v2/testpanel/images/hapi_16.png")));
    l.add(Toolkit.getDefaultToolkit()
            .getImage(TestPanelWindow.class.getResource("/ca/uhn/hl7v2/testpanel/images/hapi_64.png")));

    myframe.setIconImages(l);
    myframe.setTitle("HAPI TestPanel");
    myframe.setBounds(100, 100, 796, 603);
    myframe.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    myframe.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent theE) {
            myController.close();
        }
    });

    JMenuBar menuBar = new JMenuBar();
    myframe.setJMenuBar(menuBar);

    JMenu mnFile = new JMenu("File");
    mnFile.setMnemonic('f');
    menuBar.add(mnFile);

    JMenuItem mntmExit = new JMenuItem("Exit");
    mntmExit.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            myController.close();
        }
    });

    JMenuItem mntmNewMessage = new JMenuItem("New Message...");
    mntmNewMessage.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            myController.addMessage();
        }
    });
    mntmNewMessage.setIcon(
            new ImageIcon(TestPanelWindow.class.getResource("/ca/uhn/hl7v2/testpanel/images/message_hl7.png")));
    mnFile.add(mntmNewMessage);

    mySaveMenuItem = new JMenuItem("Save");
    mySaveMenuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_S, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    mySaveMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            doSaveMessages();
        }
    });
    mnFile.add(mySaveMenuItem);

    mySaveAsMenuItem = new JMenuItem("Save As...");
    mySaveAsMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            doSaveMessagesAs();
        }
    });
    mnFile.add(mySaveAsMenuItem);

    mymenuItem_3 = new JMenuItem("Open");
    mymenuItem_3.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_O, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    mymenuItem_3.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            myController.openMessages();
        }
    });

    myRevertToSavedMenuItem = new JMenuItem("Revert to Saved");
    myRevertToSavedMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            myController.revertMessage((Hl7V2MessageCollection) myController.getLeftSelectedItem());
        }
    });
    mnFile.add(myRevertToSavedMenuItem);
    mnFile.add(mymenuItem_3);

    myRecentFilesMenu = new JMenu("Open Recent");
    mnFile.add(myRecentFilesMenu);

    JSeparator separator = new JSeparator();
    mnFile.add(separator);
    mnFile.add(mntmExit);

    JMenu mnNewMenu = new JMenu("View");
    mnNewMenu.setMnemonic('v');
    menuBar.add(mnNewMenu);

    myShowLogConsoleMenuItem = new JMenuItem("Show Log Console");
    myShowLogConsoleMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            Prefs.getInstance().setShowLogConsole(!Prefs.getInstance().getShowLogConsole());
            updateLogScrollPaneVisibility();
            myframe.validate();
        }
    });
    mnNewMenu.add(myShowLogConsoleMenuItem);

    mymenu_1 = new JMenu("Test");
    menuBar.add(mymenu_1);

    mymenuItem_1 = new JMenuItem("Populate TestPanel with Sample Message and Connections...");
    mymenuItem_1.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            myController.populateWithSampleMessageAndConnections();
        }
    });
    mymenu_1.add(mymenuItem_1);

    mymenu_3 = new JMenu("Tools");
    menuBar.add(mymenu_3);

    mnHl7V2FileDiff = new JMenuItem("HL7 v2 File Diff...");
    mnHl7V2FileDiff.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            if (myHl7V2FileDiff == null) {
                myHl7V2FileDiff = new Hl7V2FileDiffController(myController);
            }
            myHl7V2FileDiff.show();
        }
    });
    mymenu_3.add(mnHl7V2FileDiff);

    mymenuItem_5 = new JMenuItem("HL7 v2 File Sort...");
    mymenuItem_5.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (myHl7V2FileSort == null) {
                myHl7V2FileSort = new Hl7V2FileSortController(myController);
            }
            myHl7V2FileSort.show();
        }
    });
    mymenu_3.add(mymenuItem_5);

    mymenu_2 = new JMenu("Conformance");
    menuBar.add(mymenu_2);

    mymenuItem_2 = new JMenuItem("Profiles and Tables...");
    mymenuItem_2.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            myController.showProfilesAndTablesEditor();
        }
    });
    mymenu_2.add(mymenuItem_2);

    mymenu = new JMenu("Help");
    mymenu.setMnemonic('H');
    menuBar.add(mymenu);

    mymenuItem = new JMenuItem("About HAPI TestPanel...");
    mymenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            showAboutDialog();
        }
    });
    mymenuItem.setIcon(
            new ImageIcon(TestPanelWindow.class.getResource("/ca/uhn/hl7v2/testpanel/images/hapi_16.png")));
    mymenu.add(mymenuItem);

    mymenuItem_4 = new JMenuItem("Licenses...");
    mymenuItem_4.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            new LicensesDialog().setVisible(true);
        }
    });
    mymenu.add(mymenuItem_4);
    myframe.getContentPane().setLayout(new BorderLayout(0, 0));

    JSplitPane outerSplitPane = new JSplitPane();
    outerSplitPane.setBorder(null);
    myframe.getContentPane().add(outerSplitPane);

    JSplitPane leftSplitPane = new JSplitPane();
    leftSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
    outerSplitPane.setLeftComponent(leftSplitPane);

    JPanel messagesPanel = new JPanel();
    leftSplitPane.setLeftComponent(messagesPanel);
    GridBagLayout gbl_messagesPanel = new GridBagLayout();
    gbl_messagesPanel.columnWidths = new int[] { 110, 0 };
    gbl_messagesPanel.rowHeights = new int[] { 20, 30, 118, 0, 0 };
    gbl_messagesPanel.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
    gbl_messagesPanel.rowWeights = new double[] { 0.0, 0.0, 100.0, 1.0, Double.MIN_VALUE };
    messagesPanel.setLayout(gbl_messagesPanel);

    JLabel lblMessages = new JLabel("Messages");
    GridBagConstraints gbc_lblMessages = new GridBagConstraints();
    gbc_lblMessages.insets = new Insets(0, 0, 5, 0);
    gbc_lblMessages.gridx = 0;
    gbc_lblMessages.gridy = 0;
    messagesPanel.add(lblMessages, gbc_lblMessages);

    JToolBar messagesToolBar = new JToolBar();
    messagesToolBar.setFloatable(false);
    messagesToolBar.setRollover(true);
    messagesToolBar.setAlignmentX(Component.LEFT_ALIGNMENT);
    GridBagConstraints gbc_messagesToolBar = new GridBagConstraints();
    gbc_messagesToolBar.insets = new Insets(0, 0, 5, 0);
    gbc_messagesToolBar.weightx = 1.0;
    gbc_messagesToolBar.anchor = GridBagConstraints.NORTHWEST;
    gbc_messagesToolBar.gridx = 0;
    gbc_messagesToolBar.gridy = 1;
    messagesPanel.add(messagesToolBar, gbc_messagesToolBar);

    JButton msgOpenButton = new JButton("");
    msgOpenButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            myController.openMessages();
        }
    });

    myAddMessageButton = new JButton("");
    myAddMessageButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            myController.addMessage();
        }
    });
    myAddMessageButton.setIcon(
            new ImageIcon(TestPanelWindow.class.getResource("/ca/uhn/hl7v2/testpanel/images/add.png")));
    myAddMessageButton.setToolTipText("New Message");
    myAddMessageButton.setBorderPainted(false);
    myAddMessageButton.addMouseListener(new HoverButtonMouseAdapter(myAddMessageButton));
    messagesToolBar.add(myAddMessageButton);

    myDeleteMessageButton = new JButton("");
    myDeleteMessageButton.setToolTipText("Close Selected Message");
    myDeleteMessageButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            myController.closeMessage((Hl7V2MessageCollection) myController.getLeftSelectedItem());
        }
    });
    myDeleteMessageButton.setBorderPainted(false);
    myDeleteMessageButton.addMouseListener(new HoverButtonMouseAdapter(myDeleteMessageButton));
    myDeleteMessageButton.setIcon(
            new ImageIcon(TestPanelWindow.class.getResource("/ca/uhn/hl7v2/testpanel/images/close.png")));
    messagesToolBar.add(myDeleteMessageButton);
    msgOpenButton.setBorderPainted(false);
    msgOpenButton.setToolTipText("Open Messages from File");
    msgOpenButton.setIcon(
            new ImageIcon(TestPanelWindow.class.getResource("/ca/uhn/hl7v2/testpanel/images/open.png")));
    msgOpenButton.addMouseListener(new HoverButtonMouseAdapter(msgOpenButton));
    messagesToolBar.add(msgOpenButton);

    myMsgSaveButton = new JButton("");
    myMsgSaveButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            doSaveMessages();
        }
    });
    myMsgSaveButton.setBorderPainted(false);
    myMsgSaveButton.setToolTipText("Save Selected Messages to File");
    myMsgSaveButton.setIcon(
            new ImageIcon(TestPanelWindow.class.getResource("/ca/uhn/hl7v2/testpanel/images/save.png")));
    myMsgSaveButton.addMouseListener(new HoverButtonMouseAdapter(myMsgSaveButton));
    messagesToolBar.add(myMsgSaveButton);

    myMessagesList = new JList();
    myMessagesList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (myMessagesList.getSelectedIndex() >= 0) {
                ourLog.debug("New messages selection " + myMessagesList.getSelectedIndex());
                myController.setLeftSelectedItem(myMessagesList.getSelectedValue());
                myOutboundConnectionsList.clearSelection();
                myOutboundConnectionsList.repaint();
                myInboundConnectionsList.clearSelection();
                myInboundConnectionsList.repaint();
            }
            updateLeftToolbarButtons();
        }
    });
    GridBagConstraints gbc_MessagesList = new GridBagConstraints();
    gbc_MessagesList.gridheight = 2;
    gbc_MessagesList.weightx = 1.0;
    gbc_MessagesList.weighty = 1.0;
    gbc_MessagesList.fill = GridBagConstraints.BOTH;
    gbc_MessagesList.gridx = 0;
    gbc_MessagesList.gridy = 2;
    messagesPanel.add(myMessagesList, gbc_MessagesList);

    JPanel connectionsPanel = new JPanel();
    leftSplitPane.setRightComponent(connectionsPanel);
    GridBagLayout gbl_connectionsPanel = new GridBagLayout();
    gbl_connectionsPanel.columnWidths = new int[] { 194, 0 };
    gbl_connectionsPanel.rowHeights = new int[] { 0, 30, 0, 0, 0, 0, 0 };
    gbl_connectionsPanel.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
    gbl_connectionsPanel.rowWeights = new double[] { 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, Double.MIN_VALUE };
    connectionsPanel.setLayout(gbl_connectionsPanel);

    JLabel lblConnections = new JLabel("Sending Connections");
    lblConnections.setHorizontalAlignment(SwingConstants.CENTER);
    GridBagConstraints gbc_lblConnections = new GridBagConstraints();
    gbc_lblConnections.insets = new Insets(0, 0, 5, 0);
    gbc_lblConnections.anchor = GridBagConstraints.NORTH;
    gbc_lblConnections.fill = GridBagConstraints.HORIZONTAL;
    gbc_lblConnections.gridx = 0;
    gbc_lblConnections.gridy = 0;
    connectionsPanel.add(lblConnections, gbc_lblConnections);

    JToolBar toolBar = new JToolBar();
    toolBar.setFloatable(false);
    GridBagConstraints gbc_toolBar = new GridBagConstraints();
    gbc_toolBar.insets = new Insets(0, 0, 5, 0);
    gbc_toolBar.anchor = GridBagConstraints.NORTH;
    gbc_toolBar.fill = GridBagConstraints.HORIZONTAL;
    gbc_toolBar.gridx = 0;
    gbc_toolBar.gridy = 1;
    connectionsPanel.add(toolBar, gbc_toolBar);

    myAddConnectionButton = new JButton("");
    myAddConnectionButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            myController.addOutboundConnection();
        }
    });
    myAddConnectionButton.setBorderPainted(false);
    myAddConnectionButton.addMouseListener(new HoverButtonMouseAdapter(myAddConnectionButton));
    myAddConnectionButton.setBorder(null);
    myAddConnectionButton.setToolTipText("New Connection");
    myAddConnectionButton.setIcon(
            new ImageIcon(TestPanelWindow.class.getResource("/ca/uhn/hl7v2/testpanel/images/add.png")));
    toolBar.add(myAddConnectionButton);

    myDeleteOutboundConnectionButton = new JButton("");
    myDeleteOutboundConnectionButton.setToolTipText("Delete Selected Connection");
    myDeleteOutboundConnectionButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (myController.getLeftSelectedItem() instanceof OutboundConnection) {
                myController.removeOutboundConnection((OutboundConnection) myController.getLeftSelectedItem());
            }
        }
    });
    myDeleteOutboundConnectionButton.setBorderPainted(false);
    myDeleteOutboundConnectionButton
            .addMouseListener(new HoverButtonMouseAdapter(myDeleteOutboundConnectionButton));
    myDeleteOutboundConnectionButton.setIcon(
            new ImageIcon(TestPanelWindow.class.getResource("/ca/uhn/hl7v2/testpanel/images/delete.png")));
    toolBar.add(myDeleteOutboundConnectionButton);

    myStartOneOutboundButton = new JButton("");
    myStartOneOutboundButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (myController.getLeftSelectedItem() instanceof OutboundConnection) {
                myController.startOutboundConnection((OutboundConnection) myController.getLeftSelectedItem());
            }
        }
    });
    myStartOneOutboundButton.setBorderPainted(false);
    myStartOneOutboundButton.setToolTipText("Start selected connection");
    myStartOneOutboundButton.setIcon(
            new ImageIcon(TestPanelWindow.class.getResource("/ca/uhn/hl7v2/testpanel/images/start_one.png")));
    myStartOneOutboundButton.addMouseListener(new HoverButtonMouseAdapter(myStartOneOutboundButton));
    toolBar.add(myStartOneOutboundButton);

    myStartAllOutboundButton = new JButton("");
    myStartAllOutboundButton.setBorderPainted(false);
    myStartAllOutboundButton.setToolTipText("Start all sending connections");
    myStartAllOutboundButton.setIcon(
            new ImageIcon(TestPanelWindow.class.getResource("/ca/uhn/hl7v2/testpanel/images/start_all.png")));
    myStartAllOutboundButton.addMouseListener(new HoverButtonMouseAdapter(myStartAllOutboundButton));
    myStartAllOutboundButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent theE) {
            myController.startAllOutboundConnections();
        }
    });
    toolBar.add(myStartAllOutboundButton);

    myStopAllOutboundButton = new JButton("");
    myStopAllOutboundButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            myController.stopAllOutboundConnections();
        }
    });
    myStopAllOutboundButton.setIcon(
            new ImageIcon(TestPanelWindow.class.getResource("/ca/uhn/hl7v2/testpanel/images/stop_all.png")));
    myStopAllOutboundButton.setToolTipText("Stop all sending connections");
    myStopAllOutboundButton.setBorderPainted(false);
    myStopAllOutboundButton.addMouseListener(new HoverButtonMouseAdapter(myStopAllOutboundButton));
    toolBar.add(myStopAllOutboundButton);

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

    myOutboundConnectionsList = new JList();
    myOutboundConnectionsList.setBorder(null);
    myOutboundConnectionsList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (myOutboundConnectionsList.getSelectedIndex() >= 0) {
                ourLog.debug(
                        "New outbound connection selection " + myOutboundConnectionsList.getSelectedIndex());
                myController.setLeftSelectedItem(myOutboundConnectionsList.getSelectedValue());
                myMessagesList.clearSelection();
                myMessagesList.repaint();
                myInboundConnectionsList.clearSelection();
                myInboundConnectionsList.repaint();
            }
            updateLeftToolbarButtons();
        }
    });
    scrollPane.setViewportView(myOutboundConnectionsList);

    JLabel lblReceivingConnections = new JLabel("Receiving Connections");
    lblReceivingConnections.setHorizontalAlignment(SwingConstants.CENTER);
    GridBagConstraints gbc_lblReceivingConnections = new GridBagConstraints();
    gbc_lblReceivingConnections.insets = new Insets(0, 0, 5, 0);
    gbc_lblReceivingConnections.gridx = 0;
    gbc_lblReceivingConnections.gridy = 3;
    connectionsPanel.add(lblReceivingConnections, gbc_lblReceivingConnections);

    JToolBar toolBar_1 = new JToolBar();
    toolBar_1.setFloatable(false);
    GridBagConstraints gbc_toolBar_1 = new GridBagConstraints();
    gbc_toolBar_1.anchor = GridBagConstraints.WEST;
    gbc_toolBar_1.insets = new Insets(0, 0, 5, 0);
    gbc_toolBar_1.gridx = 0;
    gbc_toolBar_1.gridy = 4;
    connectionsPanel.add(toolBar_1, gbc_toolBar_1);

    myAddInboundConnectionButton = new JButton("");
    myAddInboundConnectionButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            myController.addInboundConnection();
        }
    });
    myAddInboundConnectionButton.setIcon(
            new ImageIcon(TestPanelWindow.class.getResource("/ca/uhn/hl7v2/testpanel/images/add.png")));
    myAddInboundConnectionButton.setToolTipText("New Connection");
    myAddInboundConnectionButton.setBorderPainted(false);
    myAddInboundConnectionButton.addMouseListener(new HoverButtonMouseAdapter(myAddInboundConnectionButton));
    toolBar_1.add(myAddInboundConnectionButton);

    myDeleteInboundConnectionButton = new JButton("");
    myDeleteInboundConnectionButton.setToolTipText("Delete Selected Connection");
    myDeleteInboundConnectionButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (myController.getLeftSelectedItem() instanceof InboundConnection) {
                myController.removeInboundConnection((InboundConnection) myController.getLeftSelectedItem());
            }
        }
    });
    myDeleteInboundConnectionButton.setBorderPainted(false);
    myDeleteInboundConnectionButton
            .addMouseListener(new HoverButtonMouseAdapter(myDeleteInboundConnectionButton));
    myDeleteInboundConnectionButton.setIcon(
            new ImageIcon(TestPanelWindow.class.getResource("/ca/uhn/hl7v2/testpanel/images/delete.png")));
    toolBar_1.add(myDeleteInboundConnectionButton);

    myStartOneInboundButton = new JButton("");
    myStartOneInboundButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (myController.getLeftSelectedItem() instanceof InboundConnection) {
                myController.startInboundConnection((InboundConnection) myController.getLeftSelectedItem());
            }
        }
    });
    myStartOneInboundButton.setBorderPainted(false);
    myStartOneInboundButton.setToolTipText("Start selected connection");
    myStartOneInboundButton.setIcon(
            new ImageIcon(TestPanelWindow.class.getResource("/ca/uhn/hl7v2/testpanel/images/start_one.png")));
    myStartOneInboundButton.addMouseListener(new HoverButtonMouseAdapter(myStartOneInboundButton));
    toolBar_1.add(myStartOneInboundButton);

    myStartAllInboundButton = new JButton("");
    myStartAllInboundButton.setBorderPainted(false);
    myStartAllInboundButton.setToolTipText("Start all receiving connections");
    myStartAllInboundButton.setIcon(
            new ImageIcon(TestPanelWindow.class.getResource("/ca/uhn/hl7v2/testpanel/images/start_all.png")));
    myStartAllInboundButton.addMouseListener(new HoverButtonMouseAdapter(myStartAllInboundButton));
    myStartAllInboundButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent theE) {
            myController.startAllInboundConnections();
        }
    });
    toolBar_1.add(myStartAllInboundButton);

    myStopAllInboundButton = new JButton("");
    myStopAllInboundButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            myController.stopAllInboundConnections();
        }
    });
    myStopAllInboundButton.setIcon(
            new ImageIcon(TestPanelWindow.class.getResource("/ca/uhn/hl7v2/testpanel/images/stop_all.png")));
    myStopAllInboundButton.setToolTipText("Stop all receiving connections");
    myStopAllInboundButton.setBorderPainted(false);
    myStopAllInboundButton.addMouseListener(new HoverButtonMouseAdapter(myStopAllInboundButton));
    toolBar_1.add(myStopAllInboundButton);

    JScrollPane scrollPane_1 = new JScrollPane();
    scrollPane_1.setBorder(null);
    GridBagConstraints gbc_scrollPane_1 = new GridBagConstraints();
    gbc_scrollPane_1.fill = GridBagConstraints.BOTH;
    gbc_scrollPane_1.gridx = 0;
    gbc_scrollPane_1.gridy = 5;
    connectionsPanel.add(scrollPane_1, gbc_scrollPane_1);

    myInboundConnectionsList = new JList();
    myInboundConnectionsList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (myInboundConnectionsList.getSelectedIndex() >= 0) {
                ourLog.debug("New inbound connection selection " + myInboundConnectionsList.getSelectedIndex());
                myController.setLeftSelectedItem(myInboundConnectionsList.getSelectedValue());
                myMessagesList.clearSelection();
                myMessagesList.repaint();
                myOutboundConnectionsList.clearSelection();
                myOutboundConnectionsList.repaint();
                myInboundConnectionsList.repaint();
            }
            updateLeftToolbarButtons();
        }
    });
    scrollPane_1.setViewportView(myInboundConnectionsList);
    leftSplitPane.setDividerLocation(200);

    myWorkspacePanel = new JPanel();
    myWorkspacePanel.setBorder(null);
    outerSplitPane.setRightComponent(myWorkspacePanel);
    myWorkspacePanel.setLayout(new BorderLayout(0, 0));
    outerSplitPane.setDividerLocation(200);

    myLogScrollPane = new LogTable();
    myLogScrollPane.setPreferredSize(new Dimension(454, 120));
    myLogScrollPane.setMaximumSize(new Dimension(32767, 120));
    myframe.getContentPane().add(myLogScrollPane, BorderLayout.SOUTH);

    updateLogScrollPaneVisibility();

    updateLeftToolbarButtons();
}

From source file:com.att.aro.diagnostics.GraphPanel.java

/**
 * Initializes a new instance of the GraphPanel class.
 */// ww  w.  jav  a 2s. c o m
public GraphPanel() {

    subplotMap.put(ChartPlotOptions.GPS,
            new GraphPanelPlotLabels(rb.getString("chart.gps"), createBarPlot(Color.gray), 1));
    subplotMap.put(ChartPlotOptions.RADIO,
            new GraphPanelPlotLabels(rb.getString("chart.radio"), createRadioPlot(), 2));
    subplotMap.put(ChartPlotOptions.BLUETOOTH,
            new GraphPanelPlotLabels(rb.getString("chart.bluetooth"), createBarPlot(Color.gray), 1));
    subplotMap.put(ChartPlotOptions.CAMERA,
            new GraphPanelPlotLabels(rb.getString("chart.camera"), createBarPlot(Color.gray), 1));
    subplotMap.put(ChartPlotOptions.SCREEN,
            new GraphPanelPlotLabels(rb.getString("chart.screen"), createBarPlot(new Color(34, 177, 76)), 1));
    subplotMap.put(ChartPlotOptions.BATTERY,
            new GraphPanelPlotLabels(rb.getString("chart.battery"), createBatteryPlot(), 2));
    subplotMap.put(ChartPlotOptions.WAKELOCK,
            new GraphPanelPlotLabels(rb.getString("chart.wakelock"), createWakelockStatePlot(), 1));
    subplotMap.put(ChartPlotOptions.WIFI,
            new GraphPanelPlotLabels(rb.getString("chart.wifi"), createBarPlot(Color.gray), 1));
    subplotMap.put(ChartPlotOptions.ALARM,
            new GraphPanelPlotLabels(rb.getString("chart.alarm"), createAlarmPlot(), 2));
    subplotMap.put(ChartPlotOptions.NETWORK_TYPE,
            new GraphPanelPlotLabels(rb.getString("chart.networkType"), createBarPlot(Color.gray), 1));
    subplotMap.put(ChartPlotOptions.THROUGHPUT,
            new GraphPanelPlotLabels(rb.getString("chart.throughput"), createThroughputPlot(), 2));
    subplotMap.put(ChartPlotOptions.BURSTS,
            new GraphPanelPlotLabels(rb.getString("chart.bursts"), createBurstPlot(), 1));
    subplotMap.put(ChartPlotOptions.USER_INPUT,
            new GraphPanelPlotLabels(rb.getString("chart.userInput"), createUserEventPlot(), 1));
    subplotMap.put(ChartPlotOptions.RRC,
            new GraphPanelPlotLabels(rb.getString("chart.rrc"), createRrcPlot(), 1));
    subplotMap.put(ChartPlotOptions.CPU,
            new GraphPanelPlotLabels(rb.getString("chart.cpu"), createCpuPlot(), 1));

    this.pp = new PacketPlots();
    subplotMap.put(ChartPlotOptions.UL_PACKETS,
            new GraphPanelPlotLabels(rb.getString("chart.ul"), pp.getUlPlot(), 1));
    subplotMap.put(ChartPlotOptions.DL_PACKETS,
            new GraphPanelPlotLabels(rb.getString("chart.dl"), pp.getDlPlot(), 1));

    this.axis = new NumberAxis();
    this.axis.setStandardTickUnits(UNITS);
    this.axis.setRange(new Range(0, DEFAULT_TIMELINE));
    this.axis.setLowerBound(0);

    this.axis.setAutoTickUnitSelection(true);
    this.axis.setTickMarkInsideLength(1);
    this.axis.setTickMarkOutsideLength(1);

    this.axis.setMinorTickMarksVisible(true);
    this.axis.setMinorTickMarkInsideLength(2f);
    this.axis.setMinorTickMarkOutsideLength(2f);
    this.axis.setTickMarkInsideLength(4f);
    this.axis.setTickMarkOutsideLength(4f);

    this.axisLabel = new JLabel(rb.getString("chart.timeline"));
    this.axisLabel.setHorizontalAlignment(SwingConstants.CENTER);

    this.setLayout(new BorderLayout());
    this.setPreferredSize(new Dimension(200, 310));
    this.add(getZoomSavePanel(), BorderLayout.EAST);
    this.add(getPane(), BorderLayout.CENTER);
    this.add(getLabelsPanel(), BorderLayout.WEST);

    setChartOptions(UserPreferences.getInstance().getChartPlotOptions());
}

From source file:edu.ku.brc.specify.plugins.ipadexporter.iPadDBExporterPlugin.java

public SubPaneIFace getExportPanel() {
    if (panelTitle == null || starterPane == null) {
        loadAndPushResourceBundle(RESOURCE_NAME);

        panelTitle = createI18NLabel("NOT_LOGIN", SwingConstants.CENTER);
        JLabel desc = createI18NLabel("EXPORTIN_TO_IPAD", SwingConstants.CENTER);
        JLabel iconLbl = createLabel("  ",
                IconManager.getImage("ExportSpMobile", IconManager.STD_ICON_SIZE.NonStd));

        desc.setFont(desc.getFont().deriveFont(24.0f));

        CellConstraints cc = new CellConstraints();

        PanelBuilder pb0 = new PanelBuilder(new FormLayout("f:p:g,p,f:p:g", "p"));
        pb0.add(exportBtn, cc.xy(2, 1));

        PanelBuilder pb = new PanelBuilder(
                new FormLayout("f:p:g,p,f:p:g", "20px,p,f:p:g,p,20px,p,20px,p,f:p:g"));
        pb.add(panelTitle, cc.xy(2, 2));
        pb.add(desc, cc.xy(2, 4));/* w  ww  .j a v  a 2s . c  o m*/
        pb.add(iconLbl, cc.xy(2, 6));
        pb.add(pb0.getPanel(), cc.xy(2, 8));

        starterPane = new SimpleDescPane(title, this, pb.getPanel());

        popResourceBundle();
    }
    return starterPane;
}

From source file:edu.harvard.i2b2.query.QueryTopPanel.java

private void jMorePanelsButtonActionPerformed(java.awt.event.ActionEvent evt) {
    if (dataModel.hasEmptyPanels()) {
        JOptionPane.showMessageDialog(this, "Please use an existing empty panel before adding a new one.");
        return;/*w w  w.j a  va2 s.c o  m*/
    }
    int rightmostPosition = dataModel.lastLabelPosition();
    JLabel label = new JLabel();
    label.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    label.setText("and");
    label.setToolTipText("Click to change the relationship");
    label.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    label.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            jAndOrLabelMouseClicked(evt);
        }
    });

    //jPanel1.add(label);
    //label.setBounds(rightmostPosition, 90, 30, 18);

    QueryConceptTreePanel panel = new QueryConceptTreePanel("Group " + (dataModel.getCurrentPanelCount() + 1),
            this);
    jPanel1.add(panel);
    panel.setBounds(rightmostPosition + 5, 0, 180, getParent().getHeight() - 100);
    jPanel1.setPreferredSize(new Dimension(rightmostPosition + 5 + 181, getHeight() - 100));
    jScrollPane4.setViewportView(jPanel1);

    dataModel.addPanel(panel, label, rightmostPosition + 5 + 180);

    /*System.out.println(jScrollPane4.getViewport().getExtentSize().width+":"+
     jScrollPane4.getViewport().getExtentSize().height);
    System.out.println(jScrollPane4.getHorizontalScrollBar().getVisibleRect().width+":"
     +jScrollPane4.getHorizontalScrollBar().getVisibleRect().height);
    System.out.println(jScrollPane4.getHorizontalScrollBar().getVisibleAmount());
    System.out.println(jScrollPane4.getHorizontalScrollBar().getValue());*/
    jScrollPane4.getHorizontalScrollBar().setValue(jScrollPane4.getHorizontalScrollBar().getMaximum());
    jScrollPane4.getHorizontalScrollBar().setUnitIncrement(40);
    //this.jScrollPane4.removeAll();
    //this.jScrollPane4.setViewportView(jPanel1);
    //revalidate();
    //jScrollPane3.setBounds(420, 0, 170, 300);
    //jScrollPane4.setBounds(20, 35, 335, 220);
    resizePanels(getParent().getWidth(), getParent().getHeight());
}

From source file:edu.snu.leader.discrete.simulator.SimulatorLauncherGUI.java

/**
 * Create the frame./*from   w  ww.j  a v a  2 s  . c  o  m*/
 */
public SimulatorLauncherGUI() {
    NumberFormat countFormat = NumberFormat.getNumberInstance();
    countFormat.setParseIntegerOnly(true);

    NumberFormat doubleFormat = NumberFormat.getNumberInstance();
    doubleFormat.setMinimumIntegerDigits(1);
    doubleFormat.setMaximumFractionDigits(10);

    setTitle("Simulator");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 515, 340);
    setResizable(false);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    contentPane.setLayout(new BorderLayout(0, 0));
    setContentPane(contentPane);

    tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    contentPane.add(tabbedPane, BorderLayout.CENTER);

    JPanel panelTab1 = new JPanel();
    tabbedPane.addTab("Simulator", null, panelTab1, null);

    JPanel panelAgentCount = new JPanel();
    panelTab1.add(panelAgentCount);

    JLabel lblNewLabel = new JLabel("Agent Count");
    panelAgentCount.add(lblNewLabel);

    sliderAgent = new JSlider();
    panelAgentCount.add(sliderAgent);
    sliderAgent.setValue(10);
    sliderAgent.setSnapToTicks(true);
    sliderAgent.setPaintTicks(true);
    sliderAgent.setPaintLabels(true);
    sliderAgent.setMinorTickSpacing(10);
    sliderAgent.setMajorTickSpacing(10);
    sliderAgent.setMinimum(10);
    sliderAgent.setMaximum(70);

    sliderAgent.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent arg0) {
            Integer spinnerValue = (Integer) spinnerMaxEaten.getValue();
            if (spinnerValue > sliderAgent.getValue()) {
                spinnerValue = sliderAgent.getValue();
            }
            spinnerMaxEaten.setModel(new SpinnerNumberModel(spinnerValue, new Integer(0),
                    new Integer(sliderAgent.getValue()), new Integer(1)));
            JFormattedTextField tfMaxEaten = ((JSpinner.DefaultEditor) spinnerMaxEaten.getEditor())
                    .getTextField();
            tfMaxEaten.setEditable(false);
        }
    });

    JPanel panelCommType = new JPanel();
    panelTab1.add(panelCommType);

    JLabel lblNewLabel_1 = new JLabel("Communication Type");
    panelCommType.add(lblNewLabel_1);

    comboBoxCommType = new JComboBox<String>();
    panelCommType.add(comboBoxCommType);
    comboBoxCommType
            .setModel(new DefaultComboBoxModel<String>(new String[] { "Global", "Topological", "Metric" }));
    comboBoxCommType.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            String item = (String) comboBoxCommType.getSelectedItem();
            if (item.equals("Topological")) {
                panelNearestNeighborCount.setVisible(true);
                panelMaxLocationRadius.setVisible(false);
            } else if (item.equals("Metric")) {
                panelNearestNeighborCount.setVisible(false);
                panelMaxLocationRadius.setVisible(true);
            } else if (item.equals("Global")) {
                panelNearestNeighborCount.setVisible(false);
                panelMaxLocationRadius.setVisible(false);
            }
        }
    });

    JPanel panelDestinationRadius = new JPanel();
    panelTab1.add(panelDestinationRadius);

    JLabel lblDestinationRadius = new JLabel("Destination Radius");
    panelDestinationRadius.add(lblDestinationRadius);

    frmtdtxtfldDestinationRadius = new JFormattedTextField(doubleFormat);
    frmtdtxtfldDestinationRadius.setColumns(4);
    frmtdtxtfldDestinationRadius.setValue((Number) 10);
    panelDestinationRadius.add(frmtdtxtfldDestinationRadius);

    JPanel panelResultsOutput = new JPanel();
    panelTab1.add(panelResultsOutput);

    JLabel lblResultsOutput = new JLabel("Results Output");
    panelResultsOutput.add(lblResultsOutput);

    final JCheckBox chckbxEskridge = new JCheckBox("Eskridge");
    panelResultsOutput.add(chckbxEskridge);

    final JCheckBox chckbxConflict = new JCheckBox("Conflict");
    panelResultsOutput.add(chckbxConflict);

    final JCheckBox chckbxPosition = new JCheckBox("Position");
    panelResultsOutput.add(chckbxPosition);

    final JCheckBox chckbxPredationResults = new JCheckBox("Predation");
    panelResultsOutput.add(chckbxPredationResults);

    JPanel panelMisc = new JPanel();
    panelTab1.add(panelMisc);

    JLabel lblNewLabel_3 = new JLabel("Misc");
    panelMisc.add(lblNewLabel_3);

    chckbxGraphical = new JCheckBox("Graphical?");
    chckbxGraphical.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            if (chckbxGraphical.isSelected()) {
                frmtdtxtfldRunCount.setValue((Number) 1);
                frmtdtxtfldRunCount.setEnabled(false);
                chckbxEskridge.setSelected(false);
                chckbxEskridge.setEnabled(false);
                String agentBuilder = (String) comboBoxAgentBuilder.getSelectedItem();
                if (agentBuilder.equals("Default")) {
                    comboBoxAgentBuilder.setSelectedIndex(1);
                }
            } else {
                chckbxEskridge.setEnabled(true);
                frmtdtxtfldRunCount.setEnabled(true);
            }
        }

    });
    panelMisc.add(chckbxGraphical);

    chckbxRandomSeed = new JCheckBox("Random Seed?");
    panelMisc.add(chckbxRandomSeed);

    chckbxPredationEnable = new JCheckBox("Predation?");
    chckbxPredationEnable.setSelected(true);
    chckbxPredationEnable.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            if (chckbxPredationEnable.isSelected()) {
                panelPredationStuff.setVisible(true);
                panelPredationBoxes.setVisible(true);
                panelPredationConstant.setVisible(true);
                panelNonMoversSurvive.setVisible(true);
            } else {
                panelPredationStuff.setVisible(false);
                panelPredationBoxes.setVisible(false);
                panelPredationConstant.setVisible(false);
                panelNonMoversSurvive.setVisible(false);
            }
        }
    });
    panelMisc.add(chckbxPredationEnable);

    JPanel panelCounts = new JPanel();
    panelTab1.add(panelCounts);

    JLabel lblNewLabel_4 = new JLabel("Run Count");
    panelCounts.add(lblNewLabel_4);

    frmtdtxtfldRunCount = new JFormattedTextField(countFormat);
    frmtdtxtfldRunCount.setToolTipText("The number of runs. Each run has a different random seed.");
    panelCounts.add(frmtdtxtfldRunCount);
    frmtdtxtfldRunCount.setColumns(4);
    frmtdtxtfldRunCount.setValue((Number) 1);

    JLabel lblNewLabel_5 = new JLabel("Sim Count");
    panelCounts.add(lblNewLabel_5);

    frmtdtxtfldSimCount = new JFormattedTextField(countFormat);
    frmtdtxtfldSimCount
            .setToolTipText("The number of simulations per run. Each simulation uses the same random seed.");
    frmtdtxtfldSimCount.setColumns(4);
    frmtdtxtfldSimCount.setValue((Number) 1);
    panelCounts.add(frmtdtxtfldSimCount);

    JLabel lblNewLabel_6 = new JLabel("Max Time Steps");
    panelCounts.add(lblNewLabel_6);

    frmtdtxtfldMaxTimeSteps = new JFormattedTextField(countFormat);
    frmtdtxtfldMaxTimeSteps.setToolTipText("The max number of time steps per simulation.");
    frmtdtxtfldMaxTimeSteps.setColumns(6);
    frmtdtxtfldMaxTimeSteps.setValue((Number) 20000);
    panelCounts.add(frmtdtxtfldMaxTimeSteps);

    ////////Panel tab 2

    JPanel panelTab2 = new JPanel();
    tabbedPane.addTab("Parameters", null, panelTab2, null);

    JPanel panelDecisionCalculator = new JPanel();
    panelTab2.add(panelDecisionCalculator);

    JLabel lblDecisionCalculator = new JLabel("Decision Calculator");
    panelDecisionCalculator.add(lblDecisionCalculator);

    final JComboBox<String> comboBoxDecisionCalculator = new JComboBox<String>();
    panelDecisionCalculator.add(comboBoxDecisionCalculator);
    comboBoxDecisionCalculator.setModel(
            new DefaultComboBoxModel<String>(new String[] { "Default", "Conflict", "Conflict Uninformed" }));

    JPanel panelAgentBuilder = new JPanel();
    panelTab2.add(panelAgentBuilder);

    JLabel lblAgentBuilder = new JLabel("Agent Builder");
    panelAgentBuilder.add(lblAgentBuilder);

    comboBoxAgentBuilder = new JComboBox<String>();
    panelAgentBuilder.add(comboBoxAgentBuilder);
    comboBoxAgentBuilder.setModel(new DefaultComboBoxModel<String>(new String[] { "Default", "Simple Angular",
            "Personality Simple Angular", "Simple Angular Uninformed" }));
    comboBoxAgentBuilder.setSelectedIndex(1);
    comboBoxAgentBuilder.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            if (chckbxGraphical.isSelected()) {
                String agentBuilder = (String) comboBoxAgentBuilder.getSelectedItem();
                if (agentBuilder.equals("Default")) {
                    comboBoxAgentBuilder.setSelectedIndex(1);
                }
            }
        }
    });

    JPanel panelModel = new JPanel();
    panelTab2.add(panelModel);

    JLabel lblModel = new JLabel("Model");
    panelModel.add(lblModel);

    comboBoxModel = new JComboBox<String>();
    panelModel.add(comboBoxModel);
    comboBoxModel.setModel(new DefaultComboBoxModel<String>(new String[] { "Sueur", "Gautrais" }));
    comboBoxModel.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            String item = (String) comboBoxModel.getSelectedItem();
            if (item.equals("Sueur")) {
                panelSueurValues.setVisible(true);
                panelGautraisValues.setVisible(false);
            } else if (item.equals("Gautrais")) {
                panelSueurValues.setVisible(false);
                panelGautraisValues.setVisible(true);
            }
        }
    });

    JPanel panelEnvironment = new JPanel();
    panelTab2.add(panelEnvironment);

    JLabel lblEnvironment = new JLabel("Environment");
    panelEnvironment.add(lblEnvironment);

    comboBoxEnvironment = new JComboBox<String>();
    comboBoxEnvironment.setModel(
            new DefaultComboBoxModel<String>(new String[] { "Minimum", "Medium", "Maximum", "Uninformed" }));
    comboBoxEnvironment.setSelectedIndex(1);
    comboBoxEnvironment.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            String item = (String) comboBoxEnvironment.getSelectedItem();
            if (!item.equals("Uninformed")) {
                comboBoxDecisionCalculator.setEnabled(true);
                comboBoxAgentBuilder.setEnabled(true);
            }

            if (item.equals("Medium")) {
                panelAngle.setVisible(true);
                panelDistance.setVisible(true);
                panelPercentage.setVisible(true);
                panelNumberOfDestinations.setVisible(false);
                panelInformedCount.setVisible(false);
            } else if (item.equals("Minimum")) {
                panelAngle.setVisible(false);
                panelDistance.setVisible(false);
                panelPercentage.setVisible(true);
                panelNumberOfDestinations.setVisible(false);
                panelInformedCount.setVisible(false);
            } else if (item.equals("Maximum")) {
                panelAngle.setVisible(false);
                panelDistance.setVisible(false);
                panelPercentage.setVisible(true);
                panelNumberOfDestinations.setVisible(false);
                panelInformedCount.setVisible(false);
            } else if (item.equals("Uninformed")) {
                panelAngle.setVisible(true);
                panelDistance.setVisible(true);
                panelPercentage.setVisible(true);
                panelNumberOfDestinations.setVisible(false);
                panelInformedCount.setVisible(true);
                comboBoxDecisionCalculator.setSelectedIndex(2);
                comboBoxDecisionCalculator.setEnabled(false);
                comboBoxAgentBuilder.setSelectedIndex(3);
                comboBoxAgentBuilder.setEnabled(false);
            }
        }
    });
    panelEnvironment.add(comboBoxEnvironment);

    JPanel panelDefaultConflict = new JPanel();
    panelTab2.add(panelDefaultConflict);

    JLabel lblDefaultConflict = new JLabel("Default Conflict");
    panelDefaultConflict.add(lblDefaultConflict);

    final JSpinner spinnerDefaultConflict = new JSpinner();
    panelDefaultConflict.add(spinnerDefaultConflict);
    spinnerDefaultConflict.setModel(
            new SpinnerNumberModel(new Float(0.9f), new Float(0.1f), new Float(0.91f), new Float(0.05)));
    JFormattedTextField tfSpinnerConflict = ((JSpinner.DefaultEditor) spinnerDefaultConflict.getEditor())
            .getTextField();
    tfSpinnerConflict.setEditable(false);

    JPanel panelCancelationThreshold = new JPanel();
    panelTab2.add(panelCancelationThreshold);

    JLabel lblCancelationThreshold = new JLabel("Cancelation Threshold");
    panelCancelationThreshold.add(lblCancelationThreshold);

    final JSpinner spinnerCancelationThreshold = new JSpinner();
    panelCancelationThreshold.add(spinnerCancelationThreshold);
    spinnerCancelationThreshold.setModel(
            new SpinnerNumberModel(new Float(1.0f), new Float(0.0f), new Float(1.01f), new Float(0.05)));
    JFormattedTextField tfCancelationThreshold = ((JSpinner.DefaultEditor) spinnerCancelationThreshold
            .getEditor()).getTextField();
    tfCancelationThreshold.setEditable(false);

    JPanel panelStopAnywhere = new JPanel();
    panelTab2.add(panelStopAnywhere);

    final JCheckBox chckbxStopAnywhere = new JCheckBox("Stop Anywhere?");
    panelStopAnywhere.add(chckbxStopAnywhere);

    panelNearestNeighborCount = new JPanel();
    panelNearestNeighborCount.setVisible(false);
    panelTab2.add(panelNearestNeighborCount);

    JLabel lblNearestNeighborCount = new JLabel("Nearest Neighbor Count");
    panelNearestNeighborCount.add(lblNearestNeighborCount);

    frmtdtxtfldNearestNeighborCount = new JFormattedTextField(countFormat);
    panelNearestNeighborCount.add(frmtdtxtfldNearestNeighborCount);
    frmtdtxtfldNearestNeighborCount.setColumns(3);
    frmtdtxtfldNearestNeighborCount.setValue((Number) 10);

    panelMaxLocationRadius = new JPanel();
    panelMaxLocationRadius.setVisible(false);
    panelTab2.add(panelMaxLocationRadius);

    JLabel lblMaxLocationRadius = new JLabel("Max Location Radius");
    panelMaxLocationRadius.add(lblMaxLocationRadius);

    frmtdtxtfldMaxLocationRadius = new JFormattedTextField(doubleFormat);
    panelMaxLocationRadius.add(frmtdtxtfldMaxLocationRadius);
    frmtdtxtfldMaxLocationRadius.setColumns(5);
    frmtdtxtfldMaxLocationRadius.setValue((Number) 10.0);

    panelPredationBoxes = new JPanel();
    panelTab2.add(panelPredationBoxes);

    final JCheckBox chckbxUsePredationThreshold = new JCheckBox("Use Predation Threshold");
    panelPredationBoxes.add(chckbxUsePredationThreshold);

    final JCheckBox chckbxPopulationIndependent = new JCheckBox("Population Independent");
    chckbxPopulationIndependent.setSelected(true);
    panelPredationBoxes.add(chckbxPopulationIndependent);
    chckbxPopulationIndependent.setToolTipText(
            "Select this to allow predation to be independent of population size. Max predation for 10 agents will be the same as for 50 agents. ");

    panelPredationStuff = new JPanel();
    panelTab2.add(panelPredationStuff);

    JLabel lblPredationMinimum = new JLabel("Predation Minimum");
    panelPredationStuff.add(lblPredationMinimum);

    frmtdtxtfldPredationMinimum = new JFormattedTextField(doubleFormat);
    frmtdtxtfldPredationMinimum.setColumns(4);
    frmtdtxtfldPredationMinimum.setValue((Number) 0.0);
    panelPredationStuff.add(frmtdtxtfldPredationMinimum);

    JLabel lblPredationThreshold = new JLabel("Predation Threshold");
    panelPredationStuff.add(lblPredationThreshold);

    final JSpinner spinnerPredationThreshold = new JSpinner();
    panelPredationStuff.add(spinnerPredationThreshold);
    spinnerPredationThreshold.setModel(
            new SpinnerNumberModel(new Float(1.0f), new Float(0.0f), new Float(1.01f), new Float(0.05)));
    JFormattedTextField tfPredationThreshold = ((JSpinner.DefaultEditor) spinnerPredationThreshold.getEditor())
            .getTextField();
    tfPredationThreshold.setEditable(false);

    JLabel lblMaxEaten = new JLabel("Max Eaten");
    panelPredationStuff.add(lblMaxEaten);

    spinnerMaxEaten = new JSpinner();
    spinnerMaxEaten.setToolTipText("The max number eaten per time step.");
    panelPredationStuff.add(spinnerMaxEaten);
    spinnerMaxEaten.setModel(new SpinnerNumberModel(new Integer(10), new Integer(0),
            new Integer(sliderAgent.getValue()), new Integer(1)));
    JFormattedTextField tfMaxEaten = ((JSpinner.DefaultEditor) spinnerMaxEaten.getEditor()).getTextField();
    tfMaxEaten.setEditable(false);

    panelPredationConstant = new JPanel();
    panelTab2.add(panelPredationConstant);

    JLabel lblPredationConstant = new JLabel("Predation Constant");
    panelPredationConstant.add(lblPredationConstant);

    frmtdtxtfldPredationConstant = new JFormattedTextField(doubleFormat);
    panelPredationConstant.add(frmtdtxtfldPredationConstant);
    frmtdtxtfldPredationConstant.setToolTipText("Value should be positive. Recommended values are near 0.001");
    frmtdtxtfldPredationConstant.setColumns(4);
    frmtdtxtfldPredationConstant.setValue((Number) 0.001);

    panelNonMoversSurvive = new JPanel();
    panelTab2.add(panelNonMoversSurvive);

    final JCheckBox chckbxNonMoversSurvive = new JCheckBox("Non-movers Survive?");
    chckbxNonMoversSurvive.setSelected(false);
    panelNonMoversSurvive.add(chckbxNonMoversSurvive);

    ////////Tab 3

    JPanel panelTab3 = new JPanel();
    tabbedPane.addTab("Environment", null, panelTab3, null);
    panelTab3.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));

    panelSueurValues = new JPanel();
    panelTab3.add(panelSueurValues);
    panelSueurValues.setLayout(new BoxLayout(panelSueurValues, BoxLayout.Y_AXIS));

    JLabel lblSueurValues = new JLabel("Sueur Values");
    lblSueurValues.setHorizontalAlignment(SwingConstants.TRAILING);
    lblSueurValues.setAlignmentX(Component.CENTER_ALIGNMENT);
    panelSueurValues.add(lblSueurValues);

    JPanel panelAlpha = new JPanel();
    FlowLayout flowLayout = (FlowLayout) panelAlpha.getLayout();
    flowLayout.setAlignment(FlowLayout.RIGHT);
    panelSueurValues.add(panelAlpha);

    JLabel lblAlpha = new JLabel("alpha");
    lblAlpha.setHorizontalAlignment(SwingConstants.CENTER);
    panelAlpha.add(lblAlpha);

    final JFormattedTextField frmtdtxtfldAlpha = new JFormattedTextField(doubleFormat);
    frmtdtxtfldAlpha.setHorizontalAlignment(SwingConstants.TRAILING);
    lblAlpha.setLabelFor(frmtdtxtfldAlpha);
    panelAlpha.add(frmtdtxtfldAlpha);
    frmtdtxtfldAlpha.setColumns(6);
    frmtdtxtfldAlpha.setValue((Number) 0.006161429);

    JPanel panelAlphaC = new JPanel();
    FlowLayout flowLayout_2 = (FlowLayout) panelAlphaC.getLayout();
    flowLayout_2.setAlignment(FlowLayout.RIGHT);
    panelSueurValues.add(panelAlphaC);

    JLabel lblAlphaC = new JLabel("alpha c");
    panelAlphaC.add(lblAlphaC);

    final JFormattedTextField frmtdtxtfldAlphaC = new JFormattedTextField(doubleFormat);
    frmtdtxtfldAlphaC.setHorizontalAlignment(SwingConstants.TRAILING);
    lblAlphaC.setLabelFor(frmtdtxtfldAlphaC);
    panelAlphaC.add(frmtdtxtfldAlphaC);
    frmtdtxtfldAlphaC.setColumns(6);
    frmtdtxtfldAlphaC.setValue((Number) 0.009);

    JPanel panelBeta = new JPanel();
    FlowLayout flowLayout_1 = (FlowLayout) panelBeta.getLayout();
    flowLayout_1.setAlignment(FlowLayout.RIGHT);
    panelSueurValues.add(panelBeta);

    JLabel lblBeta = new JLabel("beta");
    panelBeta.add(lblBeta);

    final JFormattedTextField frmtdtxtfldBeta = new JFormattedTextField(doubleFormat);
    frmtdtxtfldBeta.setHorizontalAlignment(SwingConstants.TRAILING);
    panelBeta.add(frmtdtxtfldBeta);
    frmtdtxtfldBeta.setColumns(6);
    frmtdtxtfldBeta.setValue((Number) 0.013422819);

    JPanel panelBetaC = new JPanel();
    FlowLayout flowLayout_14 = (FlowLayout) panelBetaC.getLayout();
    flowLayout_14.setAlignment(FlowLayout.RIGHT);
    panelSueurValues.add(panelBetaC);

    JLabel lblBetaC = new JLabel("beta c");
    panelBetaC.add(lblBetaC);

    final JFormattedTextField frmtdtxtfldBetaC = new JFormattedTextField(doubleFormat);
    frmtdtxtfldBetaC.setHorizontalAlignment(SwingConstants.TRAILING);
    panelBetaC.add(frmtdtxtfldBetaC);
    frmtdtxtfldBetaC.setColumns(6);
    frmtdtxtfldBetaC.setValue((Number) (-0.009));

    JPanel panelS = new JPanel();
    FlowLayout flowLayout_3 = (FlowLayout) panelS.getLayout();
    flowLayout_3.setAlignment(FlowLayout.RIGHT);
    panelSueurValues.add(panelS);

    JLabel lblS = new JLabel("S");
    panelS.add(lblS);

    final JFormattedTextField frmtdtxtfldS = new JFormattedTextField(countFormat);
    frmtdtxtfldS.setHorizontalAlignment(SwingConstants.TRAILING);
    panelS.add(frmtdtxtfldS);
    frmtdtxtfldS.setColumns(6);
    frmtdtxtfldS.setValue((Number) 2);

    JPanel panelQ = new JPanel();
    FlowLayout flowLayout_4 = (FlowLayout) panelQ.getLayout();
    flowLayout_4.setAlignment(FlowLayout.RIGHT);
    panelSueurValues.add(panelQ);

    JLabel lblQ = new JLabel("q");
    panelQ.add(lblQ);

    final JFormattedTextField frmtdtxtfldQ = new JFormattedTextField(doubleFormat);
    frmtdtxtfldQ.setHorizontalAlignment(SwingConstants.TRAILING);
    panelQ.add(frmtdtxtfldQ);
    frmtdtxtfldQ.setColumns(6);
    frmtdtxtfldQ.setValue((Number) 2.3);

    panelGautraisValues = new JPanel();
    panelGautraisValues.setVisible(false);
    panelTab3.add(panelGautraisValues);
    panelGautraisValues.setLayout(new BoxLayout(panelGautraisValues, BoxLayout.Y_AXIS));

    JLabel label = new JLabel("Gautrais Values");
    label.setAlignmentX(Component.CENTER_ALIGNMENT);
    panelGautraisValues.add(label);

    JPanel panelTauO = new JPanel();
    FlowLayout flowLayout_5 = (FlowLayout) panelTauO.getLayout();
    flowLayout_5.setAlignment(FlowLayout.RIGHT);
    panelGautraisValues.add(panelTauO);

    JLabel lblTauO = new JLabel("tau o");
    panelTauO.add(lblTauO);

    final JFormattedTextField frmtdtxtfldTaoO = new JFormattedTextField(doubleFormat);
    frmtdtxtfldTaoO.setHorizontalAlignment(SwingConstants.TRAILING);
    panelTauO.add(frmtdtxtfldTaoO);
    frmtdtxtfldTaoO.setColumns(4);
    frmtdtxtfldTaoO.setValue((Number) 1290);

    JPanel panelGammaC = new JPanel();
    FlowLayout flowLayout_6 = (FlowLayout) panelGammaC.getLayout();
    flowLayout_6.setAlignment(FlowLayout.RIGHT);
    panelGautraisValues.add(panelGammaC);

    JLabel lblGammaC = new JLabel("gamma c");
    panelGammaC.add(lblGammaC);

    final JFormattedTextField frmtdtxtfldGammaC = new JFormattedTextField(doubleFormat);
    frmtdtxtfldGammaC.setHorizontalAlignment(SwingConstants.TRAILING);
    panelGammaC.add(frmtdtxtfldGammaC);
    frmtdtxtfldGammaC.setColumns(4);
    frmtdtxtfldGammaC.setValue((Number) 2.0);

    JPanel panelEpsilonC = new JPanel();
    FlowLayout flowLayout_7 = (FlowLayout) panelEpsilonC.getLayout();
    flowLayout_7.setAlignment(FlowLayout.RIGHT);
    panelGautraisValues.add(panelEpsilonC);

    JLabel lblEpsilonC = new JLabel("epsilon c");
    panelEpsilonC.add(lblEpsilonC);

    final JFormattedTextField frmtdtxtfldEpsilonC = new JFormattedTextField(doubleFormat);
    frmtdtxtfldEpsilonC.setHorizontalAlignment(SwingConstants.TRAILING);
    panelEpsilonC.add(frmtdtxtfldEpsilonC);
    frmtdtxtfldEpsilonC.setColumns(4);
    frmtdtxtfldEpsilonC.setValue((Number) 2.3);

    JPanel panelAlphaF = new JPanel();
    FlowLayout flowLayout_8 = (FlowLayout) panelAlphaF.getLayout();
    flowLayout_8.setAlignment(FlowLayout.RIGHT);
    panelGautraisValues.add(panelAlphaF);

    JLabel lblAlphaF = new JLabel("alpha f");
    panelAlphaF.add(lblAlphaF);

    final JFormattedTextField frmtdtxtfldAlphaF = new JFormattedTextField(doubleFormat);
    frmtdtxtfldAlphaF.setHorizontalAlignment(SwingConstants.TRAILING);
    panelAlphaF.add(frmtdtxtfldAlphaF);
    frmtdtxtfldAlphaF.setColumns(4);
    frmtdtxtfldAlphaF.setValue((Number) 162.3);

    JPanel panelBetaF = new JPanel();
    FlowLayout flowLayout_9 = (FlowLayout) panelBetaF.getLayout();
    flowLayout_9.setAlignment(FlowLayout.RIGHT);
    panelGautraisValues.add(panelBetaF);

    JLabel lblBetaF = new JLabel("beta f");
    panelBetaF.add(lblBetaF);

    final JFormattedTextField frmtdtxtfldBetaF = new JFormattedTextField(doubleFormat);
    frmtdtxtfldBetaF.setHorizontalAlignment(SwingConstants.TRAILING);
    panelBetaF.add(frmtdtxtfldBetaF);
    frmtdtxtfldBetaF.setColumns(4);
    frmtdtxtfldBetaF.setValue((Number) 75.4);

    JPanel panelEnvironmentVariables = new JPanel();
    panelTab3.add(panelEnvironmentVariables);
    panelEnvironmentVariables.setLayout(new BoxLayout(panelEnvironmentVariables, BoxLayout.Y_AXIS));

    JLabel lblEnvironmentVariables = new JLabel("Environment Variables");
    lblEnvironmentVariables.setAlignmentX(Component.CENTER_ALIGNMENT);
    panelEnvironmentVariables.add(lblEnvironmentVariables);

    panelAngle = new JPanel();
    FlowLayout flowLayout_10 = (FlowLayout) panelAngle.getLayout();
    flowLayout_10.setAlignment(FlowLayout.RIGHT);
    panelEnvironmentVariables.add(panelAngle);

    JLabel lblAngle = new JLabel("Angle");
    panelAngle.add(lblAngle);

    final JFormattedTextField frmtdtxtfldAngle = new JFormattedTextField(doubleFormat);
    frmtdtxtfldAngle.setHorizontalAlignment(SwingConstants.TRAILING);
    frmtdtxtfldAngle.setToolTipText("Angle between destinations");
    panelAngle.add(frmtdtxtfldAngle);
    frmtdtxtfldAngle.setColumns(3);
    frmtdtxtfldAngle.setValue((Number) 72.00);

    panelNumberOfDestinations = new JPanel();
    FlowLayout flowLayout_13 = (FlowLayout) panelNumberOfDestinations.getLayout();
    flowLayout_13.setAlignment(FlowLayout.RIGHT);
    panelNumberOfDestinations.setVisible(false);
    panelEnvironmentVariables.add(panelNumberOfDestinations);

    JLabel lblNumberOfDestinations = new JLabel("Number of Destinations");
    panelNumberOfDestinations.add(lblNumberOfDestinations);

    JFormattedTextField frmtdtxtfldNumberOfDestinations = new JFormattedTextField(countFormat);
    frmtdtxtfldNumberOfDestinations.setHorizontalAlignment(SwingConstants.TRAILING);
    panelNumberOfDestinations.add(frmtdtxtfldNumberOfDestinations);
    frmtdtxtfldNumberOfDestinations.setColumns(3);
    frmtdtxtfldNumberOfDestinations.setValue((Number) 2);

    panelDistance = new JPanel();
    FlowLayout flowLayout_11 = (FlowLayout) panelDistance.getLayout();
    flowLayout_11.setAlignment(FlowLayout.RIGHT);
    panelEnvironmentVariables.add(panelDistance);

    JLabel lblDistance = new JLabel("Distance");
    panelDistance.add(lblDistance);

    frmtdtxtfldDistance = new JFormattedTextField(doubleFormat);
    frmtdtxtfldDistance.setHorizontalAlignment(SwingConstants.TRAILING);
    frmtdtxtfldDistance.setToolTipText("Distance the destination is from origin (0,0)");
    panelDistance.add(frmtdtxtfldDistance);
    frmtdtxtfldDistance.setColumns(3);
    frmtdtxtfldDistance.setValue((Number) 150.0);

    panelPercentage = new JPanel();
    FlowLayout flowLayout_12 = (FlowLayout) panelPercentage.getLayout();
    flowLayout_12.setAlignment(FlowLayout.RIGHT);
    panelEnvironmentVariables.add(panelPercentage);

    JLabel lblPercentage = new JLabel("Percentage");
    panelPercentage.add(lblPercentage);

    frmtdtxtfldPercentage = new JFormattedTextField(doubleFormat);
    frmtdtxtfldPercentage.setHorizontalAlignment(SwingConstants.TRAILING);
    frmtdtxtfldPercentage.setToolTipText(
            "The percentage moving to one of the two destinations ( The other gets 1 - percentage).");
    panelPercentage.add(frmtdtxtfldPercentage);
    frmtdtxtfldPercentage.setColumns(3);
    frmtdtxtfldPercentage.setValue((Number) 0.500);

    panelInformedCount = new JPanel();
    panelEnvironmentVariables.add(panelInformedCount);

    JLabel lblInformedCount = new JLabel("Informed Count");
    panelInformedCount.add(lblInformedCount);

    final JFormattedTextField frmtdtxtfldInformedCount = new JFormattedTextField(countFormat);
    frmtdtxtfldInformedCount.setHorizontalAlignment(SwingConstants.TRAILING);
    frmtdtxtfldInformedCount.setColumns(3);
    frmtdtxtfldInformedCount.setToolTipText(
            "The number of agents moving toward a preferred destination. This number is duplicated on the southern pole as well.");
    frmtdtxtfldInformedCount.setValue((Number) 4);
    panelInformedCount.setVisible(false);

    panelInformedCount.add(frmtdtxtfldInformedCount);

    JPanel panelStartButtons = new JPanel();

    JButton btnStartSimulation = new JButton("Create Simulator Instance");
    btnStartSimulation.setToolTipText("Creates a new simulator instance from the settings provided.");
    btnStartSimulation.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            boolean isReady = true;
            ErrorPacketContainer errorPacketContainer = new ErrorPacketContainer();

            if (jframeErrorMessages != null && jframeErrorMessages.isVisible()) {
                jframeErrorMessages.dispose();
            }

            frmtdtxtfldRunCount.setBackground(Color.WHITE);
            frmtdtxtfldSimCount.setBackground(Color.WHITE);
            frmtdtxtfldMaxTimeSteps.setBackground(Color.WHITE);
            frmtdtxtfldPredationMinimum.setBackground(Color.WHITE);
            frmtdtxtfldPredationConstant.setBackground(Color.WHITE);
            frmtdtxtfldNearestNeighborCount.setBackground(Color.WHITE);
            frmtdtxtfldMaxLocationRadius.setBackground(Color.WHITE);
            frmtdtxtfldPercentage.setBackground(Color.WHITE);
            frmtdtxtfldDistance.setBackground(Color.WHITE);
            frmtdtxtfldDestinationRadius.setBackground(Color.WHITE);
            frmtdtxtfldAngle.setBackground(Color.WHITE);
            frmtdtxtfldInformedCount.setBackground(Color.WHITE);

            StringBuilder errorMessages = new StringBuilder();

            if (((Number) frmtdtxtfldRunCount.getValue()).intValue() <= 0) {
                errorMessages.append("Run Count must be positive\n");
                frmtdtxtfldRunCount.setBackground(Color.YELLOW);
                errorPacketContainer.addPacket("Run Count must be positive", frmtdtxtfldRunCount, 0);
                isReady = false;
            }
            if (((Number) frmtdtxtfldSimCount.getValue()).intValue() <= 0) {
                errorMessages.append("Sim Count must be positive\n");
                frmtdtxtfldSimCount.setBackground(Color.YELLOW);
                errorPacketContainer.addPacket("Sim Count must be positive", frmtdtxtfldSimCount, 0);
                isReady = false;
            }
            if (((Number) frmtdtxtfldMaxTimeSteps.getValue()).intValue() <= 0) {
                errorMessages.append("Max Time Steps must be positive\n");
                frmtdtxtfldMaxTimeSteps.setBackground(Color.YELLOW);
                errorPacketContainer.addPacket("Max Time Steps must be positive", frmtdtxtfldMaxTimeSteps, 0);
                isReady = false;
            }
            if (((Number) frmtdtxtfldPredationMinimum.getValue()).doubleValue() < 0
                    && chckbxPredationEnable.isSelected()) {
                errorMessages.append("Predation Minimum must be positive\n");
                frmtdtxtfldPredationMinimum.setBackground(Color.YELLOW);
                errorPacketContainer.addPacket("Predation Minimum must be positive",
                        frmtdtxtfldPredationMinimum, 1);
                isReady = false;
            }
            if (((Number) frmtdtxtfldPredationConstant.getValue()).doubleValue() <= 0
                    && chckbxPredationEnable.isSelected()) {
                errorMessages.append("Predation Constant must be positive\n");
                frmtdtxtfldPredationConstant.setBackground(Color.YELLOW);
                errorPacketContainer.addPacket("Predation Constant must be positive",
                        frmtdtxtfldPredationConstant, 1);
                isReady = false;
            }
            if (((Number) frmtdtxtfldNearestNeighborCount.getValue()).intValue() < 0
                    && panelNearestNeighborCount.isVisible()) {
                errorMessages.append("Nearest Neighbor Count must be positive\n");
                frmtdtxtfldNearestNeighborCount.setBackground(Color.YELLOW);
                errorPacketContainer.addPacket("Nearest Neighbor Count must be positive",
                        frmtdtxtfldNearestNeighborCount, 1);
                isReady = false;
            }
            if (((Number) frmtdtxtfldMaxLocationRadius.getValue()).doubleValue() < 0
                    && panelMaxLocationRadius.isVisible()) {
                errorMessages.append("Max Location Radius must be positive\n");
                frmtdtxtfldMaxLocationRadius.setBackground(Color.YELLOW);
                errorPacketContainer.addPacket("Max Location Radius must be positive",
                        frmtdtxtfldMaxLocationRadius, 1);
                isReady = false;
            }
            if ((((Number) frmtdtxtfldPercentage.getValue()).doubleValue() < 0.0
                    || ((Number) frmtdtxtfldPercentage.getValue()).doubleValue() > 1.0)
                    && panelPercentage.isVisible()) {
                errorMessages.append(
                        "Percentage needs to be greater than or equal to 0 and less than or equal to 1\n");
                frmtdtxtfldPercentage.setBackground(Color.YELLOW);
                errorPacketContainer.addPacket(
                        "Percentage needs to be greater than or equal to 0 and less than or equal to 1",
                        frmtdtxtfldPercentage, 2);
                isReady = false;
            }
            if (((Number) frmtdtxtfldDistance.getValue()).doubleValue() <= 0
                    && frmtdtxtfldDistance.isVisible()) {
                errorMessages.append("Distance must be positive\n");
                frmtdtxtfldDistance.setBackground(Color.YELLOW);
                errorPacketContainer.addPacket("Distance must be positive", frmtdtxtfldDistance, 2);
                isReady = false;
            }
            if (((Number) frmtdtxtfldDestinationRadius.getValue()).doubleValue() <= 0) {
                errorMessages.append("Destination Radius must be positive\n");
                frmtdtxtfldDestinationRadius.setBackground(Color.YELLOW);
                errorPacketContainer.addPacket("Destination Radius must be positive",
                        frmtdtxtfldDestinationRadius, 0);
                isReady = false;
            }
            if (((Number) frmtdtxtfldAngle.getValue()).doubleValue() < 0) {
                errorMessages.append("Angle must be positive or zero\n");
                frmtdtxtfldAngle.setBackground(Color.YELLOW);
                errorPacketContainer.addPacket("Angle must be positive", frmtdtxtfldAngle, 2);
                isReady = false;
            }
            if (((Number) frmtdtxtfldInformedCount.getValue()).intValue() <= 0) {
                errorMessages.append("Informed Count must be positive\n");
                frmtdtxtfldInformedCount.setBackground(Color.YELLOW);
                errorPacketContainer.addPacket("Informed Count must be positive", frmtdtxtfldInformedCount, 2);
                isReady = false;
            } else if (((Number) frmtdtxtfldInformedCount.getValue()).intValue() * 2 > sliderAgent.getValue()) {
                errorMessages.append("Informed Count should at most be half the count of total agents\n");
                frmtdtxtfldInformedCount.setBackground(Color.YELLOW);
                errorPacketContainer.addPacket(
                        "Informed Count should at most be half the count of total agents",
                        frmtdtxtfldInformedCount, 2);
                isReady = false;
            }

            if (!isReady) {
                jframeErrorMessages = createJFrameErrorMessages(errorPacketContainer, tabbedPane);
                jframeErrorMessages.setVisible(true);
            } else {
                _simulatorProperties = new Properties();

                _simulatorProperties.put("run-count", String.valueOf(frmtdtxtfldRunCount.getValue()));
                _simulatorProperties.put("simulation-count", String.valueOf(frmtdtxtfldSimCount.getValue()));
                _simulatorProperties.put("max-simulation-time-steps",
                        String.valueOf(frmtdtxtfldMaxTimeSteps.getValue()));
                _simulatorProperties.put("random-seed", String.valueOf(1)); // Doesn't change
                _simulatorProperties.put("individual-count", String.valueOf(sliderAgent.getValue()));
                _simulatorProperties.put("run-graphical", String.valueOf(chckbxGraphical.isSelected()));
                _simulatorProperties.put("pre-calculate-probabilities", String.valueOf(false)); // Doesn't change
                _simulatorProperties.put("use-random-random-seed",
                        String.valueOf(chckbxRandomSeed.isSelected()));
                _simulatorProperties.put("can-multiple-initiate", String.valueOf(true)); // Doesn't change

                _simulatorProperties.put("eskridge-results", String.valueOf(chckbxEskridge.isSelected()));
                _simulatorProperties.put("conflict-results", String.valueOf(chckbxConflict.isSelected()));
                _simulatorProperties.put("position-results", String.valueOf(chckbxPosition.isSelected()));
                _simulatorProperties.put("predation-results",
                        String.valueOf(chckbxPredationResults.isSelected()));

                _simulatorProperties.put("communication-type",
                        String.valueOf(comboBoxCommType.getSelectedItem()).toLowerCase());

                _simulatorProperties.put("nearest-neighbor-count",
                        String.valueOf(frmtdtxtfldNearestNeighborCount.getValue()));
                _simulatorProperties.put("max-location-radius",
                        String.valueOf(frmtdtxtfldMaxLocationRadius.getValue()));

                _simulatorProperties.put("destination-size-radius",
                        String.valueOf(frmtdtxtfldDestinationRadius.getValue()));

                _simulatorProperties.put("max-agents-eaten-per-step",
                        String.valueOf(spinnerMaxEaten.getValue()));
                _simulatorProperties.put("enable-predator", String.valueOf(chckbxPredationEnable.isSelected()));
                _simulatorProperties.put("predation-probability-minimum",
                        String.valueOf(frmtdtxtfldPredationMinimum.getValue()));
                _simulatorProperties.put("predation-multiplier",
                        String.valueOf(frmtdtxtfldPredationConstant.getValue()));
                _simulatorProperties.put("use-predation-threshold",
                        String.valueOf(chckbxUsePredationThreshold.isSelected()));
                _simulatorProperties.put("predation-threshold",
                        String.valueOf(spinnerPredationThreshold.getValue()));
                _simulatorProperties.put("predation-by-population",
                        String.valueOf(chckbxPopulationIndependent.isSelected()));
                _simulatorProperties.put("count-non-movers-as-survivors",
                        String.valueOf(chckbxNonMoversSurvive.isSelected()));

                _simulatorProperties.put("stop-at-any-destination",
                        String.valueOf(chckbxStopAnywhere.isSelected()));

                _simulatorProperties.put("adhesion-time-limit",
                        String.valueOf(frmtdtxtfldMaxTimeSteps.getValue()));

                _simulatorProperties.put("alpha", String.valueOf(frmtdtxtfldAlpha.getValue()));
                _simulatorProperties.put("alpha-c", String.valueOf(frmtdtxtfldAlphaC.getValue()));
                _simulatorProperties.put("beta", String.valueOf(frmtdtxtfldBeta.getValue()));
                _simulatorProperties.put("beta-c", String.valueOf(frmtdtxtfldBetaC.getValue()));
                _simulatorProperties.put("S", String.valueOf(frmtdtxtfldS.getValue()));
                _simulatorProperties.put("q", String.valueOf(frmtdtxtfldQ.getValue()));

                _simulatorProperties.put("lambda", String.valueOf(0.2));

                _simulatorProperties.put("tau-o", String.valueOf(frmtdtxtfldTaoO.getValue()));
                _simulatorProperties.put("gamma-c", String.valueOf(frmtdtxtfldGammaC.getValue()));
                _simulatorProperties.put("epsilon-c", String.valueOf(frmtdtxtfldEpsilonC.getValue()));
                _simulatorProperties.put("alpha-f", String.valueOf(frmtdtxtfldAlphaF.getValue()));
                _simulatorProperties.put("beta-f", String.valueOf(frmtdtxtfldBetaF.getValue()));

                _simulatorProperties.put("default-conflict-value",
                        String.valueOf(spinnerDefaultConflict.getValue()));

                _simulatorProperties.put("cancellation-threshold",
                        String.valueOf(spinnerCancelationThreshold.getValue()));
                StringBuilder sbAgentBuilder = new StringBuilder();
                sbAgentBuilder.append("edu.snu.leader.discrete.simulator.Sueur");
                sbAgentBuilder.append(comboBoxAgentBuilder.getSelectedItem().toString().replace(" ", ""));
                sbAgentBuilder.append("AgentBuilder");
                _simulatorProperties.put("agent-builder", String.valueOf(sbAgentBuilder.toString()));

                StringBuilder sbDecisionCalculator = new StringBuilder();
                sbDecisionCalculator.append("edu.snu.leader.discrete.simulator.");
                sbDecisionCalculator.append(comboBoxModel.getSelectedItem());
                //                    sbDecisionCalculator.append(comboBoxDecisionCalculator.getSelectedItem());
                sbDecisionCalculator
                        .append(comboBoxDecisionCalculator.getSelectedItem().toString().replace(" ", ""));
                sbDecisionCalculator.append("DecisionCalculator");
                _simulatorProperties.put("decision-calculator",
                        String.valueOf(sbDecisionCalculator.toString()));

                StringBuilder sbLocationsFile = new StringBuilder();
                sbLocationsFile.append("cfg/sim/locations/metric/valid-metric-loc-");
                sbLocationsFile.append(String.format("%03d", sliderAgent.getValue()));
                sbLocationsFile.append("-seed-00001.dat");
                _simulatorProperties.put("locations-file", String.valueOf(sbLocationsFile.toString()));

                //create destination file
                DestinationBuilder db = new DestinationBuilder(sliderAgent.getValue(), 1L);

                StringBuilder sbDestinationsFile = new StringBuilder();
                sbDestinationsFile.append("cfg/sim/destinations/destinations-");
                switch (comboBoxEnvironment.getSelectedItem().toString()) {
                case ("Minimum"):
                    sbDestinationsFile.append("diffdis-" + sliderAgent.getValue());
                    sbDestinationsFile.append("-per-" + frmtdtxtfldPercentage.getValue());
                    sbDestinationsFile.append("-seed-1.dat");
                    db.generateDifferentDistance(((Number) frmtdtxtfldPercentage.getValue()).doubleValue(), 200,
                            100, 75);
                    break;
                case ("Medium"):
                    sbDestinationsFile.append("split-" + sliderAgent.getValue());
                    sbDestinationsFile.append("-dis-" + frmtdtxtfldDistance.getValue());
                    sbDestinationsFile.append("-ang-"
                            + String.format("%.2f", ((Number) frmtdtxtfldAngle.getValue()).doubleValue()));
                    sbDestinationsFile.append("-per-"
                            + String.format("%.3f", ((Number) frmtdtxtfldPercentage.getValue()).doubleValue()));
                    sbDestinationsFile.append("-seed-1.dat");
                    db.generateSplitNorth(((Number) frmtdtxtfldDistance.getValue()).doubleValue(),
                            ((Number) frmtdtxtfldAngle.getValue()).doubleValue(),
                            ((Number) frmtdtxtfldPercentage.getValue()).doubleValue());
                    break;
                case ("Maximum"):
                    sbDestinationsFile.append("poles-" + sliderAgent.getValue());
                    sbDestinationsFile.append("-per-" + frmtdtxtfldPercentage.getValue());
                    sbDestinationsFile.append("-seed-1.dat");
                    db.generatePoles(50, 100, ((Number) frmtdtxtfldPercentage.getValue()).doubleValue());
                    break;
                case ("Uninformed"):
                    sbDestinationsFile.append("split-poles-" + frmtdtxtfldInformedCount.getValue());
                    sbDestinationsFile.append("-dis-"
                            + String.format("%.1f", ((Number) frmtdtxtfldDistance.getValue()).doubleValue()));
                    sbDestinationsFile.append("-ang-"
                            + String.format("%.2f", ((Number) frmtdtxtfldAngle.getValue()).doubleValue()));
                    sbDestinationsFile.append("-per-"
                            + String.format("%.3f", ((Number) frmtdtxtfldPercentage.getValue()).doubleValue()));
                    sbDestinationsFile.append("-seed-1.dat");
                    db.generateSplitPoles(((Number) frmtdtxtfldDistance.getValue()).doubleValue(),
                            ((Number) frmtdtxtfldAngle.getValue()).doubleValue(),
                            ((Number) frmtdtxtfldPercentage.getValue()).doubleValue(),
                            ((Number) frmtdtxtfldInformedCount.getValue()).intValue());
                    break;
                default: //Should never happen
                    break;
                }
                _simulatorProperties.put("destinations-file", String.valueOf(sbDestinationsFile.toString()));

                _simulatorProperties.put("live-delay", String.valueOf(15)); //Doesn't change
                _simulatorProperties.put("results-dir", "results"); //Doesn't change

                new Thread(new Runnable() {
                    public void run() {
                        try {
                            runSimulation();
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                }).start();
            }
        }

    });
    panelStartButtons.add(btnStartSimulation);

    JButton btnStartSimulationFrom = new JButton("Run Simulation from Properties File");
    btnStartSimulationFrom
            .setToolTipText("Runs the simulator with the values provided in the properties file.");
    btnStartSimulationFrom.setEnabled(false);
    panelStartButtons.add(btnStartSimulationFrom);

    panelTab3.add(panelStartButtons);
}

From source file:org.pentaho.support.standalone.SDSupportUtility.java

/**
 * initializing UI/* w  w w .j av a  2s .  com*/
 * 
 * @throws Exception
 */
public SDSupportUtility() throws Exception {

    prop = loadProperty();

    setResizable(false);
    setTitle(SDConstant.PENT_SUP_WIZARD);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 665, 516);

    contentPane = new JPanel();
    contentPane.setBackground(UIManager.getColor("Button.background"));
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    JLabel lblLastAttached = new JLabel("Last Attached");
    lblLastAttached.setOpaque(false);
    lblLastAttached.setHorizontalAlignment(SwingConstants.LEFT);
    lblLastAttached.setBounds(322, 335, 127, 23);
    contentPane.add(lblLastAttached);

    JLabel lblPentahoCustomerSupport = new JLabel("Pentaho Customer Support Wizard");
    lblPentahoCustomerSupport.setForeground(new Color(51, 51, 51));
    lblPentahoCustomerSupport.setVerticalAlignment(SwingConstants.TOP);
    lblPentahoCustomerSupport.setHorizontalAlignment(SwingConstants.RIGHT);
    lblPentahoCustomerSupport.setFont(new Font("Tahoma", Font.BOLD, 23));
    lblPentahoCustomerSupport.setBounds(130, 109, 506, 37);
    contentPane.add(lblPentahoCustomerSupport);

    JLabel lbllogo = new JLabel();
    lbllogo.setIcon(new ImageIcon(
            SDSupportUtility.class.getResource("/org/pentaho/support/standalone/puc-login-logo.png")));
    lbllogo.setBounds(10, 11, 409, 93);
    contentPane.add(lbllogo);

    chckbxNewCheckBoxEnvironment = new JCheckBox("Environment");
    chckbxNewCheckBoxEnvironment.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.ENVIRONMENT);
            } else {
                ArgList.remove(SDConstant.ENVIRONMENT);
            }
        }
    });
    chckbxNewCheckBoxEnvironment.setBounds(109, 268, 243, 23);
    contentPane.add(chckbxNewCheckBoxEnvironment);
    chckbxNewCheckBoxEnvironment.setOpaque(false);

    chckbxNewCheckBoxStructure = new JCheckBox("Structure Details");
    chckbxNewCheckBoxStructure.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.STRUCT);
            } else {
                ArgList.remove(SDConstant.STRUCT);
            }
        }
    });
    chckbxNewCheckBoxStructure.setBounds(377, 190, 248, 23);
    contentPane.add(chckbxNewCheckBoxStructure);
    chckbxNewCheckBoxStructure.setOpaque(false);

    chckbxLogs = new JCheckBox("Logs");
    chckbxLogs.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.LOGS);
            } else {
                ArgList.remove(SDConstant.LOGS);
            }
        }
    });
    chckbxLogs.setBounds(377, 164, 248, 23);
    contentPane.add(chckbxLogs);
    chckbxLogs.setOpaque(false);

    chckbxGetSecureFiles = new JCheckBox("Secure Files");
    chckbxGetSecureFiles.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.SECURITY);
            } else {
                ArgList.remove(SDConstant.SECURITY);
            }
        }
    });
    chckbxGetSecureFiles.setBounds(109, 190, 243, 23);
    contentPane.add(chckbxGetSecureFiles);
    chckbxGetSecureFiles.setOpaque(false);

    chckbxMd5 = new JCheckBox("MD5 Hash Value");
    chckbxMd5.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.MD5);
            } else {
                ArgList.remove(SDConstant.MD5);
            }
        }
    });
    chckbxMd5.setBounds(109, 216, 243, 23);
    contentPane.add(chckbxMd5);
    chckbxMd5.setOpaque(false);

    chckbxDbdetails = new JCheckBox("Datasource Details");
    chckbxDbdetails.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.DATASOURCE);
            } else {
                ArgList.remove(SDConstant.DATASOURCE);
            }
        }
    });
    chckbxDbdetails.setBounds(109, 294, 243, 23);
    contentPane.add(chckbxDbdetails);
    chckbxDbdetails.setOpaque(false);

    chckbxLicense = new JCheckBox("License File");
    chckbxLicense.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.LICENSE);
            } else {
                ArgList.remove(SDConstant.LICENSE);
            }
        }
    });
    chckbxLicense.setBounds(109, 164, 243, 23);
    contentPane.add(chckbxLicense);
    chckbxLicense.setOpaque(false);

    chckbxProcesslist = new JCheckBox("Running Process");
    chckbxProcesslist.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.RUNNING_TASK);
            } else {
                ArgList.remove(SDConstant.RUNNING_TASK);
            }
        }
    });
    chckbxProcesslist.setBounds(109, 242, 243, 23);
    contentPane.add(chckbxProcesslist);
    chckbxProcesslist.setOpaque(false);

    chckbxTomcatxml = new JCheckBox("XML files from Tomcat");
    chckbxTomcatxml.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.FILE);
                tomcatXml = true;
            } else {
                ArgList.remove(SDConstant.FILE);
                tomcatXml = false;
            }
        }
    });
    chckbxTomcatxml.setBounds(377, 242, 248, 23);
    contentPane.add(chckbxTomcatxml);
    chckbxTomcatxml.setOpaque(false);

    chckbxServerXml = new JCheckBox("XML files from Server");
    chckbxServerXml.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.FILE);
                serverXml = true;
            } else {
                ArgList.remove(SDConstant.FILE);
                serverXml = false;
            }
        }
    });
    chckbxServerXml.setBounds(377, 216, 248, 23);
    contentPane.add(chckbxServerXml);
    chckbxServerXml.setOpaque(false);

    chckbxGetBatfiles = new JCheckBox("Start up files from server");
    chckbxGetBatfiles.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.FILE);
                serverBatFile = true;
            } else {
                ArgList.remove(SDConstant.FILE);
                serverBatFile = false;
            }
        }
    });
    chckbxGetBatfiles.setBounds(377, 268, 248, 23);
    contentPane.add(chckbxGetBatfiles);
    chckbxGetBatfiles.setOpaque(false);

    chckbxServerproperties = new JCheckBox("Properites files from server");
    chckbxServerproperties.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.FILE);
                serverProrperties = true;
            } else {
                ArgList.remove(SDConstant.FILE);
                serverProrperties = false;
            }
        }
    });
    chckbxServerproperties.setBounds(377, 294, 248, 23);
    contentPane.add(chckbxServerproperties);
    chckbxServerproperties.setOpaque(false);

    btnNewButton = new JButton("Package");
    btnNewButton.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent arg0) {

            try {

                if (installType.equalsIgnoreCase("Manual")) {

                    if (prop.getProperty(SDConstant.BI_TOM_PATH) == null) {
                        JOptionPane.showMessageDialog(contentPane, SDConstant.ERROR_12, "Inane error",
                                JOptionPane.ERROR_MESSAGE);
                    } else {

                        WEB_XML = new StringBuilder();
                        WEB_XML.append(prop.getProperty(SDConstant.BI_TOM_PATH)).append(File.separator)
                                .append(SDConstant.WEB_APP).append(File.separator).append(SDConstant.PENTAHO)
                                .append(File.separator).append(SDConstant.WEB_INF).append(File.separator)
                                .append(SDConstant.WEB_XML);

                        PENTAHO_SOLU_PATH = getSolutionPath("biserver", WEB_XML.toString());
                        prop.put(SDConstant.PENTAHO_SOLU_PATH, PENTAHO_SOLU_PATH);
                        prop.put(SDConstant.BI_PATH, PENTAHO_SOLU_PATH);
                    }

                }

                if (prop.getProperty(SDConstant.BI_PATH) == null) {
                    JOptionPane.showMessageDialog(contentPane, SDConstant.ERROR_1, "Inane error",
                            JOptionPane.ERROR_MESSAGE);
                }
                if (prop.getProperty(SDConstant.BI_TOM_PATH) == null) {
                    JOptionPane.showMessageDialog(contentPane, SDConstant.ERROR_12, "Inane error",
                            JOptionPane.ERROR_MESSAGE);
                }
                disableAll();
                setBIServerPath(prop);
                final String data = textFieldBrowser.getText();
                if (!data.equalsIgnoreCase(null)) {
                    ArgList.add(SDConstant.BROWSER);
                }

                String[] array = new String[ArgList.size()];

                int count = 0;
                for (int i = 0; i < ArgList.size(); i++) {

                    String retName = ArgList.get(i);
                    if (retName.equals("file")) {
                        if (count == 0) {
                            array[i] = retName;
                            count++;
                        }
                    } else {
                        array[i] = retName;
                    }

                }

                ApplicationContext context = new ClassPathXmlApplicationContext(SDConstant.SPRNG_FILE_NAME);

                factory = (CofingRetrieverFactory) context.getBean("cofingRetrieverFactory");
                ConfigRetreiver[] config = factory.getConfigRetrevier(array);

                ExecutorService service = Executors.newFixedThreadPool(10);

                for (final ConfigRetreiver configobj : config) {
                    if (null != configobj) {
                        configobj.setBISeverPath(prop);
                        configobj.setServerName("biserver");

                        if (installType.equalsIgnoreCase("Installer")) {
                            configobj.setInstallType("Installer");
                        } else if (installType.equalsIgnoreCase("Archive")) {
                            configobj.setInstallType("Archive");
                        } else if (installType.equalsIgnoreCase("Manual")) {
                            configobj.setInstallType("Manual");
                        }

                        if (configobj instanceof FileRetriever) {
                            configobj.setBidiXml(serverXml);
                            configobj.setBidiBatFile(serverBatFile);
                            configobj.setBidiProrperties(serverProrperties);
                            configobj.setTomcatXml(tomcatXml);
                        }
                        if (configobj instanceof BrowserInfoRetriever) {
                            configobj.setBrowserInfo(data);
                        }

                        service.execute(new Runnable() {
                            public void run() {
                                if (null != configobj)
                                    configobj.readAndSaveConfiguration(prop);
                            }
                        });
                    }
                }
                btnNewButton.setVisible(false);
                progressBar.setVisible(true);
                ProgressThread thread = new ProgressThread();
                thread.setSupport(getSupport());
                thread.setProp(prop);
                new Thread(thread).start();

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

        }

    });

    chckbxSelectAll = new JCheckBox("Select/ De-select");
    chckbxSelectAll.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                selectAll();
            } else {
                deSelectAll();
            }
        }
    });

    chckbxSelectAll.setBounds(46, 138, 201, 23);
    chckbxSelectAll.setOpaque(false);
    contentPane.add(chckbxSelectAll);
    btnNewButton.setForeground(SystemColor.infoText);
    btnNewButton.setBounds(10, 430, 639, 37);
    contentPane.add(btnNewButton);
    chckbxServerproperties.setOpaque(false);

    JLabel lblAttach = new JLabel("Attach Artifact");
    lblAttach.setHorizontalAlignment(SwingConstants.LEFT);
    lblAttach.setBounds(32, 335, 177, 23);
    contentPane.add(lblAttach);
    lblAttach.setOpaque(false);

    JButton btnNewButtonBrowse = new JButton("Browse");
    btnNewButtonBrowse.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent arg0) {
            saveSelectedFile(prop);

            JFrame parentFrame = new JFrame();
            JFileChooser fileChooser = new JFileChooser();
            fileChooser.setDialogTitle("Specify a file to save");
            fileChooser.setMultiSelectionEnabled(true);

            int userSelection = fileChooser.showSaveDialog(parentFrame);

            if (userSelection == JFileChooser.APPROVE_OPTION) {
                fileToSave = fileChooser.getSelectedFiles();
                for (int i = 0; i < fileToSave.length; i++) {
                    File file = fileToSave[i];
                    String artifactpath = file.getAbsolutePath();

                    File f = new File(artifactpath);
                    String absolutefilename = f.getName();
                    String filename = ArtifactsDirectory.concat(absolutefilename);
                    CopyFile artifactcopy = new CopyFile(artifactpath, filename);
                    try {
                        artifactcopy.copy();
                    } catch (Exception e1) {
                        e1.printStackTrace();
                    }

                }
                uploadedFiles();

                rowList = new JList(model);
                listScrollPane.setViewportView(rowList);
                panel.add(listScrollPane);

            }
            rowList.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    lblDelete.setVisible(true);
                }
            });

        }
    });
    btnNewButtonBrowse.setBounds(208, 335, 104, 23);
    contentPane.add(btnNewButtonBrowse);
    btnNewButtonBrowse.setOpaque(false);

    textFieldBrowser = new JTextField();
    textFieldBrowser.setBounds(208, 364, 441, 23);
    contentPane.add(textFieldBrowser);
    textFieldBrowser.setColumns(10);

    progressBar = new JProgressBar(0, 100);
    progressBar.setBounds(8, 437, 639, 24);
    progressBar.setVisible(false);
    progressBar.setStringPainted(true);
    contentPane.add(progressBar);

    JLabel lblBrowserInformation = new JLabel("Browser Information");
    lblBrowserInformation.setHorizontalAlignment(SwingConstants.LEFT);
    lblBrowserInformation.setLabelFor(textFieldBrowser);
    lblBrowserInformation.setBounds(32, 368, 174, 14);
    contentPane.add(lblBrowserInformation);

    panel = new JPanel();
    panel.setBounds(423, 325, 127, 33);
    contentPane.add(panel);
    panel.setLayout(null);

    listScrollPane = new JScrollPane();
    listScrollPane.setBounds(0, 0, 127, 33);
    panel.add(listScrollPane);

    lblDelete = new JLabel("");
    lblDelete.setBounds(552, 325, 22, 23);
    lblDelete.setVisible(false);
    lblDelete.setIcon(
            new ImageIcon(SDSupportUtility.class.getResource("/org/pentaho/support/standalone/remove.png")));
    contentPane.add(lblDelete);
    lblDelete.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            int option = JOptionPane.showConfirmDialog(null, "Are you sure you want to delete this file ?");
            if (option == JOptionPane.YES_OPTION) {
                String sel = rowList.getSelectedValue().toString();
                String selected = dir + "/" + sel;
                File fileExists = new File(selected);
                fileExists.delete();
                model.remove(sel.indexOf(sel));
                lblDelete.setVisible(false);

            }
        }
    });

    JLabel instalType = new JLabel("Installation Type : ");
    instalType.setBounds(32, 395, 177, 23);
    instalType.setVisible(true);
    contentPane.add(instalType);

    ButtonGroup btnGrp = new ButtonGroup();

    rdbtnInstaller = new JRadioButton("Installer");
    rdbtnInstaller.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            installType = "Installer";
        }
    });
    rdbtnInstaller.setBounds(208, 395, 104, 23);
    rdbtnInstaller.setSelected(true);
    contentPane.add(rdbtnInstaller);
    btnGrp.add(rdbtnInstaller);

    rdbtnArchive = new JRadioButton("Archive");
    rdbtnArchive.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            installType = "Archive";
        }
    });
    rdbtnArchive.setBounds(333, 395, 104, 23);
    contentPane.add(rdbtnArchive);
    btnGrp.add(rdbtnArchive);

    rdbtnManual = new JRadioButton("Manual");
    rdbtnManual.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            installType = "Manual";
        }
    });
    rdbtnManual.setBounds(460, 395, 127, 27);
    contentPane.add(rdbtnManual);
    btnGrp.add(rdbtnManual);

    JLabel lblBackground = new JLabel();
    lblBackground.setIcon(new ImageIcon(
            SDSupportUtility.class.getResource("/org/pentaho/support/standalone/login-crystal-bg.jpg")));
    lblBackground.setBackground(SystemColor.controlHighlight);
    lblBackground.setHorizontalAlignment(SwingConstants.CENTER);
    lblBackground.setBounds(0, 0, 659, 488);
    contentPane.add(lblBackground);
}