Example usage for javax.swing JScrollPane setViewportView

List of usage examples for javax.swing JScrollPane setViewportView

Introduction

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

Prototype

public void setViewportView(Component view) 

Source Link

Document

Creates a viewport if necessary and then sets its view.

Usage

From source file:dpcs.UninstallUserApps.java

@SuppressWarnings({ "unchecked", "rawtypes", "deprecation" })
public UninstallUserApps() {
    setResizable(false);/* ww w  . j  av  a2 s. c o  m*/
    setTitle("Uninstall User Apps");
    setIconImage(
            Toolkit.getDefaultToolkit().getImage(UninstallSystemApps.class.getResource("/graphics/Icon.png")));
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    setBounds(100, 100, 482, 430);
    contentPane = new JPanel();
    contentPane.setBackground(Color.WHITE);
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    JLabel AppStatus = new JLabel("");
    AppStatus.setBounds(12, 366, 456, 17);
    contentPane.add(AppStatus);

    UserAppUninstallDone = new JLabel("");
    UserAppUninstallDone.setText("");
    UserAppUninstallDone.setBounds(151, 312, 186, 56);
    contentPane.add(UserAppUninstallDone);

    JLabel lblSelect = new JLabel("Select an app to remove");
    lblSelect.setBounds(26, 12, 405, 17);
    contentPane.add(lblSelect);

    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setBounds(22, 41, 428, 259);
    contentPane.add(scrollPane);

    final JButton btnUninstall = new JButton("Uninstall");
    btnUninstall.setToolTipText("Uninstall the selected app");
    btnUninstall.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            UserAppUninstallDone.setText("");
            if (list.getSelectedValue() == null) {
                JOptionPane.showMessageDialog(null, "Please select an app first");
            } else {
                try {
                    AppStatus.setText("Uninstalling...");
                    String[] commands = new String[3];
                    commands[0] = "adb";
                    commands[1] = "uninstall";
                    commands[2] = "" + list.getSelectedValue();
                    Process p1 = Runtime.getRuntime().exec(commands, null);
                    p1.waitFor();
                    Process p2 = Runtime.getRuntime()
                            .exec("adb shell pm list packages -3 > /sdcard/.userapps.txt");
                    p2.waitFor();
                    Process p3 = Runtime.getRuntime().exec("adb pull /sdcard/.userapps.txt");
                    p3.waitFor();
                    Process p4 = Runtime.getRuntime().exec("adb shell rm /sdcard/.userapps.txt");
                    p4.waitFor();
                    lines = IOUtils.readLines(new FileInputStream(".userapps.txt"));
                    values = new String[lines.size()];
                    values = lines.toArray(values);
                    moddedvalues = new String[values.length];
                    for (int i = 0; i < values.length; i++) {
                        moddedvalues[i] = values[i].substring(8);
                    }
                    list = new JList();
                    list.setModel(new AbstractListModel() {
                        public int getSize() {
                            return moddedvalues.length;
                        }

                        public Object getElementAt(int index) {
                            return moddedvalues[index];
                        }
                    });
                    scrollPane.setViewportView(list);
                    File file = new File(".userapps.txt");
                    if (file.exists() && !file.isDirectory()) {
                        file.delete();
                    }
                    AppStatus.setText("App has been uninstalled successfully");
                    UserAppUninstallDone
                            .setIcon(new ImageIcon(Interface.class.getResource("/graphics/Smalldone.png")));
                    btnUninstall.setSelected(false);
                } catch (Exception e1) {
                    System.err.println(e1);
                }
            }
        }
    });
    btnUninstall.setBounds(26, 327, 107, 27);
    contentPane.add(btnUninstall);

    JButton btnRefresh = new JButton("Refresh");
    btnRefresh.setToolTipText("Refresh the apps list");
    btnRefresh.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            try {
                Process p1 = Runtime.getRuntime().exec("adb shell pm list packages -3 > /sdcard/.userapps.txt");
                p1.waitFor();
                Process p2 = Runtime.getRuntime().exec("adb pull /sdcard/.userapps.txt");
                p2.waitFor();
                Process p3 = Runtime.getRuntime().exec("adb shell rm /sdcard/.userapps.txt");
                p3.waitFor();
                lines = IOUtils.readLines(new FileInputStream(".userapps.txt"));
                values = new String[lines.size()];
                values = lines.toArray(values);
                moddedvalues = new String[values.length];
                for (int i = 0; i < values.length; i++) {
                    moddedvalues[i] = values[i].substring(8);
                }
                list = new JList();
                list.setModel(new AbstractListModel() {
                    public int getSize() {
                        return moddedvalues.length;
                    }

                    public Object getElementAt(int index) {
                        return moddedvalues[index];
                    }
                });
                scrollPane.setViewportView(list);
                File file = new File(".userapps.txt");
                if (file.exists() && !file.isDirectory()) {
                    file.delete();
                }
            } catch (Exception e1) {
                System.err.println(e1);
            }
        }
    });
    btnRefresh.setBounds(344, 327, 107, 27);
    contentPane.add(btnRefresh);

    try {
        Process p1 = Runtime.getRuntime().exec("adb shell pm list packages -3 > /sdcard/.userapps.txt");
        p1.waitFor();
        Process p2 = Runtime.getRuntime().exec("adb pull /sdcard/.userapps.txt");
        p2.waitFor();
        Process p3 = Runtime.getRuntime().exec("adb shell rm /sdcard/.userapps.txt");
        p3.waitFor();
        lines = IOUtils.readLines(new FileInputStream(".userapps.txt"));
        values = new String[lines.size()];
        values = lines.toArray(values);
        moddedvalues = new String[values.length];
        for (int i = 0; i < values.length; i++) {
            moddedvalues[i] = values[i].substring(8);
        }
        list = new JList();
        list.setModel(new AbstractListModel() {
            public int getSize() {
                return moddedvalues.length;
            }

            public Object getElementAt(int index) {
                return moddedvalues[index];
            }
        });
        scrollPane.setViewportView(list);
        File file = new File(".userapps.txt");
        if (file.exists() && !file.isDirectory()) {
            file.delete();
        }
    } catch (Exception e1) {
        System.err.println(e1);
    }
}

From source file:au.org.ala.delta.editor.ui.ImageDetailsPanel.java

private void createUI() {
    JPanel panel = new JPanel();

    JPanel buttonPanel = new JPanel();

    JPanel panel_2 = new JPanel();
    GroupLayout groupLayout = new GroupLayout(this);
    groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(groupLayout.createSequentialGroup().addContainerGap()
                    .addComponent(panel, GroupLayout.PREFERRED_SIZE, 262, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(buttonPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(panel_2, GroupLayout.PREFERRED_SIZE, 265, Short.MAX_VALUE)
                    .addContainerGap()));
    groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
            .addGroup(groupLayout.createSequentialGroup().addContainerGap()
                    .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
                            .addComponent(panel, GroupLayout.DEFAULT_SIZE, 238, Short.MAX_VALUE)
                            .addComponent(buttonPanel, 0, 0, Short.MAX_VALUE)
                            .addComponent(panel_2, 0, 0, Short.MAX_VALUE))
                    .addContainerGap()));

    btnSettings = new JButton();
    btnDisplay = new JButton();
    btnAdd = new JButton();
    btnDelete = new JButton();

    GroupLayout gl_buttonPanel = new GroupLayout(buttonPanel);
    gl_buttonPanel.setHorizontalGroup(gl_buttonPanel.createParallelGroup(Alignment.TRAILING).addGroup(
            Alignment.LEADING,/*from  w  w  w.  j ava2  s .  c  o m*/
            gl_buttonPanel.createSequentialGroup().addContainerGap().addGroup(gl_buttonPanel
                    .createParallelGroup(Alignment.LEADING)
                    .addComponent(btnSettings, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
                            Short.MAX_VALUE)
                    .addComponent(btnDisplay, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 83, Short.MAX_VALUE)
                    .addComponent(btnAdd, GroupLayout.DEFAULT_SIZE, 83, Short.MAX_VALUE)
                    .addComponent(btnDelete, GroupLayout.DEFAULT_SIZE, 83, Short.MAX_VALUE))
                    .addContainerGap()));
    gl_buttonPanel.setVerticalGroup(gl_buttonPanel.createParallelGroup(Alignment.TRAILING)
            .addGroup(gl_buttonPanel.createSequentialGroup().addContainerGap(119, Short.MAX_VALUE)
                    .addComponent(btnSettings).addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(btnDisplay).addPreferredGap(ComponentPlacement.RELATED).addComponent(btnAdd)
                    .addPreferredGap(ComponentPlacement.RELATED).addComponent(btnDelete).addContainerGap()));
    buttonPanel.setLayout(gl_buttonPanel);

    JLabel lblSubjectText = new JLabel();
    lblSubjectText.setName("imageDetailsSubjectLabel");

    JScrollPane scrollPane_1 = new JScrollPane();

    JLabel lblDevelopersNotes = new JLabel();
    lblDevelopersNotes.setName("imageDetailsDevelopersNotesLabel");

    JScrollPane scrollPane_2 = new JScrollPane();

    JPanel panel_3 = new JPanel();

    String title = _resources.getString("imageDetailsSoundTitle");

    panel_3.setBorder(new TitledBorder(null, title, TitledBorder.LEADING, TitledBorder.TOP, null, null));

    GroupLayout gl_panel_2 = new GroupLayout(panel_2);
    gl_panel_2.setHorizontalGroup(gl_panel_2.createParallelGroup(Alignment.TRAILING)
            .addGroup(gl_panel_2.createSequentialGroup().addContainerGap()
                    .addGroup(gl_panel_2.createParallelGroup(Alignment.LEADING)
                            .addComponent(scrollPane_2, GroupLayout.DEFAULT_SIZE, 245, Short.MAX_VALUE)
                            .addComponent(scrollPane_1, GroupLayout.DEFAULT_SIZE, 245, Short.MAX_VALUE)
                            .addComponent(lblDevelopersNotes)
                            .addComponent(panel_3, GroupLayout.DEFAULT_SIZE, 245, Short.MAX_VALUE)
                            .addComponent(lblSubjectText))
                    .addContainerGap()));
    gl_panel_2.setVerticalGroup(gl_panel_2.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panel_2.createSequentialGroup().addContainerGap().addComponent(lblSubjectText)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(scrollPane_1, GroupLayout.DEFAULT_SIZE, 41, Short.MAX_VALUE)
                    .addPreferredGap(ComponentPlacement.RELATED).addComponent(lblDevelopersNotes)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(scrollPane_2, GroupLayout.DEFAULT_SIZE, 54, Short.MAX_VALUE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(panel_3, GroupLayout.PREFERRED_SIZE, 66, GroupLayout.PREFERRED_SIZE)
                    .addContainerGap()));

    developerNotesTextPane = new RtfEditorPane();
    scrollPane_2.setViewportView(developerNotesTextPane);

    subjectTextPane = new RtfEditorPane();
    scrollPane_1.setViewportView(subjectTextPane);

    soundComboBox = new JComboBox();
    soundComboBox.setRenderer(new DefaultListCellRenderer() {
        private static final long serialVersionUID = 1L;

        @Override
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
                boolean cellHasFocus) {
            String text = "";
            ImageOverlay overlay = (ImageOverlay) value;
            if (overlay != null) {
                text = overlay.overlayText;
            }
            super.getListCellRendererComponent(list, text, index, isSelected, cellHasFocus);
            return this;
        }
    });

    deleteSoundButton = new JButton();

    playSoundButton = new JButton();

    insertSoundButton = new JButton();
    GroupLayout gl_panel_3 = new GroupLayout(panel_3);
    gl_panel_3.setHorizontalGroup(gl_panel_3.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panel_3.createSequentialGroup().addComponent(soundComboBox, 0, 0, Short.MAX_VALUE)
                    .addPreferredGap(ComponentPlacement.RELATED).addComponent(deleteSoundButton)
                    .addPreferredGap(ComponentPlacement.RELATED).addComponent(playSoundButton)
                    .addPreferredGap(ComponentPlacement.RELATED).addComponent(insertSoundButton)
                    .addContainerGap()));
    gl_panel_3.setVerticalGroup(gl_panel_3.createParallelGroup(Alignment.TRAILING)
            .addGroup(gl_panel_3.createSequentialGroup().addContainerGap(5, Short.MAX_VALUE)
                    .addGroup(gl_panel_3.createParallelGroup(Alignment.BASELINE)
                            .addComponent(soundComboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE)
                            .addComponent(deleteSoundButton).addComponent(playSoundButton)
                            .addComponent(insertSoundButton))));
    panel_3.setLayout(gl_panel_3);

    panel_2.setLayout(gl_panel_2);

    JLabel lblImageFiles = new JLabel();
    lblImageFiles.setName("imageDetailsImageFilesLabel");
    lblImageFiles.setAlignmentY(Component.TOP_ALIGNMENT);

    JScrollPane scrollPane = new JScrollPane();
    GroupLayout gl_panel = new GroupLayout(panel);
    gl_panel.setHorizontalGroup(gl_panel.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panel.createSequentialGroup()
                    .addGroup(gl_panel.createParallelGroup(Alignment.LEADING).addComponent(lblImageFiles)
                            .addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE))
                    .addContainerGap()));
    gl_panel.setVerticalGroup(gl_panel.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panel.createSequentialGroup().addContainerGap().addComponent(lblImageFiles)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, 236, Short.MAX_VALUE)
                    .addContainerGap()));

    imageList = new ImageList();

    scrollPane.setViewportView(imageList);
    panel.setLayout(gl_panel);
    setLayout(groupLayout);
}

From source file:at.becast.youploader.gui.FrmMain.java

