Example usage for javax.swing BorderFactory createTitledBorder

List of usage examples for javax.swing BorderFactory createTitledBorder

Introduction

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

Prototype

public static TitledBorder createTitledBorder(Border border) 

Source Link

Document

Creates a new titled border with an empty title, the specified border object, the default text position (determined by the current look and feel), the default justification (leading), and the default font and text color (determined by the current look and feel).

Usage

From source file:com.google.code.facebook.graph.sna.applet.VertexCollapseDemoWithLayouts.java

public VertexCollapseDemoWithLayouts() {

    // create a simple graph for the demo
    graph = TestGraphs.getOneComponentGraph();
    collapsedGraph = graph;//from   ww  w  .jav a  2  s  . c  o m
    collapser = new GraphCollapser(graph);

    layout = new FRLayout(graph);

    Dimension preferredSize = new Dimension(400, 400);
    final VisualizationModel visualizationModel = new DefaultVisualizationModel(layout, preferredSize);
    vv = new VisualizationViewer(visualizationModel, preferredSize);

    vv.getRenderContext().setVertexShapeTransformer(new ClusterVertexShapeFunction());

    final PredicatedParallelEdgeIndexFunction eif = PredicatedParallelEdgeIndexFunction.getInstance();
    final Set exclusions = new HashSet();
    eif.setPredicate(new Predicate() {

        public boolean evaluate(Object e) {

            return exclusions.contains(e);
        }
    });

    vv.getRenderContext().setParallelEdgeIndexFunction(eif);

    vv.setBackground(Color.white);

    // add a listener for ToolTips
    vv.setVertexToolTipTransformer(new ToStringLabeller() {

        /* (non-Javadoc)
         * @see edu.uci.ics.jung.visualization.decorators.DefaultToolTipFunction#getToolTipText(java.lang.Object)
         */
        @Override
        public String transform(Object v) {
            if (v instanceof Graph) {
                return ((Graph) v).getVertices().toString();
            }
            return super.transform(v);
        }
    });

    /**
     * the regular graph mouse for the normal view
     */
    final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse();

    vv.setGraphMouse(graphMouse);

    Container content = getContentPane();
    GraphZoomScrollPane gzsp = new GraphZoomScrollPane(vv);
    content.add(gzsp);

    JComboBox modeBox = graphMouse.getModeComboBox();
    modeBox.addItemListener(graphMouse.getModeListener());
    graphMouse.setMode(ModalGraphMouse.Mode.PICKING);

    final ScalingControl scaler = new CrossoverScalingControl();

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

    JButton collapse = new JButton("Collapse");
    collapse.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            Collection picked = new HashSet(vv.getPickedVertexState().getPicked());
            if (picked.size() > 1) {
                Graph inGraph = layout.getGraph();
                Graph clusterGraph = collapser.getClusterGraph(inGraph, picked);

                Graph g = collapser.collapse(layout.getGraph(), clusterGraph);
                collapsedGraph = g;
                double sumx = 0;
                double sumy = 0;
                for (Object v : picked) {
                    Point2D p = (Point2D) layout.transform(v);
                    sumx += p.getX();
                    sumy += p.getY();
                }
                Point2D cp = new Point2D.Double(sumx / picked.size(), sumy / picked.size());
                vv.getRenderContext().getParallelEdgeIndexFunction().reset();
                layout.setGraph(g);
                layout.setLocation(clusterGraph, cp);
                vv.getPickedVertexState().clear();
                vv.repaint();
            }
        }
    });

    JButton compressEdges = new JButton("Compress Edges");
    compressEdges.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            Collection picked = vv.getPickedVertexState().getPicked();
            if (picked.size() == 2) {
                Pair pair = new Pair(picked);
                Graph graph = layout.getGraph();
                Collection edges = new HashSet(graph.getIncidentEdges(pair.getFirst()));
                edges.retainAll(graph.getIncidentEdges(pair.getSecond()));
                exclusions.addAll(edges);
                vv.repaint();
            }

        }
    });

    JButton expandEdges = new JButton("Expand Edges");
    expandEdges.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            Collection picked = vv.getPickedVertexState().getPicked();
            if (picked.size() == 2) {
                Pair pair = new Pair(picked);
                Graph graph = layout.getGraph();
                Collection edges = new HashSet(graph.getIncidentEdges(pair.getFirst()));
                edges.retainAll(graph.getIncidentEdges(pair.getSecond()));
                exclusions.removeAll(edges);
                vv.repaint();
            }

        }
    });

    JButton expand = new JButton("Expand");
    expand.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            Collection picked = new HashSet(vv.getPickedVertexState().getPicked());
            for (Object v : picked) {
                if (v instanceof Graph) {

                    Graph g = collapser.expand(layout.getGraph(), (Graph) v);
                    vv.getRenderContext().getParallelEdgeIndexFunction().reset();
                    layout.setGraph(g);
                }
                vv.getPickedVertexState().clear();
                vv.repaint();
            }
        }
    });

    JButton reset = new JButton("Reset");
    reset.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            layout.setGraph(graph);
            exclusions.clear();
            vv.repaint();
        }
    });

    JButton help = new JButton("Help");
    help.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JOptionPane.showMessageDialog((JComponent) e.getSource(), instructions, "Help",
                    JOptionPane.PLAIN_MESSAGE);
        }
    });
    Class[] combos = getCombos();
    final JComboBox jcb = new JComboBox(combos);
    // use a renderer to shorten the layout name presentation
    jcb.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);
        }
    });
    jcb.addActionListener(new LayoutChooser(jcb, vv));
    jcb.setSelectedItem(FRLayout.class);

    JPanel controls = new JPanel();
    JPanel zoomControls = new JPanel(new GridLayout(2, 1));
    zoomControls.setBorder(BorderFactory.createTitledBorder("Zoom"));
    zoomControls.add(plus);
    zoomControls.add(minus);
    controls.add(zoomControls);
    JPanel collapseControls = new JPanel(new GridLayout(3, 1));
    collapseControls.setBorder(BorderFactory.createTitledBorder("Picked"));
    collapseControls.add(collapse);
    collapseControls.add(expand);
    collapseControls.add(compressEdges);
    collapseControls.add(expandEdges);
    collapseControls.add(reset);
    controls.add(collapseControls);
    controls.add(modeBox);
    controls.add(help);
    controls.add(jcb);
    content.add(controls, BorderLayout.SOUTH);
}

From source file:FileChooserDemo.java

