Example usage for javax.swing JList JList

List of usage examples for javax.swing JList JList

Introduction

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

Prototype

public JList() 

Source Link

Document

Constructs a JList with an empty, read-only, model.

Usage

From source file:com.itemanalysis.jmetrik.gui.Jmetrik.java

public Jmetrik() {
    super("jMetrik");
    setPreferredSize(new Dimension(1024, 650));
    setDefaultCloseOperation(EXIT_ON_CLOSE);

    //properly close database if user closes window
    this.addWindowListener(new WindowAdapter() {
        @Override/*  w w  w .  j a va 2  s . c om*/
        public void windowClosing(WindowEvent we) {
            if (workspace != null) {
                workspace.closeDatabase();
            }
            System.exit(0);
        }
    });

    //add statusbar
    statusBar = new StatusBar(1024, 30);
    statusBar.setBorder(new EmptyBorder(2, 2, 2, 2));
    getContentPane().add(statusBar, BorderLayout.SOUTH);

    //start logging
    startLog();

    //left-right splitpane
    JSplitPane splitPane1 = new JSplitPane();
    splitPane1.setDividerLocation(200);

    //setup workspace list
    workspaceList = new JList();
    workspaceList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    workspaceList.setModel(new SortedListModel<DataTableName>());
    workspaceList.addKeyListener(new DeleteKeyListener());
    //        workspaceList.getInsets().set(5, 5, 5, 5);

    //add icon to list cell renderer
    String urlString = "/images/spreadsheet.png";
    URL url = this.getClass().getResource(urlString);
    final ImageIcon tableIcon = new ImageIcon(url, "Table");
    workspaceList.setCellRenderer(new DefaultListCellRenderer() {
        @Override
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
                boolean cellHasFocus) {
            JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected,
                    cellHasFocus);
            label.setIcon(tableIcon);
            return label;
        }
    });

    JScrollPane scrollPane1 = new JScrollPane(workspaceList);
    scrollPane1.setPreferredSize(new Dimension(200, 698));

    splitPane1.setLeftComponent(scrollPane1);

    //tabbed pane for top pane
    tabbedPane = new JTabbedPane();
    tabbedPane.setTabPlacement(JTabbedPane.BOTTOM);

    //setup data table
    dataTable = new DataTable();
    dataTable.setRowHeight(18);

    //change size of table header and center text
    JTableHeader header = dataTable.getTableHeader();
    header.setDefaultRenderer(new TableHeaderCellRenderer());

    JScrollPane dataScrollPane = new JScrollPane(dataTable);
    tabbedPane.addTab("Data", dataScrollPane);

    //setup variable table
    variableTable = new DataTable();
    variableTable.setRowHeight(18);
    variableTable.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            super.mouseClicked(e);
            if (e.getClickCount() == 2) {
                JTable target = (JTable) e.getSource();
                int row = target.getSelectedRow();
                int col = target.getSelectedColumn();
                if (col == 0) {
                    if (target.getModel() instanceof VariableModel) {
                        VariableModel vModel = (VariableModel) target.getModel();
                        String s = (String) vModel.getValueAt(row, col);

                        DatabaseName db = workspace.getDatabaseName();
                        DataTableName table = workspace.getCurrentDataTable();

                        RenameVariableDialog renameVariableDialog = new RenameVariableDialog(Jmetrik.this, db,
                                table, s);
                        renameVariableDialog.setVisible(true);

                        if (renameVariableDialog.canRun()) {
                            RenameVariableCommand command = renameVariableDialog.getCommand();
                            workspace.runProcess(command);
                        }

                    } //end instanceof

                } //end if col==0

            } //end if click count==2
        }//end mouse clicked
    });

    //change size of table header and center text
    JTableHeader variableHeader = variableTable.getTableHeader();
    variableHeader.setDefaultRenderer(new TableHeaderCellRenderer());
    variableHeader.setPreferredSize(new Dimension(30, 21));

    JScrollPane variableScrollPane = new JScrollPane(variableTable);
    tabbedPane.addTab("Variables", variableScrollPane);

    splitPane1.setRightComponent(tabbedPane);
    getContentPane().add(splitPane1, BorderLayout.CENTER);

    //add status bar listener - needed to display status message that are generated within this class
    this.addPropertyChangeListener(statusBar.getStatusListener());

    //add listener for displaying error messages - needed to display errors and exceptions
    this.addPropertyChangeListener(new ErrorOccurredPropertyChangeListener());

    //instantiate file utilities
    fileUtils = new JmetrikFileUtils();
    fileUtils.addPropertyChangeListener(statusBar.getStatusListener());

    //set import and export path to user's documents folder
    JFileChooser chooser = new JFileChooser();
    FileSystemView fw = chooser.getFileSystemView();
    importExportPath = fw.getDefaultDirectory().toString().replaceAll("\\\\", "/");

    //create and start a workspace
    startWorkspace();

    //create menu bar and tool bar
    this.setJMenuBar(createMenuBar());

    JToolBar toolBar = createToolBar();
    toolBar.setFloatable(false);
    toolBar.setRollover(true);
    getContentPane().add(toolBar, BorderLayout.PAGE_START);

    pack();

}

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.
 *//*from   w  w w  .j ava  2  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.projity.pm.graphic.chart.ChartLegend.java

JList getListInstance(boolean cost) {
    final JList list = new JList() { // do not want to update the UI. see below also
        private static final long serialVersionUID = 1L;

        public void updateUI() {
            if (!Environment.isNewLook())
                super.updateUI();
        }/*from  w  w w.j a  va2 s.  com*/
    };
    if (Environment.isNewLook()) // The PLAF can override the custom renderer. This avoids that
        list.setUI(new BasicListUI());
    list.setSelectionMode(DefaultListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    list.setCellRenderer(new ListRenderer());
    setListFields(list, cost);
    if (!simple) {
        list.setSelectedIndex(0); // start off with first choice selected         
        list.addListSelectionListener(new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent e) {
                if (chartInfo.isRestoring()) // don't want to listen if updating from workspace
                    return;
                if (e.getValueIsAdjusting() == false) {
                    chartInfo.setTraces(list.getSelectedValues());
                }
            }
        });
    }

    return list;
}

From source file:gtu._work.ui.ExportSVNModificationFilesUI.java

