Example usage for javax.swing JButton setBorderPainted

List of usage examples for javax.swing JButton setBorderPainted

Introduction

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

Prototype

@BeanProperty(visualUpdate = true, description = "Whether the border should be painted.")
public void setBorderPainted(boolean b) 

Source Link

Document

Sets the borderPainted property.

Usage

From source file:marytts.tools.voiceimport.DatabaseImportMain.java

protected void setupGUI() {
    // A scroll pane containing one labelled checkbox per component,
    // and a "run selected components" button below.
    GridBagLayout gridBagLayout = new GridBagLayout();
    GridBagConstraints gridC = new GridBagConstraints();
    getContentPane().setLayout(gridBagLayout);

    JPanel checkboxPane = new JPanel();
    checkboxPane.setLayout(new BoxLayout(checkboxPane, BoxLayout.Y_AXIS));
    //checkboxPane.setPreferredSize(new Dimension(300, 300));
    int compIndex = 0;
    for (int j = 0; j < groups2Comps.length; j++) {
        String[] nextGroup = groups2Comps[j];
        JPanel groupPane = new JPanel();
        groupPane.setLayout(new BoxLayout(groupPane, BoxLayout.Y_AXIS));
        groupPane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(nextGroup[0]),
                BorderFactory.createEmptyBorder(1, 1, 1, 1)));
        for (int i = 1; i < nextGroup.length; i++) {
            JButton configButton = new JButton();
            Icon configIcon = new ImageIcon(DatabaseImportMain.class.getResource("configure.png"), "Configure");
            configButton.setIcon(configIcon);
            configButton.setPreferredSize(new Dimension(configIcon.getIconWidth(), configIcon.getIconHeight()));
            configButton.addActionListener(new ConfigButtonActionListener(nextGroup[i]));
            configButton.setBorderPainted(false);
            //System.out.println("Adding checkbox for "+components[i].getClass().getName());
            checkboxes[compIndex] = new JCheckBox(nextGroup[i]);
            checkboxes[compIndex].setFocusable(true);
            //checkboxes[i].setPreferredSize(new Dimension(200, 30));
            JPanel line = new JPanel();
            line.setLayout(new BorderLayout(5, 0));
            line.add(configButton, BorderLayout.WEST);
            line.add(checkboxes[compIndex], BorderLayout.CENTER);
            groupPane.add(line);/*from w  w  w.  j  a  v  a 2s .co m*/
            compIndex++;
        }
        checkboxPane.add(groupPane);
    }
    gridC.gridx = 0;
    gridC.gridy = 0;
    gridC.fill = GridBagConstraints.BOTH;
    JScrollPane scrollPane = new JScrollPane(checkboxPane);
    scrollPane.setPreferredSize(new Dimension(450, 300));
    gridBagLayout.setConstraints(scrollPane, gridC);
    getContentPane().add(scrollPane);

    JButton helpButton = new JButton("Help");
    helpButton.setMnemonic(KeyEvent.VK_H);
    helpButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            displayHelpGUI();
        }
    });
    JButton settingsButton = new JButton("Settings");
    settingsButton.setMnemonic(KeyEvent.VK_S);
    settingsButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            currentComponent = "Global properties";
            displaySettingsGUI();
        }
    });
    runButton = new JButton("Run");
    runButton.setMnemonic(KeyEvent.VK_R);
    runButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            runSelectedComponents();
        }
    });

    JButton quitAndSaveButton = new JButton("Quit");
    quitAndSaveButton.setMnemonic(KeyEvent.VK_Q);
    quitAndSaveButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            try {
                askIfSave();
            } catch (IOException ioe) {
                ioe.printStackTrace();
            }
            System.exit(0);
        }
    });

    gridC.gridy = 1;
    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new FlowLayout());
    //buttonPanel.setLayout(new BoxLayout(buttonPanel,BoxLayout.X_AXIS));
    //runButton.setAlignmentX(JButton.LEFT_ALIGNMENT);
    buttonPanel.add(runButton);
    //helpButton.setAlignmentX(JButton.LEFT_ALIGNMENT);
    buttonPanel.add(helpButton);
    //settingsButton.setAlignmentX(JButton.LEFT_ALIGNMENT);
    buttonPanel.add(settingsButton);
    //buttonPanel.add(Box.createHorizontalGlue());
    //quitAndSaveButton.setAlignmentX(JButton.RIGHT_ALIGNMENT);
    buttonPanel.add(quitAndSaveButton);
    gridBagLayout.setConstraints(buttonPanel, gridC);
    getContentPane().add(buttonPanel);

    //getContentPane().setPreferredSize(new Dimension(300, 300));
    // End program when closing window:
    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent evt) {
            try {
                askIfSave();
            } catch (IOException ioe) {
                ioe.printStackTrace();
            }
            System.exit(0);
        }
    });
}