public FileChooserDemo() {
    UIManager.LookAndFeelInfo[] installedLafs = UIManager.getInstalledLookAndFeels();
    for (UIManager.LookAndFeelInfo lafInfo : installedLafs) {
        try {//w ww  .j a  v a2s .  c  o  m
            Class lnfClass = Class.forName(lafInfo.getClassName());
            LookAndFeel laf = (LookAndFeel) (lnfClass.newInstance());
            if (laf.isSupportedLookAndFeel()) {
                String name = lafInfo.getName();
                supportedLaFs.add(new SupportedLaF(name, laf));
            }
        } catch (Exception e) { // If ANYTHING weird happens, don't add it
            continue;
        }
    }

    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

    chooser = new JFileChooser();
    previewer = new FilePreviewer(chooser);

    // Create Custom FileView
    fileView = new ExampleFileView();
    //    fileView.putIcon("jpg", new ImageIcon(getClass().getResource("/resources/images/jpgIcon.jpg")));
    //  fileView.putIcon("gif", new ImageIcon(getClass().getResource("/resources/images/gifIcon.gif")));

    // create a radio listener to listen to option changes
    OptionListener optionListener = new OptionListener();

    // Create options
    openRadioButton = new JRadioButton("Open");
    openRadioButton.setSelected(true);
    openRadioButton.addActionListener(optionListener);

    saveRadioButton = new JRadioButton("Save");
    saveRadioButton.addActionListener(optionListener);

    customButton = new JRadioButton("Custom");
    customButton.addActionListener(optionListener);

    customField = new JTextField(8) {
        public Dimension getMaximumSize() {
            return new Dimension(getPreferredSize().width, getPreferredSize().height);
        }
    };
    customField.setText("Doit");
    customField.setAlignmentY(JComponent.TOP_ALIGNMENT);
    customField.setEnabled(false);
    customField.addActionListener(optionListener);

    ButtonGroup group1 = new ButtonGroup();
    group1.add(openRadioButton);
    group1.add(saveRadioButton);
    group1.add(customButton);

    // filter buttons
    showAllFilesFilterCheckBox = new JCheckBox("Show \"All Files\" Filter");
    showAllFilesFilterCheckBox.addActionListener(optionListener);
    showAllFilesFilterCheckBox.setSelected(true);

    showImageFilesFilterCheckBox = new JCheckBox("Show JPG and GIF Filters");
    showImageFilesFilterCheckBox.addActionListener(optionListener);
    showImageFilesFilterCheckBox.setSelected(false);

    accessoryCheckBox = new JCheckBox("Show Preview");
    accessoryCheckBox.addActionListener(optionListener);
    accessoryCheckBox.setSelected(false);

    // more options
    setHiddenCheckBox = new JCheckBox("Show Hidden Files");
    setHiddenCheckBox.addActionListener(optionListener);

    showFullDescriptionCheckBox = new JCheckBox("With File Extensions");
    showFullDescriptionCheckBox.addActionListener(optionListener);
    showFullDescriptionCheckBox.setSelected(true);
    showFullDescriptionCheckBox.setEnabled(false);

    useFileViewCheckBox = new JCheckBox("Use FileView");
    useFileViewCheckBox.addActionListener(optionListener);
    useFileViewCheckBox.setSelected(false);

    useEmbedInWizardCheckBox = new JCheckBox("Embed in Wizard");
    useEmbedInWizardCheckBox.addActionListener(optionListener);
    useEmbedInWizardCheckBox.setSelected(false);

    useControlsCheckBox = new JCheckBox("Show Control Buttons");
    useControlsCheckBox.addActionListener(optionListener);
    useControlsCheckBox.setSelected(true);

    enableDragCheckBox = new JCheckBox("Enable Dragging");
    enableDragCheckBox.addActionListener(optionListener);

    // File or Directory chooser options
    ButtonGroup group3 = new ButtonGroup();
    justFilesRadioButton = new JRadioButton("Just Select Files");
    justFilesRadioButton.setSelected(true);
    group3.add(justFilesRadioButton);
    justFilesRadioButton.addActionListener(optionListener);

    justDirectoriesRadioButton = new JRadioButton("Just Select Directories");
    group3.add(justDirectoriesRadioButton);
    justDirectoriesRadioButton.addActionListener(optionListener);

    bothFilesAndDirectoriesRadioButton = new JRadioButton("Select Files or Directories");
    group3.add(bothFilesAndDirectoriesRadioButton);
    bothFilesAndDirectoriesRadioButton.addActionListener(optionListener);

    singleSelectionRadioButton = new JRadioButton("Single Selection", true);
    singleSelectionRadioButton.addActionListener(optionListener);

    multiSelectionRadioButton = new JRadioButton("Multi Selection");
    multiSelectionRadioButton.addActionListener(optionListener);

    ButtonGroup group4 = new ButtonGroup();
    group4.add(singleSelectionRadioButton);
    group4.add(multiSelectionRadioButton);

    // Create show button
    showButton = new JButton("Show FileChooser");
    showButton.addActionListener(this);
    showButton.setMnemonic('s');

    // Create laf combo box

    lafComboBox = new JComboBox(supportedLaFs);
    lafComboBox.setEditable(false);
    lafComboBox.addActionListener(optionListener);

    // ********************************************************
    // ******************** Dialog Type ***********************
    // ********************************************************
    JPanel control1 = new InsetPanel(insets);
    control1.setBorder(BorderFactory.createTitledBorder("Dialog Type"));

    control1.setLayout(new BoxLayout(control1, BoxLayout.Y_AXIS));
    control1.add(Box.createRigidArea(vpad20));
    control1.add(openRadioButton);
    control1.add(Box.createRigidArea(vpad7));
    control1.add(saveRadioButton);
    control1.add(Box.createRigidArea(vpad7));
    control1.add(customButton);
    control1.add(Box.createRigidArea(vpad4));
    JPanel fieldWrapper = new JPanel();
    fieldWrapper.setLayout(new BoxLayout(fieldWrapper, BoxLayout.X_AXIS));
    fieldWrapper.setAlignmentX(Component.LEFT_ALIGNMENT);
    fieldWrapper.add(Box.createRigidArea(hpad10));
    fieldWrapper.add(Box.createRigidArea(hpad10));
    fieldWrapper.add(customField);
    control1.add(fieldWrapper);
    control1.add(Box.createRigidArea(vpad20));
    control1.add(Box.createGlue());

    // ********************************************************
    // ***************** Filter Controls **********************
    // ********************************************************
    JPanel control2 = new InsetPanel(insets);
    control2.setBorder(BorderFactory.createTitledBorder("Filter Controls"));
    control2.setLayout(new BoxLayout(control2, BoxLayout.Y_AXIS));
    control2.add(Box.createRigidArea(vpad20));
    control2.add(showAllFilesFilterCheckBox);
    control2.add(Box.createRigidArea(vpad7));
    control2.add(showImageFilesFilterCheckBox);
    control2.add(Box.createRigidArea(vpad4));
    JPanel checkWrapper = new JPanel();
    checkWrapper.setLayout(new BoxLayout(checkWrapper, BoxLayout.X_AXIS));
    checkWrapper.setAlignmentX(Component.LEFT_ALIGNMENT);
    checkWrapper.add(Box.createRigidArea(hpad10));
    checkWrapper.add(Box.createRigidArea(hpad10));
    checkWrapper.add(showFullDescriptionCheckBox);
    control2.add(checkWrapper);
    control2.add(Box.createRigidArea(vpad20));
    control2.add(Box.createGlue());

    // ********************************************************
    // ****************** Display Options *********************
    // ********************************************************
    JPanel control3 = new InsetPanel(insets);
    control3.setBorder(BorderFactory.createTitledBorder("Display Options"));
    control3.setLayout(new BoxLayout(control3, BoxLayout.Y_AXIS));
    control3.add(Box.createRigidArea(vpad20));
    control3.add(setHiddenCheckBox);
    control3.add(Box.createRigidArea(vpad7));
    control3.add(useFileViewCheckBox);
    control3.add(Box.createRigidArea(vpad7));
    control3.add(accessoryCheckBox);
    control3.add(Box.createRigidArea(vpad7));
    control3.add(useEmbedInWizardCheckBox);
    control3.add(Box.createRigidArea(vpad7));
    control3.add(useControlsCheckBox);
    control3.add(Box.createRigidArea(vpad7));
    control3.add(enableDragCheckBox);
    control3.add(Box.createRigidArea(vpad20));
    control3.add(Box.createGlue());

    // ********************************************************
    // ************* File & Directory Options *****************
    // ********************************************************
    JPanel control4 = new InsetPanel(insets);
    control4.setBorder(BorderFactory.createTitledBorder("File and Directory Options"));
    control4.setLayout(new BoxLayout(control4, BoxLayout.Y_AXIS));
    control4.add(Box.createRigidArea(vpad20));
    control4.add(justFilesRadioButton);
    control4.add(Box.createRigidArea(vpad7));
    control4.add(justDirectoriesRadioButton);
    control4.add(Box.createRigidArea(vpad7));
    control4.add(bothFilesAndDirectoriesRadioButton);
    control4.add(Box.createRigidArea(vpad20));
    control4.add(singleSelectionRadioButton);
    control4.add(Box.createRigidArea(vpad7));
    control4.add(multiSelectionRadioButton);
    control4.add(Box.createRigidArea(vpad20));
    control4.add(Box.createGlue());

    // ********************************************************
    // **************** Look & Feel Switch ********************
    // ********************************************************
    JPanel panel = new JPanel();
    panel.add(new JLabel("Look and Feel: "));
    panel.add(lafComboBox);
    panel.add(showButton);

    // ********************************************************
    // ****************** Wrap 'em all up *********************
    // ********************************************************
    JPanel wrapper = new JPanel();
    wrapper.setLayout(new BoxLayout(wrapper, BoxLayout.X_AXIS));

    add(Box.createRigidArea(vpad20));

    wrapper.add(Box.createRigidArea(hpad10));
    wrapper.add(Box.createRigidArea(hpad10));
    wrapper.add(control1);
    wrapper.add(Box.createRigidArea(hpad10));
    wrapper.add(control2);
    wrapper.add(Box.createRigidArea(hpad10));
    wrapper.add(control3);
    wrapper.add(Box.createRigidArea(hpad10));
    wrapper.add(control4);
    wrapper.add(Box.createRigidArea(hpad10));
    wrapper.add(Box.createRigidArea(hpad10));

    add(wrapper);
    add(Box.createRigidArea(vpad20));
    add(panel);
    add(Box.createRigidArea(vpad20));
}