public void initPlaylistSettingsTab() {
    JPanel TabPlaylistSettings = new JPanel();
    TabbedPane.addTab(LANG.getString("frmMain.Tabs.PlaylistSettings"), null, TabPlaylistSettings, null);

    JPanel panel_1 = new JPanel();

    JScrollPane scrollPane = new JScrollPane();
    GroupLayout gl_TabPlaylistSettings = new GroupLayout(TabPlaylistSettings);
    gl_TabPlaylistSettings.setHorizontalGroup(gl_TabPlaylistSettings.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_TabPlaylistSettings.createSequentialGroup()
                    .addComponent(panel_1, GroupLayout.DEFAULT_SIZE, 188, Short.MAX_VALUE).addGap(8)
                    .addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, 675, Short.MAX_VALUE)
                    .addContainerGap()));
    gl_TabPlaylistSettings.setVerticalGroup(gl_TabPlaylistSettings.createParallelGroup(Alignment.TRAILING)
            .addGroup(gl_TabPlaylistSettings.createSequentialGroup()
                    .addGroup(gl_TabPlaylistSettings.createParallelGroup(Alignment.LEADING)
                            .addComponent(panel_1, GroupLayout.DEFAULT_SIZE, 459, Short.MAX_VALUE)
                            .addGroup(gl_TabPlaylistSettings.createSequentialGroup().addGap(11)
                                    .addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, 448, Short.MAX_VALUE)))
                    .addContainerGap()));

    PlayPanel = new JPanel();
    scrollPane.setViewportView(PlayPanel);
    PlayPanel.setLayout(new GridLayout(0, 2, 0, 0));

    AccList = new JList<AccountType>(AccListModel);
    AccList.setOpaque(false);//www .j  ava 2s. c om
    AccList.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
    AccList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    GroupLayout gl_panel_1 = new GroupLayout(panel_1);
    gl_panel_1.setHorizontalGroup(gl_panel_1.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panel_1.createSequentialGroup().addContainerGap()
                    .addComponent(AccList, GroupLayout.DEFAULT_SIZE, 177, Short.MAX_VALUE).addContainerGap()));
    gl_panel_1.setVerticalGroup(gl_panel_1.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panel_1.createSequentialGroup().addContainerGap()
                    .addComponent(AccList, GroupLayout.DEFAULT_SIZE, 437, Short.MAX_VALUE).addContainerGap()));
    panel_1.setLayout(gl_panel_1);
    TabPlaylistSettings.setLayout(gl_TabPlaylistSettings);
    AccList.addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            selectPlaylistAccount();
        }
    });
}

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

/**
 * Initialize the contents of the frame.
 *//*ww  w . j  a  v  a2 s  .com*/
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:edu.harvard.mcz.imagecapture.SpecimenPartAttributeDialog.java

private void init() {
    thisDialog = this;
    setBounds(100, 100, 820, 335);/*from   w w w  .j av  a2s . co  m*/
    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    JPanel panel = new JPanel();
    panel.setLayout(new FormLayout(
            new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
                    FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), },
            new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, }));
    {
        JLabel lblAttributeType = new JLabel("Attribute Type");
        panel.add(lblAttributeType, "2, 2, right, default");
    }
    {
        comboBoxType = new JComboBox();
        comboBoxType.setModel(new DefaultComboBoxModel(
                new String[] { "caste", "scientific name", "sex", "life stage", "part association" }));
        comboBoxType.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                String item = comboBoxType.getSelectedItem().toString();
                if (item != null) {
                    comboBoxValue.setEditable(false);
                    if (item.equals("scientific name")) {
                        comboBoxValue.setEditable(true);
                    }
                    if (item.equals("sex")) {
                        comboBoxValue.setModel(new DefaultComboBoxModel(Sex.getSexValues()));
                    }
                    if (item.equals("life stage")) {
                        comboBoxValue.setModel(new DefaultComboBoxModel(LifeStage.getLifeStageValues()));
                    }
                    if (item.equals("caste")) {
                        comboBoxValue.setModel(new DefaultComboBoxModel(Caste.getCasteValues()));
                    }
                    if (item.equals("part association")) {
                        comboBoxValue
                                .setModel(new DefaultComboBoxModel(PartAssociation.getPartAssociationValues()));
                    }
                }
            }

        });
        panel.add(comboBoxType, "4, 2, fill, default");
    }
    {
        JLabel lblValue = new JLabel("Value");
        panel.add(lblValue, "2, 4, right, default");
    }
    {
        comboBoxValue = new JComboBox();
        comboBoxValue.setModel(new DefaultComboBoxModel(Caste.getCasteValues()));

        panel.add(comboBoxValue, "4, 4, fill, default");
    }
    {
        JLabel lblUnits = new JLabel("Units");
        panel.add(lblUnits, "2, 6, right, default");
    }
    {
        textFieldUnits = new JTextField();
        panel.add(textFieldUnits, "4, 6, fill, default");
        textFieldUnits.setColumns(10);
    }
    {
        JLabel lblRemarks = new JLabel("Remarks");
        panel.add(lblRemarks, "2, 8, right, default");
    }
    contentPanel.setLayout(new BorderLayout(0, 0));
    contentPanel.add(panel, BorderLayout.WEST);
    {
        textFieldRemarks = new JTextField();
        panel.add(textFieldRemarks, "4, 8, fill, default");
        textFieldRemarks.setColumns(10);
    }
    {
        JButton btnAdd = new JButton("Add");
        btnAdd.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                SpecimenPartAttribute newAttribs = new SpecimenPartAttribute();
                newAttribs.setAttributeType(comboBoxType.getSelectedItem().toString());
                newAttribs.setAttributeValue(comboBoxValue.getSelectedItem().toString());
                newAttribs.setAttributeUnits(textFieldUnits.getText());
                newAttribs.setAttributeRemark(textFieldRemarks.getText());
                newAttribs.setSpecimenPartId(parentPart);
                newAttribs.setAttributeDeterminer(Singleton.getSingletonInstance().getUserFullName());
                parentPart.getAttributeCollection().add(newAttribs);
                SpecimenPartAttributeLifeCycle sls = new SpecimenPartAttributeLifeCycle();
                try {
                    sls.attachDirty(newAttribs);
                } catch (SaveFailedException e1) {
                    // TODO Auto-generated catch block
                    e1.printStackTrace();
                }
                ((AbstractTableModel) table.getModel()).fireTableDataChanged();
            }
        });
        panel.add(btnAdd, "4, 10");
    }
    try {
        JLabel lblNewLabel = new JLabel(parentPart.getSpecimenId().getBarcode() + ":" + parentPart.getPartName()
                + " " + parentPart.getPreserveMethod() + " (" + parentPart.getLotCount()
                + ")    Right click on table to edit attributes.");
        contentPanel.add(lblNewLabel, BorderLayout.NORTH);
    } catch (Exception e) {
        JLabel lblNewLabel = new JLabel("No Specimen");
        contentPanel.add(lblNewLabel, BorderLayout.NORTH);
    }
    JComboBox comboBox = new JComboBox();
    comboBox.addItem("caste");
    JComboBox comboBox1 = new JComboBox();
    for (int i = 0; i < Caste.getCasteValues().length; i++) {
        comboBox1.addItem(Caste.getCasteValues()[i]);
    }
    JScrollPane scrollPane = new JScrollPane();

    table = new JTable(new SpecimenPartsAttrTableModel(
            (Collection<SpecimenPartAttribute>) parentPart.getAttributeCollection()));

    //table.getColumnModel().getColumn(0).setCellEditor(new DefaultCellEditor(comboBox));   

    table.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent e) {
            if (e.isPopupTrigger()) {
                clickedOnRow = ((JTable) e.getComponent()).getSelectedRow();
                popupMenu.show(e.getComponent(), e.getX(), e.getY());
            }
        }

        @Override
        public void mouseReleased(MouseEvent e) {
            if (e.isPopupTrigger()) {
                clickedOnRow = ((JTable) e.getComponent()).getSelectedRow();
                popupMenu.show(e.getComponent(), e.getX(), e.getY());
            }
        }
    });

    popupMenu = new JPopupMenu();

    JMenuItem mntmCloneRow = new JMenuItem("Edit Row");
    mntmCloneRow.setMnemonic(KeyEvent.VK_E);
    mntmCloneRow.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            try {
                // Launch a dialog to edit the selected row.
                SpecimenPartAttribEditDialog popup = new SpecimenPartAttribEditDialog(
                        ((SpecimenPartsAttrTableModel) table.getModel()).getRowObject(clickedOnRow));
                popup.setVisible(true);
            } catch (Exception ex) {
                log.error(ex.getMessage());
                JOptionPane.showMessageDialog(thisDialog,
                        "Failed to edit a part attribute row. " + ex.getMessage());
            }
        }
    });
    popupMenu.add(mntmCloneRow);

    JMenuItem mntmDeleteRow = new JMenuItem("Delete Row");
    mntmDeleteRow.setMnemonic(KeyEvent.VK_D);
    mntmDeleteRow.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            try {
                if (clickedOnRow >= 0) {
                    ((SpecimenPartsAttrTableModel) table.getModel()).deleteRow(clickedOnRow);
                }
            } catch (Exception ex) {
                log.error(ex.getMessage());
                JOptionPane.showMessageDialog(thisDialog,
                        "Failed to delete a part attribute row. " + ex.getMessage());
            }
        }
    });
    popupMenu.add(mntmDeleteRow);

    // TODO: Enable controlled value editing of selected row.

    // table.getColumnModel().getColumn(1).setCellEditor(new DefaultCellEditor(comboBox1));

    scrollPane.setViewportView(table);
    contentPanel.add(scrollPane, BorderLayout.EAST);
    {
        JPanel buttonPane = new JPanel();
        buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
        getContentPane().add(buttonPane, BorderLayout.SOUTH);
        {
            okButton = new JButton("OK");
            okButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    okButton.grabFocus();
                    thisDialog.setVisible(false);
                }
            });
            okButton.setActionCommand("OK");
            buttonPane.add(okButton);
            getRootPane().setDefaultButton(okButton);
        }
        {
            JButton cancelButton = new JButton("Cancel");
            cancelButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    thisDialog.setVisible(false);
                }
            });
            cancelButton.setActionCommand("Cancel");
            buttonPane.add(cancelButton);
        }
    }
}

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

/**
 * Metodo adibito alla creazione dinamica ricorsiva dell'interfaccia dei
 * metadati/*from  ww w .ja  v a2s.c  om*/
 *
 * @param submetadatas Map contente i metadati e i sottolivelli di metadati
 * @param vocabularies Map contenente i dati contenuti nel file xml
 * vocabulary.xml
 * @param parent Jpanel nel quale devono venir inseriti i metadati
 * @param level Livello corrente
 */
