Example usage for javax.swing.border BevelBorder LOWERED

List of usage examples for javax.swing.border BevelBorder LOWERED

Introduction

In this page you can find the example usage for javax.swing.border BevelBorder LOWERED.

Prototype

int LOWERED

To view the source code for javax.swing.border BevelBorder LOWERED.

Click Source Link

Document

Lowered bevel type.

Usage

From source file:org.esa.beam.timeseries.ui.graph.TimeSeriesGraphForm.java

private void createUI(JFreeChart chart, String helpID) {
    final TableLayout tableLayout = new TableLayout(2);
    tableLayout.setTablePadding(4, 4);// w  w w.j a  v  a 2  s.  c  o  m
    tableLayout.setTableAnchor(TableLayout.Anchor.NORTHWEST);
    tableLayout.setTableFill(TableLayout.Fill.BOTH);
    tableLayout.setTableWeightY(1.0);
    tableLayout.setColumnWeightX(0, 1.0);
    tableLayout.setColumnWeightX(1, 0.0);
    tableLayout.setRowWeightY(0, 1.0);
    tableLayout.setRowWeightY(1, 0.0);
    tableLayout.setCellRowspan(0, 1, 2);
    tableLayout.setCellFill(1, 0, TableLayout.Fill.HORIZONTAL);
    tableLayout.setCellPadding(1, 0, new Insets(5, 5, 5, 5));

    mainPanel = new JPanel(tableLayout);
    mainPanel.setPreferredSize(new Dimension(320, 200));

    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setBorder(BorderFactory.createCompoundBorder(
            BorderFactory.createBevelBorder(BevelBorder.LOWERED), BorderFactory.createEmptyBorder(2, 2, 2, 2)));
    mainPanel.add(chartPanel);
    mainPanel.add(createButtonPanel(helpID));
    mainPanel.add(validatorUI.createUI());
}

From source file:DesktopManagerDemo.java

public DesktopManagerDemo() {
    setTitle("Animated DesktopManager");
    m_count = m_tencount = 0;/*  ww w . j  a  v  a 2  s  .co  m*/

    JPanel innerListenerPanel = new JPanel(new GridLayout(15, 1));
    JPanel listenerPanel = new JPanel(new BorderLayout());
    m_dmEventCanvas = new DMEventCanvas();

    m_lActivates = new JLabel("activateFrame");
    m_lBegindrags = new JLabel("beginDraggingFrame");
    m_lBeginresizes = new JLabel("beginResizingFrame");
    m_lCloses = new JLabel("closeFrame");
    m_lDeactivates = new JLabel("deactivateFrame");
    m_lDeiconifies = new JLabel("deiconifyFrame");
    m_lDrags = new JLabel("dragFrame");
    m_lEnddrags = new JLabel("endDraggingFrame");
    m_lEndresizes = new JLabel("endResizingFrame");
    m_lIconifies = new JLabel("iconifyFrame");
    m_lMaximizes = new JLabel("maximizeFrame");
    m_lMinimizes = new JLabel("minimizeFrame");
    m_lOpens = new JLabel("openFrame");
    m_lResizes = new JLabel("resizeFrame");
    m_lSetbounds = new JLabel("setBoundsForFrame");

    innerListenerPanel.add(m_lActivates);
    innerListenerPanel.add(m_lBegindrags);
    innerListenerPanel.add(m_lBeginresizes);
    innerListenerPanel.add(m_lCloses);
    innerListenerPanel.add(m_lDeactivates);
    innerListenerPanel.add(m_lDeiconifies);
    innerListenerPanel.add(m_lDrags);
    innerListenerPanel.add(m_lEnddrags);
    innerListenerPanel.add(m_lEndresizes);
    innerListenerPanel.add(m_lIconifies);
    innerListenerPanel.add(m_lMaximizes);
    innerListenerPanel.add(m_lMinimizes);
    innerListenerPanel.add(m_lOpens);
    innerListenerPanel.add(m_lResizes);
    innerListenerPanel.add(m_lSetbounds);

    listenerPanel.add("Center", m_dmEventCanvas);
    listenerPanel.add("West", innerListenerPanel);
    listenerPanel.setOpaque(true);
    listenerPanel.setBackground(Color.white);

    m_myDesktopManager = new MyDesktopManager();
    m_desktop = new JDesktopPane();
    m_desktop.setDesktopManager(m_myDesktopManager);
    m_desktop.setBorder(new SoftBevelBorder(BevelBorder.LOWERED));
    m_newFrame = new JButton("New Frame");
    m_newFrame.addActionListener(this);
    m_infos = UIManager.getInstalledLookAndFeels();
    String[] LAFNames = new String[m_infos.length];
    for (int i = 0; i < m_infos.length; i++) {
        LAFNames[i] = m_infos[i].getName();
    }
    m_UIBox = new JComboBox(LAFNames);
    m_UIBox.addActionListener(this);
    JPanel topPanel = new JPanel(true);
    topPanel.setLayout(new FlowLayout());
    topPanel.setBorder(new CompoundBorder(new SoftBevelBorder(BevelBorder.LOWERED),
            new CompoundBorder(new EmptyBorder(2, 2, 2, 2), new SoftBevelBorder(BevelBorder.RAISED))));
    getContentPane().setLayout(new BorderLayout());
    getContentPane().add("North", topPanel);
    getContentPane().add("Center", m_desktop);
    getContentPane().add("South", listenerPanel);
    ((JPanel) getContentPane()).setBorder(new CompoundBorder(new SoftBevelBorder(BevelBorder.LOWERED),
            new CompoundBorder(new EmptyBorder(1, 1, 1, 1), new SoftBevelBorder(BevelBorder.RAISED))));
    topPanel.add(m_newFrame);
    topPanel.add(new JLabel("Look & Feel:", SwingConstants.RIGHT));
    topPanel.add(m_UIBox);
    setSize(645, 600);
    Dimension dim = getToolkit().getScreenSize();
    setLocation(dim.width / 2 - getWidth() / 2, dim.height / 2 - getHeight() / 2);
    setVisible(true);
    WindowListener l = new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    };
    addWindowListener(l);
    m_eventTimer = new Timer(1000, this);
    m_eventTimer.setRepeats(true);
    m_eventTimer.start();
}