From source file:com.rapidminer.gui.new_plotter.gui.ColorSchemeDialog.java

/**
 *
 *//*www . j a  v  a 2  s  .  com*/
private void createComponents() {

    // creat popup menus
    {

        popupMenu = new JPopupMenu();
        removeMenuItem = new JMenuItem(I18N
                .getGUILabel("plotter.configuration_dialog.color_scheme_dialog.remove_color_menu_item.label"));
        removeMenuItem.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                removeSelectedColorAction();
            }

        });
        popupMenu.add(removeMenuItem);

        changeColorMenuItem = new JMenuItem(I18N
                .getGUILabel("plotter.configuration_dialog.color_scheme_dialog.change_color_menu_item.label"));
        changeColorMenuItem.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                replaceSelectedColorAction();
            }

        });
        popupMenu.add(changeColorMenuItem);

        popupMenu.addSeparator();

        moveUpColorMenuItem = new JMenuItem(
                I18N.getGUILabel("plotter.configuration_dialog.color_scheme_dialog.move_up_menu_item.label"));
        moveUpColorMenuItem.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                moveSelectedColorUpAction();

            }

        });
        popupMenu.add(moveUpColorMenuItem);

        moveDownColorMenuItem = new JMenuItem(
                I18N.getGUILabel("plotter.configuration_dialog.color_scheme_dialog.move_down_menu_item.label"));
        moveDownColorMenuItem.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                moveSelectedColorDownAction();
            }

        });
        popupMenu.add(moveDownColorMenuItem);

    }

    JPanel containerPanel = new JPanel(new GridBagLayout());
    containerPanel.setPreferredSize(new Dimension(520, 450));

    // create containing panel
    {

        {
            JPanel configurePanel = new JPanel(new GridBagLayout());
            configurePanel.setPreferredSize(new Dimension(220, 400));
            configurePanel.setBorder(BorderFactory.createTitledBorder(I18N.getGUILabel(
                    "plotter.configuration_dialog.color_scheme_dialog.scheme_configuration_border.label")));

            // add scheme list panel
            {
                JPanel schemeComboBoxPanel = createSchemeComboBoxPanel();

                // add category choosing panel
                GridBagConstraints itemConstraint = new GridBagConstraints();
                itemConstraint.fill = GridBagConstraints.BOTH;
                itemConstraint.weightx = 1;
                itemConstraint.weighty = 1;
                itemConstraint.gridwidth = GridBagConstraints.REMAINDER;
                itemConstraint.insets = new Insets(2, 2, 2, 5);

                configurePanel.add(schemeComboBoxPanel, itemConstraint);
            }

            {
                categoryAndGradientConfigPanel = new JPanel(new GridBagLayout());

                // add categories panel
                {
                    JPanel categoryConfigurationPanel = createColorCategoriesPanel();

                    // add category choosing panel
                    GridBagConstraints itemConstraint = new GridBagConstraints();
                    itemConstraint.fill = GridBagConstraints.BOTH;
                    itemConstraint.weightx = 1;
                    itemConstraint.weighty = 1;
                    itemConstraint.insets = new Insets(2, 2, 2, 5);
                    itemConstraint.gridwidth = GridBagConstraints.REMAINDER;

                    categoryAndGradientConfigPanel.add(categoryConfigurationPanel, itemConstraint);

                }

                // add gradient chooser panel
                {
                    JPanel gradientConfigPanel = createGradientConfigurationPanel();

                    GridBagConstraints itemConstraint = new GridBagConstraints();
                    itemConstraint.fill = GridBagConstraints.BOTH;
                    itemConstraint.weightx = 1;
                    itemConstraint.weighty = 1;
                    itemConstraint.insets = new Insets(2, 2, 2, 5);
                    itemConstraint.gridwidth = GridBagConstraints.REMAINDER;

                    categoryAndGradientConfigPanel.add(gradientConfigPanel, itemConstraint);
                }

                GridBagConstraints itemConstraint = new GridBagConstraints();
                itemConstraint.fill = GridBagConstraints.BOTH;
                itemConstraint.weightx = 1;
                itemConstraint.weighty = 1;
                itemConstraint.gridwidth = GridBagConstraints.REMAINDER;
                itemConstraint.insets = new Insets(2, 2, 2, 5);

                configurePanel.add(categoryAndGradientConfigPanel, itemConstraint);

            }

            GridBagConstraints itemConstraint = new GridBagConstraints();
            itemConstraint.fill = GridBagConstraints.BOTH;
            itemConstraint.weightx = 1;
            itemConstraint.weighty = 1;
            itemConstraint.gridwidth = GridBagConstraints.RELATIVE;
            containerPanel.add(configurePanel, itemConstraint);
        }

        createPlotPreviewPanel(containerPanel);

    }

    // create buttons
    Collection<AbstractButton> buttons = new LinkedList<AbstractButton>();
    buttons.add(makeOkButton());

    Action saveAction = new ResourceAction("plotter.configuration_dialog.color_scheme_dialog.save_button") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent e) {
            save(currentColorSchemes, currentActiveColorSchemeName);

            // set new scheme
            plotConfig.setColorSchemes(currentColorSchemes, currentActiveColorSchemeName);
        }
    };
    saveButton = new JButton(saveAction);
    buttons.add(saveButton);
    saveButton.setEnabled(false);

    Action revertAction = new ResourceAction("plotter.configuration_dialog.color_scheme_dialog.revert_button") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent e) {
            revert();
        }
    };
    revertButton = new JButton(revertAction);
    revertButton.setEnabled(false);
    buttons.add(revertButton);
    buttons.add(makeCancelButton("plotter.configuration_dialog.color_scheme_dialog.cancel_button"));

    layoutDefault(containerPanel, buttons);
}