public void create_metadata_view(Map<Object, Metadata> submetadatas, JPanel parent, int level,
        final String panelname) throws Exception {
    ResourceBundle bundle = ResourceBundle.getBundle(Globals.RESOURCES, Globals.CURRENT_LOCALE, Globals.loader);
    int lenght = submetadatas.size();
    int labelwidth = 220;
    int i = 0;
    JButton addcontribute = null;

    for (Map.Entry<Object, Metadata> kv : submetadatas.entrySet()) {
        ArrayList<Component> tabobjects = new ArrayList<Component>();

        if (kv.getValue().MID == 17 || kv.getValue().MID == 23 || kv.getValue().MID == 18
                || kv.getValue().MID == 137) {
            continue;
        }

        //Crea un jpanel nuovo e fa appen su parent
        JPanel innerPanel = new JPanel(new MigLayout("fillx, insets 1 1 1 1"));
        innerPanel.setName("pannello" + level + i);

        i++;
        String datatype = kv.getValue().datatype.toString();

        if (kv.getValue().MID == 45) {
            JPanel choice = new JPanel(new MigLayout());

            JComboBox combo = addClassificationChoice(choice, kv.getValue().sequence, panelname);

            JLabel labelc = new JLabel();
            labelc.setText(Utility.getBundleString("selectclassif", bundle));
            labelc.setPreferredSize(new Dimension(100, 20));

            choice.add(labelc);

            findLastClassification(panelname);
            if (last_classification != 0 && classificationRemoveButton == null) {
                logger.info("Removing last clasification");
                classificationRemoveButton = new JButton("-");

                classificationRemoveButton.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent event) {
                        BookImporter.getInstance().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                        removeClassificationToMetadata(panelname);
                        BookImporter.getInstance().refreshMetadataTab(false, panelname);
                        findLastClassification(panelname); //update last_classification
                        BookImporter.getInstance().setCursor(null);
                    }
                });
                if (Integer.parseInt(kv.getValue().sequence) == last_classification) {
                    choice.add(classificationRemoveButton, "wrap, width :50:");
                }
            }

            if (classificationAddButton == null) {
                logger.info("Adding a new classification");
                choice.add(combo, "width 100:600:600");

                classificationAddButton = new JButton("+");

                classificationAddButton.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent event) {
                        BookImporter.getInstance().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                        addClassificationToMetadata(panelname);
                        BookImporter.getInstance().refreshMetadataTab(false, panelname);
                        BookImporter.getInstance().setCursor(null);
                    }
                });

                choice.add(classificationAddButton, "width :50:");
            } else {
                //choice.add(combo, "wrap,width 100:700:700");
                choice.add(combo, "width 100:700:700");
                if (Integer.parseInt(kv.getValue().sequence) == last_classification) {
                    choice.add(classificationRemoveButton, "wrap, width :50");
                }
            }
            parent.add(choice, "wrap,width 100:700:700");
            classificationMID = kv.getValue().MID;

            innerPanel.setName(panelname + "---ImPannelloClassif---" + kv.getValue().sequence);
            try {

                addClassification(innerPanel, classificationMID, kv.getValue().sequence, panelname);
            } catch (Exception ex) {
                logger.error("Errore nell'aggiunta delle classificazioni");
            }
            parent.add(innerPanel, "wrap, growx");
            BookImporter.policy.addIndexedComponent(combo);

            continue;
        }

        if (datatype.equals("Node")) {
            JLabel label = new JLabel();
            label.setText(kv.getValue().description);
            label.setPreferredSize(new Dimension(100, 20));

            int size = 16 - (level * 2);
            Font myFont = new Font("MS Sans Serif", Font.PLAIN, size);
            label.setFont(myFont);

            if (Integer.toString(kv.getValue().MID).equals("11")) {
                JPanel temppanel = new JPanel(new MigLayout());

                //update last_contribute
                findLastContribute(panelname);

                if (last_contribute != 0 && removeContribute == null) {
                    logger.info("Removing last contribute");
                    removeContribute = new JButton("-");

                    removeContribute.addActionListener(new ActionListener() {
                        @Override
                        public void actionPerformed(ActionEvent event) {
                            BookImporter.getInstance()
                                    .setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                            removeContributorToMetadata(panelname);
                            BookImporter.getInstance().refreshMetadataTab(false, panelname);
                            BookImporter.getInstance().setCursor(null);
                        }
                    });

                    if (!kv.getValue().sequence.equals("")) {
                        if (Integer.parseInt(kv.getValue().sequence) == last_contribute) {
                            innerPanel.add(removeContribute, "width :50:");
                        }
                    }
                }

                if (addcontribute == null) {
                    logger.info("Adding a new contribute");
                    addcontribute = new JButton("+");

                    addcontribute.addActionListener(new ActionListener() {
                        @Override
                        public void actionPerformed(ActionEvent event) {
                            BookImporter.getInstance()
                                    .setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                            addContributorToMetadata(panelname);
                            BookImporter.getInstance().refreshMetadataTab(false, panelname);
                            BookImporter.getInstance().setCursor(null);
                        }
                    });

                    temppanel.add(label, " width :200:");
                    temppanel.add(addcontribute, "width :50:");
                    innerPanel.add(temppanel, "wrap, growx");
                } else {
                    temppanel.add(label, " width :200:");
                    findLastContribute(panelname);
                    if (!kv.getValue().sequence.equals("")) {
                        if (Integer.parseInt(kv.getValue().sequence) == last_contribute) {
                            temppanel.add(removeContribute, "width :50:");
                        }
                    }
                    innerPanel.add(temppanel, "wrap, growx");
                }
            } else if (Integer.toString(kv.getValue().MID).equals("115")) {
                logger.info("Devo gestire una provenience!");
            }
        } else {
            String title = "";

            if (kv.getValue().mandatory.equals("Y") || kv.getValue().MID == 14 || kv.getValue().MID == 15) {
                title = kv.getValue().description + " *";
            } else {
                title = kv.getValue().description;
            }

            innerPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), title,
                    TitledBorder.LEFT, TitledBorder.TOP));

            if (datatype.equals("Vocabulary")) {
                TreeMap<String, String> entryCombo = new TreeMap<String, String>();
                int index = 0;
                String selected = null;

                if (!Integer.toString(kv.getValue().MID).equals("8"))
                    entryCombo.put(Utility.getBundleString("comboselect", bundle),
                            Utility.getBundleString("comboselect", bundle));

                for (Map.Entry<String, TreeMap<String, VocEntry>> vc : vocabularies.entrySet()) {
                    String tempmid = Integer.toString(kv.getValue().MID);

                    if (Integer.toString(kv.getValue().MID_parent).equals("11")
                            || Integer.toString(kv.getValue().MID_parent).equals("13")) {
                        String[] testmid = tempmid.split("---");
                        tempmid = testmid[0];
                    }

                    if (vc.getKey().equals(tempmid)) {
                        TreeMap<String, VocEntry> iEntry = vc.getValue();

                        for (Map.Entry<String, VocEntry> ivc : iEntry.entrySet()) {
                            entryCombo.put(ivc.getValue().description, ivc.getValue().ID);
                            if (kv.getValue().value != null) {
                                if (kv.getValue().value.equals(ivc.getValue().ID)) {
                                    selected = ivc.getValue().ID;
                                }
                            }
                            index++;
                        }
                    }
                }

                final ComboMapImpl model = new ComboMapImpl();
                model.setVocabularyCombo(true);
                model.putAll(entryCombo);

                final JComboBox voc = new javax.swing.JComboBox(model);
                model.specialRenderCombo(voc);

                if (Integer.toString(kv.getValue().MID_parent).equals("11")
                        || Integer.toString(kv.getValue().MID_parent).equals("13")) {
                    voc.setName("MID_" + Integer.toString(kv.getValue().MID) + "---" + kv.getValue().sequence);
                } else {
                    voc.setName("MID_" + Integer.toString(kv.getValue().MID));
                }

                if (Integer.toString(kv.getValue().MID).equals("8") && selected == null)
                    selected = "44";

                selected = (selected == null) ? Utility.getBundleString("comboselect", bundle) : selected;

                for (int k = 0; k < voc.getItemCount(); k++) {
                    Map.Entry<String, String> el = (Map.Entry<String, String>) voc.getItemAt(k);
                    if (el.getValue().equals(selected))
                        voc.setSelectedIndex(k);
                }

                voc.setPreferredSize(new Dimension(150, 30));
                innerPanel.add(voc, "wrap, width :400:");
                tabobjects.add(voc);
            } else if (datatype.equals("CharacterString") || datatype.equals("GPS")) {
                final JTextArea textField = new javax.swing.JTextArea();

                if (Integer.toString(kv.getValue().MID_parent).equals("11")
                        || Integer.toString(kv.getValue().MID_parent).equals("13")) {
                    textField.setName(
                            "MID_" + Integer.toString(kv.getValue().MID) + "---" + kv.getValue().sequence);
                } else {
                    textField.setName("MID_" + Integer.toString(kv.getValue().MID));
                }

                textField.setPreferredSize(new Dimension(230, 0));
                textField.setText(kv.getValue().value);
                textField.setLineWrap(true);
                textField.setWrapStyleWord(true);

                innerPanel.add(textField, "wrap, width :300:");

                textField.addKeyListener(new KeyAdapter() {
                    @Override
                    public void keyPressed(KeyEvent e) {
                        if (e.getKeyCode() == KeyEvent.VK_TAB) {
                            if (e.getModifiers() > 0) {
                                textField.transferFocusBackward();
                            } else {
                                textField.transferFocus();
                            }
                            e.consume();
                        }
                    }
                });

                tabobjects.add(textField);
            } else if (datatype.equals("LangString")) {
                JScrollPane inner_scroll = new javax.swing.JScrollPane();
                inner_scroll.setHorizontalScrollBarPolicy(
                        javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
                inner_scroll.setVerticalScrollBarPolicy(
                        javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
                inner_scroll.setPreferredSize(new Dimension(240, 80));
                inner_scroll.setName("langStringScroll");
                final JTextArea jTextArea1 = new javax.swing.JTextArea();
                jTextArea1.setName("MID_" + Integer.toString(kv.getValue().MID));
                jTextArea1.setText(kv.getValue().value);

                jTextArea1.setSize(new Dimension(350, 70));
                jTextArea1.setLineWrap(true);
                jTextArea1.setWrapStyleWord(true);

                inner_scroll.setViewportView(jTextArea1);
                innerPanel.add(inner_scroll, "width :300:");

                //Add combo language box
                JComboBox voc = getComboLangBox(kv.getValue().language);
                voc.setName("MID_" + Integer.toString(kv.getValue().MID) + "_lang");

                voc.setPreferredSize(new Dimension(200, 20));
                innerPanel.add(voc, "wrap, width :300:");

                jTextArea1.addKeyListener(new KeyAdapter() {
                    @Override
                    public void keyPressed(KeyEvent e) {
                        if (e.getKeyCode() == KeyEvent.VK_TAB) {
                            if (e.getModifiers() > 0) {
                                jTextArea1.transferFocusBackward();
                            } else {
                                jTextArea1.transferFocus();
                            }
                            e.consume();
                        }
                    }
                });
                tabobjects.add(jTextArea1);
                tabobjects.add(voc);
            } else if (datatype.equals("Language")) {
                final JComboBox voc = getComboLangBox(kv.getValue().value);
                voc.setName("MID_" + Integer.toString(kv.getValue().MID));

                voc.setPreferredSize(new Dimension(150, 20));
                voc.setBounds(5, 5, 150, 20);
                innerPanel.add(voc, "wrap, width :500:");

                //BookImporter.policy.addIndexedComponent(voc);
                tabobjects.add(voc);

            } else if (datatype.equals("Boolean")) {
                int selected = 0;
                TreeMap bin = new TreeMap<String, String>();
                bin.put("yes", Utility.getBundleString("voc1", bundle));
                bin.put("no", Utility.getBundleString("voc2", bundle));

                if (kv.getValue().value == null) {
                    switch (kv.getValue().MID) {
                    case 35:
                        selected = 0;
                        break;
                    case 36:
                        selected = 1;
                        break;
                    }
                } else if (kv.getValue().value.equals("yes")) {
                    selected = 1;
                } else {
                    selected = 0;
                }

                final ComboMapImpl model = new ComboMapImpl();
                model.putAll(bin);

                final JComboBox voc = new javax.swing.JComboBox(model);
                model.specialRenderCombo(voc);

                voc.setName("MID_" + Integer.toString(kv.getValue().MID));
                voc.setSelectedIndex(selected);

                voc.setPreferredSize(new Dimension(150, 20));
                voc.setBounds(5, 5, 150, 20);
                innerPanel.add(voc, "wrap, width :300:");
                //BookImporter.policy.addIndexedComponent(voc);
                tabobjects.add(voc);
            } else if (datatype.equals("License")) {
                String selectedIndex = null;
                int vindex = 0;
                int defaultIndex = 0;

                TreeMap<String, String> entryCombo = new TreeMap<String, String>();

                for (Map.Entry<String, TreeMap<String, VocEntry>> vc : vocabularies.entrySet()) {
                    if (vc.getKey().equals(Integer.toString(kv.getValue().MID))) {
                        TreeMap<String, VocEntry> iEntry = vc.getValue();

                        for (Map.Entry<String, VocEntry> ivc : iEntry.entrySet()) {
                            entryCombo.put(ivc.getValue().description, ivc.getValue().ID);

                            if (ivc.getValue().ID.equals("1"))
                                defaultIndex = vindex;

                            if (kv.getValue().value != null) {
                                if (ivc.getValue().ID.equals(kv.getValue().value)) {
                                    selectedIndex = Integer.toString(vindex);
                                }
                            }
                            vindex++;
                        }
                    }
                }

                if (selectedIndex == null)
                    selectedIndex = Integer.toString(defaultIndex);

                ComboMapImpl model = new ComboMapImpl();
                model.putAll(entryCombo);
                model.setVocabularyCombo(true);

                JComboBox voc = new javax.swing.JComboBox(model);
                model.specialRenderCombo(voc);

                voc.setName("MID_" + Integer.toString(kv.getValue().MID));
                voc.setSelectedIndex(Integer.parseInt(selectedIndex));
                voc.setPreferredSize(new Dimension(150, 20));

                voc.setBounds(5, 5, 150, 20);
                innerPanel.add(voc, "wrap, width :500:");
                //BookImporter.policy.addIndexedComponent(voc);
                tabobjects.add(voc);
            } else if (datatype.equals("DateTime")) {
                //final JXDatePicker datePicker = new JXDatePicker();
                JDateChooser datePicker = new JDateChooser();
                datePicker.setName("MID_" + Integer.toString(kv.getValue().MID));

                JPanel test = new JPanel(new MigLayout());
                JLabel lbefore = new JLabel(Utility.getBundleString("beforechristlabel", bundle));
                JCheckBox beforechrist = new JCheckBox();
                beforechrist.setName("MID_" + Integer.toString(kv.getValue().MID) + "_check");

                if (kv.getValue().value != null) {
                    try {
                        if (kv.getValue().value.charAt(0) == '-') {
                            beforechrist.setSelected(true);
                        }

                        Date date1 = new Date();
                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                        if (kv.getValue().value.charAt(0) == '-') {
                            date1 = sdf.parse(adjustDate(kv.getValue().value));
                        } else {
                            date1 = sdf.parse(kv.getValue().value);
                        }
                        datePicker.setDate(date1);
                    } catch (Exception e) {
                        //Console.WriteLine("ERROR import date:" + ex.Message);
                    }
                }

                test.add(datePicker, "width :200:");
                test.add(lbefore, "gapleft 30");
                test.add(beforechrist, "wrap");

                innerPanel.add(test, "wrap");
            }
        }

        //Recursive call
        create_metadata_view(kv.getValue().submetadatas, innerPanel, level + 1, panelname);

        if (kv.getValue().editable.equals("Y")
                || (datatype.equals("Node") && kv.getValue().hidden.equals("0"))) {
            parent.add(innerPanel, "wrap, growx");

            for (Component tabobject : tabobjects) {
                BookImporter.policy.addIndexedComponent(tabobject);
            }
        }
    }
}

From source file:org.fhaes.jsea.JSEAFrame.java

/**
 * Setup the GUI components/*from   w w  w  .  j a va2s  .  co m*/
 */