From source file:Citas.FrameCita.java

private void disenoBotones(JButton actual) {
    actual.setBackground(colorBotones);// www  .  j ava  2  s  .c om
    font = font.deriveFont(Font.TYPE1_FONT, 13);
    actual.setFont(font);
    actual.setBorderPainted(false);
    actual.setFocusPainted(false);
    //actual.setContentAreaFilled(false);

    actual.setOpaque(false);
}

From source file:es.emergya.ui.plugins.admin.aux1.SummaryAction.java

private JPanel buildBotones(final Dimension dimension2, final JList left, final JList right) {

    JPanel botones = new JPanel(new GridBagLayout());
    botones.setPreferredSize(dimension2);
    JButton derecha = new JButton(LogicConstants.getIcon("button_right"));
    derecha.setBorderPainted(false);
    derecha.setOpaque(false);//from w  ww.  java2 s  .  c  om
    derecha.setContentAreaFilled(false);
    derecha.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            cambios = true;
            for (Object o : left.getSelectedValues()) {
                ((DefaultListModel) right.getModel()).addElement(o);
                rightItems.add(o);
            }
            for (Object o : left.getSelectedValues()) {
                ((DefaultListModel) left.getModel()).removeElement(o);
                leftItems.remove(o);
            }
        }
    });
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridy = 0;
    botones.add(derecha, gbc);
    izquierda.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            cambios = true;
            for (Object o : right.getSelectedValues()) {
                ((DefaultListModel) left.getModel()).addElement(o);
                leftItems.add(o);
            }
            for (Object o : right.getSelectedValues()) {
                ((DefaultListModel) right.getModel()).removeElement(o);
                rightItems.remove(o);
            }
        }
    });
    gbc.gridy++;
    izquierda.setBorderPainted(false);
    izquierda.setOpaque(false);
    izquierda.setContentAreaFilled(false);
    botones.add(izquierda, gbc);
    botones.setOpaque(false);
    return botones;
}

From source file:es.emergya.ui.plugins.admin.aux1.SummaryAction.java