From source file:net.sourceforge.squirrel_sql.client.preferences.UpdatePreferencesPanel.java

private JPanel createUpdateSitePanel() {
    JPanel pnl = new JPanel(new GridBagLayout());
    pnl.setBorder(BorderFactory.createTitledBorder(i18n.UPDATE_SITE_BORDER_LABEL));

    ItemListener urlUpdateItemListener = new UrlItemListener();
    DocumentListener urlDocumentListener = new UrlDocumentListener();
    final GridBagConstraints gbc = new GridBagConstraints();

    setSeparatorConstraints(gbc, 0);//  ww w.  jav a2s. c o  m
    gbc.gridwidth = 1;
    gbc.weightx = 0;
    gbc.fill = GridBagConstraints.NONE;
    gbc.anchor = GridBagConstraints.EAST;
    siteTypeLabel = new JLabel(i18n.SITE_TYPE_LABEL, JLabel.RIGHT);
    pnl.add(siteTypeLabel, gbc);

    // Site type

    setSeparatorConstraints(gbc, 0);
    gbc.gridx = 1;
    gbc.gridwidth = 1;
    gbc.fill = GridBagConstraints.NONE;
    pnl.add(getSiteTypePanel(), gbc);

    setSeparatorConstraints(gbc, 1);
    pnl.add(getSep(), gbc);

    // Update server name

    setLabelConstraints(gbc, 2);
    _serverLabel = new JLabel(i18n.SERVER, SwingConstants.RIGHT);
    pnl.add(_serverLabel, gbc);

    setFieldConstraints(gbc, 2);
    _updateServerName.getDocument().addDocumentListener(urlDocumentListener);
    pnl.add(_updateServerName, gbc);

    // Update server port

    setLabelConstraints(gbc, 3);
    _portLabel = new JLabel(i18n.PORT, SwingConstants.RIGHT);
    pnl.add(_portLabel, gbc);

    setFieldConstraints(gbc, 3);
    _updateServerPort.getDocument().addDocumentListener(urlDocumentListener);
    pnl.add(_updateServerPort, gbc);

    // Path to release.xml

    setLabelConstraints(gbc, 4);
    _pathLabel = new JLabel(i18n.PATH, SwingConstants.RIGHT);
    pnl.add(_pathLabel, gbc);

    setFieldConstraints(gbc, 4);
    _updateServerPath.getDocument().addDocumentListener(urlDocumentListener);
    pnl.add(_updateServerPath, gbc);

    // Channnel combo-box

    setLabelConstraints(gbc, 5);
    _channelLabel = new JLabel(i18n.CHANNEL, SwingConstants.RIGHT);
    pnl.add(_channelLabel, gbc);

    setFieldConstraints(gbc, 5);
    gbc.fill = GridBagConstraints.NONE;
    _updateServerChannel.addItemListener(urlUpdateItemListener);
    pnl.add(_updateServerChannel, gbc);

    // URL text field

    setLabelConstraints(gbc, 6);
    _urlLabel = new JLabel(i18n.URL, SwingConstants.RIGHT);
    pnl.add(_urlLabel, gbc);

    setFieldConstraints(gbc, 6);
    updateUrl();
    pnl.add(_updateUrl, gbc);

    setFieldConstraints(gbc, 7);
    JLabel lblProxy = new JLabel(s_stringMgr.getString("UpdatePreferencesPanel.proxyHintHtml"));
    lblProxy.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    lblProxy.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            _prefrenceTabActvivationListener.activateTabForClass(ProxyPreferenceTabComponent.class);
        }
    });
    pnl.add(lblProxy, gbc);

    // Test Connection Button Panel (Both the button and the status label

    setFieldConstraints(gbc, 8);

    Box buttonBox = Box.createHorizontalBox();
    buttonBox.add(_testConnectionButton);
    buttonBox.add(Box.createHorizontalStrut(20));
    buttonBox.add(_testConnectionStatusLabel);
    _testConnectionButton.addActionListener(new TestConnectionButtonListener());
    pnl.add(buttonBox, gbc);

    // Separator

    setSeparatorConstraints(gbc, 9);
    pnl.add(getSep(), gbc);

    // Local update directory

    setLabelConstraints(gbc, 10);
    _localPathLabel = new JLabel(i18n.LOCAL_PATH, SwingConstants.RIGHT);
    pnl.add(_localPathLabel, gbc);

    setFieldConstraints(gbc, 10);
    pnl.add(_localPath, gbc);
    return pnl;
}

