Example usage for javax.swing Box setBorder

List of usage examples for javax.swing Box setBorder

Introduction

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

Prototype

@BeanProperty(preferred = true, visualUpdate = true, description = "The component's border.")
public void setBorder(Border border) 

Source Link

Document

Sets the border of this component.

Usage

From source file:org.apache.jmeter.protocol.amf.visualizers.RenderAsXPathAMF.java

/**
 * Create the XPath task pane/*from  w  ww .  ja va2s  .c o m*/
 *
 * @return XPath task pane
 */
private JPanel createXpathExtractorTasksPanel() {
    Box xpathActionPanel = Box.createVerticalBox();

    Box selectorAndButton = Box.createHorizontalBox();

    Border margin = new EmptyBorder(5, 5, 0, 5);
    xpathActionPanel.setBorder(margin);
    xpathExpressionField = new JLabeledTextField(JMeterUtils.getResString("xpath_tester_field")); // $NON-NLS-1$

    JButton xpathTester = new JButton(JMeterUtils.getResString("xpath_tester_button_test")); // $NON-NLS-1$
    xpathTester.setActionCommand(XPATH_TESTER_COMMAND);
    xpathTester.addActionListener(this);

    selectorAndButton.add(xpathExpressionField);
    selectorAndButton.add(xpathTester);

    xpathActionPanel.add(selectorAndButton);
    xpathActionPanel.add(xmlConfPanel);
    xpathActionPanel.add(getFragment);

    xpathResultField = new JTextArea();
    xpathResultField.setEditable(false);
    xpathResultField.setLineWrap(true);
    xpathResultField.setWrapStyleWord(true);

    JPanel xpathTasksPanel = new JPanel(new BorderLayout(0, 5));
    xpathTasksPanel.add(xpathActionPanel, BorderLayout.NORTH);
    xpathTasksPanel.add(GuiUtils.makeScrollPane(xpathResultField), BorderLayout.CENTER);

    return xpathTasksPanel;
}

From source file:org.colombbus.tangara.update.SoftwareUpdateDialog.java

private void addButtonPane() {
    Box box = Box.createHorizontalBox();
    box.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
    box.add(Box.createGlue());/*  w  w w  . j  a v  a 2s .  c om*/
    String closeLabel = bundle.getString("SoftwareUpdateDialog.close"); //$NON-NLS-1$
    closeButton = new JButton(closeLabel);
    closeButton.addActionListener(this);
    box.add(closeButton);
    add(box, BorderLayout.SOUTH);
}

From source file:org.genedb.jogra.plugins.TermRationaliser.java

/**
 * Return a new JFrame which is the main interface to the Rationaliser.
 *///from  ww  w . j  a  va  2s.c o  m