private void initGUI() {
    try {/*from   w ww.j  ava 2  s  .  com*/
        final SwingActionUtil swingUtil = SwingActionUtil.newInstance(this);

        BorderLayout thisLayout = new BorderLayout();
        getContentPane().setLayout(thisLayout);
        this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        this.setTitle("SVN BACKUP");
        this.setPreferredSize(new java.awt.Dimension(734, 442));
        {
            jTabbedPane1 = new JTabbedPane();
            getContentPane().add(jTabbedPane1, BorderLayout.CENTER);
            jTabbedPane1.addChangeListener(new ChangeListener() {
                public void stateChanged(ChangeEvent evt) {
                    swingUtil.invokeAction("jTabbedPane1_changeEvent", evt);
                }
            });
            {
                jPanel1 = new JPanel();
                BorderLayout jPanel1Layout = new BorderLayout();
                jPanel1.setLayout(jPanel1Layout);
                jTabbedPane1.addTab("src text", null, jPanel1, null);
                {
                    jScrollPane1 = new JScrollPane();
                    jPanel1.add(jScrollPane1, BorderLayout.CENTER);
                    {
                        srcArea = new JTextArea();
                        jScrollPane1.setViewportView(srcArea);
                    }
                }
                {
                    loadSrcTextarea = new JButton();
                    jPanel1.add(loadSrcTextarea, BorderLayout.SOUTH);
                    loadSrcTextarea.setText("load src textarea");
                    loadSrcTextarea.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            swingUtil.invokeAction("loadSrcTextarea.actionPerformed", evt);
                        }
                    });
                }
                {
                    srcBaseDir = new JButton();
                    jPanel1.add(srcBaseDir, BorderLayout.NORTH);
                    srcBaseDir.setText("set src base dir");
                    srcBaseDir.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            swingUtil.invokeAction("srcBaseDir.actionPerformed", evt);
                        }
                    });
                }
            }
            {
                jPanel2 = new JPanel();
                BorderLayout jPanel2Layout = new BorderLayout();
                jPanel2.setLayout(jPanel2Layout);
                jTabbedPane1.addTab("src list", null, jPanel2, null);
                {
                    jScrollPane2 = new JScrollPane();
                    jPanel2.add(jScrollPane2, BorderLayout.CENTER);
                    jScrollPane2.setPreferredSize(new java.awt.Dimension(531, 317));
                    {
                        ListModel srcListModel = new DefaultListModel();
                        srcList = new JList();
                        jScrollPane2.setViewportView(srcList);
                        srcList.setModel(srcListModel);
                        srcList.addMouseListener(new MouseAdapter() {
                            public void mouseClicked(MouseEvent evt) {
                                swingUtil.invokeAction("srcList.mouseClicked", evt);
                            }
                        });
                        srcList.addKeyListener(new KeyAdapter() {
                            public void keyPressed(KeyEvent evt) {
                                swingUtil.invokeAction("srcList.keyPressed", evt);
                            }
                        });
                    }
                }
                {
                    srcListQuery = new JTextField();
                    srcListQuery.getDocument()
                            .addDocumentListener(JCommonUtil.getDocumentListener(new HandleDocumentEvent() {
                                public void process(DocumentEvent event) {
                                    String scan = JCommonUtil.getDocumentText(event);
                                    DefaultListModel model = new DefaultListModel();
                                    Pattern pat = Pattern.compile(scan);
                                    for (LineParser line : copySrcListForQuerySet) {
                                        if (!line.file.exists()) {
                                            continue;
                                        }
                                        if (line.file.getAbsolutePath().contains(scan)) {
                                            model.addElement(line);
                                            continue;
                                        }
                                        try {
                                            if (pat.matcher(line.file.getAbsolutePath()).find()) {
                                                model.addElement(line);
                                                continue;
                                            }
                                        } catch (Exception ex) {
                                        }
                                    }
                                    srcList.setModel(model);
                                }
                            }));
                    jPanel2.add(srcListQuery, BorderLayout.NORTH);
                }
            }
            {
                jPanel3 = new JPanel();
                BorderLayout jPanel3Layout = new BorderLayout();
                jPanel3.setLayout(jPanel3Layout);
                jTabbedPane1.addTab("out list", null, jPanel3, null);
                {
                    jScrollPane3 = new JScrollPane();
                    jPanel3.add(jScrollPane3, BorderLayout.CENTER);
                    {
                        ListModel outPutListModel = new DefaultListModel();
                        outPutList = new JList();
                        jScrollPane3.setViewportView(outPutList);
                        outPutList.setModel(outPutListModel);
                        outPutList.addMouseListener(new MouseAdapter() {
                            public void mouseClicked(MouseEvent evt) {
                                swingUtil.invokeAction("outPutList.mouseClicked", evt);
                            }
                        });
                        outPutList.addKeyListener(new KeyAdapter() {
                            public void keyPressed(KeyEvent evt) {
                                swingUtil.invokeAction("outPutList.keyPressed", evt);
                            }
                        });
                    }
                }
                {
                    outPutDir = new JButton();
                    jPanel3.add(outPutDir, BorderLayout.NORTH);
                    outPutDir.setText("set output dir");
                    outPutDir.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            swingUtil.invokeAction("outPutDir.actionPerformed", evt);
                        }
                    });
                }
                {
                    execute = new JButton();
                    jPanel3.add(execute, BorderLayout.SOUTH);
                    execute.setText("execute backup");
                    execute.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            swingUtil.invokeAction("execute.actionPerformed", evt);
                        }
                    });
                }
            }
            {
                jPanel4 = new JPanel();
                BorderLayout jPanel4Layout = new BorderLayout();
                jPanel4.setLayout(jPanel4Layout);
                jTabbedPane1.addTab("compre", null, jPanel4, null);
                {
                    jScrollPane4 = new JScrollPane();
                    jPanel4.add(jScrollPane4, BorderLayout.CENTER);
                    jScrollPane4.setPreferredSize(new java.awt.Dimension(713, 339));
                    {
                        TableModel compareTableModel = new DefaultTableModel();
                        compareTable = new JTable();
                        jScrollPane4.setViewportView(compareTable);
                        compareTable.setModel(compareTableModel);
                        JTableUtil.defaultSetting(compareTable);
                        compareTable.addMouseListener(new MouseAdapter() {
                            public void mouseClicked(MouseEvent evt) {
                                swingUtil.invokeAction("compareTable.mouseClicked", evt);
                            }
                        });
                    }
                }
                {
                    jPanel5 = new JPanel();
                    jPanel4.add(jPanel5, BorderLayout.NORTH);
                    jPanel5.setPreferredSize(new java.awt.Dimension(713, 42));
                    {
                        openExternalSrcFolder = new JButton();
                        jPanel5.add(openExternalSrcFolder);
                        openExternalSrcFolder.setText("open external src folder");
                        openExternalSrcFolder.setPreferredSize(new java.awt.Dimension(280, 29));
                        openExternalSrcFolder.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                swingUtil.invokeAction("openExternalSrcFolder.actionPerformed", evt);
                            }
                        });
                    }
                    {
                        startCompareMatch = new JButton();
                        jPanel5.add(startCompareMatch);
                        startCompareMatch.setText("start compare source");
                        startCompareMatch.setPreferredSize(new java.awt.Dimension(280, 29));
                        startCompareMatch.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                swingUtil.invokeAction("startCompareMatch.actionPerformed", evt);
                            }
                        });
                    }
                }
            }
            {
                jPanel6 = new JPanel();
                GroupLayout jPanel6Layout = new GroupLayout((JComponent) jPanel6);
                jPanel6.setLayout(jPanel6Layout);
                jTabbedPane1.addTab("configuration", null, jPanel6, null);
                {
                    DefaultComboBoxModel exportModeComboModel = new DefaultComboBoxModel();
                    for (ParseMode mode : ParseMode.values()) {
                        exportModeComboModel.addElement(mode);
                    }
                    exportModeCombo = new JComboBox();
                    exportModeCombo.setModel(exportModeComboModel);
                }
                jPanel6Layout.setHorizontalGroup(jPanel6Layout
                        .createSequentialGroup().addContainerGap(41, 41).addComponent(exportModeCombo,
                                GroupLayout.PREFERRED_SIZE, 167, GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(505, Short.MAX_VALUE));
                jPanel6Layout
                        .setVerticalGroup(jPanel6Layout.createSequentialGroup().addContainerGap(30, 30)
                                .addComponent(exportModeCombo, GroupLayout.PREFERRED_SIZE,
                                        GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
                                .addContainerGap(321, Short.MAX_VALUE));
            }
            {
                jPanel7 = new JPanel();
                BorderLayout jPanel7Layout = new BorderLayout();
                jPanel7.setLayout(jPanel7Layout);
                jTabbedPane1.addTab("error log", null, jPanel7, null);
                {
                    jScrollPane5 = new JScrollPane();
                    jPanel7.add(jScrollPane5, BorderLayout.CENTER);
                    {
                        DefaultListModel errorLogListModel = new DefaultListModel();
                        errorLogList = new JList();
                        jScrollPane5.setViewportView(errorLogList);
                        errorLogList.setModel(errorLogListModel);
                    }
                }
            }
        }
        this.setSize(734, 442);

        swingUtil.addAction("openExternalSrcFolder.actionPerformed", new Action() {
            public void action(EventObject evt) throws Exception {
                File dir = JFileChooserUtil.newInstance().selectDirectoryOnly().showOpenDialog()
                        .getApproveSelectedFile();
                if (dir == null) {
                    JOptionPaneUtil.newInstance().iconErrorMessage().showMessageDialog("file is not correct!",
                            "ERROR");
                    return;
                }
                externalDir = dir;
            }
        });
        swingUtil.addAction("startCompareMatch.actionPerformed", new Action() {

            public void action(EventObject evt) throws Exception {
                Validate.notNull(manualBaseDir, "source folder not set!!");
                Validate.notNull(externalDir, "external folder not set!!");
                Validate.isTrue(!manualBaseDir.equals(externalDir), "source dir : " + manualBaseDir
                        + "\nexternal dir : " + externalDir + "\n cant be the same!!");

                List<File> externalSrcFolderList = new ArrayList<File>();
                FileUtil.searchFileMatchs(externalDir, ".*", externalSrcFolderList);
                System.out.println("externalSrcFolderList = " + externalSrcFolderList.size());

                List<File> manualBaseSourceList = new ArrayList<File>();
                FileUtil.searchFileMatchs(manualBaseDir, ".*", manualBaseSourceList);
                System.out.println("manualBaseSourceList = " + manualBaseSourceList.size());

                String cutExternalPath = FileUtil.exportReceiveBaseDir(externalSrcFolderList).getAbsolutePath();
                System.out.println("cutExternalPath = " + cutExternalPath);
                int cutExternalLength = cutExternalPath.length();

                List<CompareFile> _compareList = new ArrayList<CompareFile>();
                CompareFile compare = null;
                File mostCloseFile = null;
                List<File> searchMatchSrcList = new ArrayList<File>();
                for (File external : externalSrcFolderList) {
                    compare = new CompareFile();
                    compare.external = external;

                    searchMatchSrcList.clear();
                    mostCloseFile = new File(manualBaseDir,
                            external.getAbsolutePath().substring(cutExternalLength));
                    System.out.println(mostCloseFile.exists() + " == close file : " + mostCloseFile);
                    if (mostCloseFile.exists()) {
                        searchMatchSrcList.add(mostCloseFile);
                    } else {
                        for (File src : manualBaseSourceList) {
                            if (src.getName().equalsIgnoreCase(external.getName())) {
                                searchMatchSrcList.add(src);
                            }
                        }
                    }

                    System.out.println(external.getName() + " => match source : " + searchMatchSrcList.size());
                    compare.srcSet = new HashSet<File>(searchMatchSrcList);
                    _compareList.add(compare);
                }
                compareList = _compareList;
                reloadCompareTable();
            }
        });
        swingUtil.addAction("compareTable.mouseClicked", new Action() {
            String tortoiseMergeFormat = "cmd /c call TortoiseMerge /base:\"%s\" /theirs:\"%s\"";
            String openFileFormat = "cmd /c call \"%s\"";

            void openFile(File file) {
                String command = String.format(openFileFormat, file);
                System.out.println(command);
                try {
                    ProcessWatcher.newInstance(Runtime.getRuntime().exec(command)).getStreamSync();
                    System.out.println("do reload...");
                    reloadCompareTable();
                } catch (IOException e1) {
                    JCommonUtil.handleException(e1);
                }
            }

            public void action(EventObject evt) throws Exception {
                MouseEvent event = (MouseEvent) evt;

                int rowPos = JTableUtil.newInstance(compareTable).getSelectedRow();
                final File external = (File) JTableUtil.newInstance(compareTable).getModel().getValueAt(rowPos,
                        CompareTableIndex.EXTERNAL_FILE.pos);
                final File srcFile = (File) JTableUtil.newInstance(compareTable).getModel().getValueAt(rowPos,
                        CompareTableIndex.SOURCE_FILE.pos);

                System.out.println("external : " + external);
                System.out.println("srcFile : " + srcFile);

                if (JMouseEventUtil.buttonLeftClick(2, event)) {
                    String command = String.format(tortoiseMergeFormat, external, srcFile);
                    System.out.println(command);
                    Runtime.getRuntime().exec(command);
                }
                if (JMouseEventUtil.buttonRightClick(1, event)) {
                    JMenuItem showInfoMenu = new JMenuItem();
                    showInfoMenu.setText("information");
                    showInfoMenu.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                            JOptionPaneUtil.newInstance().iconInformationMessage().showMessageDialog(//
                                    "source file : \n" + srcFile + "\n"
                                            + DateFormatUtils.format(srcFile.lastModified(),
                                                    "yyyy/MM/dd HH:mm:ss")
                                            + "\n" + "size : " + srcFile.length() / 1024 + "\n\n"
                                            + "external file : \n" + external + "\n"
                                            + DateFormatUtils.format(external.lastModified(),
                                                    "yyyy/MM/dd HH:mm:ss")
                                            + "\n" + "size : " + external.length() / 1024,
                                    "INFORMATION");
                        }
                    });
                    JMenuItem openFileMenu = new JMenuItem();
                    openFileMenu.setText("OPEN : source");
                    openFileMenu.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                            openFile(srcFile);
                        }
                    });
                    JMenuItem openExternalMenu = new JMenuItem();
                    openExternalMenu.setText("OPEN : external");
                    openExternalMenu.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                            openFile(external);
                        }
                    });
                    JMenuItem openPairlMenu = new JMenuItem();
                    openPairlMenu.setText("OPEN : all");
                    openPairlMenu.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                            openFile(srcFile);
                            openFile(external);
                        }
                    });

                    JPopupMenuUtil.newInstance(compareTable).applyEvent(event)
                            .addJMenuItem(showInfoMenu, openFileMenu, openExternalMenu, openPairlMenu).show();
                }
            }
        });
        swingUtil.addAction("loadSrcTextarea.actionPerformed", new Action() {
            public void action(EventObject evt) throws Exception {
                loadSrcTextarea();
            }
        });
        swingUtil.addAction("srcList.mouseClicked", new Action() {
            public void action(EventObject evt) throws Exception {
                if (JMouseEventUtil.buttonRightClick(1, evt)) {
                    JPopupMenuUtil.newInstance(srcList).applyEvent(evt)
                            .addJMenuItem("mark svn delete", new ActionListener() {
                                public void actionPerformed(ActionEvent e) {
                                    if (JOptionPaneUtil.ComfirmDialogResult.YES_OK_OPTION != JOptionPaneUtil
                                            .newInstance().confirmButtonYesNo().showConfirmDialog(
                                                    "are you sure, mark delete file : "
                                                            + srcList.getSelectedValues().length,
                                                    "SVN DELETE")) {
                                        return;
                                    }
                                    StringBuilder sb = new StringBuilder();
                                    Process process = null;
                                    InputStream in = null;
                                    for (Object obj : srcList.getSelectedValues()) {
                                        LineParser l = (LineParser) obj;
                                        String command = String.format("svn delete \"%s\"", l.file);
                                        System.out.println(command);
                                        try {
                                            process = Runtime.getRuntime().exec(command);
                                            in = process.getInputStream();
                                            for (; in.read() != -1;)
                                                ;
                                            if (l.file.exists()) {
                                                sb.append(l.file.getName() + "\n");
                                            }
                                        } catch (IOException e1) {
                                            e1.printStackTrace();
                                            sb.append(l.file.getName() + "\n");
                                        }
                                    }
                                    if (sb.length() > 0) {
                                        JOptionPaneUtil.newInstance().iconErrorMessage()
                                                .showMessageDialog("error : \n" + sb, "ERROR");
                                    } else {
                                        JOptionPaneUtil.newInstance().iconInformationMessage()
                                                .showMessageDialog("mark delete completed!!", "SUCCESS");
                                    }
                                    DefaultListModel model = (DefaultListModel) srcList.getModel();
                                    for (int ii = 0; ii < model.getSize(); ii++) {
                                        LineParser l = (LineParser) model.getElementAt(ii);
                                        if (!l.file.exists()) {
                                            model.remove(ii);
                                            ii--;
                                        }
                                    }
                                }
                            }).show();
                }

                if (!JListUtil.newInstance(srcList).isCorrectMouseClick(evt)) {
                    return;
                }
                LineParser lineParser = (LineParser) JListUtil.getLeadSelectionObject(srcList);
                if (lineParser == null) {
                    return;
                }
                Runtime.getRuntime().exec("cmd /c call \"" + lineParser.file + "\"");
            }
        });
        swingUtil.addAction("srcList.keyPressed", new Action() {
            public void action(EventObject evt) throws Exception {
                JListUtil.newInstance(srcList).defaultJListKeyPressed(evt);
            }
        });
        swingUtil.addAction("outPutList.mouseClicked", new Action() {
            public void action(EventObject evt) throws Exception {
                if (!JListUtil.newInstance(outPutList).isCorrectMouseClick(evt)) {
                    return;
                }
            }
        });
        swingUtil.addAction("outPutList.keyPressed", new Action() {
            public void action(EventObject evt) throws Exception {
                JListUtil.newInstance(outPutList).defaultJListKeyPressed(evt);
            }
        });
        swingUtil.addAction("outPutDir.actionPerformed", new Action() {
            public void action(EventObject evt) throws Exception {
                File dir = JFileChooserUtil.newInstance().selectDirectoryOnly().showOpenDialog()
                        .getApproveSelectedFile();
                if (dir == null) {
                    outputDir = DEFAULT_OUTPUT_DIR;
                } else {
                    outputDir = dir;
                }
                reflushOutputList();
            }
        });
        swingUtil.addAction("srcBaseDir.actionPerformed", new Action() {
            public void action(EventObject evt) throws Exception {
                File dir = JFileChooserUtil.newInstance().selectDirectoryOnly().showOpenDialog()
                        .getApproveSelectedFile();
                Validate.notNull(dir, "src base directory is not correct!");
                manualBaseDir = dir;
            }
        });
        swingUtil.addAction("execute.actionPerformed", new Action() {
            public void action(EventObject evt) throws Exception {
                DefaultListModel model = (DefaultListModel) outPutList.getModel();
                for (int ii = 0; ii < model.size(); ii++) {
                    OutputFile file = (OutputFile) model.getElementAt(ii);
                    if (!file.destFile.getParentFile().exists()) {
                        file.destFile.getParentFile().mkdirs();
                    }
                    FileUtil.copyFile(file.srcFile, file.destFile);
                }
                JOptionPaneUtil.newInstance().iconInformationMessage()
                        .showMessageDialog("copy success!!\nsize = " + model.getSize(), getTitle());
            }
        });
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:au.org.ala.delta.intkey.ui.TaxonInformationDialog.java