From source file:net.sourceforge.doddle_owl.utils.Utils.java

public static JComponent createTitledPanel(JComponent component, String title) {
    JPanel p = new JPanel();
    p.setLayout(new BorderLayout());
    p.setBorder(BorderFactory.createTitledBorder(title));
    p.add(component, BorderLayout.CENTER);
    return p;/*ww  w.  j a va2s  .  co m*/
}

From source file:de.codesourcery.eve.skills.ui.components.impl.ImportMarketLogFileComponent.java

@Override
protected JPanel createPanelHook() {

    final JPanel result = new JPanel();

    result.setLayout(new GridBagLayout());

    final JPanel crapFilterPanel = new JPanel();
    crapFilterPanel.setLayout(new GridBagLayout());
    crapFilterPanel.setBorder(BorderFactory.createTitledBorder("Import filter"));

    crapFilterPanel.add(priceFilter, constraints(0, 0).width(3).anchorWest().noResizing().end());
    priceFilter.addActionListener(actionListener);

    linkComponentEnabledStates(priceFilter, minPriceFilter);
    linkComponentEnabledStates(priceFilter, maxPriceFilter);

    final List<PriceInfo.Type> types = Arrays.asList(PriceInfo.Type.values());
    requiredOrderType.setModel(new DefaultComboBoxModel<Type>(types));
    requiredOrderType.setSelectedItem(PriceInfo.Type.ANY);
    requiredOrderType.addActionListener(actionListener);

    minPriceFilter.setEnabled(false);// www .  j av a2s .c o  m
    maxPriceFilter.setEnabled(false);

    minPriceFilter.setColumns(10);
    maxPriceFilter.setColumns(10);

    minPriceFilter.addActionListener(actionListener);
    maxPriceFilter.addActionListener(actionListener);

    crapFilterPanel.add(minPriceFilter, constraints(1, 1).anchorWest().noResizing().end());
    crapFilterPanel.add(maxPriceFilter, constraints(2, 1).anchorWest().noResizing().end());

    // order volume filter
    crapFilterPanel.add(orderVolumeFilter, constraints(0, 2).width(3).anchorWest().noResizing().end());
    orderVolumeFilter.addActionListener(actionListener);

    linkComponentEnabledStates(orderVolumeFilter, minOrderSize);
    linkComponentEnabledStates(orderVolumeFilter, maxOrderSize);

    minOrderSize.addActionListener(actionListener);
    maxOrderSize.addActionListener(actionListener);

    minOrderSize.setEnabled(false);
    maxOrderSize.setEnabled(false);

    minOrderSize.setColumns(10);
    maxOrderSize.setColumns(10);

    crapFilterPanel.add(minOrderSize, constraints(1, 3).anchorWest().noResizing().end());
    crapFilterPanel.add(maxOrderSize, constraints(2, 3).anchorWest().noResizing().end());

    crapFilterPanel.add(new JLabel("Imported order types"), constraints(1, 4).anchorWest().noResizing().end());
    crapFilterPanel.add(this.requiredOrderType, constraints(2, 4).anchorWest().noResizing().end());

    result.add(crapFilterPanel,
            constraints(0, 0).width(1).weightX(0.1).weightY(0.1).anchorWest().resizeBoth().end());

    // add text area
    infoArea.setEditable(false);
    infoArea.setLineWrap(true);
    infoArea.setWrapStyleWord(true);

    result.add(new JScrollPane(infoArea), constraints(1, 0).width(1).resizeBoth().end());

    // add table
    table.setModel(model);
    table.setDefaultRenderer(Double.class, new MyRenderer());
    table.setDefaultRenderer(String.class, new MyRenderer());
    table.setDefaultRenderer(EveDate.class, new MyRenderer());
    table.setDefaultRenderer(Boolean.class, new MyBooleanRenderer());
    table.setDefaultRenderer(Date.class, new MyRenderer());

    table.setRowSorter(model.getRowSorter());

    final JPanel splitPane = createSplitPanePanel(result, new JScrollPane(table));

    popupMenuBuilder = new PopupMenuBuilder().attach(table)
            .addItem("Clear user overrides", new AbstractAction() {

                @Override
                public boolean isEnabled() {
                    return model.hasUserOverrides();
                }

                @Override
                public void actionPerformed(ActionEvent e) {
                    model.clearUserOverrides();
                }
            }).addSeparatorIfNotEmpty().addItem("Add selected prices to import", new AbstractAction() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    markRowsManually(true);
                }

                @Override
                public boolean isEnabled() {
                    return hasMultipleLinesSelection();
                }
            }).addItem("Remove selected prices from import", new AbstractAction() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    markRowsManually(false);
                }

                @Override
                public boolean isEnabled() {
                    return hasMultipleLinesSelection();
                }
            });

    updateInfoTextArea();

    return splitPane;
}

From source file:com.google.code.facebook.graph.sna.applet.LensDemo.java

/**
 * create an instance of a simple graph with controls to
 * demo the zoomand hyperbolic features.
 * /*from w w w  .java2s  .  co  m*/
 */