public JFrame getMainPanel() {

    /* JFRAME */
    frame.setTitle(WINDOW_TITLE);
    frame.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
    frame.setLayout(new BorderLayout());

    /* MENU */
    JMenuBar menuBar = new JMenuBar();

    JMenu actions_menu = new JMenu("Actions");
    JMenuItem actions_mitem_1 = new JMenuItem("Refresh lists");
    actions_mitem_1.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            initModels();
        }
    });
    actions_menu.add(actions_mitem_1);

    JMenu about_menu = new JMenu("About");
    JMenuItem about_mitem_1 = new JMenuItem("About");
    about_mitem_1.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            JOptionPane.showMessageDialog(null,
                    "Term Rationaliser \n" + "Wellcome Trust Sanger Institute, UK \n" + "2009",
                    "Term Rationaliser", JOptionPane.PLAIN_MESSAGE);
        }
    });
    about_menu.add(about_mitem_1);

    menuBar.add(about_menu);
    menuBar.add(actions_menu);
    frame.add(menuBar, BorderLayout.NORTH);

    /* MAIN BOX */
    Box center = Box.createHorizontalBox(); //A box that displays contents from left to right
    center.add(Box.createHorizontalStrut(5)); //Invisible fixed-width component

    /* FROM LIST AND PANEL */
    fromList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); //Allow multiple products to be selected 
    fromList.addKeyListener(new KeyListener() {
        @Override
        public void keyPressed(KeyEvent arg0) {
            if (arg0.getKeyCode() == KeyEvent.VK_RIGHT) {
                synchroniseLists(fromList, toList); //synchronise from left to right
            }
        }

        @Override
        public void keyReleased(KeyEvent arg0) {
        }

        @Override
        public void keyTyped(KeyEvent arg0) {
        }
    });

    Box fromPanel = this.createRationaliserPanel(FROM_LIST_NAME, fromList); //Box on left hand side
    fromPanel.add(Box.createVerticalStrut(55)); //Add some space
    center.add(fromPanel); //Add to main box
    center.add(Box.createHorizontalStrut(3)); //Add some space

    /* MIDDLE PANE */
    Box middlePane = Box.createVerticalBox();

    ClassLoader classLoader = this.getClass().getClassLoader(); //Needed to access the images later on
    ImageIcon leftButtonIcon = new ImageIcon(classLoader.getResource("left_arrow.gif"));
    ImageIcon rightButtonIcon = new ImageIcon(classLoader.getResource("right_arrow.gif"));

    leftButtonIcon = new ImageIcon(leftButtonIcon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH)); //TODO: Investigate simpler way to resize an icon!
    rightButtonIcon = new ImageIcon(rightButtonIcon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH)); //TODO: Investigate simpler way to resize an icon!

    JButton rightSynch = new JButton(rightButtonIcon);
    rightSynch.setToolTipText("Synchronise TO list. \n Shortcut: Right-arrow key");

    rightSynch.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            synchroniseLists(fromList, toList);
        }
    });

    JButton leftSynch = new JButton(leftButtonIcon);
    leftSynch.setToolTipText("Synchronise FROM list. \n Shortcut: Left-arrow key");

    leftSynch.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            synchroniseLists(toList, fromList);
        }
    });

    middlePane.add(rightSynch);
    middlePane.add(leftSynch);

    center.add(middlePane); //Add middle pane to main box
    center.add(Box.createHorizontalStrut(3));

    /* TO LIST AND PANEL */
    toList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); //Single product selection in TO list
    toList.addKeyListener(new KeyListener() {
        @Override
        public void keyPressed(KeyEvent arg0) {
            if (arg0.getKeyCode() == KeyEvent.VK_LEFT) {
                synchroniseLists(toList, fromList); //synchronise from right to left
            }
        }

        @Override
        public void keyReleased(KeyEvent arg0) {
        }

        @Override
        public void keyTyped(KeyEvent arg0) {
        }
    });

    Box toPanel = this.createRationaliserPanel(TO_LIST_NAME, toList);

    Box newTerm = Box.createVerticalBox();

    textField = new JTextArea(1, 1); //textfield to let the user edit the name of an existing term
    textField.setMaximumSize(new Dimension(Toolkit.getDefaultToolkit().getScreenSize().height, 10));

    textField.setForeground(Color.BLUE);
    JScrollPane jsp = new JScrollPane(textField); //scroll pane so that there is a horizontal scrollbar
    jsp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);

    newTerm.add(jsp);
    TitledBorder editBorder = BorderFactory.createTitledBorder("Edit term name");
    editBorder.setTitleColor(Color.DARK_GRAY);
    newTerm.setBorder(editBorder);
    toPanel.add(newTerm); //add textfield to panel

    center.add(toPanel); //add panel to main box
    center.add(Box.createHorizontalStrut(5));

    frame.add(center); //add the main panel to the frame

    initModels(); //load the lists with data

    /* BOTTOM HALF OF FRAME */
    Box main = Box.createVerticalBox();
    TitledBorder border = BorderFactory.createTitledBorder("Information");
    border.setTitleColor(Color.DARK_GRAY);

    /* INFORMATION BOX */
    Box info = Box.createVerticalBox();

    Box scope = Box.createHorizontalBox();
    scope.add(Box.createHorizontalStrut(5));
    scope.add(scopeLabel); //label showing the scope of the terms
    scope.add(Box.createHorizontalGlue());

    Box productCount = Box.createHorizontalBox();
    productCount.add(Box.createHorizontalStrut(5));
    productCount.add(productCountLabel); //display the label showing the number of terms
    productCount.add(Box.createHorizontalGlue());

    info.add(scope);
    info.add(productCount);
    info.setBorder(border);

    /* ACTION BUTTONS */
    Box actionButtons = Box.createHorizontalBox();
    actionButtons.add(Box.createHorizontalGlue());
    actionButtons.add(Box.createHorizontalStrut(10));

    JButton findFix = new JButton(new FindClosestMatchAction());
    actionButtons.add(findFix);
    actionButtons.add(Box.createHorizontalStrut(10));

    RationaliserAction ra = new RationaliserAction();
    // RationaliserAction2 ra2 = new RationaliserAction2();
    JButton go = new JButton(ra);
    actionButtons.add(go);
    actionButtons.add(Box.createHorizontalGlue());

    /* MORE INFORMATION TOGGLE */
    Box buttonBox = Box.createHorizontalBox();
    final JButton toggle = new JButton("Hide information <<");

    buttonBox.add(Box.createHorizontalStrut(5));
    buttonBox.add(toggle);
    buttonBox.add(Box.createHorizontalGlue());

    Box textBox = Box.createHorizontalBox();

    final JScrollPane scrollPane = new JScrollPane(information);
    scrollPane.setPreferredSize(new Dimension(frame.getWidth(), 100));
    scrollPane.setVisible(true);
    textBox.add(Box.createHorizontalStrut(5));
    textBox.add(scrollPane);

    ActionListener actionListener = new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            if (toggle.getText().equals("Show information >>")) {
                scrollPane.setVisible(true);
                toggle.setText("Hide information <<");
                frame.setPreferredSize(new Dimension(frame.getWidth(), frame.getHeight() + 100));
                frame.pack();
            } else if (toggle.getText().equals("Hide information <<")) {
                scrollPane.setVisible(false);
                toggle.setText("Show information >>");
                frame.setPreferredSize(new Dimension(frame.getWidth(), frame.getHeight() - 100));
                frame.pack();
            }
        }
    };
    toggle.addActionListener(actionListener);

    main.add(Box.createVerticalStrut(5));
    main.add(info);
    main.add(Box.createVerticalStrut(5));
    main.add(Box.createVerticalStrut(5));
    main.add(actionButtons);
    main.add(Box.createVerticalStrut(10));
    main.add(buttonBox);
    main.add(textBox);

    frame.add(main, BorderLayout.SOUTH);
    frame.pack();
    frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    frame.setVisible(true);
    //initModels();

    return frame;
}