From source file:com.diversityarrays.kdxplore.curate.fieldview.OverviewDialog.java

@SuppressWarnings("unchecked")
public OverviewDialog(Window window, String title,

        @SuppressWarnings("rawtypes") ComboBoxModel comboBoxModel, CurationData curationData,
        Transformer<TraitInstance, String> tiNameProvider, OverviewInfoProvider overviewInfoProvider,
        FieldViewSelectionModel fvsm, FieldLayoutTableModel fltm, CurationTableModel ctm) {
    super(window, title, ModalityType.MODELESS);

    setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    setAlwaysOnTop(true);/*w  w  w .  j  av  a2s. co m*/

    this.fieldViewSelectionModel = fvsm;

    @SuppressWarnings({ "rawtypes" })
    JComboBox activeTiCombo = new JComboBox(comboBoxModel);
    TraitInstanceCellRenderer tiCellRenderer = new TraitInstanceCellRenderer(
            curationData.getTraitColorProvider(), tiNameProvider);
    activeTiCombo.setRenderer(tiCellRenderer);

    JLabel infoLabel = new JLabel(" ");
    infoLabel.setBorder(new BevelBorder(BevelBorder.LOWERED));

    final JFrame[] helpDialog = new JFrame[1];
    Action helpAction = new AbstractAction("?") {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (helpDialog[0] != null) {
                GuiUtil.restoreFrame(helpDialog[0]);
            } else {
                JFrame f = new JFrame("Overview Help");
                helpDialog[0] = f;
                f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
                f.setAlwaysOnTop(true);
                f.setLocationRelativeTo(overview);
                String html = Overview.getOverviewHelpHtml();
                JLabel label = new JLabel(html);
                label.setBorder(new EmptyBorder(0, 10, 0, 10));
                f.setContentPane(label);
                f.pack();
                f.setVisible(true);
            }
        }
    };

    //        Window window = GuiUtil.getOwnerWindow(FieldLayoutViewPanel.this);
    if (window != null) {
        if (window instanceof JFrame) {
            System.out.println("Found window: " + ((JFrame) window).getTitle());
        }
        window.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosed(WindowEvent e) {
                window.removeWindowListener(this);
                if (helpDialog[0] != null) {
                    helpDialog[0].dispose();
                }
            }
        });
    }

    KDClientUtils.initAction(ImageId.HELP_24, helpAction, "Help for Overview");
    Box top = Box.createHorizontalBox();
    top.add(activeTiCombo);
    top.add(new JButton(helpAction));

    overview = new Overview(overviewInfoProvider, fltm, curationData, ctm, infoLabel);
    overview.setActiveTraitInstance(fvsm.getActiveTraitInstance(true));
    Container cp = getContentPane();

    cp.add(top, BorderLayout.NORTH);
    //      cp.add(traitLabel, BorderLayout.NORTH);
    cp.add(infoLabel, BorderLayout.SOUTH);
    cp.add(overview, BorderLayout.CENTER);

    pack();
    //      setResizable(false);

    //      setLocationRelativeTo(showOverviewButton);
    // DEFAULT POSITION is "out of the way"
    setVisible(true);

    this.fieldViewSelectionModel.addListSelectionListener(listSelectionListener);

    addWindowListener(new WindowAdapter() {
        @Override
        public void windowOpened(WindowEvent e) {
            toFront();
        }

        @Override
        public void windowClosed(WindowEvent e) {
            fieldViewSelectionModel.removeListSelectionListener(listSelectionListener);
            removeWindowListener(this);
        }
    });
}