private JPanel buildPanelFilter(final String topLabel, final int textfieldSize, final Dimension dimension,
        final JList list, final boolean left) {
    JPanel left_filtro = new JPanel(new GridBagLayout());
    left_filtro.setPreferredSize(dimension);
    left_filtro.setOpaque(false);//from   w  ww  .  j  av  a2 s  .co m
    final GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.anchor = GridBagConstraints.BASELINE_LEADING;
    left_filtro.add(new JLabel(topLabel, JLabel.LEFT), gbc);

    final JTextField filtro = new JTextField(textfieldSize);
    gbc.gridy++;
    left_filtro.add(filtro, gbc);

    AbstractAction actionStartFilter = new AbstractAction(null, getIcon("Buttons.noFiltrar")) {

        private static final long serialVersionUID = -4737487889360372801L;

        @Override
        public void actionPerformed(ActionEvent e) {
            ((DefaultListModel) list.getModel()).removeAllElements();
            filtro.setText(null);
            if (left) {
                for (Object obj : leftItems) {
                    ((DefaultListModel) list.getModel()).addElement(obj);
                }
            } else {
                for (Object obj : rightItems) {
                    ((DefaultListModel) list.getModel()).addElement(obj);
                }
            }

        }
    };
    AbstractAction actionStopFilter = new AbstractAction(null, getIcon("Buttons.filtrar")) {

        private static final long serialVersionUID = 6570608476764008290L;

        @Override
        public void actionPerformed(ActionEvent e) {
            ((DefaultListModel) list.getModel()).removeAllElements();
            if (left) {
                for (Object obj : leftItems) {
                    if (compare(filtro, obj)) {
                        ((DefaultListModel) list.getModel()).addElement(obj);
                    }
                }
            } else {
                for (Object obj : rightItems) {
                    if (compare(filtro, obj)) {
                        ((DefaultListModel) list.getModel()).addElement(obj);
                    }
                }
            }
        }

        private boolean compare(final JTextField filtro, Object obj) {
            final String elemento = obj.toString().toUpperCase().trim();
            final String text = filtro.getText().toUpperCase().trim();

            final String pattern = text.replace("*", ".*");
            boolean res = Pattern.matches(pattern, elemento);

            return res;// || elemento.indexOf(text) >= 0;
        }
    };
    JButton jButton = new JButton(actionStartFilter);
    JButton jButton2 = new JButton(actionStopFilter);
    jButton.setBorderPainted(false);
    jButton2.setBorderPainted(false);
    jButton.setContentAreaFilled(false);
    jButton2.setContentAreaFilled(false);
    jButton.setPreferredSize(
            new Dimension(jButton.getIcon().getIconWidth(), jButton.getIcon().getIconHeight()));
    jButton2.setPreferredSize(
            new Dimension(jButton2.getIcon().getIconWidth(), jButton2.getIcon().getIconHeight()));

    gbc.gridx++;
    left_filtro.add(jButton2, gbc);
    gbc.gridx++;
    left_filtro.add(jButton, gbc);
    return left_filtro;
}

From source file:es.emergya.ui.plugins.AdminPanel.java

/**
 * // w w w .j ava 2  s. c o  m
 * @param columnNames
 *            nombres de las columnas de la tabla
 * @param filterOptions
 *            lista de opciones de un combobox. Si esta vacio entonces es un
 *            textfield
 * @param noFiltrarAction
 * @param filtrarAction
 */