From source file:org.genedb.jogra.plugins.TermRationaliser.java

private Box createRationaliserPanel(final String name, final RationaliserJList rjlist) {

    int preferredHeight = 500; //change accordingly
    int preferredWidth = 500;

    Toolkit tk = Toolkit.getDefaultToolkit();
    Dimension size = tk.getScreenSize();
    int textboxHeight = 10; //change accordingly
    int textboxWidth = size.width;

    Box box = Box.createVerticalBox();
    box.add(new JLabel(name));

    JTextField searchField = new JTextField(20); //Search field on top
    /* We don't want this textfield's height to expand when
     * the Rationaliser is dragged to exapnd. So we set it's
     * height to what we want and the width to the width of
     * the screen  /*from  ww w. j av  a 2s .c  o  m*/
     */
    searchField.setMaximumSize(new Dimension(textboxWidth, textboxHeight));
    rjlist.installJTextField(searchField);
    box.add(searchField);

    JScrollPane scrollPane = new JScrollPane(); //scroll pane
    scrollPane.setViewportView(rjlist);
    scrollPane.setPreferredSize(new Dimension(preferredWidth, preferredHeight));
    box.add(scrollPane);

    TitledBorder sysidBorder = BorderFactory.createTitledBorder("Systematic IDs"); //systematic ID box
    sysidBorder.setTitleColor(Color.DARK_GRAY);

    final JTextArea idField = new JTextArea(1, 1);
    idField.setMaximumSize(new Dimension(textboxWidth, textboxHeight));
    idField.setEditable(false);
    idField.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY));
    idField.setForeground(Color.DARK_GRAY);
    JScrollPane scroll = new JScrollPane(idField);
    scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);

    Box sysidBox = Box.createVerticalBox();
    sysidBox.add(scroll /*idField*/);
    sysidBox.setBorder(sysidBorder);
    box.add(sysidBox);

    rjlist.addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            Term highlightedTerm = (Term) rjlist.getSelectedValue();
            if (highlightedTerm != null) {
                /* For each list, call the relevant methods
                 * to get the systematic IDs. Then for the
                 * right list, add the term name in the
                 * text box below
                 */
                if (name.equals(FROM_LIST_NAME)) {
                    idField.setText(StringUtils.collectionToCommaDelimitedString(
                            termService.getSystematicIDs(highlightedTerm, selectedTaxons)));
                } else if (name.equals(TO_LIST_NAME)) {
                    idField.setText(StringUtils.collectionToCommaDelimitedString(
                            termService.getSystematicIDs(highlightedTerm, null)));
                    /* We allow the user to edit the term name */
                    textField.setText(highlightedTerm.getName());
                }

            }
        }
    });

    return box;

}