private void setupGui() {

    setTitle("jSEA - Superposed Epoch Analysis");

    getContentPane().setLayout(new MigLayout("", "[1200px,grow,fill]", "[][600px,grow,fill]"));

    initActions();
    setupMenu();
    setupToolbar();

    this.setIconImage(Builder.getApplicationIcon());
    {
        JSplitPane splitPane = new JSplitPane();
        splitPane.setOneTouchExpandable(true);
        getContentPane().add(splitPane, "cell 0 1,alignx left,aligny top");
        splitPane.setLeftComponent(contentPanel);
        contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
        contentPanel.setLayout(new MigLayout("", "[grow,fill]", "[78.00][][][grow][]"));
        {
            JPanel panel = new JPanel();
            panel.setBorder(
                    new TitledBorder(null, "Input Files", TitledBorder.LEADING, TitledBorder.TOP, null, null));
            contentPanel.add(panel, "cell 0 0,grow");
            panel.setLayout(new MigLayout("", "[][][grow][]", "[][]"));
            {
                JLabel lblContinuousTimeSeries = new JLabel("Continuous time series file:");
                panel.add(lblContinuousTimeSeries, "cell 0 0,alignx trailing");
            }
            {
                HelpTipButton label = new HelpTipButton(
                        "Continuous time series data files should be two column comma seperated (CSV) text files.  Column one should contains the years (in sequence), and column two should contain the data values.  If there are header lines or comments in the file, these lines should beginning with a *");
                panel.add(label, "cell 1 0,alignx trailing");
            }
            {
                txtTimeSeriesFile = new JTextField();
                txtwrapper = new TextComponentWrapper(txtTimeSeriesFile,
                        PrefKey.JSEA_CONTINUOUS_TIME_SERIES_FILE, "");
                txtTimeSeriesFile.setEditable(true);
                panel.add(txtTimeSeriesFile, "cell 2 0,growx");
                txtTimeSeriesFile.setColumns(10);
            }
            {
                btnTimeSeriesFile = new JButton();
                btnTimeSeriesFile.setIcon(Builder.getImageIcon("fileopen16.png"));
                btnTimeSeriesFile.setActionCommand("TimeSeriesFileBrowse");
                btnTimeSeriesFile.addActionListener(this);
                btnTimeSeriesFile.setPreferredSize(new Dimension(25, 25));
                btnTimeSeriesFile.setMaximumSize(new Dimension(25, 25));
                btnTimeSeriesFile.putClientProperty("JButton.buttonType", "segmentedTextured");
                btnTimeSeriesFile.putClientProperty("JButton.segmentPosition", "middle");

                panel.add(btnTimeSeriesFile, "cell 3 0");
            }
            {
                JLabel lblEventListFile = new JLabel("Event list file:");
                panel.add(lblEventListFile, "cell 0 1,alignx trailing");
            }
            {
                HelpTipButton helpTipButton = new HelpTipButton(
                        "Event data files should be a text file with a single column of integer year values.  If there are any header or comment lines, these should begin with a *");
                panel.add(helpTipButton, "cell 1 1,alignx trailing");
            }
            {
                txtEventListFile = new JTextField();
                new TextComponentWrapper(txtEventListFile, PrefKey.JSEA_EVENT_LIST_FILE, "");
                txtEventListFile.setEditable(false);
                panel.add(txtEventListFile, "cell 2 1,growx");
                txtEventListFile.setColumns(10);
            }
            {
                btnEventListFile = new JButton();
                btnEventListFile.setIcon(Builder.getImageIcon("fileopen16.png"));
                btnEventListFile.setActionCommand("EventListFileBrowse");
                btnEventListFile.addActionListener(this);
                btnEventListFile.setPreferredSize(new Dimension(25, 25));
                btnEventListFile.setMaximumSize(new Dimension(25, 25));
                btnEventListFile.putClientProperty("JButton.buttonType", "segmentedTextured");
                btnEventListFile.putClientProperty("JButton.segmentPosition", "middle");
                panel.add(btnEventListFile, "cell 3 1");
            }
        }
        {
            JPanel panel = new JPanel();
            panel.setBorder(new TitledBorder(null, "Window, Simulation and Statistics", TitledBorder.LEADING,
                    TitledBorder.TOP, null, null));
            contentPanel.add(panel, "cell 0 1,grow");
            panel.setLayout(new MigLayout("", "[right][][fill][10px:10px:10px][right][][90.00,grow,fill]",
                    "[grow][][][]"));
            {
                JLabel lblYears = new JLabel("Years to analyse:");
                panel.add(lblYears, "cell 0 0");
            }
            {
                HelpTipButton helpTipButton = new HelpTipButton(
                        "Specify which years from the dataset to analyse.");
                panel.add(helpTipButton, "cell 1 0");
            }
            {
                JPanel panel_1 = new JPanel();
                panel.add(panel_1, "cell 2 0 5 1,grow");
                panel_1.setLayout(new MigLayout("fill, insets 0", "[80px:80px][][80px:80px,fill][grow]", "[]"));
                {
                    spnFirstYear = new JSpinner();
                    spnFirstYear.setEnabled(false);
                    panel_1.add(spnFirstYear, "cell 0 0,growx");
                    spnFirstYear.setModel(new SpinnerNumberModel(new Integer(0), null, null, new Integer(1)));
                    spnFirstYear.setEditor(new JSpinner.NumberEditor(spnFirstYear, "#"));
                    new SpinnerWrapper(spnFirstYear, PrefKey.JSEA_FIRST_YEAR, 0);
                }
                {
                    JLabel lblTo = new JLabel("-");
                    panel_1.add(lblTo, "cell 1 0");
                }
                {
                    spnLastYear = new JSpinner();
                    spnLastYear.setEnabled(false);
                    panel_1.add(spnLastYear, "cell 2 0");
                    spnLastYear.setModel(new SpinnerNumberModel(new Integer(2020), null, null, new Integer(1)));
                    spnLastYear.setEditor(new JSpinner.NumberEditor(spnLastYear, "#"));
                    new SpinnerWrapper(spnLastYear, PrefKey.JSEA_LAST_YEAR, 2020);
                }
                {
                    chkAllYears = new JCheckBox("all years in series");
                    chkAllYears.setSelected(true);
                    chkAllYears.setActionCommand("AllYearsCheckbox");
                    chkAllYears.addActionListener(this);
                    panel_1.add(chkAllYears, "cell 3 0");
                }
            }
            {
                JLabel lblLagsPriorTo = new JLabel("Lags prior to event:");
                panel.add(lblLagsPriorTo, "cell 0 1");
            }
            {
                HelpTipButton helpTipButton = new HelpTipButton("");
                panel.add(helpTipButton, "cell 1 1");
            }
            {
                spnLagsPrior = new JSpinner();
                new SpinnerWrapper(spnLagsPrior, PrefKey.JSEA_LAGS_PRIOR_TO_EVENT, 6);
                panel.add(spnLagsPrior, "cell 2 1,growx");
                // spnLagsPrior.setModel(new SpinnerNumberModel(6, 1, 100, 1));
                spnLagsPrior.addChangeListener(new ChangeListener() {

                    @Override
                    public void stateChanged(ChangeEvent e) {

                        segmentationPanel.table.tableModel.clearSegments();
                        validateForm();
                    }
                });
            }
            {
                JLabel lblSimulationsToRun = new JLabel("Simulations:");
                panel.add(lblSimulationsToRun, "cell 4 1");
            }
            {
                HelpTipButton helpTipButton = new HelpTipButton(
                        "Number of simulations to run.  Increasing the number of simulations increases the analysis time.");
                panel.add(helpTipButton, "cell 5 1");
            }
            {
                spnSimulationsToRun = new JSpinner();
                new SpinnerWrapper(spnSimulationsToRun, PrefKey.JSEA_SIMULATION_COUNT, 1000);
                panel.add(spnSimulationsToRun, "cell 6 1");
                spnSimulationsToRun.setModel(new SpinnerNumberModel(1000, 1, 10096, 1));
            }
            {
                JLabel lblLagsFollowingThe = new JLabel("Lags following the event:");
                panel.add(lblLagsFollowingThe, "cell 0 2");
            }
            {
                HelpTipButton helpTipButton = new HelpTipButton("");
                panel.add(helpTipButton, "cell 1 2");
            }
            {
                spnLagsAfter = new JSpinner();
                new SpinnerWrapper(spnLagsAfter, PrefKey.JSEA_LAGS_AFTER_EVENT, 4);
                panel.add(spnLagsAfter, "cell 2 2,growx");
                spnLagsAfter.addChangeListener(new ChangeListener() {

                    @Override
                    public void stateChanged(ChangeEvent e) {

                        segmentationPanel.table.tableModel.clearSegments();
                        validateForm();
                    }
                });
            }
            {
                JLabel lblSeedNumber = new JLabel("Seed number:");
                panel.add(lblSeedNumber, "cell 4 2");
            }
            {
                HelpTipButton helpTipButton = new HelpTipButton(
                        "The analysis requires a pseudo-random component which is seeded with the seed number (a large integer value).  Running analyses with the same seed number enables produces the same results.  You can leave the seed as the default number unless you specifically want to generate results from a different randomised pool.");
                panel.add(helpTipButton, "cell 5 2");
            }
            {
                spnSeedNumber = new JSpinner();
                new SpinnerWrapper(spnSeedNumber, PrefKey.JSEA_SEED_NUMBER, 30188);
                panel.add(spnSeedNumber, "cell 6 2");
                spnSeedNumber.setModel(new SpinnerNumberModel(30188, 10000, 1000000, 1));
            }
            {
                JLabel lblIncludeIncompleteWindow = new JLabel("Include incomplete epoch:");
                panel.add(lblIncludeIncompleteWindow, "cell 0 3");
            }
            {
                HelpTipButton helpTipButton = new HelpTipButton("");
                panel.add(helpTipButton, "cell 1 3");
            }
            {
                chkIncludeIncompleteWindow = new JCheckBox("");
                new CheckBoxWrapper(chkIncludeIncompleteWindow, PrefKey.JSEA_INCLUDE_INCOMPLETE_WINDOW, false);

                panel.add(chkIncludeIncompleteWindow, "cell 2 3");
            }
            {
                JLabel lblPvalue = new JLabel("p-value:");
                panel.add(lblPvalue, "cell 4 3");
            }
            {
                HelpTipButton helpTipButton = new HelpTipButton(
                        "The cutoff value to use for statistical significance");
                panel.add(helpTipButton, "cell 5 3,alignx trailing");
            }
            {
                cbxPValue = new JComboBox();
                panel.add(cbxPValue, "cell 6 3");
                cbxPValue.setModel(new DefaultComboBoxModel(new Double[] { 0.05, 0.01, 0.001 }));
            }
        }
        {
            JPanel panel = new JPanel();
            panel.setBorder(new TitledBorder(null, "Chart Options", TitledBorder.LEADING, TitledBorder.TOP,
                    null, null));
            contentPanel.add(panel, "cell 0 2,grow");

            panel.setLayout(new MigLayout("", "[right][][grow]", "[][]"));
            {
                JLabel lblTitleOfChart = new JLabel("Title of chart:");
                panel.add(lblTitleOfChart, "cell 0 0,alignx trailing");
            }
            {
                HelpTipButton helpTipButton = new HelpTipButton(
                        "Title to use on the chart.  The placeholder {segment} is replaced with the years of the segment being plotted.");
                panel.add(helpTipButton, "cell 1 0,alignx trailing");
            }
            {
                txtChartTitle = new JTextField();
                txtChartTitle.setToolTipText("<html>Title to be displayed on the<br/>" + "chart output");
                new TextComponentWrapper(txtChartTitle, PrefKey.JSEA_CHART_TITLE, "Chart title {segment}");
                panel.add(txtChartTitle, "cell 2 0,growx,aligny top");
                txtChartTitle.setColumns(10);
            }
            {
                JLabel lblYaxisLabel = new JLabel("Continuous series (y-axis) label");
                panel.add(lblYaxisLabel, "cell 0 1,alignx trailing");
            }
            {
                txtYAxisLabel = new JTextField();
                txtYAxisLabel
                        .setToolTipText("<html>Label to be displayed on the<br/> " + "continuous series axis");
                new TextComponentWrapper(txtYAxisLabel, PrefKey.JSEA_YAXIS_LABEL, "Y Axis");
                panel.add(txtYAxisLabel, "cell 2 1,growx");
                txtYAxisLabel.setColumns(10);
            }
        }
        {
            // Segmentation implementation used from FHSampleSize
            segmentationPanel = new SegmentationPanel();
            segmentationPanel.chkSegmentation.setText("Process subset or segments of events?");
            segmentationPanel.chkSegmentation.setActionCommand("SegmentationMode");
            segmentationPanel.chkSegmentation.addActionListener(this);
            contentPanel.add(segmentationPanel, "cell 0 3,grow");
        }
        {
            tabbedPane = new JTabbedPane(JTabbedPane.BOTTOM);
            splitPane.setRightComponent(tabbedPane);
            {
                summaryPanel = new JPanel();
                tabbedPane.addTab("Summary ", Builder.getImageIcon("info.png"), summaryPanel, null);
                summaryPanel.setLayout(new BorderLayout(0, 0));
                {
                    scrollPane = new JScrollPane();
                    summaryPanel.add(scrollPane);
                    {
                        txtSummary = new JTextArea();
                        txtSummary.setEditable(false);
                        scrollPane.setViewportView(txtSummary);
                        JMenuItem mntmCopy = new JMenuItem(actionCopy);
                        JPopupMenu popup = new JPopupMenu();
                        addPopup(scrollPane, popup);
                        popup.add(mntmCopy);
                    }
                }
            }
            {
                dataPanel = new JPanel();
                tabbedPane.addTab("Data ", Builder.getImageIcon("table.png"), dataPanel, null);
                dataPanel.setLayout(new MigLayout("", "[grow,fill]", "[grow]"));
                {
                    JSplitPane splitPaneDataTables = new JSplitPane();
                    splitPaneDataTables.setResizeWeight(0.5);
                    splitPaneDataTables.setOneTouchExpandable(true);
                    splitPaneDataTables.setOrientation(JSplitPane.VERTICAL_SPLIT);
                    dataPanel.add(splitPaneDataTables, "cell 0 0,grow");
                    {
                        JPanel panel = new JPanel();
                        splitPaneDataTables.setLeftComponent(panel);
                        panel.setBorder(new TitledBorder(null, "Actual key events", TitledBorder.LEADING,
                                TitledBorder.TOP, null, null));
                        panel.setLayout(new MigLayout("", "[227.00px,grow,fill]", "[68.00px,grow,fill]"));
                        {
                            JScrollPane scrollPane = new JScrollPane();
                            panel.add(scrollPane, "cell 0 0,grow");
                            {
                                tblActual = new JXTable();
                                adapterActualTable = new JTableSpreadsheetByRowAdapter(tblActual);
                                scrollPane.setViewportView(tblActual);
                                tblActual.setSortable(false);
                                JMenuItem mntmCopy = new JMenuItem(actionCopy);
                                JPopupMenu popup = new JPopupMenu();
                                addPopup(tblActual, popup);
                                popup.add(mntmCopy);
                            }
                        }
                    }
                    {
                        JPanel panel = new JPanel();
                        splitPaneDataTables.setRightComponent(panel);
                        panel.setBorder(new TitledBorder(null, "Simulation results", TitledBorder.LEADING,
                                TitledBorder.TOP, null, null));
                        panel.setLayout(new MigLayout("", "[grow,fill]", "[grow,fill]"));
                        {
                            JScrollPane scrollPane = new JScrollPane();
                            panel.add(scrollPane, "cell 0 0,grow");
                            {
                                tblSimulation = new JXTable();
                                adapterSimulationTable = new JTableSpreadsheetByRowAdapter(tblSimulation);
                                scrollPane.setViewportView(tblSimulation);
                                tblSimulation.setSortable(false);
                                JMenuItem mntmCopy = new JMenuItem(actionCopy);
                                JPopupMenu popup = new JPopupMenu();
                                addPopup(tblSimulation, popup);
                                popup.add(mntmCopy);
                            }
                        }
                    }
                    splitPaneDataTables.setDividerLocation(0.5f);
                }
            }
            {
                chartPanel = new JPanel();
                tabbedPane.addTab("Chart ", Builder.getImageIcon("barchart.png"), chartPanel, null);
                chartPanel.setLayout(new MigLayout("", "[][grow]", "[][grow]"));
                {
                    segmentComboBox = new JComboBox();
                    segmentComboBox.addItemListener(new ItemListener() {

                        @Override
                        public void itemStateChanged(ItemEvent arg0) {

                            if (segmentComboBox.getItemCount() > 0) {
                                barChart = new JSEABarChart(
                                        jsea.getChartList().get(segmentComboBox.getSelectedIndex()));
                                barChart.setMaximumDrawHeight(MAX_DRAW_HEIGHT);
                                barChart.setMaximumDrawWidth(MAX_DRAW_WIDTH);
                                chartPanel.removeAll();
                                chartPanel.add(plotSegmentLabel, "cell 0 0,alignx center,aligny center");
                                chartPanel.add(segmentComboBox, "cell 1 0,growx,aligny center");
                                chartPanel.add(barChart, "cell 0 1 2 1,grow");
                                chartPanel.revalidate();
                                chartPanel.repaint();
                            }
                        }
                    });
                    {
                        plotSegmentLabel = new JLabel("Plot Segment: ");
                        chartPanel.add(plotSegmentLabel, "cell 0 0,alignx center,aligny center");
                    }
                    chartPanel.add(segmentComboBox, "cell 1 0,growx,aligny center");
                }
            }
        }
    }

    pack();
    validateForm();
    setAnalysisAvailable(false);
    setExtendedState(this.getExtendedState() | JFrame.MAXIMIZED_BOTH);
}