public void generateTable(String[] columnNames, Object[][] filterOptions,
        AdminPanel.NoFiltrarAction noFiltrarAction, AdminPanel.FiltrarAction filtrarAction) {

    if (columnNames == null) {
        columnNames = new String[] {};
    }
    if (filterOptions == null) {
        filterOptions = new Object[][] {};
    }

    String filterString = "[";
    for (Object[] o : filterOptions) {
        filterString += Arrays.toString(o) + " ";
    }
    filterString += "]";

    log.debug("generateTable( columnNames = " + Arrays.toString(columnNames) + ", filterOptions = "
            + filterString + ")");

    tablePanel.removeAll();
    int columnNamesLength = columnNames.length;
    if (!getCanDelete())
        columnNamesLength++;
    MyTableModel dataModel = new MyTableModel(1, columnNamesLength + 2) {

        private static final long serialVersionUID = 1348355328684460769L;

        @Override
        public boolean isCellEditable(int row, int column) {
            return column != 0 && !invisibleFilterCols.contains(column);
        }
    };
    filters = new JTable(dataModel) {

        private static final long serialVersionUID = -8266991359840905405L;

        @Override
        public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
            Component c = super.prepareRenderer(renderer, row, column);

            if (isCellEditable(row, column) && column != getColumnCount() - 1) {
                if (c instanceof JTextField) {
                    ((JTextField) c).setBorder(new MatteBorder(1, 1, 1, 1, Color.BLACK));
                } else if (c instanceof JComboBox) {
                    ((JComboBox) c).setBorder(new MatteBorder(1, 1, 1, 1, Color.BLACK));
                } else if (c instanceof JLabel) {
                    ((JLabel) c).setBorder(new MatteBorder(1, 1, 1, 1, Color.BLACK));
                }
            }
            return c;
        }
    };
    filters.setSurrendersFocusOnKeystroke(true);
    filters.setShowGrid(false);
    filters.setRowHeight(22);
    filters.setOpaque(false);

    for (Integer i = 0; i < filterOptions.length; i++) {
        final Object[] items = filterOptions[i];
        if (items != null && items.length > 1) {
            setComboBoxEditor(i, items);
        } else {
            final DefaultCellEditor defaultCellEditor = new DefaultCellEditor(new JTextField());
            defaultCellEditor.setClickCountToStart(1);
            filters.getColumnModel().getColumn(i + 1).setCellEditor(defaultCellEditor);
        }
    }

    filters.setRowSelectionAllowed(false);
    filters.setDragEnabled(false);
    filters.setColumnSelectionAllowed(false);
    filters.setDefaultEditor(JButton.class, new JButtonCellEditor());

    filters.setDefaultRenderer(Object.class, new DefaultTableRenderer() {
        private static final long serialVersionUID = -4811729559786534118L;

        @Override
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                boolean hasFocus, int row, int column) {
            Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
            if (invisibleFilterCols.contains(column))
                c = new JLabel("");
            return c;
        }

    });

    filters.setDefaultRenderer(JButton.class, new TableCellRenderer() {

        @Override
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                boolean hasFocus, int row, int column) {
            JButton b = (JButton) value;
            b.setBorderPainted(false);
            b.setContentAreaFilled(false);
            return b;
        }
    });
    filters.setDefaultRenderer(JLabel.class, new TableCellRenderer() {

        @Override
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                boolean hasFocus, int row, int column) {
            return (JLabel) value;
        }
    });
    filters.setDefaultEditor(JButton.class, new JButtonCellEditor());
    filters.getModel().setValueAt(new JLabel(""), 0, 0);
    JButton jButton2 = new JButton(noFiltrarAction);
    JButton jButton = new JButton(filtrarAction);
    jButton.setBorderPainted(false);
    jButton2.setBorderPainted(false);
    jButton.setContentAreaFilled(false);
    jButton2.setContentAreaFilled(false);
    if (jButton.getIcon() != null)
        jButton.setPreferredSize(
                new Dimension(jButton.getIcon().getIconWidth(), jButton.getIcon().getIconHeight()));
    if (jButton2.getIcon() != null)
        jButton2.setPreferredSize(
                new Dimension(jButton2.getIcon().getIconWidth(), jButton2.getIcon().getIconHeight()));

    filters.getModel().setValueAt(jButton, 0, columnNamesLength - 1);
    filters.getColumnModel().getColumn(columnNamesLength - 1).setMinWidth(jButton.getWidth() + 24);
    filters.getModel().setValueAt(jButton2, 0, columnNamesLength);
    filters.getColumnModel().getColumn(columnNamesLength).setMinWidth(jButton2.getWidth() + 14);
    cuenta.setHorizontalAlignment(JLabel.CENTER);
    cuenta.setText("?/?");
    filters.getModel().setValueAt(cuenta, 0, columnNamesLength + 1);

    tablePanel.add(filters, BorderLayout.NORTH);

    Vector<String> headers = new Vector<String>();
    headers.add("");
    headers.addAll(Arrays.asList(columnNames));
    MyTableModel model = new MyTableModel(headers, 0);
    table = new JTable(model) {

        private static final long serialVersionUID = 949284378605881770L;
        private int highLightedRow = -1;
        private Rectangle dirtyRegion = null;

        public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
            Component c = super.prepareRenderer(renderer, row, column);
            try {
                if (AdminPanel.this.myRendererColoring != null)
                    c.setBackground(AdminPanel.this.myRendererColoring
                            .getColor(AdminPanel.this.table.getValueAt(row, 1)));
            } catch (Throwable t) {
                log.error("Error al colorear la celda: " + t);
            }
            return c;
        }

        @Override
        protected void processMouseMotionEvent(MouseEvent e) {
            try {
                int row = rowAtPoint(e.getPoint());
                Graphics g = getGraphics();
                if (row == -1) {
                    highLightedRow = -1;
                }

                // row changed
                if (highLightedRow != row) {
                    if (null != dirtyRegion) {
                        paintImmediately(dirtyRegion);
                    }
                    for (int j = 0; j < getRowCount(); j++) {
                        if (row == j) {
                            // highlight
                            Rectangle firstRowRect = getCellRect(row, 0, false);
                            Rectangle lastRowRect = getCellRect(row, getColumnCount() - 1, false);
                            dirtyRegion = firstRowRect.union(lastRowRect);
                            g.setColor(new Color(0xff, 0xff, 0, 100));
                            g.fillRect((int) dirtyRegion.getX(), (int) dirtyRegion.getY(),
                                    (int) dirtyRegion.getWidth(), (int) dirtyRegion.getHeight());
                            highLightedRow = row;
                        }

                    }
                }
            } catch (Exception ex) {
            }
            super.processMouseMotionEvent(e);
        }
    };

    table.setRowHeight(22);

    table.setOpaque(false);
    // table.setAutoCreateRowSorter(true);

    table.setDragEnabled(false);
    table.getTableHeader().setReorderingAllowed(false);
    table.getTableHeader().setResizingAllowed(false);

    table.setDefaultEditor(JButton.class, new JButtonCellEditor());
    table.setDefaultRenderer(JButton.class, new TableCellRenderer() {

        @Override
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                boolean hasFocus, int row, int column) {
            JButton b = (JButton) value;
            if (b != null) {
                b.setBorderPainted(false);
                b.setContentAreaFilled(false);
            }
            return b;
        }
    });

    JScrollPane jScrollPane = new JScrollPane(table);
    jScrollPane.setOpaque(false);
    jScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    jScrollPane.getViewport().setOpaque(false);
    tablePanel.add(jScrollPane, BorderLayout.CENTER);
}