From source file:org.kepler.gui.DialogGeneralTab.java

/**
 * getCenterPanel//from   w ww .j av  a 2s  .  com
 * 
 * @return Component
 */
protected Component getCenterPanel() {
    Box centerPanel = Box.createHorizontalBox();

    final Border middlePanelPaddingBorder = BorderFactory.createEmptyBorder( // top, left, bottom, right
            StaticResources.getSize("dialogs.tabPanels.padding.top", 0), 0, 0, 0);

    centerPanel.setBorder(middlePanelPaddingBorder);

    JLabel noteLbl = WidgetFactory.makeJLabel(
            StaticResources.getDisplayString("dialogs." + _targetType + ".general.note", "Note"),
            TabbedDialog.jLabelDims);
    centerPanel.add(noteLbl);

    noteTxtArea = WidgetFactory.makeJTextArea(_target != null ? _target.getName() : "");
    JScrollPane scrollPane = new JScrollPane(noteTxtArea);
    scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setVerticalScrollBarPolicy(scrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    scrollPane.setWheelScrollingEnabled(true);
    centerPanel.add(scrollPane);

    return centerPanel;
}

From source file:org.kepler.gui.DialogGeneralTab.java

/**
 * getBottomPanel/*from   w  ww .j a  v  a  2s. c  o m*/
 * 
 * @return Component
 */
protected Component getBottomPanel() {
    final Box bottomPanel = Box.createVerticalBox();
    final Border bottomPanelTitledBorder = BorderFactory.createTitledBorder(
            StaticResources.getDisplayString("dialogs." + _targetType + ".general.NamesNotesBorderTitle", ""));

    bottomPanel.setBorder(bottomPanelTitledBorder);

    cbName = new JCheckBox(
            StaticResources.getDisplayString("dialogs." + _targetType + ".general.showNameCheckbox", ""));
    cbNotes = new JCheckBox(
            StaticResources.getDisplayString("dialogs." + _targetType + ".general.showNoteCheckbox", ""));
    cbPorts = new JCheckBox(
            StaticResources.getDisplayString("dialogs." + _targetType + ".general.showPortNamesCheckbox", ""));

    bottomPanel.add(cbName);
    bottomPanel.add(cbNotes);
    bottomPanel.add(cbPorts);
    return bottomPanel;
}

From source file:org.neuroph.netbeans.main.easyneurons.NeuralGraphRenderer.java

/**
 * @param jp//from ww w . j  a  v  a 2s  .  c  o  m
 *            panel to which controls will be added
 */
protected void addControls(final JPanel jp) {
    final JPanel control_panel = new JPanel();
    jp.add(control_panel, BorderLayout.EAST);

    control_panel.setLayout(new GridBagLayout());

    java.awt.GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 5);
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;

    // control_panel.setBackground(new Color(00, 255, 00));

    final Box vertex_panel = Box.createVerticalBox();
    vertex_panel.setBorder(BorderFactory.createTitledBorder("Neurons"));
    final Box edge_panel = Box.createVerticalBox();
    edge_panel.setBorder(BorderFactory.createTitledBorder("Connections"));

    final Box edges_and_vertex_panel = Box.createVerticalBox();
    // Box zoom_and_mode_panel = Box.createVerticalBox();
    // zoom_and_mode_panel.setBorder(BorderFactory.createTitledBorder("Other controls"));
    //      final Box layout_panel = Box.createVerticalBox();
    //      layout_panel.setBorder(BorderFactory.createTitledBorder("Layout"));
    // JPanel zoom_and_mode_panel = new JPanel();
    // zoom_and_mode_panel.setLayout(new GridBagLayout() );
    // //GridLayout(3,1)
    // zoom_and_mode_panel.setBackground(new Color(0,255,0));

    edges_and_vertex_panel.add(vertex_panel);
    edges_and_vertex_panel.add(edge_panel);
    // edges_and_vertex_panel.add(layout_panel);

    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    control_panel.add(edges_and_vertex_panel, gridBagConstraints);

    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    //      control_panel.add(layout_panel, gridBagConstraints);

    // originalni layout
    // control_panel.add(vertex_panel, BorderLayout.WEST);
    // control_panel.add(edge_panel, BorderLayout.EAST);
    // control_panel.add(edges_and_vertex_panel, BorderLayout.CENTER);

    // set up vertex controls
    v_color = new JCheckBox("vertex seed coloring");
    v_color.addActionListener(this);
    //      v_stroke = new JCheckBox("<html>stroke highlight selected</html>");
    //      v_stroke.addActionListener(this);

    v_shape = new JCheckBox("vertex degree shapes");
    v_shape.addActionListener(this);
    v_size = new JCheckBox("activation size");
    v_size.addActionListener(this);
    v_size.setSelected(false);
    v_aspect = new JCheckBox("vertex degree ratio stretch");
    v_aspect.addActionListener(this);
    v_small = new JCheckBox("filter vertices of degree < " + VertexDisplayPredicate.MIN_DEGREE);
    v_small.addActionListener(this);

    // vertex_panel.add(v_color);

    vertex_panel.add(v_labels);
    // vertex_panel.add(v_shape);
    vertex_panel.add(v_size);
    // vertex_panel.add(v_aspect);
    // vertex_panel.add(v_small);
    // vertex_panel.add(v_stroke);

    // set up edge controls
    // JPanel gradient_panel = new JPanel(new GridLayout(1, 0));
    // gradient_panel.setBorder(BorderFactory.createTitledBorder("Edge paint"));
    // no_gradient = new JRadioButton("Solid color");
    // no_gradient.addActionListener(this);
    // no_gradient.setSelected(true);
    // // gradient_absolute = new JRadioButton("Absolute gradient");
    // // gradient_absolute.addActionListener(this);
    // gradient_relative = new JRadioButton("Gradient");
    // gradient_relative.addActionListener(this);
    // ButtonGroup bg_grad = new ButtonGroup();
    // bg_grad.add(no_gradient);
    // bg_grad.add(gradient_relative);
    // //bg_grad.add(gradient_absolute);
    // gradient_panel.add(no_gradient);
    // //gradientGrid.add(gradient_absolute);
    // gradient_panel.add(gradient_relative);

    //      JPanel shape_panel = new JPanel(new GridLayout(3, 2));
    //      shape_panel.setBorder(BorderFactory
    //            .createTitledBorder("Connection shape"));
    //      e_line = new JRadioButton("line");
    //      e_line.addActionListener(this);
    //      e_line.setSelected(true);
    //      // e_bent = new JRadioButton("bent line");
    //      // e_bent.addActionListener(this);
    //      e_wedge = new JRadioButton("wedge");
    //      e_wedge.addActionListener(this);
    //      e_quad = new JRadioButton("quad curve");
    //      e_quad.addActionListener(this);
    //      e_cubic = new JRadioButton("cubic curve");
    //      e_cubic.addActionListener(this);
    //      ButtonGroup bg_shape = new ButtonGroup();
    //      bg_shape.add(e_line);
    //      // bg.add(e_bent);
    //      bg_shape.add(e_wedge);
    //      bg_shape.add(e_quad);
    //      bg_shape.add(e_cubic);
    //      shape_panel.add(e_line);
    //      // shape_panel.add(e_bent);
    //      // shape_panel.add(e_wedge);
    //      shape_panel.add(e_quad);
    //      shape_panel.add(e_cubic);
    //      // fill_edges = new JCheckBox("fill edge shapes");
    //      // fill_edges.setSelected(false);
    //      // fill_edges.addActionListener(this);
    //      // shape_panel.add(fill_edges);
    //      shape_panel.setOpaque(true);
    e_color = new JCheckBox("weight highlighting");
    e_color.addActionListener(this);
    e_uarrow_pred = new JCheckBox("undirected");
    e_uarrow_pred.addActionListener(this);
    e_darrow_pred = new JCheckBox("directed");
    e_darrow_pred.addActionListener(this);
    e_darrow_pred.setSelected(true);
    // JPanel arrow_panel = new JPanel(new GridLayout(1,0));
    // arrow_panel.setBorder(BorderFactory.createTitledBorder("Show arrows"));
    // arrow_panel.add(e_uarrow_pred);
    // arrow_panel.add(e_darrow_pred);

    e_show_d = new JCheckBox("directed");
    e_show_d.addActionListener(this);
    e_show_d.setSelected(true);
    e_show_u = new JCheckBox("undirected");
    e_show_u.addActionListener(this);
    e_show_u.setSelected(true);
    JPanel show_edge_panel = new JPanel(new GridLayout(1, 0));
    show_edge_panel.setBorder(BorderFactory.createTitledBorder("Show edges"));
    show_edge_panel.add(e_show_u);
    show_edge_panel.add(e_show_d);

    //      shape_panel.setAlignmentX(Component.LEFT_ALIGNMENT);
    //      edge_panel.add(shape_panel);
    // gradient_panel.setAlignmentX(Component.LEFT_ALIGNMENT);
    // edge_panel.add(gradient_panel);
    // show_edge_panel.setAlignmentX(Component.LEFT_ALIGNMENT);
    // edge_panel.add(show_edge_panel);
    // arrow_panel.setAlignmentX(Component.LEFT_ALIGNMENT);
    // edge_panel.add(arrow_panel);

    e_color.setAlignmentX(Component.LEFT_ALIGNMENT);
    edge_panel.add(e_color);
    e_labels.setAlignmentX(Component.LEFT_ALIGNMENT);
    edge_panel.add(e_labels);

    //      Class<?>[] combos = getLayoutOptions();
    //      final JComboBox layoutCombo = new JComboBox(combos);
    //      // use a renderer to shorten the layout name presentation
    //      layoutCombo.setRenderer(new DefaultListCellRenderer() {
    //         public Component getListCellRendererComponent(JList list,
    //               Object value, int index, boolean isSelected,
    //               boolean cellHasFocus) {
    //            String valueString = value.toString();
    //            valueString = valueString.substring(valueString
    //                  .lastIndexOf('.') + 1);
    //            return super.getListCellRendererComponent(list, valueString,
    //                  index, isSelected, cellHasFocus);
    //         }
    //      });
    //      layoutCombo.addActionListener(new LayoutChooser(layoutCombo, vv));
    //// UNDO:      layoutCombo.setSelectedItem(FRLayout.class);
    //      layout_panel.add(layoutCombo);

    // set up zoom controls
    zoom_at_mouse = new JCheckBox("<html><center>zoom at mouse<p>(wheel only)</center></html>");
    zoom_at_mouse.addActionListener(this);

    final ScalingControl scaler = new CrossoverScalingControl();

    JButton plus = new JButton("+");
    plus.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1.1f, vv.getCenter());
        }
    });
    JButton minus = new JButton("-");
    minus.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1 / 1.1f, vv.getCenter());
        }
    });

    JPanel zoomPanel = new JPanel();
    zoomPanel.setAlignmentX(Component.RIGHT_ALIGNMENT);
    zoomPanel.setBorder(BorderFactory.createTitledBorder("Zoom"));
    zoomPanel.add(plus);
    zoomPanel.add(minus);

    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 5);
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;

    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;

    JComboBox modeBox = graphMouse.getModeComboBox();
    modeBox.setAlignmentX(Component.RIGHT_ALIGNMENT);

    JPanel modePanel = new JPanel(new BorderLayout()) {
        @Override
        public Dimension getMaximumSize() {
            return getPreferredSize();
        }
    };
    modePanel.setBorder(BorderFactory.createTitledBorder("Mouse Mode"));
    modePanel.add(modeBox);

    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    control_panel.add(modePanel, gridBagConstraints);

    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 3;
    control_panel.add(zoomPanel, gridBagConstraints);

    // add font control to center panel
    font = new JCheckBox("bold text");
    font.addActionListener(this);
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 4;
    control_panel.add(font, gridBagConstraints);
}