From source file:be.ac.ua.comp.scarletnebula.gui.SSHPanel.java

public SSHPanel(final Server server) {
    super();//from   ww  w.  ja v  a  2  s. com

    final JCTermSwing term = new JCTermSwing();
    term.setCompression(7);
    term.setAntiAliasing(true);

    setLayout(new BorderLayout());

    addComponentListener(new ComponentListener() {

        @Override
        public void componentShown(final ComponentEvent e) {
        }

        @Override
        public void componentResized(final ComponentEvent e) {
            final Component c = e.getComponent();
            int cw = c.getWidth();
            int ch = c.getHeight();

            final JPanel source = ((JPanel) c);

            final int cwm = source.getBorder() != null
                    ? source.getBorder().getBorderInsets(c).left + source.getBorder().getBorderInsets(c).right
                    : 0;
            final int chm = source.getBorder() != null
                    ? source.getBorder().getBorderInsets(c).bottom + source.getBorder().getBorderInsets(c).top
                    : 0;
            cw -= cwm;
            ch -= chm;

            term.setBorder(BorderFactory.createMatteBorder(0, 0, term.getTermHeight() - c.getHeight(),
                    term.getTermWidth() - c.getWidth(), Color.BLACK));
            term.setSize(cw, ch);
            term.setPreferredSize(new Dimension(cw, ch));
            // term.setMinimumSize(new Dimension(cw, ch));
            term.setMaximumSize(new Dimension(cw, ch));
            term.redraw(0, 0, term.getTermWidth(), term.getTermHeight());
        }

        @Override
        public void componentMoved(final ComponentEvent e) { // TODO
            // Auto-generated
            // method
            // stub

        }

        @Override
        public void componentHidden(final ComponentEvent e) { // TODO
            // Auto-generated
            // method
            // stub

        }
    });

    add(term, BorderLayout.CENTER);

    setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20),
            BorderFactory.createBevelBorder(BevelBorder.LOWERED)));

    final Thread connectionThread = new Thread() {
        @Override
        public void run() {

            Connection connection = null;
            try {
                final SSHCommandConnection commandConnection = (SSHCommandConnection) server
                        .newCommandConnection(new NotPromptingJschUserInfo());

                connection = commandConnection.getJSchTerminalConnection();

                term.requestFocusInWindow();
                term.start(connection);
            } catch (final Exception e) {
                for (final ExceptionListener listener : exceptionListeners) {
                    listener.exceptionThrown(e);
                }

                log.warn("Exception thrown by SSHPanel", e);
            } finally {
            }

        }
    };

    connectionThread.start();
}

From source file:MessageMonitor.java

/** Constructor for MessageMonitor window. */
public MessageMonitor() {
    loadProperties();//from   w  ww.j a  v  a 2  s .  co m

    setTitle(title);

    // Connect to Message Broker
    try {
        javax.jms.ConnectionFactory factory;
        factory = new ActiveMQConnectionFactory(user, password, url);

        connection = factory.createConnection(userID, password);
        session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
    } catch (javax.jms.JMSException jmse) {
        System.err.println("Cannot connect to Broker");
        jmse.printStackTrace();
        System.exit(1);
    }

    // Subscribe to Topics
    StringTokenizer topics = new StringTokenizer(subscriptionTopics, ",");
    while (topics.hasMoreTokens()) {
        try {
            String topicName = topics.nextToken();
            System.out.println("Subscribing to: " + topicName);
            new Subscription(session.createTopic(topicName));
        } catch (javax.jms.JMSException jmse) {
            jmse.printStackTrace();
        }
    }

    // Set up the viewing area.
    textArea.setEditable(false);
    scrollPane.setBorder(
            new CompoundBorder(new EmptyBorder(6, 6, 6, 6), new SoftBevelBorder(BevelBorder.LOWERED)));
    getContentPane().add(scrollPane, BorderLayout.CENTER);
    getContentPane().add(clearButton, BorderLayout.SOUTH);
    clearButton.addActionListener(new OnClear());
    // Start the connection so that we can now receive messages.
    try {
        connection.start();
    } catch (javax.jms.JMSException jmse) {
        System.err.println("Cannot start connection");
        jmse.printStackTrace();
        System.exit(1);
    }

}