public LensDemo() {

    // create a simple graph for the demo
    graph = TestGraphs.getOneComponentGraph();

    graphLayout = new FRLayout<String, Number>(graph);
    ((FRLayout) graphLayout).setMaxIterations(1000);

    Dimension preferredSize = new Dimension(600, 600);
    Map<String, Point2D> map = new HashMap<String, Point2D>();
    Transformer<String, Point2D> vlf = TransformerUtils.mapTransformer(map);
    grid = this.generateVertexGrid(map, preferredSize, 25);
    gridLayout = new StaticLayout<String, Number>(grid, vlf, preferredSize);

    final VisualizationModel<String, Number> visualizationModel = new DefaultVisualizationModel<String, Number>(
            graphLayout, preferredSize);
    vv = new VisualizationViewer<String, Number>(visualizationModel, preferredSize);

    PickedState<String> ps = vv.getPickedVertexState();
    PickedState<Number> pes = vv.getPickedEdgeState();
    vv.getRenderContext().setVertexFillPaintTransformer(
            new PickableVertexPaintTransformer<String>(ps, Color.red, Color.yellow));
    vv.getRenderContext().setEdgeDrawPaintTransformer(
            new PickableEdgePaintTransformer<Number>(pes, Color.black, Color.cyan));
    vv.setBackground(Color.white);

    vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());

    final Transformer<String, Shape> ovals = vv.getRenderContext().getVertexShapeTransformer();
    final Transformer<String, Shape> squares = new ConstantTransformer(new Rectangle2D.Float(-10, -10, 20, 20));

    // add a listener for ToolTips
    vv.setVertexToolTipTransformer(new ToStringLabeller());

    Container content = getContentPane();
    GraphZoomScrollPane gzsp = new GraphZoomScrollPane(vv);
    content.add(gzsp);

    /**
     * the regular graph mouse for the normal view
     */
    final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse();

    vv.setGraphMouse(graphMouse);
    vv.addKeyListener(graphMouse.getModeKeyListener());

    hyperbolicViewSupport = new ViewLensSupport<String, Number>(vv,
            new HyperbolicShapeTransformer(vv,
                    vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW)),
            new ModalLensGraphMouse());
    hyperbolicLayoutSupport = new LayoutLensSupport<String, Number>(vv,
            new HyperbolicTransformer(vv,
                    vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT)),
            new ModalLensGraphMouse());
    magnifyViewSupport = new ViewLensSupport<String, Number>(vv,
            new MagnifyShapeTransformer(vv,
                    vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW)),
            new ModalLensGraphMouse(new LensMagnificationGraphMousePlugin(1.f, 6.f, .2f)));
    magnifyLayoutSupport = new LayoutLensSupport<String, Number>(vv,
            new MagnifyTransformer(vv,
                    vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT)),
            new ModalLensGraphMouse(new LensMagnificationGraphMousePlugin(1.f, 6.f, .2f)));
    hyperbolicLayoutSupport.getLensTransformer()
            .setLensShape(hyperbolicViewSupport.getLensTransformer().getLensShape());
    magnifyViewSupport.getLensTransformer()
            .setLensShape(hyperbolicLayoutSupport.getLensTransformer().getLensShape());
    magnifyLayoutSupport.getLensTransformer()
            .setLensShape(magnifyViewSupport.getLensTransformer().getLensShape());

    final ScalingControl scaler = new CrossoverScalingControl();

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

    ButtonGroup radio = new ButtonGroup();
    JRadioButton normal = new JRadioButton("None");
    normal.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                if (hyperbolicViewSupport != null) {
                    hyperbolicViewSupport.deactivate();
                }
                if (hyperbolicLayoutSupport != null) {
                    hyperbolicLayoutSupport.deactivate();
                }
                if (magnifyViewSupport != null) {
                    magnifyViewSupport.deactivate();
                }
                if (magnifyLayoutSupport != null) {
                    magnifyLayoutSupport.deactivate();
                }
            }
        }
    });

    final JRadioButton hyperView = new JRadioButton("Hyperbolic View");
    hyperView.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            hyperbolicViewSupport.activate(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    final JRadioButton hyperModel = new JRadioButton("Hyperbolic Layout");
    hyperModel.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            hyperbolicLayoutSupport.activate(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    final JRadioButton magnifyView = new JRadioButton("Magnified View");
    magnifyView.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            magnifyViewSupport.activate(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    final JRadioButton magnifyModel = new JRadioButton("Magnified Layout");
    magnifyModel.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            magnifyLayoutSupport.activate(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    JLabel modeLabel = new JLabel("     Mode Menu >>");
    modeLabel.setUI(new VerticalLabelUI(false));
    radio.add(normal);
    radio.add(hyperModel);
    radio.add(hyperView);
    radio.add(magnifyModel);
    radio.add(magnifyView);
    normal.setSelected(true);

    graphMouse.addItemListener(hyperbolicLayoutSupport.getGraphMouse().getModeListener());
    graphMouse.addItemListener(hyperbolicViewSupport.getGraphMouse().getModeListener());
    graphMouse.addItemListener(magnifyLayoutSupport.getGraphMouse().getModeListener());
    graphMouse.addItemListener(magnifyViewSupport.getGraphMouse().getModeListener());

    ButtonGroup graphRadio = new ButtonGroup();
    JRadioButton graphButton = new JRadioButton("Graph");
    graphButton.setSelected(true);
    graphButton.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                visualizationModel.setGraphLayout(graphLayout);
                vv.getRenderContext().setVertexShapeTransformer(ovals);
                vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
                vv.repaint();
            }
        }
    });
    JRadioButton gridButton = new JRadioButton("Grid");
    gridButton.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                visualizationModel.setGraphLayout(gridLayout);
                vv.getRenderContext().setVertexShapeTransformer(squares);
                vv.getRenderContext().setVertexLabelTransformer(new ConstantTransformer(null));
                vv.repaint();
            }
        }
    });
    graphRadio.add(graphButton);
    graphRadio.add(gridButton);

    JPanel modePanel = new JPanel(new GridLayout(3, 1));
    modePanel.setBorder(BorderFactory.createTitledBorder("Display"));
    modePanel.add(graphButton);
    modePanel.add(gridButton);

    JMenuBar menubar = new JMenuBar();
    menubar.add(graphMouse.getModeMenu());
    gzsp.setCorner(menubar);

    Box controls = Box.createHorizontalBox();
    JPanel zoomControls = new JPanel(new GridLayout(2, 1));
    zoomControls.setBorder(BorderFactory.createTitledBorder("Zoom"));
    JPanel hyperControls = new JPanel(new GridLayout(3, 2));
    hyperControls.setBorder(BorderFactory.createTitledBorder("Examiner Lens"));
    zoomControls.add(plus);
    zoomControls.add(minus);

    hyperControls.add(normal);
    hyperControls.add(new JLabel());

    hyperControls.add(hyperModel);
    hyperControls.add(magnifyModel);

    hyperControls.add(hyperView);
    hyperControls.add(magnifyView);

    controls.add(zoomControls);
    controls.add(hyperControls);
    controls.add(modePanel);
    controls.add(modeLabel);
    content.add(controls, BorderLayout.SOUTH);
}

From source file:edu.uci.ics.jung.samples.LensDemo.java