public TaxonInformationDialog(Frame owner, List<Item> taxa, IntkeyContext context,
        boolean imageDisplayEnabled) {
    super(owner, false);

    setPreferredSize(new Dimension(550, 280));
    setMinimumSize(new Dimension(550, 280));

    ResourceMap resourceMap = Application.getInstance().getContext()
            .getResourceMap(TaxonInformationDialog.class);
    resourceMap.injectFields(this);
    ActionMap actionMap = Application.getInstance().getContext().getActionMap(TaxonInformationDialog.class,
            this);

    setTitle(title);//from  ww w.j  a  v  a 2s .co m
    getContentPane().setLayout(new BorderLayout(0, 0));

    _mainPanel = new JPanel();
    getContentPane().add(_mainPanel, BorderLayout.CENTER);
    _mainPanel.setLayout(new BorderLayout(0, 0));

    _comboPanel = new JPanel();
    _comboPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
    _mainPanel.add(_comboPanel, BorderLayout.NORTH);
    _comboPanel.setLayout(new BorderLayout(0, 0));

    _comboBox = new JComboBox();
    _comboBox.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            displayTaxon(_comboBox.getSelectedIndex());
        }
    });

    _comboPanel.add(_comboBox, BorderLayout.CENTER);

    _btnPanel = new JPanel();
    _btnPanel.setBorder(new EmptyBorder(0, 0, 10, 0));
    _mainPanel.add(_btnPanel, BorderLayout.SOUTH);

    _btnDisplay = new JButton();
    _btnDisplay.setAction(actionMap.get("displaySelectedTaxonInformation"));
    _btnPanel.add(_btnDisplay);

    _btnMultipleImages = new JButton();
    _btnMultipleImages.setAction(actionMap.get("displayMultipleImages"));
    _btnMultipleImages.setEnabled(!context.displayContinuous() && imageDisplayEnabled);
    _btnPanel.add(_btnMultipleImages);

    _btnWebSearch = new JButton();
    _btnWebSearch.setAction(actionMap.get("webSearch"));
    _btnWebSearch.setEnabled(true);
    _btnPanel.add(_btnWebSearch);

    _btnDeselectAll = new JButton();
    _btnDeselectAll.setAction(actionMap.get("deselectAllTaxonInformation"));
    _btnPanel.add(_btnDeselectAll);

    _btnDone = new JButton();
    _btnDone.setAction(actionMap.get("done"));
    _btnPanel.add(_btnDone);

    _pnlCenter = new JPanel();
    _mainPanel.add(_pnlCenter, BorderLayout.CENTER);
    _pnlCenter.setLayout(new BorderLayout(0, 0));

    _pnlNavigationButtons = new JPanel();
    _pnlCenter.add(_pnlNavigationButtons, BorderLayout.NORTH);

    _btnStart = new JButton();
    _btnStart.setAction(actionMap.get("firstTaxon"));
    _pnlNavigationButtons.add(_btnStart);

    _btnPrevious = new JButton();
    _btnPrevious.setAction(actionMap.get("previousTaxon"));
    _pnlNavigationButtons.add(_btnPrevious);

    _btnForward = new JButton();
    _btnForward.setAction(actionMap.get("nextTaxon"));
    _pnlNavigationButtons.add(_btnForward);

    _btnEnd = new JButton();
    _btnEnd.setAction(actionMap.get("lastTaxon"));
    _pnlNavigationButtons.add(_btnEnd);

    _pnlLists = new JPanel();
    _pnlCenter.add(_pnlLists, BorderLayout.CENTER);
    _pnlLists.setLayout(new GridLayout(0, 2, 0, 0));

    _pnlListOther = new JPanel();
    _pnlListOther.setBorder(new EmptyBorder(5, 5, 5, 5));
    _pnlLists.add(_pnlListOther);
    _pnlListOther.setLayout(new BorderLayout(0, 0));

    _listOther = new JList();
    _listOther.addMouseListener(new MouseInputAdapter() {

        @Override
        public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() >= 2) {
                int selectedIndex = _listOther.getSelectedIndex();
                _cmds.get(selectedIndex).execute();
            }
        }

    });

    _sclPnOther = new JScrollPane();
    _sclPnOther.setViewportView(_listOther);
    _pnlListOther.add(_sclPnOther, BorderLayout.CENTER);

    _lblOther = new JLabel();
    _pnlListOther.add(_lblOther, BorderLayout.NORTH);

    _pnlListIllustrations = new JPanel();
    _pnlListIllustrations.setBorder(new EmptyBorder(5, 5, 5, 5));
    _pnlLists.add(_pnlListIllustrations);
    _pnlListIllustrations.setLayout(new BorderLayout(0, 0));

    _lblIllustrations = new JLabel();
    _pnlListIllustrations.add(_lblIllustrations, BorderLayout.NORTH);

    _listIllustrations = new JList();
    _listIllustrations.addMouseListener(new MouseInputAdapter() {

        @Override
        public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() >= 2) {
                if (_imageDisplayEnabled) {
                    int selectedListIndex = _listIllustrations.getSelectedIndex();
                    displaySelectedTaxonImage(selectedListIndex, true);
                } else {
                    _context.getUI()
                            .displayErrorMessage(UIUtils.getResourceString("ImageDisplayDisabled.error"));
                }
            }
        }

    });

    _sclPnIllustrations = new JScrollPane();

    _sclPnIllustrations.setViewportView(_listIllustrations);
    _pnlListIllustrations.add(_sclPnIllustrations);

    _context = context;
    _imageDisplayEnabled = imageDisplayEnabled;
    _definedDirectiveCommands = _context.getTaxonInformationDialogCommands();

    _infoSettings = _context.getInfoSettings();
    _imageSettings = _context.getImageSettings();
    _itemFormatter = new ItemFormatter(_context.displayNumbering(), CommentStrippingMode.RETAIN,
            AngleBracketHandlingMode.REMOVE, true, false, false);
    _imageDescriptionFormatter = new Formatter(CommentStrippingMode.RETAIN, AngleBracketHandlingMode.RETAIN,
            true, false);

    int totalNumberImages = 0;
    _taxa = taxa;
    _taxaWithImages = new ArrayList<Item>();
    for (Item taxon : taxa) {
        totalNumberImages += taxon.getImageCount();
        if (taxon.getImageCount() > 0) {
            _taxaWithImages.add(taxon);
        }
    }

    if (totalNumberImages < 2) {
        _btnMultipleImages.setEnabled(false);
    }

    initialize();

    loadDesktopInBackground();

    this.pack();
}