From source file:com.lynk.hrm.ui.dialog.InfoEmployee.java

private void initComponents() {
    addWindowListener(new WindowAdapter() {
        @Override//w  ww . j av a 2 s  .  com
        public void windowClosing(WindowEvent e) {
            thisWindowClosing(e);
        }
    });
    setSize(836, 674);
    setTitle("");
    setIconImage(
            Toolkit.getDefaultToolkit().getImage(InfoEmployee.class.getResource("/resource/image/icon.png")));
    setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
    getContentPane().setLayout(new BorderLayout(0, 0));
    {
        JToolBar toolBar = new JToolBar();
        toolBar.setFloatable(false);
        getContentPane().add(toolBar, BorderLayout.NORTH);
        {
            JButton uiSave = new JButton("?");
            uiSave.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    uiSaveActionPerformed(true);
                }
            });
            uiSave.setFocusable(false);
            uiSave.setIcon(new ImageIcon(InfoEmployee.class.getResource("/resource/image/emp_save.png")));
            uiSave.setFont(APP_FONT);
            toolBar.add(uiSave);
        }
        toolBar.addSeparator();
        {
            JButton uiReadIdCard = new JButton("??");
            uiReadIdCard.setFont(APP_FONT);
            uiReadIdCard.setIcon(
                    new ImageIcon(InfoEmployee.class.getResource("/resource/image/manager_teacher.png")));
            uiReadIdCard.setFocusable(false);
            uiReadIdCard.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    uiReadIdCardActionPerformed(e);
                }
            });
            toolBar.add(uiReadIdCard);
        }
        toolBar.addSeparator();
        {
            JButton uiInputFinger = new JButton("");
            uiInputFinger.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    uiInputFingerActionPerformed(e);
                }
            });
            uiInputFinger.setIcon(new ImageIcon(InfoEmployee.class.getResource("/resource/image/finger.png")));
            uiInputFinger.setFont(APP_FONT);
            uiInputFinger.setFocusable(false);
            toolBar.add(uiInputFinger);
        }
        toolBar.addSeparator();
        {
            JButton uiSetSuspend = new JButton("??");
            uiSetSuspend.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    uiSetSuspendActionPerformed(e);
                }
            });
            uiSetSuspend
                    .setIcon(new ImageIcon(InfoEmployee.class.getResource("/resource/image/emp_retire.png")));
            uiSetSuspend.setFont(APP_FONT);
            uiSetSuspend.setFocusable(false);
            toolBar.add(uiSetSuspend);
        }
    }

    {
        JPanel panel = new JPanel();
        getContentPane().add(panel);
        panel.setLayout(new MigLayout("", "[]5[grow]25[]5[grow]25[]5[grow]5[102]", "[][][][]"));
        {
            JLabel label = new JLabel("?");
            label.setHorizontalAlignment(SwingConstants.RIGHT);
            label.setFont(APP_FONT);
            panel.add(label, "cell 0 0");
        }
        {
            uiId = new LynkTextField();
            uiId.setEditable(false);
            uiId.setForeground(Color.BLUE);
            panel.add(uiId, "cell 1 0,growx");
        }
        {
            JLabel label = new JLabel("??");
            label.setHorizontalAlignment(SwingConstants.RIGHT);
            label.setFont(APP_FONT);
            panel.add(label, "cell 2 0");
        }
        {
            uiName = new LynkTextField();
            uiName.addFocusListener(new FocusAdapter() {
                @Override
                public void focusLost(FocusEvent e) {
                    uiNameFocusLost(e);
                }
            });
            panel.add(uiName, "cell 3 0,growx");
        }
        {
            JLabel label = new JLabel("?");
            label.setHorizontalAlignment(SwingConstants.RIGHT);
            label.setFont(APP_FONT);
            panel.add(label, "cell 4 0");
        }
        {
            uiNamePy = new LynkTextField();
            panel.add(uiNamePy, "cell 5 0,growx");
        }
        {
            JLabel label = new JLabel("?");
            label.setHorizontalAlignment(SwingConstants.RIGHT);
            label.setFont(APP_FONT);
            panel.add(label, "cell 0 1");
        }
        {
            uiState = new JComboBox<String>();
            uiState.setForeground(Color.BLUE);
            uiState.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    uiStateActionPerformed(e);
                }
            });
            uiState.setModel(new DefaultComboBoxModel<String>(new String[] { "", Employee.STATE_PROBATION,
                    Employee.STATE_CONTRACT, Employee.STATE_SUSPEND, Employee.STATE_LEAVE,
                    Employee.STATE_RETIRE, Employee.STATE_DELETE }));
            uiState.setFont(APP_FONT);
            panel.add(uiState, "cell 1 1,growx");
        }
        {
            uiInfoTab = new JideTabbedPane(JTabbedPane.TOP);
            uiInfoTab.addChangeListener(new ChangeListener() {
                public void stateChanged(ChangeEvent e) {
                    uiInfoTabStateChanged(e);
                }
            });
            uiInfoTab.setColorTheme(JideTabbedPane.COLOR_THEME_DEFAULT);
            uiInfoTab.setFont(APP_FONT);
            panel.add(uiInfoTab, "cell 0 3 7 1");
            {
                JPanel uiInfoBasic = new JPanel();
                uiInfoBasic.setLayout(new MigLayout("", "[473px,grow][307px,grow]", "[grow][289px][149px]"));
                uiInfoTab.addTab("?", uiInfoBasic);
                {
                    JPanel uiIdCardPane = new JPanel();
                    uiIdCardPane.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
                    uiIdCardPane.setLayout(new MigLayout("", "[]5[grow]10[]", "[][][][][40px:40px:40px,grow]"));
                    uiInfoBasic.add(uiIdCardPane, "cell 0 0,grow");
                    {
                        JLabel label = new JLabel("??");
                        uiIdCardPane.add(label, "cell 0 0");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiIdCard = new LynkTextField();
                        uiIdCardPane.add(uiIdCard, "cell 1 0,growx");
                    }
                    {
                        JPanel pane = new JPanel();
                        uiIdCardPane.add(pane, "cell 2 0 1 5,grow");
                        pane.setLayout(new MigLayout("insets 0", "[102px:102px:102px]", "[126px:126px:126px]"));
                        {
                            uiPhoto = new ImagePane();
                            pane.add(uiPhoto, "cell 0 0,grow");
                        }
                    }
                    //                  {
                    //                     JPanel photoPane = new JPanel();
                    //                     photoPane.setLayout(new MigLayout("insets 0", "[grow]", "[grow][]"));
                    //                     uiIdCardPane.add(photoPane, "cell 2 0 2 4,grow");
                    //                     {
                    //                        uiPhoto = new ImagePane();
                    //                        photoPane.add(uiPhoto, "cell 0 0,grow");
                    //                     }
                    //                     {
                    //                        JButton uiReadIdCardDirect = new JButton("??");
                    //                        uiReadIdCardDirect.addActionListener(new ActionListener() {
                    //                           public void actionPerformed(ActionEvent e) {
                    //                              uiReadIdCardDirectActionPerformed(e);
                    //                           }
                    //                        });
                    //                        uiReadIdCardDirect.setFont(APP_FONT);
                    //                        uiReadIdCardDirect.setFocusable(false);
                    //                        photoPane.add(uiReadIdCardDirect, "cell 0 1,grow");
                    //                     }
                    //                  }
                    {
                        JLabel label = new JLabel("");
                        uiIdCardPane.add(label, "cell 0 1");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiBirthday = new LynkTextField();
                        uiIdCardPane.add(uiBirthday, "cell 1 1,growx");
                    }
                    {
                        JLabel label = new JLabel("");
                        uiIdCardPane.add(label, "cell 0 2");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiAge = new LynkTextField();
                        uiIdCardPane.add(uiAge, "cell 1 2,growx");
                    }
                    {
                        JLabel label = new JLabel("");
                        uiIdCardPane.add(label, "cell 0 3,aligny top");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiGender = new LynkTextField();
                        uiIdCardPane.add(uiGender, "cell 1 3,growx,aligny top");
                    }
                    {
                        JLabel label = new JLabel("??");
                        label.setFont(APP_FONT);
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        uiIdCardPane.add(label, "cell 0 4");
                    }
                    {
                        JScrollPane scrollPane = new JScrollPane();
                        uiIdCardPane.add(scrollPane, "cell 1 4,grow");
                        {
                            uiCensusAddress = new JTextArea();
                            uiCensusAddress.setWrapStyleWord(true);
                            uiCensusAddress.setLineWrap(true);
                            scrollPane.setViewportView(uiCensusAddress);
                            uiCensusAddress.setFont(APP_FONT);
                        }
                    }
                }
                {
                    JPanel uiIdCardPane = new JPanel();
                    uiIdCardPane.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
                    uiIdCardPane
                            .setLayout(new MigLayout("", "[]5[grow]25[]5[grow]", "[][][40px:40px:40px,grow]"));
                    uiInfoBasic.add(uiIdCardPane, "cell 0 1,grow");
                    {
                        JLabel label = new JLabel("");
                        uiIdCardPane.add(label, "cell 0 0");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiMarital = new JComboBox<String>();
                        uiIdCardPane.add(uiMarital, "cell 1 0,growx");
                        uiMarital.setModel(new DefaultComboBoxModel<String>(
                                new String[] { Employee.MARITAL_YES, Employee.MARITAL_NO }));
                        uiMarital.setFont(APP_FONT);
                    }
                    {
                        JLabel label = new JLabel("?");
                        uiIdCardPane.add(label, "cell 2 0");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiContact = new LynkTextField();
                        uiIdCardPane.add(uiContact, "cell 3 0,growx");
                    }
                    {
                        JLabel label = new JLabel("?");
                        uiIdCardPane.add(label, "cell 0 1");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiCensus = new JComboBox<String>();
                        uiIdCardPane.add(uiCensus, "cell 1 1,growx");
                        uiCensus.setModel(new DefaultComboBoxModel<String>(
                                new String[] { Employee.CENSUS_A, Employee.CENSUS_B, Employee.CENSUS_C,
                                        Employee.CENSUS_D, Employee.CENSUS_E, Employee.CENSUS_F }));
                        uiCensus.setFont(APP_FONT);
                    }
                    {
                        JLabel label = new JLabel("??");
                        uiIdCardPane.add(label, "cell 2 1");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiResidencePermit = new JComboBox<String>();
                        uiIdCardPane.add(uiResidencePermit, "cell 3 1,growx");
                        uiResidencePermit
                                .setModel(new DefaultComboBoxModel<String>(new String[] { "", "", "" }));
                        uiResidencePermit.setFont(APP_FONT);
                    }
                    {
                        JLabel label = new JLabel("");
                        uiIdCardPane.add(label, "cell 0 2");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        JScrollPane scrollPane = new JScrollPane();
                        uiIdCardPane.add(scrollPane, "cell 1 2 3 1,grow");
                        {
                            uiAddress = new JTextArea();
                            uiAddress.setWrapStyleWord(true);
                            uiAddress.setLineWrap(true);
                            scrollPane.setViewportView(uiAddress);
                            uiAddress.setFont(APP_FONT);
                        }
                    }
                }
                {
                    JPanel uiCompanyPanel = new JPanel();
                    uiCompanyPanel.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
                    uiCompanyPanel.setLayout(new MigLayout("", "[]5[grow][]25[]5[grow][]", "[][][][][][][][]"));
                    uiInfoBasic.add(uiCompanyPanel, "cell 0 2,growx,aligny top");
                    {
                        JLabel label = new JLabel(Employee.SUSPEND_NOTE);
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                        uiCompanyPanel.add(label, "cell 0 0");
                    }
                    {
                        uiFactory = new JComboBox<String>(new DefaultComboBoxModel<String>(
                                new String[] { Employee.FACROTY_TC, Employee.FACTORY_SX }));
                        uiFactory.setFont(APP_FONT);
                        uiCompanyPanel.add(uiFactory, "cell 1 0 2 1,growx");
                    }
                    {
                        JLabel label = new JLabel("");
                        uiCompanyPanel.add(label, "cell 3 0");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiDept = new LynkTextField();
                        uiDept.setEditable(false);
                        uiCompanyPanel.add(uiDept, "cell 4 0,growx");
                    }
                    {
                        JButton uiChooseDept = new JButton();
                        uiChooseDept.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent e) {
                                uiChooseDeptActionPerformed(e);
                            }
                        });
                        uiChooseDept.setIcon(new ImageIcon(
                                InfoEmployee.class.getResource("/resource/image/choose_more.png")));
                        uiChooseDept.setMargin(new Insets(1, 1, 1, 1));
                        uiCompanyPanel.add(uiChooseDept, "cell 5 0,growx");
                    }
                    {
                        JLabel label = new JLabel("?");
                        uiCompanyPanel.add(label, "cell 0 1");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiJob = new LynkTextField();
                        uiJob.setEditable(false);
                        uiCompanyPanel.add(uiJob, "cell 1 1,growx");
                    }
                    {
                        JButton uiChooseJob = new JButton();
                        uiChooseJob.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent e) {
                                uiChooseJobActionPerformed(e);
                            }
                        });
                        uiChooseJob.setIcon(new ImageIcon(
                                InfoEmployee.class.getResource("/resource/image/choose_more.png")));
                        uiChooseJob.setMargin(new Insets(1, 1, 1, 1));
                        uiCompanyPanel.add(uiChooseJob, "cell 2 1,growx");
                    }
                    {
                        JLabel label = new JLabel(Employee.SUSPEND_START);
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                        uiCompanyPanel.add(label, "cell 3 1");
                    }
                    {
                        uiDdg = new JComboBox<String>(
                                new DefaultComboBoxModel<>(new String[] { Employee.DDG_N, Employee.DDG_Y }));
                        uiDdg.setFont(APP_FONT);
                        uiCompanyPanel.add(uiDdg, "cell 4 1 2 1,growx");
                    }
                    {
                        JLabel label = new JLabel("");
                        uiCompanyPanel.add(label, "cell 0 2");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiEntryDate = new JDateChooser();
                        uiCompanyPanel.add(uiEntryDate, "cell 1 2 2 1,growx");
                        uiEntryDate.setDateFormatString("yyyy-MM-dd");
                        uiEntryDate.setFont(APP_FONT);
                        uiEntryDate.getJCalendar().setTodayButtonVisible(true);
                        uiEntryDate.addPropertyChangeListener(new PropertyChangeListener() {

                            @Override
                            public void propertyChange(PropertyChangeEvent evt) {
                                if ("date".equals(evt.getPropertyName())) {
                                    setWorkAge();
                                }
                            }
                        });
                    }
                    {
                        JLabel label = new JLabel("");
                        uiCompanyPanel.add(label, "cell 3 2");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiWorkAge = new LynkTextField("0");
                        uiCompanyPanel.add(uiWorkAge, "cell 4 2 2 1,growx");
                        uiWorkAge.setEditable(false);
                    }
                    {
                        JLabel label = new JLabel("?");
                        uiCompanyPanel.add(label, "cell 0 3");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiProbation = new JDateChooser();
                        uiCompanyPanel.add(uiProbation, "cell 1 3 2 1,growx");
                        uiProbation.setDateFormatString("yyyy-MM-dd");
                        uiProbation.setFont(APP_FONT);
                        uiProbation.getJCalendar().setTodayButtonVisible(true);
                    }
                    {
                        JLabel label = new JLabel("??");
                        uiCompanyPanel.add(label, "cell 3 3");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiExpiration = new JDateChooser();
                        uiCompanyPanel.add(uiExpiration, "cell 4 3 2 1,growx");
                        uiExpiration.setDateFormatString("yyyy-MM-dd");
                        uiExpiration.setFont(APP_FONT);
                        uiExpiration.getJCalendar().setLeftButtonText(Employee.EXPIRATION_NO);
                        uiExpiration.getJCalendar().setLeftButtonVisible(true);
                        uiExpiration.getJCalendar().setRightButtonText(Employee.EXPIRATION_LONG);
                        uiExpiration.getJCalendar().setRightButtonVisible(true);
                    }
                    {
                        JLabel label = new JLabel("");
                        uiCompanyPanel.add(label, "cell 0 4");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiSchool = new LynkTextField();
                        uiCompanyPanel.add(uiSchool, "cell 1 4 2 1,growx");
                    }
                    {
                        JLabel label = new JLabel("");
                        uiCompanyPanel.add(label, "cell 3 4");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiDegree = new JComboBox<String>();
                        uiCompanyPanel.add(uiDegree, "cell 4 4 2 1,growx");
                        uiDegree.setMaximumRowCount(12);
                        uiDegree.setModel(new DefaultComboBoxModel<String>(new String[] { "", Employee.DEGREE_A,
                                Employee.DEGREE_B, Employee.DEGREE_C, Employee.DEGREE_D, Employee.DEGREE_E,
                                Employee.DEGREE_F, Employee.DEGREE_G, Employee.DEGREE_H, Employee.DEGREE_I,
                                Employee.DEGREE_J }));
                        uiDegree.setFont(APP_FONT);
                    }
                    {
                        JLabel label = new JLabel("");
                        uiCompanyPanel.add(label, "cell 0 5");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiMajor = new LynkTextField();
                        uiCompanyPanel.add(uiMajor, "cell 1 5 2 1,growx");
                    }
                    {
                        JLabel label = new JLabel("");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                        uiCompanyPanel.add(label, "cell 3 5");
                    }
                    {
                        uiGuide = new LynkTextField();
                        uiCompanyPanel.add(uiGuide, "cell 4 5 2 1,growx");
                    }
                    {
                        JLabel label = new JLabel("?");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT_BLOD);
                        uiCompanyPanel.add(label, "cell 0 6");
                    }
                    {
                        uiPhoneShort = new LynkTextField();
                        uiPhoneShort.setFont(APP_FONT_BLOD);
                        uiCompanyPanel.add(uiPhoneShort, "cell 1 6 2 1,growx");
                    }
                    {
                        JLabel label = new JLabel("?");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                        uiCompanyPanel.add(label, "cell 3 6");
                    }
                    {
                        uiPerformance = new LynkTextField();
                        uiCompanyPanel.add(uiPerformance, "cell 4 6 2 1,growx");
                    }
                    //                  {
                    //                     JLabel label = new JLabel("??");
                    //                     label.setHorizontalAlignment(SwingConstants.RIGHT);
                    //                     label.setFont(APP_FONT);
                    //                     uiCompanyPanel.add(label, "cell 0 7");
                    //                  }
                    //                  {
                    //                     uiSuspendEnd = new LynkTextField();
                    //                     uiCompanyPanel.add(uiSuspendEnd, "cell 1 7 5 1,growx");
                    //                  }
                }
                {
                    JPanel panel4 = new JPanel();
                    panel4.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
                    panel4.setLayout(new MigLayout("", "[]5[grow]", "[][][][grow][grow]"));
                    uiInfoBasic.add(panel4, "cell 1 0 1 3,grow");
                    {
                        JLabel label = new JLabel("???");
                        panel4.add(label, "cell 0 0,grow");
                        label.setFont(APP_FONT);
                    }
                    {
                        uiSocialCard = new LynkTextField();
                        panel4.add(uiSocialCard, "cell 1 0,grow");
                    }
                    {
                        JLabel label = new JLabel("?");
                        panel4.add(label, "cell 0 1,grow");
                        label.setFont(APP_FONT);
                    }
                    {
                        uiHousingCard = new LynkTextField();
                        panel4.add(uiHousingCard, "cell 1 1,grow");
                    }
                    {
                        JLabel label = new JLabel("??");
                        panel4.add(label, "cell 0 2,grow");
                        label.setFont(APP_FONT);
                    }
                    {
                        uiBankCard = new LynkTextField();
                        panel4.add(uiBankCard, "cell 1 2,grow");
                    }
                    {
                        JLabel label = new JLabel("?");
                        panel4.add(label, "cell 0 3,growx,aligny top");
                        label.setFont(APP_FONT);
                    }
                    {
                        JScrollPane scrollPane = new JScrollPane();
                        panel4.add(scrollPane, "cell 1 3,grow");
                        uiWorkExperience = new JTextArea();
                        uiWorkExperience.setFont(APP_FONT);
                        scrollPane.setViewportView(uiWorkExperience);
                    }
                    {
                        JLabel label = new JLabel("");
                        panel4.add(label, "cell 0 4,growx,aligny top");
                        label.setFont(APP_FONT);
                    }
                    {
                        JScrollPane scrollPane = new JScrollPane();
                        panel4.add(scrollPane, "cell 1 4,grow");
                        {
                            uiNote = new JTextArea();
                            uiNote.setFont(APP_FONT);
                            scrollPane.setViewportView(uiNote);
                        }
                    }
                }
            }
            {
                JPanel uiInfoLeave = new JPanel();
                uiInfoLeave.setLayout(new MigLayout("", "[]5[150px]25[]5[150px]", "[][][][grow][]"));
                uiInfoTab.addTab("??", uiInfoLeave);
                {
                    uiLabelLeaveDate = new JLabel("?");
                    uiLabelLeaveDate.setFont(APP_FONT);
                    uiInfoLeave.add(uiLabelLeaveDate, "cell 0 0,grow");
                }
                {
                    uiLeaveDate = new JDateChooser();
                    uiLeaveDate.setDateFormatString("yyyy-MM-dd");
                    uiLeaveDate.setFont(APP_FONT);
                    uiLeaveDate.getJCalendar().setTodayButtonVisible(true);
                    uiLeaveDate.getJCalendar().setNullDateButtonVisible(true);
                    uiInfoLeave.add(uiLeaveDate, "cell 1 0,growx,aligny top");
                }
                {
                    uiLabelSocialEnd = new JLabel("??");
                    uiLabelSocialEnd.setFont(APP_FONT);
                    uiInfoLeave.add(uiLabelSocialEnd, "cell 0 1,grow");
                }
                {
                    uiLabelHousingEnd = new JLabel("?");
                    uiLabelHousingEnd.setFont(APP_FONT);
                    uiInfoLeave.add(uiLabelHousingEnd, "cell 2 1,grow");
                }
                {
                    uiHousingEndDate = new JDateChooser();
                    uiHousingEndDate.setDateFormatString("yyyy-MM-dd");
                    uiHousingEndDate.setFont(APP_FONT);
                    uiHousingEndDate.getJCalendar().setLeftButtonText("");
                    uiHousingEndDate.getJCalendar().setLeftButtonVisible(true);
                    uiHousingEndDate.getJCalendar().setTodayButtonVisible(true);
                    uiHousingEndDate.getJCalendar().setNullDateButtonVisible(true);
                    uiInfoLeave.add(uiHousingEndDate, "cell 3 1,growx,aligny top");
                }
                {
                    uiLabelLeaveType = new JLabel("?");
                    uiLabelLeaveType.setFont(APP_FONT);
                    uiInfoLeave.add(uiLabelLeaveType, "cell 0 2,grow");
                }
                {
                    uiSocialEndDate = new JDateChooser();
                    uiSocialEndDate.setDateFormatString("yyyy-MM-dd");
                    uiSocialEndDate.setFont(APP_FONT);
                    uiSocialEndDate.getJCalendar().setLeftButtonText("");
                    uiSocialEndDate.getJCalendar().setLeftButtonVisible(true);
                    uiSocialEndDate.getJCalendar().setTodayButtonVisible(true);
                    uiSocialEndDate.getJCalendar().setNullDateButtonVisible(true);
                    uiInfoLeave.add(uiSocialEndDate, "cell 1 1,growx,aligny top");
                }
                {
                    uiLeaveType = new JComboBox<String>(new DefaultComboBoxModel<String>(
                            new String[] { "", Employee.LEAVE_TYPE_A, Employee.LEAVE_TYPE_B,
                                    Employee.LEAVE_TYPE_C, Employee.LEAVE_TYPE_D, Employee.LEAVE_TYPE_E,
                                    Employee.LEAVE_TYPE_F, Employee.LEAVE_TYPE_G, Employee.LEAVE_TYPE_H }));
                    uiLeaveType.setMaximumRowCount(10);
                    uiLeaveType.setFont(APP_FONT);
                    uiInfoLeave.add(uiLeaveType, "cell 1 2 3 1,grow");
                }
                {
                    uiLabelLeaveReason = new JLabel("?");
                    uiLabelLeaveReason.setFont(APP_FONT);
                    uiInfoLeave.add(uiLabelLeaveReason, "cell 0 3,growx,aligny top");
                }
                {
                    JScrollPane scrollPane_2 = new JScrollPane();
                    uiInfoLeave.add(scrollPane_2, "cell 1 3 3 1,grow");
                    {
                        uiLeaveReason = new JTextArea();
                        scrollPane_2.setViewportView(uiLeaveReason);
                        uiLeaveReason.setFont(APP_FONT);
                    }
                }
                {
                    JLabel label = new JLabel("??");
                    label.setHorizontalAlignment(SwingConstants.RIGHT);
                    label.setFont(APP_FONT);
                    uiInfoLeave.add(label, "cell 0 4");
                }
                {
                    uiTimeCardLeaveCertify = new LynkTextField();
                    uiTimeCardLeaveCertify.setEditable(false);
                    uiInfoLeave.add(uiTimeCardLeaveCertify, "cell 1 4 2 1,growx");
                }
                {
                    JButton uiPrintLeaveCertify = new JButton("???");
                    uiPrintLeaveCertify.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                            uiPrintLeaveCertifyActionPerformed(e);
                        }
                    });
                    uiPrintLeaveCertify.setToolTipText("???!");
                    uiPrintLeaveCertify.setFont(APP_FONT);
                    uiPrintLeaveCertify.setFocusable(false);
                    uiInfoLeave.add(uiPrintLeaveCertify, "cell 3 4,alignx right");
                }
            }
            {
                JPanel uiInfoSuspendHistory = new JPanel();
                uiInfoSuspendHistory.setLayout(new BorderLayout(0, 0));
                uiInfoTab.addTab("???", uiInfoSuspendHistory);
                {
                    JScrollPane scrollPane = new JScrollPane();
                    uiInfoSuspendHistory.add(scrollPane, BorderLayout.CENTER);
                    {
                        suspendModel = new EmployeeSuspendModel();
                        uiEmpSuspend = new LynkTable(suspendModel);
                        uiEmpSuspend.addHighlighter(UtilsClient.createAlignHighlighter());
                        uiEmpSuspend.setAutoResizeMode(LynkTable.AUTO_RESIZE_ALL_COLUMNS);
                        scrollPane.setRowHeaderView(new TableRowHead(uiEmpSuspend));
                        scrollPane.setViewportView(uiEmpSuspend);
                    }
                }
            }
            {
                JPanel uiInfoEmpHistory = new JPanel();
                uiInfoEmpHistory.setLayout(new BorderLayout(0, 0));
                uiInfoTab.addTab("?", uiInfoEmpHistory);
                {
                    JPanel pane = new JPanel();
                    pane.setLayout(new MigLayout("", "[][][][100px:100px:100px][]", "[]"));
                    uiInfoEmpHistory.add(pane, BorderLayout.NORTH);
                    {
                        JLabel label = new JLabel("");
                        label.setFont(APP_FONT);
                        pane.add(label, "cell 0 0");
                    }
                    {
                        uiHistoryType = new JComboBox<String>(new DefaultComboBoxModel<>(
                                new String[] { "", PraisePunish.TYPE_A, PraisePunish.TYPE_B,
                                        PraisePunish.TYPE_C, PraisePunish.TYPE_D, PraisePunish.TYPE_E,
                                        PraisePunish.TYPE_F, PraisePunish.TYPE_G, PraisePunish.TYPE_H }));
                        uiHistoryType.setFont(APP_FONT);
                        pane.add(uiHistoryType, "cell 1 0");
                    }
                    {
                        JLabel label = new JLabel("?");
                        label.setFont(APP_FONT);
                        pane.add(label, "cell 2 0");
                    }
                    {
                        uiHistoryOperator = new LynkTextField();
                        pane.add(uiHistoryOperator, "cell 3 0,growx");
                    }
                    {
                        JButton uiRefresh = new JButton("");
                        uiRefresh.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent e) {
                                uiRefreshActionPerformed(e);
                            }
                        });
                        uiRefresh.setIcon(
                                new ImageIcon(InfoEmployee.class.getResource("/resource/image/refresh.png")));
                        uiRefresh.setFont(APP_FONT);
                        uiRefresh.setFocusable(false);
                        pane.add(uiRefresh, "cell 4 0");
                    }
                }
                {
                    JScrollPane scrollPane = new JScrollPane();
                    uiInfoEmpHistory.add(scrollPane, BorderLayout.CENTER);
                    {
                        historyModel = new EmployeeHistoryModel();
                        uiEmployeeHistory = new LynkTable(historyModel);
                        uiEmployeeHistory.setColumnSize(70, 540, 50, 130, 90);
                        scrollPane.setViewportView(uiEmployeeHistory);
                        scrollPane.setRowHeaderView(new TableRowHead(uiEmployeeHistory));

                    }
                }
            }
            {
                JPanel uiInfoJobAdjustment = new JPanel();
                uiInfoJobAdjustment.setLayout(new BorderLayout(0, 0));
                uiInfoTab.addTab("?", uiInfoJobAdjustment);
                {
                    JToolBar toolBar = new JToolBar();
                    toolBar.setFloatable(false);
                    uiInfoJobAdjustment.add(toolBar, BorderLayout.NORTH);
                    {
                        {
                            JButton uiAddJobAdjust = new JButton("?");
                            uiAddJobAdjust.addActionListener(new ActionListener() {
                                public void actionPerformed(ActionEvent e) {
                                    uiAddJobAdjustActionPerformed(e);
                                }
                            });
                            uiAddJobAdjust.setIcon(
                                    new ImageIcon(InfoEmployee.class.getResource("/resource/image/add.png")));
                            uiAddJobAdjust.setFont(APP_FONT);
                            toolBar.add(uiAddJobAdjust);
                        }
                    }
                }
                {
                    JScrollPane scrollPane = new JScrollPane();
                    uiInfoJobAdjustment.add(scrollPane, BorderLayout.CENTER);
                    {
                        jobAdjustmentModel = new JobAdjustmentModel();
                        uiJobAdjustment = new LynkTable(jobAdjustmentModel);
                        uiJobAdjustment.setColumnSize(50, 100, 100, 100, 100, 100, 80, 100, 150);
                        scrollPane.setRowHeaderView(new TableRowHead(uiJobAdjustment));
                        scrollPane.setViewportView(uiJobAdjustment);
                    }
                }
            }
            {
                JPanel uiInfoPraisePunish = new JPanel();
                uiInfoTab.addTab("", uiInfoPraisePunish);
                uiInfoPraisePunish.setLayout(
                        new MigLayout("", "[]10[grow]30[]10[120]5[]5[120]20[]20[][grow]", "[][grow]"));
                {
                    uiPraisePunishDateStart = new JDateChooser();
                    uiPraisePunishDateStart.setFont(APP_FONT);
                    uiPraisePunishDateStart.setDateFormatString("yyyy-MM-dd");
                    uiInfoPraisePunish.add(uiPraisePunishDateStart, "cell 3 0,growx");
                }
                {
                    uiPraisePunishDateEnd = new JDateChooser();
                    uiPraisePunishDateEnd.setFont(APP_FONT);
                    uiPraisePunishDateEnd.setDateFormatString("yyyy-MM-dd");
                    uiInfoPraisePunish.add(uiPraisePunishDateEnd, "cell 5 0,growx");

                }

                JButton uiAddPraisePunish = new JButton("");
                uiAddPraisePunish.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        uiAddPraisePunishActionPerformed(e);
                    }
                });
                {
                    JButton uiFindPraisePunish = new JButton("");
                    uiFindPraisePunish.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                            uiFindPraisePunishActionPerformed(e);
                        }
                    });
                    {
                        JLabel label = new JLabel("");
                        label.setFont(APP_FONT);
                        uiInfoPraisePunish.add(label, "cell 0 0,alignx trailing");
                    }
                    {
                        uiPraisePunishType = new JComboBox<String>(
                                new DefaultComboBoxModel<String>(new String[] { "", PraisePunish.TYPE_A,
                                        PraisePunish.TYPE_B, PraisePunish.TYPE_C, PraisePunish.TYPE_D,
                                        PraisePunish.TYPE_E, PraisePunish.TYPE_F, PraisePunish.TYPE_G }));
                        uiPraisePunishType.setEditable(true);
                        uiPraisePunishType.setFont(APP_FONT);
                        uiInfoPraisePunish.add(uiPraisePunishType, "cell 1 0,growx");
                    }

                    {
                        JLabel label = new JLabel("");
                        label.setFont(APP_FONT);
                        uiInfoPraisePunish.add(label, "cell 2 0");
                    }
                    {
                        JLabel label = new JLabel("");
                        label.setFont(APP_FONT);
                        uiInfoPraisePunish.add(label, "cell 4 0");
                    }
                    uiFindPraisePunish.setFocusable(false);
                    uiFindPraisePunish.setIcon(
                            new ImageIcon(InfoEmployee.class.getResource("/resource/image/refresh.png")));
                    uiFindPraisePunish.setFont(APP_FONT);
                    uiInfoPraisePunish.add(uiFindPraisePunish, "cell 6 0");
                }
                uiAddPraisePunish
                        .setIcon(new ImageIcon(InfoEmployee.class.getResource("/resource/image/add.png")));
                uiAddPraisePunish.setFont(APP_FONT);
                uiAddPraisePunish.setFocusable(false);
                uiInfoPraisePunish.add(uiAddPraisePunish, "cell 7 0");

                JScrollPane scrollPane = new JScrollPane();
                uiInfoPraisePunish.add(scrollPane, "cell 0 1 9 1,grow");
                {
                    praisePunishModel = new PraisePunishModel(
                            new String[] { PraisePunish.COLUMN_TYPE, PraisePunish.COLUMN_ACTION,
                                    PraisePunish.COLUMN_ACTION_DATE, PraisePunish.COLUMN_DEAL,
                                    PraisePunish.COLUMN_DEAL_DATE, PraisePunish.COLUMN_NOTE });
                    uiPraisePunish = new LynkTable(praisePunishModel);
                    uiPraisePunish.setColumnVisible(
                            new String[] { PraisePunish.COLUMN_TYPE, PraisePunish.COLUMN_ACTION,
                                    PraisePunish.COLUMN_ACTION_DATE, PraisePunish.COLUMN_DEAL,
                                    PraisePunish.COLUMN_DEAL_DATE, PraisePunish.COLUMN_NOTE });
                    uiPraisePunish.setDefaultRenderer(Object.class, new PraisePunishColorRenderer());
                    uiPraisePunish.setMouseDoubleClick(new MouseDoubleClick() {

                        @Override
                        public void doubleClick(int index) {
                            if (index != -1) {
                                index = uiPraisePunish.convertRowIndexToModel(index);
                                PraisePunish pp = praisePunishModel.getPp(index);
                                pp = InfoPraisePunish.showdialog(InfoEmployee.this, pp, null);
                                if (pp != null) {
                                    praisePunishModel.updatePp(pp);
                                }
                            }
                        }
                    });
                    scrollPane.setViewportView(uiPraisePunish);
                    scrollPane.setRowHeaderView(new TableRowHead(uiPraisePunish));
                }
            }
            {
                JPanel uiPanelVacation = new JPanel();
                uiPanelVacation.setLayout(new BorderLayout());
                uiInfoTab.addTab("?", uiPanelVacation);
                {
                    JToolBar uiVacationToolBar = new JToolBar();
                    uiVacationToolBar.setFloatable(false);
                    uiPanelVacation.add(uiVacationToolBar, BorderLayout.NORTH);
                    {
                        JButton uiVacationRefresh = new JButton("");
                        uiVacationRefresh.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent e) {
                                uiVacationRefreshActionPerformed(e);
                            }
                        });
                        uiVacationRefresh.setIcon(
                                new ImageIcon(InfoEmployee.class.getResource("/resource/image/refresh.png")));
                        uiVacationRefresh.setFocusable(false);
                        uiVacationRefresh.setFont(APP_FONT);
                        uiVacationToolBar.add(uiVacationRefresh);
                    }
                    uiVacationToolBar.addSeparator();
                    {
                        uiVacationHistoryAdd = new JButton("");
                        uiVacationHistoryAdd.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent e) {
                                uiVacationAddActionPerformed(e);
                            }
                        });
                        uiVacationHistoryAdd.setIcon(
                                new ImageIcon(InfoEmployee.class.getResource("/resource/image/add.png")));
                        uiVacationHistoryAdd.setFocusable(false);
                        uiVacationHistoryAdd.setFont(APP_FONT);
                        uiVacationToolBar.add(uiVacationHistoryAdd);
                    }
                    uiVacationToolBar.addSeparator();
                    {
                        JButton uiEndLastLeft = new JButton("");
                        uiEndLastLeft.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent e) {
                                uiEndLastLeftActionPerformed(e);
                            }
                        });
                        uiEndLastLeft.setIcon(
                                new ImageIcon(InfoEmployee.class.getResource("/resource/image/add.png")));
                        uiEndLastLeft.setFocusable(false);
                        uiEndLastLeft.setFont(APP_FONT);
                        uiVacationToolBar.add(uiEndLastLeft);
                    }
                }
                {
                    JPanel uiPanelVacationInfo = new JPanel();
                    uiPanelVacation.add(uiPanelVacationInfo, BorderLayout.CENTER);
                    uiPanelVacationInfo.setLayout(new MigLayout("", "[grow]", "[][grow]"));

                    JPanel paneAv = new JPanel();
                    uiPanelVacationInfo.add(paneAv, "cell 0 0,grow");
                    paneAv.setLayout(new MigLayout("", "[][grow]50[][grow]", "[][][]"));
                    {
                        uiVacationStartEnd = new JLabel("Time");
                        uiVacationStartEnd.setHorizontalAlignment(SwingConstants.CENTER);
                        paneAv.add(uiVacationStartEnd, "cell 0 0 4 1,growx");
                        uiVacationStartEnd.setForeground(Color.BLUE);
                        uiVacationStartEnd.setFont(APP_FONT.deriveFont(16f));
                    }
                    {
                        JLabel labe = new JLabel(":");
                        paneAv.add(labe, "cell 0 1");
                        labe.setFont(APP_FONT.deriveFont(16f));
                    }
                    {
                        uiLastTotal = new JLabel("");
                        paneAv.add(uiLastTotal, "cell 1 1,alignx left");
                        uiLastTotal.setForeground(Color.BLUE);
                        uiLastTotal.setFont(APP_FONT.deriveFont(16f));
                    }
                    {
                        JLabel labe = new JLabel(":");
                        paneAv.add(labe, "cell 2 1");
                        labe.setFont(APP_FONT.deriveFont(16f));
                    }
                    {
                        uiLastLeft = new JLabel("");
                        paneAv.add(uiLastLeft, "cell 3 1,alignx left");
                        uiLastLeft.setForeground(Color.BLUE);
                        uiLastLeft.setFont(APP_FONT.deriveFont(16f));
                    }
                    {
                        JLabel labe = new JLabel(":");
                        paneAv.add(labe, "cell 0 2");
                        labe.setFont(APP_FONT.deriveFont(16f));
                    }
                    {
                        uiCurrentTotal = new JLabel("");
                        paneAv.add(uiCurrentTotal, "cell 1 2,alignx left");
                        uiCurrentTotal.setForeground(Color.BLUE);
                        uiCurrentTotal.setFont(APP_FONT.deriveFont(16f));
                    }
                    {
                        JLabel labe = new JLabel("?:");
                        paneAv.add(labe, "cell 2 2");
                        labe.setFont(APP_FONT.deriveFont(16f));
                    }
                    {
                        uiLeftHours = new JLabel("");
                        paneAv.add(uiLeftHours, "cell 3 2,alignx left");
                        uiLeftHours.setForeground(Color.BLUE);
                        uiLeftHours.setFont(APP_FONT.deriveFont(16f));
                    }

                    JScrollPane scrollPane = new JScrollPane();
                    uiPanelVacationInfo.add(scrollPane, "cell 0 1,grow");
                    {
                        attendanceVacationModel = new AttendanceVacationHistoryModel();
                        uiAttendanceVacationHistory = new LynkTable(attendanceVacationModel);
                        uiAttendanceVacationHistory.setAutoResizeMode(LynkTable.AUTO_RESIZE_ALL_COLUMNS);
                        scrollPane.setViewportView(uiAttendanceVacationHistory);
                        scrollPane.setRowHeaderView(new TableRowHead(uiAttendanceVacationHistory));
                    }
                }
            }
        }
    }

}

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

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

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

    final FormListener formListener = new FormListener();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    bindingGroup.bind();
}