From source file:QueueMonitor.java

/** Constructor for MessageMonitor window. */
public QueueMonitor() {
    loadProperties();//from  ww w  .  j  a  va 2 s .  com

    setTitle(title);

    // Connect to Message Broker
    try {
        javax.jms.ConnectionFactory factory;
        factory = new ActiveMQConnectionFactory(username, password, broker);

        connect = factory.createConnection(username, password);
        session = connect.createSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE);
    } catch (javax.jms.JMSException jmse) {
        System.err.println("Cannot connect to Broker");
        jmse.printStackTrace();
        System.exit(1);
    }

    // Set up Queues:
    StringTokenizer queues = new StringTokenizer(browseQueues, ",");
    while (queues.hasMoreTokens()) {
        try {
            String queueName = queues.nextToken();
            System.out.println("Monitoring  " + queueName);
            theQueues.addElement(session.createQueue(queueName));
        } catch (javax.jms.JMSException jmse) {
            jmse.printStackTrace();
        }
    }

    // After init it is time to start the connection
    try {
        connect.start();
    } catch (javax.jms.JMSException jmse) {
        System.err.println("Cannot start connection");
        jmse.printStackTrace();
        System.exit(1);
    }

    //Elements visible on the screen
    textArea.setEditable(false);
    scrollPane.setBorder(
            new CompoundBorder(new EmptyBorder(6, 6, 6, 6), new SoftBevelBorder(BevelBorder.LOWERED)));
    getContentPane().add(scrollPane, BorderLayout.CENTER);
    getContentPane().add(browseButton, BorderLayout.SOUTH);

    browseButton.addActionListener(new OnBrowse());

}

From source file:be.ac.ua.comp.scarletnebula.gui.addserverwizard.ChooseImagePage.java

private final JPanel getAllImagesPanel(final CloudProvider provider) {
    final JPanel panel = new JPanel(new BorderLayout());
    final TableRowSorter<MachineImageTableModel> sorter = new TableRowSorter<MachineImageTableModel>(
            allImagesModel);//  ww w .j a v a 2 s  . co  m
    allImagesTable.setRowSorter(sorter);
    allImagesTable.setFillsViewportHeight(true);
    allImagesTable.addMouseListener(new SmartImageModelContextMenuMouseListener(provider, allImagesModel,
            allImagesTable, favoriteImagesPanel.getModel()));

    final JPanel aboveTable = new JPanel(new BorderLayout());
    final JPanel searchPanel = getSearchPanel(sorter);

    aboveTable.add(searchPanel, BorderLayout.NORTH);
    aboveTable.add(throbberPanel, BorderLayout.SOUTH);

    panel.add(aboveTable, BorderLayout.NORTH);

    final JScrollPane tableScrollPane = new JScrollPane(allImagesTable);
    tableScrollPane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5, 20, 10, 20),
            BorderFactory.createBevelBorder(BevelBorder.LOWERED)));

    panel.add(tableScrollPane, BorderLayout.CENTER);

    return panel;
}

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