/**
 * create an instance of a simple graph with controls to
 * demo the zoomand hyperbolic features.
 * // w  w w  .ja  v  a2  s . com
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
public LensDemo() {

    // create a simple graph for the demo
    graph = TestGraphs.getOneComponentGraph();

    graphLayout = new FRLayout<String, Number>(graph);
    ((FRLayout) graphLayout).setMaxIterations(1000);

    Dimension preferredSize = new Dimension(600, 600);
    Map<String, Point2D> map = new HashMap<String, Point2D>();
    Transformer<String, Point2D> vlf = TransformerUtils.mapTransformer(map);
    grid = this.generateVertexGrid(map, preferredSize, 25);
    gridLayout = new StaticLayout<String, Number>(grid, vlf, preferredSize);

    final VisualizationModel<String, Number> visualizationModel = new DefaultVisualizationModel<String, Number>(
            graphLayout, preferredSize);
    vv = new VisualizationViewer<String, Number>(visualizationModel, preferredSize);

    PickedState<String> ps = vv.getPickedVertexState();
    PickedState<Number> pes = vv.getPickedEdgeState();
    vv.getRenderContext().setVertexFillPaintTransformer(
            new PickableVertexPaintTransformer<String>(ps, Color.red, Color.yellow));
    vv.getRenderContext().setEdgeDrawPaintTransformer(
            new PickableEdgePaintTransformer<Number>(pes, Color.black, Color.cyan));
    vv.setBackground(Color.white);

    vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());

    final Transformer<String, Shape> ovals = vv.getRenderContext().getVertexShapeTransformer();
    final Transformer<String, Shape> squares = new ConstantTransformer(new Rectangle2D.Float(-10, -10, 20, 20));

    // add a listener for ToolTips
    vv.setVertexToolTipTransformer(new ToStringLabeller());

    Container content = getContentPane();
    GraphZoomScrollPane gzsp = new GraphZoomScrollPane(vv);
    content.add(gzsp);

    /**
     * the regular graph mouse for the normal view
     */
    final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse();

    vv.setGraphMouse(graphMouse);
    vv.addKeyListener(graphMouse.getModeKeyListener());

    hyperbolicViewSupport = new ViewLensSupport<String, Number>(vv,
            new HyperbolicShapeTransformer(vv,
                    vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW)),
            new ModalLensGraphMouse());
    hyperbolicLayoutSupport = new LayoutLensSupport<String, Number>(vv,
            new HyperbolicTransformer(vv,
                    vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT)),
            new ModalLensGraphMouse());
    magnifyViewSupport = new ViewLensSupport<String, Number>(vv,
            new MagnifyShapeTransformer(vv,
                    vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW)),
            new ModalLensGraphMouse(new LensMagnificationGraphMousePlugin(1.f, 6.f, .2f)));
    magnifyLayoutSupport = new LayoutLensSupport<String, Number>(vv,
            new MagnifyTransformer(vv,
                    vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT)),
            new ModalLensGraphMouse(new LensMagnificationGraphMousePlugin(1.f, 6.f, .2f)));
    hyperbolicLayoutSupport.getLensTransformer()
            .setLensShape(hyperbolicViewSupport.getLensTransformer().getLensShape());
    magnifyViewSupport.getLensTransformer()
            .setLensShape(hyperbolicLayoutSupport.getLensTransformer().getLensShape());
    magnifyLayoutSupport.getLensTransformer()
            .setLensShape(magnifyViewSupport.getLensTransformer().getLensShape());

    final ScalingControl scaler = new CrossoverScalingControl();

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

    ButtonGroup radio = new ButtonGroup();
    JRadioButton normal = new JRadioButton("None");
    normal.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                if (hyperbolicViewSupport != null) {
                    hyperbolicViewSupport.deactivate();
                }
                if (hyperbolicLayoutSupport != null) {
                    hyperbolicLayoutSupport.deactivate();
                }
                if (magnifyViewSupport != null) {
                    magnifyViewSupport.deactivate();
                }
                if (magnifyLayoutSupport != null) {
                    magnifyLayoutSupport.deactivate();
                }
            }
        }
    });

    final JRadioButton hyperView = new JRadioButton("Hyperbolic View");
    hyperView.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            hyperbolicViewSupport.activate(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    final JRadioButton hyperModel = new JRadioButton("Hyperbolic Layout");
    hyperModel.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            hyperbolicLayoutSupport.activate(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    final JRadioButton magnifyView = new JRadioButton("Magnified View");
    magnifyView.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            magnifyViewSupport.activate(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    final JRadioButton magnifyModel = new JRadioButton("Magnified Layout");
    magnifyModel.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            magnifyLayoutSupport.activate(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    JLabel modeLabel = new JLabel("     Mode Menu >>");
    modeLabel.setUI(new VerticalLabelUI(false));
    radio.add(normal);
    radio.add(hyperModel);
    radio.add(hyperView);
    radio.add(magnifyModel);
    radio.add(magnifyView);
    normal.setSelected(true);

    graphMouse.addItemListener(hyperbolicLayoutSupport.getGraphMouse().getModeListener());
    graphMouse.addItemListener(hyperbolicViewSupport.getGraphMouse().getModeListener());
    graphMouse.addItemListener(magnifyLayoutSupport.getGraphMouse().getModeListener());
    graphMouse.addItemListener(magnifyViewSupport.getGraphMouse().getModeListener());

    ButtonGroup graphRadio = new ButtonGroup();
    JRadioButton graphButton = new JRadioButton("Graph");
    graphButton.setSelected(true);
    graphButton.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                visualizationModel.setGraphLayout(graphLayout);
                vv.getRenderContext().setVertexShapeTransformer(ovals);
                vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
                vv.repaint();
            }
        }
    });
    JRadioButton gridButton = new JRadioButton("Grid");
    gridButton.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                visualizationModel.setGraphLayout(gridLayout);
                vv.getRenderContext().setVertexShapeTransformer(squares);
                vv.getRenderContext().setVertexLabelTransformer(new ConstantTransformer(null));
                vv.repaint();
            }
        }
    });
    graphRadio.add(graphButton);
    graphRadio.add(gridButton);

    JPanel modePanel = new JPanel(new GridLayout(3, 1));
    modePanel.setBorder(BorderFactory.createTitledBorder("Display"));
    modePanel.add(graphButton);
    modePanel.add(gridButton);

    JMenuBar menubar = new JMenuBar();
    menubar.add(graphMouse.getModeMenu());
    gzsp.setCorner(menubar);

    Box controls = Box.createHorizontalBox();
    JPanel zoomControls = new JPanel(new GridLayout(2, 1));
    zoomControls.setBorder(BorderFactory.createTitledBorder("Zoom"));
    JPanel hyperControls = new JPanel(new GridLayout(3, 2));
    hyperControls.setBorder(BorderFactory.createTitledBorder("Examiner Lens"));
    zoomControls.add(plus);
    zoomControls.add(minus);

    hyperControls.add(normal);
    hyperControls.add(new JLabel());

    hyperControls.add(hyperModel);
    hyperControls.add(magnifyModel);

    hyperControls.add(hyperView);
    hyperControls.add(magnifyView);

    controls.add(zoomControls);
    controls.add(hyperControls);
    controls.add(modePanel);
    controls.add(modeLabel);
    content.add(controls, BorderLayout.SOUTH);
}

From source file:iDynoOptimizer.MOEAFramework26.src.org.moeaframework.analysis.diagnostics.ApproximationSetViewer.java

/**
 * Lays out the components on this window.  This method is invoked by the
 * constructor, and should not be invoked again.
 *//*www.  java  2 s. c  o m*/