From source file:org.rdv.ui.channel.LocalChannelDialog.java

private JPanel buildVariablesPanel() {
    JPanel variablesPanel = new JPanel();
    variablesPanel.setLayout(new BorderLayout());

    JScrollPane variablesScrollPane = new JScrollPane(variablesTable.getComponent());
    variablesPanel.add(variablesScrollPane, BorderLayout.CENTER);

    Box variablesButtonsPanel = Box.createVerticalBox();
    variablesButtonsPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));

    JButton addVariableButton = new JButton();
    addVariableButton.setName("addVariableButton");
    addVariableButton.setText(PROPERTY_REPO.getValue(ADD_VARIABLE_BUTTON_KEY));
    addVariableButton.addActionListener(new ActionListener() {
        @Override/*from   w  w  w.  j a  v  a 2  s  .  co m*/
        public void actionPerformed(ActionEvent e) {
            addVariable();
        }
    });
    variablesButtonsPanel.add(addVariableButton);

    variablesButtonsPanel.add(Box.createVerticalStrut(5));

    removeVariableButton.setName("removeVariableButton");
    removeVariableButton.setText(PROPERTY_REPO.getValue(REMOVE_VARIABLE_BUTTON_KEY));
    removeVariableButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            removeVariable();
        }
    });
    variablesButtonsPanel.add(removeVariableButton);

    variablesPanel.add(variablesButtonsPanel, BorderLayout.EAST);
    return variablesPanel;
}