From source file:com.isencia.passerelle.hmi.HMIBase.java

/**
 * DBA : add tooltip for each button/*from ww  w.ja  v a  2s . com*/
 * 
 * @return
 */
private JButton createToolbarButton(final Action action, final JToolBar toolbar, final String tooltip) {
    final JButton b = new JButton(action);
    b.setBorderPainted(false);
    b.setToolTipText(tooltip);
    b.setText(null);
    toolbar.add(b);
    return b;
}

From source file:com.rapidminer.gui.viewer.metadata.AttributeStatisticsPanel.java

/**
 * Updates the charts.//from  ww  w  .  j a v a  2 s .  c  om
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
private void updateCharts() {
    for (int i = 0; i < listOfChartPanels.size(); i++) {
        JPanel panel = listOfChartPanels.get(i);
        panel.removeAll();
        final ChartPanel chartPanel = new ChartPanel(getModel().getChartOrNull(i)) {

            private static final long serialVersionUID = -6953213567063104487L;

            @Override
            public Dimension getPreferredSize() {
                return DIMENSION_CHART_PANEL_ENLARGED;
            }
        };
        chartPanel.setPopupMenu(null);
        chartPanel.setBackground(COLOR_TRANSPARENT);
        chartPanel.setOpaque(false);
        chartPanel.addMouseListener(enlargeAndHoverAndPopupMouseAdapter);
        panel.add(chartPanel, BorderLayout.CENTER);

        JPanel openChartPanel = new JPanel(new GridBagLayout());
        openChartPanel.setOpaque(false);

        GridBagConstraints gbc = new GridBagConstraints();
        gbc.anchor = GridBagConstraints.CENTER;
        gbc.fill = GridBagConstraints.NONE;
        gbc.weightx = 1.0;
        gbc.weighty = 1.0;

        JButton openChartButton = new JButton(OPEN_CHART_ACTION);
        openChartButton.setOpaque(false);
        openChartButton.setContentAreaFilled(false);
        openChartButton.setBorderPainted(false);
        openChartButton.addMouseListener(enlargeAndHoverAndPopupMouseAdapter);
        openChartButton.setHorizontalAlignment(SwingConstants.LEFT);
        openChartButton.setHorizontalTextPosition(SwingConstants.LEFT);
        openChartButton.setIcon(null);
        Font font = openChartButton.getFont();
        Map attributes = font.getAttributes();
        attributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
        openChartButton.setFont(font.deriveFont(attributes).deriveFont(10.0f));

        openChartPanel.add(openChartButton, gbc);

        panel.add(openChartPanel, BorderLayout.SOUTH);
        panel.revalidate();
        panel.repaint();
    }
}

From source file:es.emergya.ui.plugins.admin.aux1.SummaryAction.java

private JPanel buildCentralUrl(final String centered_label, final Object[] left_items,
        final Object[] right_items, final String left_label, final String right_label, final int textfieldSize,
        final Dimension dimensionList, final Dimension dimensionPanel, final Dimension dimensionButtonPanel,
        final Dimension dimensionFilterLateral, JPanel cabecera) {

    JPanel central = buildCenter(centered_label);
    GridBagConstraints gbc = new GridBagConstraints();
    buildJList(dimensionList, left_items, left, false);
    JScrollPane scrollleft = addScrollPane(dimensionList, left);
    buildJList(dimensionList, right_items, right, false);
    JScrollPane scrollright = addScrollPane(dimensionList, right);

    gbc.gridx = 0;/*www  .j  a  va 2s  . c  om*/
    gbc.gridy = 1;
    gbc.insets = new Insets(10, 10, 10, 10);

    gbc.gridwidth = 5;
    central.add(cabecera, gbc);
    gbc.gridwidth = 1;
    gbc.gridy++;

    JPanel leftPanel = null;
    if (left_items != null) {
        leftPanel = buildLateral(left_label, dimensionPanel, dimensionFilterLateral, scrollleft, left, true);

        leftItems.clear();
        for (Object o : ((DefaultListModel) left.getModel()).toArray()) {
            leftItems.add(o);
        }
        central.add(leftPanel, gbc);

        gbc.gridx++;
        JPanel botones = buildBotones(dimensionButtonPanel, left, right);
        central.add(botones, gbc);

        gbc.gridx++;
        right.setEnabled(true);
        comboTipoCapa.setEnabled(true);
        habilitado.setEnabled(true);
    } else {
        right.setEnabled(false);
    }
    JPanel rightPanel = buildLateral(right_label, dimensionPanel, dimensionFilterLateral, scrollright, right,
            false);
    rightItems.clear();
    for (Object o : ((DefaultListModel) right.getModel()).toArray()) {
        rightItems.add(o);
    }

    central.add(rightPanel, gbc);

    if (left_items != null) {
        final JButton up = new JButton(LogicConstants.getIcon("button_up"));
        up.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                reorder(0, right.getModel().getSize() - 1);
            }
        });
        up.setBorderPainted(false);
        up.setOpaque(false);
        up.setContentAreaFilled(false);
        final JButton down = new JButton(LogicConstants.getIcon("button_down"));
        down.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                reorder(right.getModel().getSize() - 1, 0);
            }
        });
        down.setBorderPainted(false);
        down.setOpaque(false);
        down.setContentAreaFilled(false);

        JPanel upDown = new JPanel(new FlowLayout());
        upDown.setOpaque(false);
        upDown.add(up);
        upDown.add(down);
        upDown.setPreferredSize(new Dimension(SummaryAction.BUTTON_WIDTH, 100));

        gbc.gridx++;
        central.add(upDown, gbc);
    }
    JPanel resultado = new JPanel(new BorderLayout(10, 5));
    final TitledBorder titledBorder = new TitledBorder(centered_label);
    resultado.setBorder(titledBorder);
    resultado.setOpaque(false);
    resultado.add(central, BorderLayout.CENTER);

    JPanel res = new JPanel(new BorderLayout());
    res.setOpaque(false);
    res.setBorder(new EmptyBorder(0, 15, 0, 15));
    res.add(resultado);
    return res;
}

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