From source file:com.mirth.connect.manager.ManagerDialog.java

private void initServerPanel() {
    serverPanel = new JPanel(
            new MigLayout("insets 8, novisualpadding, hidemode 3, fill", "[right][left][right][left]"));
    serverPanel.setFocusable(false);/*from ww  w  . ja  v a2  s . co m*/
    serverPanel.setBackground(new Color(255, 255, 255));
    serverPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));

    webstartPortLabel = new JLabel("Web Start Port:");
    webstartPortField = new MirthTextField();

    adminPortLabel = new JLabel("Administrator Port:");
    adminPortField = new MirthTextField();

    serverMemoryLabel = new JLabel("Server Memory (mb):");
    serverMemoryField = new MirthTextField();

    serverLogFiles = new JList();
    serverLogFiles.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
        public void valueChanged(ListSelectionEvent evt) {
            serverLogFilesValueChanged(evt);
        }
    });

    serverLogFiles.addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent evt) {
        }

        public void mouseReleased(MouseEvent evt) {
        }

        public void mouseClicked(MouseEvent evt) {
            if (evt.getClickCount() >= 2) {
                if (serverLogFiles.getSelectedIndex() != -1) {
                    viewFileButtonActionPerformed(null);
                }
            }
        }
    });

    serverLogsScrollPane = new JScrollPane();
    serverLogsScrollPane.setViewportView(serverLogFiles);

    mainLogLevelLabel = new JLabel("Main Log Level:");
    mainLogLevelCombobox = new MirthComboBox();
    mainLogLevelCombobox.setModel(new DefaultComboBoxModel(ManagerConstants.LOG4J_ERROR_CODES)); // This can be combined with the above as a new ctor

    databaseLogLevelLabel = new JLabel("Database Log Level:");
    databaseLogLevelCombobox = new MirthComboBox();
    databaseLogLevelCombobox.setModel(new DefaultComboBoxModel(ManagerConstants.LOG4J_ERROR_CODES));

    channelLogLevelLabel = new JLabel("Channel Log Level:");
    channelLogLevelCombobox = new MirthComboBox();
    channelLogLevelCombobox.setModel(new DefaultComboBoxModel(ManagerConstants.LOG4J_ERROR_CODES_WITH_BLANK));

    refreshServiceButton = new JButton("Refresh");
    refreshServiceButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            refreshServiceButtonActionPerformed(evt);
        }
    });

    viewFileButton = new JButton("View File");
    viewFileButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            viewFileButtonActionPerformed(evt);
        }
    });
}