From source file:org.stanwood.swing.AboutDialog.java

private JComponent createAuthorsTab() {
    JScrollPane scroll = new JScrollPane();
    scroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
    Box box = Box.createVerticalBox();
    box.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    for (Author author : authors) {
        box.add(new JLabel(author.getName()));
        JXHyperlink link = new JXHyperlink(
                new LinkAction(this, author.getEmail(), "mailto:" + author.getEmail()));
        box.add(link);/*from  w w  w.  j  a v a2s .c om*/
        link.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
        JLabel lblDescription = new JLabel(author.getDescription());
        lblDescription.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
        box.add(lblDescription);
    }

    scroll.getViewport().add(box);
    return scroll;
}

From source file:org.stanwood.swing.AboutDialog.java

private JComponent createAboutTab() {
    JScrollPane scroll = new JScrollPane();
    scroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
    Box box = Box.createVerticalBox();
    box.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    box.add(Box.createVerticalGlue());
    if (message != null) {
        JXLabel lblMessage = new JXLabel(message);
        lblMessage.setLineWrap(true);//from  ww  w.  j  a  va  2  s . c  o m
        box.add(lblMessage);
    }
    if (appUrl != null) {
        JXHyperlink link = new JXHyperlink(new LinkAction(this, appUrl, appUrl));
        box.add(link);
    }
    box.add(Box.createVerticalGlue());
    scroll.getViewport().add(box);
    return scroll;
}