/**
 * Initialize the contents of the frame.
 *///from   ww w  .j a va2s . c om
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:op.care.bhp.PnlBHP.java

private java.util.List<Component> addFilter() {
    java.util.List<Component> list = new ArrayList<Component>();

    jdcDatum = new JDateChooser(new Date());
    jdcDatum.setFont(new Font("Arial", Font.PLAIN, 18));
    jdcDatum.setMinSelectableDate(BHPTools.getMinDatum(resident));

    jdcDatum.setBackground(Color.WHITE);
    jdcDatum.addPropertyChangeListener(new PropertyChangeListener() {
        @Override//from  w ww .j a  v a 2 s  .c  o  m
        public void propertyChange(PropertyChangeEvent evt) {
            if (initPhase) {
                return;
            }
            if (evt.getPropertyName().equals("date")) {
                reloadDisplay();
            }
        }
    });
    list.add(jdcDatum);

    JPanel buttonPanel = new JPanel();
    buttonPanel.setBackground(Color.WHITE);
    buttonPanel.setLayout(new HorizontalLayout(5));
    buttonPanel.setBorder(new EmptyBorder(0, 0, 0, 0));

    JButton homeButton = new JButton(
            new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_start.png")));
    homeButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            jdcDatum.setDate(jdcDatum.getMinSelectableDate());
        }
    });
    homeButton.setPressedIcon(
            new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_start_pressed.png")));
    homeButton.setBorder(null);
    homeButton.setBorderPainted(false);
    homeButton.setOpaque(false);
    homeButton.setContentAreaFilled(false);
    homeButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

    JButton backButton = new JButton(
            new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_back.png")));
    backButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            DateMidnight current = new DateMidnight(jdcDatum.getDate());
            DateMidnight min = new DateMidnight(jdcDatum.getMinSelectableDate());
            if (current.equals(min)) {
                return;
            }
            jdcDatum.setDate(SYSCalendar.addDate(jdcDatum.getDate(), -1));
        }
    });
    backButton
            .setPressedIcon(new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_back_pressed.png")));
    backButton.setBorder(null);
    backButton.setBorderPainted(false);
    backButton.setOpaque(false);
    backButton.setContentAreaFilled(false);
    backButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

    JButton fwdButton = new JButton(new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_play.png")));
    fwdButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            DateMidnight current = new DateMidnight(jdcDatum.getDate());
            if (current.equals(new DateMidnight())) {
                return;
            }
            jdcDatum.setDate(SYSCalendar.addDate(jdcDatum.getDate(), 1));
        }
    });
    fwdButton
            .setPressedIcon(new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_play_pressed.png")));
    fwdButton.setBorder(null);
    fwdButton.setBorderPainted(false);
    fwdButton.setOpaque(false);
    fwdButton.setContentAreaFilled(false);
    fwdButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

    JButton endButton = new JButton(new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_end.png")));
    endButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            jdcDatum.setDate(new Date());
        }
    });
    endButton.setPressedIcon(new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_end_pressed.png")));
    endButton.setBorder(null);
    endButton.setBorderPainted(false);
    endButton.setOpaque(false);
    endButton.setContentAreaFilled(false);
    endButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

    buttonPanel.add(homeButton);
    buttonPanel.add(backButton);
    buttonPanel.add(fwdButton);
    buttonPanel.add(endButton);

    list.add(buttonPanel);

    //        panelFilter.setContentPane(labelPanel);

    return list;
}