From source file:gtu._work.ui.TextScanUI.java

private void initGUI() {
    try {//from  w  w w  .j  a va 2s  . c  om
        BorderLayout thisLayout = new BorderLayout();
        getContentPane().setLayout(thisLayout);
        this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        this.addComponentListener(new ComponentAdapter() {
            public void componentResized(ComponentEvent evt) {
                thisComponentResized(evt);
            }
        });
        this.addWindowStateListener(new WindowStateListener() {
            public void windowStateChanged(WindowEvent evt) {
                System.out.println("this.windowStateChanged, event=" + evt);
                // TODO add your code for this.windowStateChanged
            }
        });
        this.addWindowListener(new WindowAdapter() {
            public void windowIconified(WindowEvent evt) {
                System.out.println("this.windowIconified, event=" + evt);
                // TODO add your code for this.windowIconified
            }
        });
        this.setTitle(TITLE);
        {
            jPanel1 = new JPanel();
            getContentPane().add(jPanel1, BorderLayout.NORTH);
            GroupLayout jPanel1Layout = new GroupLayout((JComponent) jPanel1);
            jPanel1.setLayout(jPanel1Layout);
            jPanel1.setPreferredSize(new java.awt.Dimension(521, 89));
            jPanel1.setBounds(0, 0, 521, 89);
            {
                jButton1 = new JButton();
                jButton1.setText("File");
                jButton1.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent evt) {
                        jButton1ActionPerformed(evt);
                    }
                });
            }
            {
                jButton2 = new JButton();
                jButton2.setText("Clipboard");
                jButton2.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent evt) {
                        jButton2ActionPerformed(evt);
                    }
                });
            }
            {
                contentFilter = new JTextField();
                contentFilter.getDocument().addDocumentListener(new DocumentListener() {
                    public void insertUpdate(DocumentEvent paramDocumentEvent) {
                        jTextField2filterAgain();
                    }

                    public void removeUpdate(DocumentEvent paramDocumentEvent) {
                        jTextField2filterAgain();
                    }

                    public void changedUpdate(DocumentEvent paramDocumentEvent) {
                        jTextField2filterAgain();
                    }
                });
            }
            {
                fileFilter = new JTextField();
                fileFilter.getDocument().addDocumentListener(new DocumentListener() {
                    public void insertUpdate(DocumentEvent paramDocumentEvent) {
                        jTextField1DocumentListener(paramDocumentEvent);
                    }

                    public void removeUpdate(DocumentEvent paramDocumentEvent) {
                        jTextField1DocumentListener(paramDocumentEvent);
                    }

                    public void changedUpdate(DocumentEvent paramDocumentEvent) {
                        jTextField1DocumentListener(paramDocumentEvent);
                    }
                });
            }
            {
                totalLabel = new JLabel();
            }
            {
                matchLabel = new JLabel();
            }
            {
                jLabel4 = new JLabel();
                jLabel4.setText("Match : ");
            }
            {
                jLabel2 = new JLabel();
                jLabel2.setText("Total : ");
            }
            {
                ComboBoxModel jComboBox1Model = new DefaultComboBoxModel(new String[] { "All", "Match" });
                contextFilter = new JComboBox();
                contextFilter.setModel(jComboBox1Model);
                contextFilter.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent evt) {
                        jTextField2filterAgain();
                    }
                });
            }
            {
                ComboBoxModel jComboBox1Model = new DefaultComboBoxModel(new String[] { "Regex", "find" });
                fileChk = new JComboBox();
                fileChk.setModel(jComboBox1Model);
                fileChk.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent evt) {
                        fileChkActionPerformed(evt);
                    }
                });
            }
            {
                jScrollPane2 = new JScrollPane();
                {
                    ListModel groupListModel = new DefaultComboBoxModel();
                    groupList = new JList();
                    jScrollPane2.setViewportView(groupList);
                    groupList.setModel(groupListModel);
                    groupList.addKeyListener(new KeyAdapter() {
                        public void keyPressed(KeyEvent evt) {
                            groupListKeyPressed(evt);
                        }
                    });
                }
            }
            jPanel1Layout.setVerticalGroup(jPanel1Layout.createSequentialGroup().addContainerGap(16, 16)
                    .addGroup(jPanel1Layout.createParallelGroup()
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                    .addGroup(jPanel1Layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                            .addComponent(jButton1, GroupLayout.Alignment.BASELINE,
                                                    GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addComponent(fileFilter, GroupLayout.Alignment.BASELINE,
                                                    GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addComponent(jLabel2, GroupLayout.Alignment.BASELINE,
                                                    GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE)
                                            .addComponent(fileChk, GroupLayout.Alignment.BASELINE,
                                                    GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                                    GroupLayout.PREFERRED_SIZE))
                                    .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addGroup(jPanel1Layout.createParallelGroup().addGroup(jPanel1Layout
                                            .createParallelGroup(GroupLayout.Alignment.BASELINE)
                                            .addComponent(jButton2, GroupLayout.Alignment.BASELINE,
                                                    GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addComponent(contentFilter, GroupLayout.Alignment.BASELINE,
                                                    GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                                    GroupLayout.PREFERRED_SIZE)
                                            .addComponent(jLabel4, GroupLayout.Alignment.BASELINE,
                                                    GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE)
                                            .addComponent(contextFilter, GroupLayout.Alignment.BASELINE,
                                                    GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                                    GroupLayout.PREFERRED_SIZE))
                                            .addComponent(matchLabel, GroupLayout.Alignment.LEADING,
                                                    GroupLayout.PREFERRED_SIZE, 24,
                                                    GroupLayout.PREFERRED_SIZE)))
                            .addGroup(jPanel1Layout.createParallelGroup()
                                    .addComponent(totalLabel, GroupLayout.Alignment.LEADING,
                                            GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jScrollPane2, GroupLayout.Alignment.LEADING,
                                            GroupLayout.PREFERRED_SIZE, 61, GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap(12, 12));
            jPanel1Layout.setHorizontalGroup(jPanel1Layout.createSequentialGroup().addContainerGap(12, 12)
                    .addGroup(jPanel1Layout.createParallelGroup()
                            .addComponent(contextFilter, GroupLayout.Alignment.LEADING,
                                    GroupLayout.PREFERRED_SIZE, 87, GroupLayout.PREFERRED_SIZE)
                            .addComponent(fileChk, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE,
                                    87, GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel1Layout.createParallelGroup()
                            .addComponent(jLabel4, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel2, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE,
                                    45, GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel1Layout.createParallelGroup()
                            .addComponent(matchLabel, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE,
                                    67, GroupLayout.PREFERRED_SIZE)
                            .addComponent(totalLabel, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE,
                                    67, GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel1Layout.createParallelGroup()
                            .addComponent(contentFilter, GroupLayout.Alignment.LEADING,
                                    GroupLayout.PREFERRED_SIZE, 266, GroupLayout.PREFERRED_SIZE)
                            .addComponent(fileFilter, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE,
                                    266, GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(jPanel1Layout.createParallelGroup()
                            .addComponent(jButton1, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE,
                                    91, GroupLayout.PREFERRED_SIZE)
                            .addComponent(jButton2, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE,
                                    91, GroupLayout.PREFERRED_SIZE))
                    .addGap(19)
                    .addComponent(jScrollPane2, GroupLayout.PREFERRED_SIZE, 36, GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(16, 16));
        }
        {
            jScrollPane1 = new JScrollPane();
            getContentPane().add(jScrollPane1, BorderLayout.CENTER);
            jScrollPane1.setPreferredSize(new java.awt.Dimension(581, 235));
            {
                ListModel jList1Model = new DefaultComboBoxModel();
                matchList = new JList();
                jScrollPane1.setViewportView(matchList);

                // matchList.setPreferredSize(new java.awt.Dimension(575,
                // 232));// ???
                // ??
                // XXX
                // TODO
                // IMPORT
                // !!!!

                matchList.addMouseListener(new MouseAdapter() {
                    public void mouseClicked(MouseEvent evt) {
                        jList1MouseClicked(evt);
                    }
                });
                matchList.setModel(jList1Model);
            }
        }
        this.setSize(697, 440);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.digitexx.ancestry.gui.FrmUpperLowerData.java

private void initGUI() {
    try {/*from w w  w  .jav  a 2  s . c  o  m*/
        this.setTitle("Uppercase & Lowercase data");
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        AnchorLayout thisLayout = new AnchorLayout();
        getContentPane().setLayout(thisLayout);
        {
            panelMain = new JPanel();
            BorderLayout panelMainLayout = new BorderLayout();
            panelMain.setLayout(panelMainLayout);
            getContentPane().add(panelMain, new AnchorConstraint(0, 1000, 944, 0, AnchorConstraint.ANCHOR_REL,
                    AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
            panelMain.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
            panelMain.setPreferredSize(new java.awt.Dimension(775, 488));
            {
                splitPaneMain = new JSplitPane();
                panelMain.add(splitPaneMain, BorderLayout.CENTER);
                splitPaneMain.setOrientation(JSplitPane.VERTICAL_SPLIT);
                splitPaneMain.setDividerLocation(200);
                {
                    panelColumnLog = new JPanel();
                    BorderLayout panelLogLayout = new BorderLayout();
                    panelColumnLog.setLayout(panelLogLayout);
                    splitPaneMain.add(panelColumnLog, JSplitPane.RIGHT);
                    panelColumnLog.setPreferredSize(new java.awt.Dimension(417, 482));
                    {
                        splitPaneColumnAndLog = new JSplitPane();
                        panelColumnLog.add(splitPaneColumnAndLog, BorderLayout.CENTER);
                        splitPaneColumnAndLog.setDividerLocation(200);
                        {
                            panelLog = new JPanel();
                            BorderLayout panelLogLayout1 = new BorderLayout();
                            panelLog.setLayout(panelLogLayout1);
                            splitPaneColumnAndLog.add(panelLog, JSplitPane.RIGHT);
                            {
                                scrollPaneLog = new JScrollPane();
                                panelLog.add(scrollPaneLog, BorderLayout.CENTER);
                                {
                                    textPaneLog = new JTextPane();
                                    scrollPaneLog.setViewportView(textPaneLog);
                                }
                            }
                        }
                        {
                            panelColumn = new JPanel();
                            BorderLayout panelColumnLayout = new BorderLayout();
                            panelColumn.setLayout(panelColumnLayout);
                            splitPaneColumnAndLog.add(panelColumn, JSplitPane.LEFT);
                            {
                                scrollPaneColumn = new JScrollPane();
                                panelColumn.add(scrollPaneColumn, BorderLayout.CENTER);
                                {
                                    tableField = new JTable() {
                                        @Override
                                        public boolean isCellEditable(int row, int column) {
                                            if (getColumnName(column).equals("Check")) {
                                                return true;
                                            } else {
                                                return false;
                                            }
                                        }

                                        @Override
                                        public Class<?> getColumnClass(int column) {
                                            if (getColumnName(column).equals("Check")) {
                                                return Boolean.class;
                                            } else {
                                                return super.getColumnClass(column);
                                            }
                                        }
                                    };
                                    scrollPaneColumn.setViewportView(tableField);
                                }
                            }
                        }
                    }
                }
                {
                    panelPath = new JPanel();
                    BorderLayout panelPathLayout = new BorderLayout();
                    panelPath.setLayout(panelPathLayout);
                    splitPaneMain.add(panelPath, JSplitPane.LEFT);
                    panelPath.setPreferredSize(new java.awt.Dimension(769, 316));
                    {
                        scrollPanePath = new JScrollPane();
                        panelPath.add(scrollPanePath, BorderLayout.CENTER);
                        {
                            jListPath = new JList();
                            scrollPanePath.setViewportView(jListPath);
                            jListPath.setFont(new java.awt.Font("Arial", 0, 14));
                        }
                    }
                }
            }
        }
        {
            panelFooter = new JPanel();
            AnchorLayout panelFooterLayout = new AnchorLayout();
            getContentPane().add(panelFooter,
                    new AnchorConstraint(944, 1000, 1000, 0, AnchorConstraint.ANCHOR_REL,
                            AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL,
                            AnchorConstraint.ANCHOR_REL));
            panelFooter.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
            panelFooter.setLayout(panelFooterLayout);
            panelFooter.setPreferredSize(new java.awt.Dimension(775, 29));
            {
                buttonRun = new JButton();
                panelFooter.add(buttonRun, new AnchorConstraint(86, 998, 948, 890, AnchorConstraint.ANCHOR_REL,
                        AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
                buttonRun.setText("Run");
                buttonRun.setFont(new java.awt.Font("Arial", 1, 16));
                buttonRun.setPreferredSize(new java.awt.Dimension(83, 25));
                buttonRun.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent evt) {
                        buttonRunActionPerformed(evt);
                    }
                });
            }
            {
                checkboxRework = new JCheckBox();
                panelFooter.add(checkboxRework,
                        new AnchorConstraint(86, 155, 948, 3, AnchorConstraint.ANCHOR_REL,
                                AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL,
                                AnchorConstraint.ANCHOR_REL));
                checkboxRework.setText("Rework");
                checkboxRework.setFont(new java.awt.Font("Arial", 1, 16));
                checkboxRework.setForeground(new java.awt.Color(255, 0, 0));
                checkboxRework.setPreferredSize(new java.awt.Dimension(118, 25));
                checkboxRework.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent evt) {
                        checkboxReworkActionPerformed(evt);
                    }
                });
            }
        }
        pack();
        this.setSize(783, 551);
        AppUtility.centerFrame(this);
        this.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent evt) {
                exit();
            }
        });
        ;
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:net.aepik.alasca.gui.ldap.SchemaObjectEditorFrame.java

/**
 * Build frame.//  ww  w. j  a  v  a  2  s  .c o m
 */
private void build() {
    setTitle("Proprits de l'objet " + objetSchema.getId());
    setSize(700, 400);
    setResizable(false);
    setLocationRelativeTo(mainFrame);

    if (mainFrame != null)
        setIconImage(mainFrame.getIconImage());

    // - Panel bouton du bas -

    JPanel boutonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    boutonsPanel.add(boutonOk);
    boutonsPanel.add(boutonAnnuler);

    // - Description -

    JTextArea textAreaValues = new JTextArea("Vous pouvez apporter des modifications sur les paramtres"
            + " de cet objet d'identifiant " + objetSchema.getId() + ". Les"
            + " modifications apportes  des paramtres non-cochs ne" + " seront pas prises en compte.");
    textAreaValues.setEditable(false);
    textAreaValues.setLineWrap(true);
    textAreaValues.setWrapStyleWord(true);
    textAreaValues.setFont((new JLabel()).getFont());
    textAreaValues.setBorder(BorderFactory.createEmptyBorder(7, 8, 7, 8));
    textAreaValues.setBackground((new JLabel()).getBackground());

    // - La table des valeurs -
    // Correction : Tri alphabtique des valeurs

    Enumeration<String> k = values.keys();
    String[] keys = new String[values.size()];

    for (int i = 0; i < keys.length; i++)
        keys[i] = k.nextElement();
    Arrays.sort(keys);

    JPanel colonne1 = new JPanel(new GridLayout(keys.length, 1));
    JPanel colonne2 = new JPanel(new GridLayout(keys.length, 1));

    // Enumeration<JComponent> l = labels.elements();
    // Enumeration<JComponent> v = values.elements();
    // Enumeration<String> k = values.keys();
    // JPanel colonne1 = new JPanel( new GridLayout( values.size(), 1 ) );
    // JPanel colonne2 = new JPanel( new GridLayout( values.size(), 1 ) );

    for (int i = 0; keys != null && i < keys.length; i++) {

        // while( l.hasMoreElements() && v.hasMoreElements() && k.hasMoreElements() ) {

        String key = keys[i];
        JComponent label = labels.get(key);
        JComponent value = values.get(key);
        JCheckBox checkbox = valuesPresent.get(key);

        // String key = k.nextElement();
        // JComponent label = l.nextElement();
        // JComponent value = v.nextElement();
        // JCheckBox checkbox = valuesPresent.get( key );

        if (!value.isEnabled() && value instanceof JTextField) {

            //value.setEnabled( true );

            JButton b = new JButton("...");
            b.setBorder(BorderFactory.createCompoundBorder(
                    BorderFactory.createMatteBorder(0, 5, 0, 0, Color.white), b.getBorder()));
            b.addActionListener(new SchemaValueEditorLauncher(b, (JTextField) value, objetSchema, key));

            JPanel tmp = new JPanel(new BorderLayout());
            tmp.add(value, BorderLayout.CENTER);
            tmp.add(b, BorderLayout.EAST);
            tmp.setOpaque(false);
            value = tmp;
        }

        JPanel panelTmp1 = new JPanel(new BorderLayout());
        panelTmp1.add(checkbox, BorderLayout.WEST);
        panelTmp1.add(label, BorderLayout.CENTER);
        panelTmp1.setBorder(BorderFactory.createEmptyBorder(2, 0, 2, 3));
        colonne1.add(panelTmp1);

        JPanel panelTmp2 = new JPanel(new BorderLayout());
        panelTmp2.add(value, BorderLayout.CENTER);
        panelTmp2.setBorder(BorderFactory.createEmptyBorder(2, 3, 2, 3));
        colonne2.add(panelTmp2);

        checkbox.setOpaque(false);
        label.setOpaque(false);
        value.setOpaque(false);
        panelTmp1.setOpaque(false);
        panelTmp2.setOpaque(false);
    }

    JPanel tablePanel = new JPanel(new BorderLayout());
    tablePanel.add(colonne1, BorderLayout.WEST);
    tablePanel.add(colonne2, BorderLayout.EAST);
    tablePanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    colonne1.setOpaque(false);
    colonne2.setOpaque(false);
    tablePanel.setOpaque(false);

    JPanel tablePanelContainer = new JPanel(new BorderLayout());
    tablePanelContainer.add(tablePanel, BorderLayout.NORTH);
    tablePanelContainer.setBackground(Color.white);

    JList tmpForBorderList = new JList();
    JScrollPane tmpForBorderScroller = new JScrollPane(tmpForBorderList);

    JScrollPane tableScroller = new JScrollPane(tablePanelContainer);
    //tableScroller.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS );
    tableScroller.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5, 6, 1, 6),
            BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(" Listes des paramtres "),
                    BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5),
                            tmpForBorderScroller.getBorder()))));

    // - Organisation gnrale -

    JPanel mainPanel = new JPanel(new BorderLayout());
    mainPanel.add(textAreaValues, BorderLayout.NORTH);
    mainPanel.add(tableScroller, BorderLayout.CENTER);

    JPanel mainPanelContainer = new JPanel(new BorderLayout());
    mainPanelContainer.add(mainPanel, BorderLayout.CENTER);
    mainPanelContainer.add(boutonsPanel, BorderLayout.SOUTH);
    mainPanelContainer.setBorder(BorderFactory.createEmptyBorder(2, 1, 1, 1));

    getContentPane().add(mainPanelContainer);

    // - Listeners -

    addWindowListener(this);
    boutonOk.addActionListener(this);
    boutonAnnuler.addActionListener(this);
}

From source file:com.neurotec.samples.panels.EnrollFromScanner.java

@Override
protected void initGUI() {
    panelMain = new JPanel();
    panelScanners = new JPanel();
    scrollPaneList = new JScrollPane();
    scannerList = new JList();
    panelButtons = new JPanel();
    btnRefresh = new JButton();
    btnScan = new JButton();
    btnCancel = new JButton();
    btnForce = new JButton();
    cbAutomatic = new JCheckBox();
    scrollPane = new JScrollPane();
    panelSouth = new JPanel();
    panelInfo = new JPanel();
    lblInfo = new JLabel();
    panelSave = new JPanel();
    btnIdentifyPatient = new JButton();
    btnRegisterPatient = new JButton();
    cbShowProcessed = new JCheckBox();

    setLayout(new BorderLayout());

    panelMain.setLayout(new BorderLayout());

    panelScanners.setBorder(BorderFactory.createTitledBorder("Scanners list"));
    panelScanners.setLayout(new BorderLayout());

    scrollPaneList.setPreferredSize(new Dimension(0, 90));

    scannerList.setModel(new DefaultListModel());
    scannerList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    scannerList.setBorder(LineBorder.createBlackLineBorder());
    scrollPaneList.setViewportView(scannerList);

    panelScanners.add(scrollPaneList, BorderLayout.CENTER);

    panelButtons.setLayout(new FlowLayout(FlowLayout.LEADING));

    btnRefresh.setText("Refresh list");
    panelButtons.add(btnRefresh);//  w w  w  .  jav  a  2s. c o m

    btnScan.setText("Scan");
    panelButtons.add(btnScan);

    btnCancel.setText("Cancel");
    btnCancel.setEnabled(false);
    panelButtons.add(btnCancel);

    btnForce.setText("Force");
    panelButtons.add(btnForce);

    cbAutomatic.setSelected(true);
    cbAutomatic.setText("Scan automatically");
    panelButtons.add(cbAutomatic);

    panelScanners.add(panelButtons, BorderLayout.SOUTH);

    panelMain.add(panelScanners, BorderLayout.NORTH);
    panelMain.add(scrollPane, BorderLayout.CENTER);

    panelSouth.setLayout(new BorderLayout());

    panelInfo.setBorder(new SoftBevelBorder(BevelBorder.LOWERED));
    panelInfo.setLayout(new GridLayout(1, 1));

    lblInfo.setText(" ");
    panelInfo.add(lblInfo);

    panelSouth.add(panelInfo, BorderLayout.NORTH);

    panelSave.setLayout(new FlowLayout(FlowLayout.LEADING));

    btnIdentifyPatient.setText("Identify Patient");
    btnIdentifyPatient.setEnabled(false);
    panelSave.add(btnIdentifyPatient);

    btnRegisterPatient.setText("Register Patient");
    btnRegisterPatient.setEnabled(false);
    panelSave.add(btnRegisterPatient);

    cbShowProcessed.setSelected(true);
    cbShowProcessed.setText("Show processed image");
    panelSave.add(cbShowProcessed);

    panelSouth.add(panelSave, BorderLayout.SOUTH);

    panelMain.add(panelSouth, BorderLayout.SOUTH);

    add(panelMain, BorderLayout.CENTER);

    panelLicensing = new LicensingPanel(requiredLicenses, optionalLicenses);
    add(panelLicensing, java.awt.BorderLayout.NORTH);

    fcImage = new JFileChooser();
    fcImage.setFileFilter(new Utils.ImageFileFilter(NImages.getSaveFileFilter()));
    fcTemplate = new JFileChooser();
    view = new NFingerView();
    view.setShownImage(ShownImage.RESULT);
    view.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent ev) {
            super.mouseClicked(ev);
            if (ev.getButton() == MouseEvent.BUTTON3) {
                cbShowProcessed.doClick();
            }
        }

    });
    scrollPane.setViewportView(view);

    btnRefresh.addActionListener(this);
    btnScan.addActionListener(this);
    btnCancel.addActionListener(this);
    btnForce.addActionListener(this);
    btnIdentifyPatient.addActionListener(this);
    btnRegisterPatient.addActionListener(this);
    cbShowProcessed.addActionListener(this);
    scannerList.addListSelectionListener(new ScannerSelectionListener());
}