private void initGUI() {
    try {/* w w w. ja  v  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:be.ac.ua.comp.scarletnebula.gui.windows.LinkUnlinkWindow.java

private final JPanel getMainPanel() {
    final JPanel mainPanel = new JPanel(new GridBagLayout());
    mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
    final ServerList linkedServerList = new ServerList(linkedServerListModel);
    linkedServerList.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
    final JScrollPane linkedServerScrollPane = new JScrollPane(linkedServerList);
    linkedServerScrollPane/*  w ww. j  ava 2 s  . c o m*/
            .setBorder(BorderFactory.createTitledBorder(new EmptyBorder(5, 20, 20, 20), "Linked Servers"));
    // Doesn't matter what this is set to, as long as it's the same as the
    // one for unlinkedServerScrollPane
    linkedServerScrollPane.setPreferredSize(new Dimension(10, 10));

    final GridBagConstraints c = new GridBagConstraints();

    c.fill = GridBagConstraints.BOTH;
    c.gridx = 0;
    c.gridy = 0;
    c.weightx = 0.5;
    c.weighty = 1.0;

    mainPanel.add(linkedServerScrollPane, c);

    final ServerList unlinkedServerList = new ServerList(unlinkedServerListModel);
    unlinkedServerList.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
    final JScrollPane unlinkedServerScrollPane = new JScrollPane(unlinkedServerList);
    unlinkedServerScrollPane
            .setBorder(BorderFactory.createTitledBorder(new EmptyBorder(5, 20, 20, 20), "Unlinked Servers"));

    // Doesn't matter what this is set to, as long as it's the same as the
    // one for unlinkedServerScrollPane
    unlinkedServerScrollPane.setPreferredSize(new Dimension(10, 10));

    final JPanel middlePanel = new JPanel();
    middlePanel.setLayout(new BoxLayout(middlePanel, BoxLayout.Y_AXIS));
    middlePanel.add(Box.createVerticalGlue());

    final JButton linkSelectionButton = new JButton("<");
    final JButton unlinkSelectionButton = new JButton(">");

    linkSelectionButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            // Move selection from unlinked to linked list
            final int selection = unlinkedServerList.getSelectedIndex();

            if (selection < 0) {
                return;
            }

            final Server server = unlinkedServerListModel.getVisibleServerAtIndex(selection);

            unlinkedServerListModel.removeServer(server);

            linkedServerListModel.addServer(server);
        }
    });

    unlinkSelectionButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            // Move selection from linked to unlinked list
            final int selection = linkedServerList.getSelectedIndex();

            if (selection < 0) {
                return;
            }

            final int answer = JOptionPane.showOptionDialog(LinkUnlinkWindow.this,
                    "You are about to unlink a server. "
                            + "Unlinking a server will permanently remove \nall data associated with "
                            + "this server, but the server will keep running. "
                            + "\n\nAre you sure you wish to continue?",
                    "Unlink Server", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, null, null);

            if (answer != JOptionPane.YES_OPTION) {
                return;
            }

            final Server server = linkedServerListModel.getVisibleServerAtIndex(selection);

            linkedServerListModel.removeServer(server);

            unlinkedServerListModel.addServer(server);
        }
    });

    middlePanel.add(unlinkSelectionButton);
    middlePanel.add(Box.createVerticalStrut(10));
    middlePanel.add(linkSelectionButton);
    middlePanel.add(Box.createVerticalGlue());

    c.gridx = 1;
    c.gridy = 0;
    c.weightx = 0.0;
    c.weighty = 0.0;

    mainPanel.add(middlePanel, c);

    c.gridx = 2;
    c.gridy = 0;
    c.weightx = 0.5;
    c.weighty = 1.0;

    mainPanel.add(unlinkedServerScrollPane, c);
    return mainPanel;
}

From source file:be.ac.ua.comp.scarletnebula.gui.addserverwizard.ChooseImagePage.java

private JPanel getSearchPanel(final TableRowSorter<MachineImageTableModel> sorter) {
    final JPanel searchPanel = new JPanel(new GridBagLayout());
    searchPanel.setBorder(BorderFactory.createEmptyBorder(10, 20, 5, 20));

    add(searchPanel, BorderLayout.NORTH);
    final PlatformComboBox platformComboBox = new PlatformComboBox();

    final GridBagConstraints c = new GridBagConstraints();
    c.weightx = 0.0;/*w  w w .  j a v a 2s.c  o m*/
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridx = 0;
    c.gridy = 0;
    c.insets = new Insets(0, 0, 0, 5);

    searchPanel.add(platformComboBox, c);
    final ArchitectureComboBox architectureComboBox = new ArchitectureComboBox();

    c.gridx = 1;
    searchPanel.add(architectureComboBox, c);

    final BetterTextField searchField = new BetterTextField();
    searchField.setPlaceHolder("Search terms");

    searchField.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));

    c.gridx = 2;
    c.weightx = 1.0;
    c.insets = new Insets(0, 0, 0, 0);
    searchPanel.add(searchField, c);

    searchField.addActionListener(
            new SearchFieldListener(architectureComboBox, sorter, platformComboBox, searchField));

    return searchPanel;
}