From source file:com.pianobakery.complsa.MainGui.java

/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 *
 * @noinspection ALL//from   ww w .  jav a2  s  . com
 */
private void $$$setupUI$$$() {
    createUIComponents();
    mainPanel = new JPanel();
    mainPanel.setLayout(new FormLayout("fill:max(m;620px):grow", "center:max(m;600px):grow"));
    tabbedPane1 = new JTabbedPane();
    tabbedPane1.setEnabled(true);
    CellConstraints cc = new CellConstraints();
    mainPanel.add(tabbedPane1, cc.xy(1, 1, CellConstraints.DEFAULT, CellConstraints.FILL));
    setupPanel = new JPanel();
    setupPanel.setLayout(new FormLayout(
            "fill:d:noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:126px:noGrow,fill:max(d;4px):noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:5dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:d:grow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:52px:noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:d:grow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:d:grow,fill:d:grow,fill:d:grow,fill:66px:noGrow",
            "center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:d:noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow"));
    tabbedPane1.addTab("Project", setupPanel);
    newFolderButton = new JButton();
    newFolderButton.setText("New Folder");
    setupPanel.add(newFolderButton, cc.xy(1, 5));
    final JLabel label1 = new JLabel();
    label1.setText("Project Folder:");
    setupPanel.add(label1, cc.xy(1, 1, CellConstraints.LEFT, CellConstraints.DEFAULT));
    selectFolderButton = new JButton();
    selectFolderButton.setText("Select Folder");
    setupPanel.add(selectFolderButton, cc.xy(5, 5));
    wDirText = new JTextField();
    wDirText.setEditable(false);
    wDirText.setText("Create or select Project Folder");
    setupPanel.add(wDirText, cc.xyw(7, 5, 48, CellConstraints.FILL, CellConstraints.DEFAULT));
    final JLabel label2 = new JLabel();
    label2.setText("The Project Folder contains all the Project Data.");
    setupPanel.add(label2, cc.xyw(1, 3, 54));
    final JLabel label3 = new JLabel();
    label3.setText("Arrange your Documents in a Folder. Then add it to the Software.");
    setupPanel.add(label3, cc.xyw(1, 15, 54));
    downloadModelButton = new JButton();
    downloadModelButton.setText("Download Models");
    setupPanel.add(downloadModelButton, cc.xy(1, 9));
    final JLabel label4 = new JLabel();
    label4.setText("Language Models:");
    setupPanel.add(label4, cc.xy(5, 9));
    langModelsText = new JLabel();
    langModelsText.setText("");
    setupPanel.add(langModelsText, cc.xyw(7, 9, 48));
    trainCorpButton = new JButton();
    trainCorpButton.setText("Train Semantics");
    setupPanel.add(trainCorpButton, cc.xy(1, 33, CellConstraints.FILL, CellConstraints.DEFAULT));
    final JLabel label5 = new JLabel();
    label5.setText("Create Semantic Knowledge with selected Training Corpus:");
    setupPanel.add(label5, cc.xyw(1, 25, 7));
    addTopicCorpusButton = new JButton();
    addTopicCorpusButton.setEnabled(true);
    addTopicCorpusButton.setText(" Add Corpus Folder");
    setupPanel.add(addTopicCorpusButton, cc.xy(1, 19));
    addCorpRecursiveCheckBox = new JCheckBox();
    addCorpRecursiveCheckBox.setSelected(true);
    addCorpRecursiveCheckBox.setText("Recursive");
    setupPanel.add(addCorpRecursiveCheckBox, cc.xy(5, 19));
    createChunksCheckBox = new JCheckBox();
    createChunksCheckBox.setSelected(true);
    createChunksCheckBox.setText("Split in Paragraph of:");
    setupPanel.add(createChunksCheckBox, cc.xy(7, 19));
    final JLabel label6 = new JLabel();
    label6.setText("Add/Remove Training Corpus:");
    setupPanel.add(label6, cc.xyw(1, 17, 5));
    final JLabel label7 = new JLabel();
    label7.setText("Select Training Corpus:");
    setupPanel.add(label7, cc.xyw(1, 21, 54));
    selectTrainCorp = new JComboBox();
    selectTrainCorp.setEnabled(true);
    setupPanel.add(selectTrainCorp, cc.xyw(1, 23, 5));
    removeTopicCorpusButton = new JButton();
    removeTopicCorpusButton.setEnabled(true);
    removeTopicCorpusButton.setHorizontalAlignment(2);
    removeTopicCorpusButton.setText("Remove Training Corpus");
    setupPanel.add(removeTopicCorpusButton, cc.xy(7, 23));
    setupPanel.add(indexTypeComboBox, cc.xy(7, 33));
    amountOfSentencesPerTextField = new JTextField();
    amountOfSentencesPerTextField.setHorizontalAlignment(2);
    amountOfSentencesPerTextField.setText("20");
    setupPanel.add(amountOfSentencesPerTextField,
            cc.xyw(9, 19, 6, CellConstraints.FILL, CellConstraints.DEFAULT));
    posIndRadiusTextField = new JTextField();
    posIndRadiusTextField.setHorizontalAlignment(2);
    posIndRadiusTextField.setText("20");
    setupPanel.add(posIndRadiusTextField, cc.xyw(9, 33, 6, CellConstraints.FILL, CellConstraints.DEFAULT));
    final JLabel label8 = new JLabel();
    label8.setText("Indextype:");
    setupPanel.add(label8, cc.xy(5, 33, CellConstraints.RIGHT, CellConstraints.DEFAULT));
    final JLabel label9 = new JLabel();
    label9.setHorizontalAlignment(2);
    label9.setText("Sentences");
    setupPanel.add(label9, cc.xy(15, 19));
    final JLabel label10 = new JLabel();
    label10.setHorizontalAlignment(2);
    label10.setText("Words");
    setupPanel.add(label10, cc.xy(15, 33));
    setupPanel.add(termComboBox, cc.xyw(31, 33, 19));
    final JLabel label11 = new JLabel();
    label11.setText("Termweight:");
    setupPanel.add(label11, cc.xyw(18, 33, 13));
    updateIndexButton = new JButton();
    updateIndexButton.setText("Update Index");
    setupPanel.add(updateIndexButton, cc.xy(1, 29));
    removeIndexButton = new JButton();
    removeIndexButton.setText("Remove Index");
    setupPanel.add(removeIndexButton, cc.xy(5, 29));
    final JLabel label12 = new JLabel();
    label12.setText("Add/Remove Search Corpus:");
    setupPanel.add(label12, cc.xyw(1, 41, 5));
    impSearchCorpButton = new JButton();
    impSearchCorpButton.setText("Add Search Corpus");
    setupPanel.add(impSearchCorpButton, cc.xy(1, 43));
    impSearchCorpRecursiveCheckBox = new JCheckBox();
    impSearchCorpRecursiveCheckBox.setSelected(true);
    impSearchCorpRecursiveCheckBox.setText("Recursive");
    setupPanel.add(impSearchCorpRecursiveCheckBox, cc.xy(5, 43));
    splitSearchCorpCheckBox = new JCheckBox();
    splitSearchCorpCheckBox.setSelected(true);
    splitSearchCorpCheckBox.setText("Split in Paragraph of:");
    setupPanel.add(splitSearchCorpCheckBox, cc.xy(7, 43));
    amountSearchCorpSent = new JTextField();
    amountSearchCorpSent.setHorizontalAlignment(2);
    amountSearchCorpSent.setText("20");
    setupPanel.add(amountSearchCorpSent, cc.xyw(9, 43, 6, CellConstraints.FILL, CellConstraints.DEFAULT));
    final JLabel label13 = new JLabel();
    label13.setHorizontalAlignment(2);
    label13.setText("Sentences");
    setupPanel.add(label13, cc.xy(15, 43));
    searchCorpComboBox = new JComboBox();
    setupPanel.add(searchCorpComboBox, cc.xyw(1, 47, 5, CellConstraints.DEFAULT, CellConstraints.TOP));
    removeSearchCorpButton = new JButton();
    removeSearchCorpButton.setText("Remove Search Corpus");
    setupPanel.add(removeSearchCorpButton, cc.xy(7, 47));
    final JLabel label14 = new JLabel();
    label14.setText("Select Search Corpus:");
    setupPanel.add(label14, cc.xyw(1, 45, 5));
    final JLabel label15 = new JLabel();
    label15.setText("Arrange your Search Corpus in a Folder. Then add it to the Software. ");
    setupPanel.add(label15, cc.xyw(1, 39, 54));
    final JLabel label16 = new JLabel();
    label16.setText("First update the Index.");
    setupPanel.add(label16, cc.xyw(1, 27, 5));
    final JLabel label17 = new JLabel();
    label17.setText(
            "Then select an Algorithm and train the Software. On the Search Tab you can select the Algorithms to run your semantic searches.");
    setupPanel.add(label17, cc.xyw(1, 31, 54));
    final JLabel label18 = new JLabel();
    label18.setText("Download Language Models:");
    setupPanel.add(label18, cc.xyw(1, 7, 54));
    final JLabel label19 = new JLabel();
    label19.setText("Training Corpora:");
    setupPanel.add(label19, cc.xyw(1, 13, 54));
    final JLabel label20 = new JLabel();
    label20.setText("Search Corpora:");
    setupPanel.add(label20, cc.xyw(1, 37, 54));
    final JLabel label21 = new JLabel();
    label21.setEnabled(true);
    label21.setText(" ");
    setupPanel.add(label21, cc.xy(1, 11));
    final JLabel label22 = new JLabel();
    label22.setText(" ");
    setupPanel.add(label22, cc.xy(1, 35));
    searchDocs = new JPanel();
    searchDocs.setLayout(new FormLayout(
            "left:4dlu:noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:277px:noGrow,left:4dlu:noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(m;400px):grow,left:4dlu:noGrow,fill:max(m;200px):grow",
            "center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,top:3dlu:noGrow,center:d:noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:243px:grow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow,top:3dlu:noGrow,center:38px:noGrow,top:3dlu:noGrow"));
    searchDocs.setEnabled(true);
    tabbedPane1.addTab("Search", searchDocs);
    final JLabel label23 = new JLabel();
    label23.setText("Choose Semantic Knowledge Algorithm:");
    searchDocs.add(label23, cc.xyw(3, 1, 5));
    final JLabel label24 = new JLabel();
    label24.setText("Enter Search Text or select Search Document:");
    searchDocs.add(label24, cc.xyw(3, 20, 5));
    final JLabel label25 = new JLabel();
    label25.setText("Document Search Results:");
    searchDocs.add(label25, cc.xyw(10, 1, 3));
    final JLabel label26 = new JLabel();
    label26.setText("Selection Metadata:");
    searchDocs.add(label26, cc.xyw(10, 27, 3));
    selectIndexTypeComboBox = new JComboBox();
    searchDocs.add(selectIndexTypeComboBox, cc.xyw(7, 10, 3));
    final JLabel label27 = new JLabel();
    label27.setText("Index Type:");
    searchDocs.add(label27, cc.xy(7, 8));
    final JLabel label28 = new JLabel();
    label28.setText("Termweight:");
    searchDocs.add(label28, cc.xy(7, 12));
    selectTermweightComboBox = new JComboBox();
    searchDocs.add(selectTermweightComboBox, cc.xy(7, 14));
    final JLabel label29 = new JLabel();
    label29.setText("Number of search results:");
    searchDocs.add(label29, cc.xy(7, 16));
    noOfSearchResultsText = new JTextField();
    noOfSearchResultsText.setText("20");
    searchDocs.add(noOfSearchResultsText, cc.xy(7, 18, CellConstraints.FILL, CellConstraints.DEFAULT));
    final JScrollPane scrollPane1 = new JScrollPane();
    searchDocs.add(scrollPane1, cc.xywh(7, 22, 1, 2, CellConstraints.FILL, CellConstraints.FILL));
    searchTextArea = new JTextArea();
    searchTextArea.setLineWrap(true);
    searchTextArea.setText("");
    searchTextArea.setWrapStyleWord(true);
    scrollPane1.setViewportView(searchTextArea);
    selTextRadioButton = new JRadioButton();
    selTextRadioButton.setSelected(true);
    selTextRadioButton.setText("");
    searchDocs.add(selTextRadioButton, cc.xy(5, 22));
    algTextField = new JLabel();
    algTextField.setText("Knowledge Corpus: null");
    searchDocs.add(algTextField, cc.xy(7, 3, CellConstraints.DEFAULT, CellConstraints.FILL));
    selectDocumentButton = new JButton();
    selectDocumentButton.setEnabled(false);
    selectDocumentButton.setText("Select Document");
    searchDocs.add(selectDocumentButton, cc.xy(7, 25));
    selDocRadioButton = new JRadioButton();
    selDocRadioButton.setText("");
    searchDocs.add(selDocRadioButton, cc.xy(5, 25));
    final JLabel label30 = new JLabel();
    label30.setText("Select Corpus to Search:");
    searchDocs.add(label30, cc.xyw(3, 30, 5));
    searchTopCorpRadioButton = new JRadioButton();
    searchTopCorpRadioButton.setSelected(true);
    searchTopCorpRadioButton.setText("Topic Corpus");
    searchDocs.add(searchTopCorpRadioButton, cc.xy(7, 32, CellConstraints.DEFAULT, CellConstraints.TOP));
    searchSearchCorpRadioButton = new JRadioButton();
    searchSearchCorpRadioButton.setSelected(false);
    searchSearchCorpRadioButton.setText("Search Corpus");
    searchDocs.add(searchSearchCorpRadioButton, cc.xy(7, 34, CellConstraints.DEFAULT, CellConstraints.TOP));
    searchButton = new JButton();
    searchButton.setText("Search");
    searchDocs.add(searchButton, cc.xy(7, 36));
    final JScrollPane scrollPane2 = new JScrollPane();
    searchDocs.add(scrollPane2, cc.xywh(10, 30, 3, 7, CellConstraints.FILL, CellConstraints.FILL));
    metadataTextField = new JTextArea();
    metadataTextField.setEditable(false);
    scrollPane2.setViewportView(metadataTextField);
    termTablePane = new JScrollPane();
    termTablePane.setEnabled(true);
    termTablePane.setVerticalScrollBarPolicy(22);
    searchDocs.add(termTablePane, cc.xywh(14, 3, 1, 21, CellConstraints.FILL, CellConstraints.FILL));
    termSearchResTable.setAutoCreateRowSorter(true);
    termSearchResTable.setAutoResizeMode(2);
    termSearchResTable.setFillsViewportHeight(false);
    termSearchResTable.setForeground(new Color(-16777216));
    termTablePane.setViewportView(termSearchResTable);
    docTablePane = new JScrollPane();
    docTablePane.setVerticalScrollBarPolicy(22);
    searchDocs.add(docTablePane, cc.xywh(10, 3, 3, 21, CellConstraints.FILL, CellConstraints.FILL));
    docSearchResTable.setAutoCreateRowSorter(true);
    docTablePane.setViewportView(docSearchResTable);
    final JLabel label31 = new JLabel();
    label31.setText("Term Search Result:");
    searchDocs.add(label31, cc.xy(14, 1));
    searchDocValue = new JLabel();
    searchDocValue.setText("nothing selected");
    searchDocs.add(searchDocValue, cc.xyw(12, 25, 3, CellConstraints.LEFT, CellConstraints.DEFAULT));
    openSearchDocumentButton = new JButton();
    openSearchDocumentButton.setEnabled(false);
    openSearchDocumentButton.setText("Open Search Document");
    searchDocs.add(openSearchDocumentButton, cc.xy(10, 25, CellConstraints.LEFT, CellConstraints.DEFAULT));
}