protected void layoutComponents() {
    setLayout(new BorderLayout());

    JPanel buttonPane = new JPanel(new FlowLayout(FlowLayout.CENTER));
    buttonPane.add(useInitialBounds);
    buttonPane.add(useReferenceSetBounds);
    buttonPane.add(useDynamicBounds);
    buttonPane.add(useZoomBounds);

    JPanel objectivePane = new JPanel(new FlowLayout(FlowLayout.CENTER));
    objectivePane.add(new JLabel(localization.getString("text.xAxis")));
    objectivePane.add(xAxisSelection);
    objectivePane.add(new JLabel(localization.getString("text.yAxis")));
    objectivePane.add(yAxisSelection);

    JPanel controlPane = new JPanel(new GridLayout(3, 1));
    controlPane.add(slider);
    controlPane.add(buttonPane);
    controlPane.add(objectivePane);

    JPanel rightPane = new JPanel(new BorderLayout());
    rightPane.add(chartContainer, BorderLayout.CENTER);
    rightPane.add(controlPane, BorderLayout.SOUTH);

    JPanel leftPane = new JPanel(new BorderLayout());
    leftPane.setBorder(BorderFactory.createTitledBorder(localization.getString("text.seeds")));
    leftPane.add(new JScrollPane(seedList), BorderLayout.CENTER);
    leftPane.add(selectAll, BorderLayout.SOUTH);
    leftPane.setMinimumSize(new Dimension(100, 100));

    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftPane, rightPane);

    add(splitPane, BorderLayout.CENTER);
}

From source file:net.sourceforge.squirrel_sql.client.preferences.WikiTablePreferencesPanel.java

/**
 * The detail panel contains all information of a specific configuration.
 * The user can edit the configuration in this panel.
 *//*from   w w  w.ja v  a  2 s.  c  om*/
private JPanel createDetailPanel() {
    JPanel jp = new JPanel(new GridBagLayout());
    jp.setBorder(BorderFactory
            .createTitledBorder(s_stringMgr.getString("WikiTablePreferencesPanel.titleDetailPanel"))); //$NON-NLS-1$
    jp.setMinimumSize(new Dimension(400, 50));

    final GridBagConstraints gbc = new GridBagConstraints();

    int row = 0;

    setLabelConstraints(gbc, row);
    nameLable = new JLabel(s_stringMgr.getString("WikiTablePreferencesPanel.name"), SwingConstants.RIGHT); //$NON-NLS-1$
    jp.add(nameLable, gbc);

    setFieldConstraints(gbc, row);
    name = new JTextField(30);
    jp.add(name, gbc);

    setLabelConstraints(gbc, ++row);
    tableStartTagLabel = new JLabel(s_stringMgr.getString("WikiTablePreferencesPanel.tableStartTag"), //$NON-NLS-1$
            SwingConstants.RIGHT);
    jp.add(tableStartTagLabel, gbc);

    setFieldConstraints(gbc, row);
    tableStartTag = new JTextField(30);
    jp.add(tableStartTag, gbc);

    setLabelConstraints(gbc, ++row);
    headerStartTagLabel = new JLabel(s_stringMgr.getString("WikiTablePreferencesPanel.headerStartTag"), //$NON-NLS-1$
            SwingConstants.RIGHT);
    jp.add(headerStartTagLabel, gbc);

    setFieldConstraints(gbc, row);
    headerStartTag = new JTextField(30);
    jp.add(headerStartTag, gbc);

    setLabelConstraints(gbc, ++row);
    headerCellTagLabel = new JLabel(s_stringMgr.getString("WikiTablePreferencesPanel.headerCellTag"), //$NON-NLS-1$
            SwingConstants.RIGHT);
    jp.add(headerCellTagLabel, gbc);

    setFieldConstraints(gbc, row);
    headerCellTag = new JTextField(30);
    jp.add(headerCellTag, gbc);

    setLabelConstraints(gbc, ++row);
    headerEndTagLabel = new JLabel(s_stringMgr.getString("WikiTablePreferencesPanel.headerEndTag"), //$NON-NLS-1$
            SwingConstants.RIGHT);
    jp.add(headerEndTagLabel, gbc);

    setFieldConstraints(gbc, row);
    headerEndTag = new JTextField(30);
    jp.add(headerEndTag, gbc);

    setLabelConstraints(gbc, ++row);
    rowStartTagLabel = new JLabel(s_stringMgr.getString("WikiTablePreferencesPanel.rowStartTag"), //$NON-NLS-1$
            SwingConstants.RIGHT);
    jp.add(rowStartTagLabel, gbc);

    setFieldConstraints(gbc, row);
    rowStartTag = new JTextField(30);
    jp.add(rowStartTag, gbc);

    setLabelConstraints(gbc, ++row);
    cellTagLabel = new JLabel(s_stringMgr.getString("WikiTablePreferencesPanel.cellTag"), SwingConstants.RIGHT); //$NON-NLS-1$
    jp.add(cellTagLabel, gbc);

    setFieldConstraints(gbc, row);
    cellTag = new JTextField(30);
    jp.add(cellTag, gbc);

    setLabelConstraints(gbc, ++row);
    rowEndTagLabel = new JLabel(s_stringMgr.getString("WikiTablePreferencesPanel.rowEndTag"), //$NON-NLS-1$
            SwingConstants.RIGHT);
    jp.add(rowEndTagLabel, gbc);

    setFieldConstraints(gbc, row);
    rowEndTag = new JTextField(30);
    jp.add(rowEndTag, gbc);

    setLabelConstraints(gbc, ++row);
    tableEndTagLabel = new JLabel(s_stringMgr.getString("WikiTablePreferencesPanel.tableEndTag"), //$NON-NLS-1$
            SwingConstants.RIGHT);
    jp.add(tableEndTagLabel, gbc);

    setFieldConstraints(gbc, row);
    tableEndTag = new JTextField(30);
    jp.add(tableEndTag, gbc);

    setLabelConstraints(gbc, ++row);
    noWikiTagLabel = new JLabel(s_stringMgr.getString("WikiTablePreferencesPanel.noWikiTag"), //$NON-NLS-1$
            SwingConstants.RIGHT);
    jp.add(noWikiTagLabel, gbc);

    setFieldConstraints(gbc, row);
    noWikiTag = new JTextField(30);
    jp.add(noWikiTag, gbc);

    setLabelConstraints(gbc, ++row);
    noWikiTagLabel = new JLabel(s_stringMgr.getString("WikiTablePreferencesPanel.enabled"), //$NON-NLS-1$
            SwingConstants.RIGHT);
    jp.add(noWikiTagLabel, gbc);

    setFieldConstraints(gbc, row);
    enabled = new JCheckBox();
    jp.add(enabled, gbc);

    addFocusLostListeners();

    return jp;
}