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:JXTransformer.java

private JPanel createStressTestPanel() {
        JPanel panel = new JPanel();
        TitledBorder titledBorder = BorderFactory.createTitledBorder("Stress test (with tooltips)");
        titledBorder.setTitleJustification(TitledBorder.CENTER);
        panel.setBorder(titledBorder);/*from   w ww  .  j av a 2  s .com*/
        JButton lowerButton = new JButton("Button");
        lowerButton.setLayout(new FlowLayout());
        lowerButton.setToolTipText("Lower button");
        JButton middleButton = new JButton();
        middleButton.setToolTipText("Middle button");
        middleButton.setLayout(new FlowLayout());
        lowerButton.add(middleButton);
        JButton upperButton = new JButton("Upper button");
        upperButton.setToolTipText("Upper button");
        middleButton.add(upperButton);
        panel.add(createTransformer(lowerButton));
        return panel;
    }

From source file:Import.pnl_import_vcf.java

public void progressBar() {
    JProgressBar progressBar = new JProgressBar();
    TitledBorder border = BorderFactory.createTitledBorder("Importing...");
    progressBar.setBorder(border);//w w w  .  j  ava 2 s  . c o  m
    progressBar.setIndeterminate(true);
    JDialog dialog = new JDialog();
}

From source file:com.isencia.passerelle.hmi.generic.GenericHMI.java

/**
 * @param e/*from  www  . ja va 2  s  .  c o  m*/
 * @param b
 * @return true if a form was effectively rendered, i.e. when at least 1
 *         parameter was available
 */
@SuppressWarnings("unchecked")
private boolean renderCompositeModelComponent(final CompositeActor e, final JPanel b) {
    if (logger.isDebugEnabled()) {
        logger.debug("renderCompositeModelComponent() - Entity " + e.getFullName()); //$NON-NLS-1$ //$NON-NLS-2$
    }

    final IPasserelleEditorPaneFactory epf = getEditorPaneFactoryForComponent(e);
    final IPasserelleQuery pQuery = epf.createEditorPaneWithAuthorizer(e, this, this);
    final JComponent c = (JComponent) pQuery.getPasserelleComponent();

    if (pQuery != null) {
        boolean nonEmptyForm = !(pQuery instanceof PasserelleEmptyQuery);
        // remove the default message in an empty query
        if (!nonEmptyForm) {
            ((PasserelleEmptyQuery) pQuery).setText("");
        } else if (!pQuery.hasAutoSync()) {
            try {
                final Set<ParameterToWidgetBinder> queryBindings = pQuery.getParameterBindings();
                for (final ParameterToWidgetBinder parameterToWidgetBinder : queryBindings) {
                    hmiFields.put(parameterToWidgetBinder.getBoundParameter().getFullName(),
                            parameterToWidgetBinder);
                }
            } catch (final Exception exception) {
                throw new RuntimeException("Error creating bindings for passerelleQuery", exception);
            }
        }

        final String name = ModelUtils.getFullNameButWithoutModelName(getCurrentModel(), e);
        final List subActors = e.entityList();
        // TODO: && changed by || because was not displaying parameters for
        // composite
        // still a problem of display with multiactor
        if (pQuery instanceof PasserelleQuery || !subActors.isEmpty()) {
            final JPanel compositeBox = createCompositePanel(b, c, name);
            renderModelComponentAnnotations(e, compositeBox);
            for (final Iterator<NamedObj> subActorItr = subActors.iterator(); subActorItr.hasNext();) {
                final NamedObj subActor = subActorItr.next();
                nonEmptyForm |= renderModelComponent(true, subActor, compositeBox);
            }
            if (nonEmptyForm) {
                b.add(compositeBox);
                StateMachine.getInstance().registerActionForState(StateMachine.MODEL_OPEN, name, c);
                StateMachine.getInstance().compile();
            }
            return nonEmptyForm;
        } else if (!(pQuery instanceof PasserelleEmptyQuery)) {
            // System.out.println("else name" + name);
            c.setName(name);
            c.setBorder(BorderFactory.createTitledBorder(name));
            b.add(c);
            StateMachine.getInstance().registerActionForState(StateMachine.MODEL_OPEN, name, c);
            StateMachine.getInstance().compile();
            return true;
        }
    }
    // System.out.println("renderComposite - out");
    return false;
}

From source file:davmail.ui.SettingsFrame.java

protected JPanel getOtherSettingsPanel() {
    JPanel otherSettingsPanel = new JPanel(new GridLayout(11, 2));
    otherSettingsPanel.setBorder(BorderFactory.createTitledBorder(BundleMessage.format("UI_OTHER")));

    enableEwsComboBox = new JComboBox(new String[] { WEBDAV, EWS, AUTO });
    setEwsModeSelectedItem(Settings.getProperty("davmail.enableEws", "auto"));
    caldavEditNotificationsField = new JCheckBox();
    caldavEditNotificationsField.setSelected(Settings.getBooleanProperty("davmail.caldavEditNotifications"));
    caldavAlarmSoundField = new JTextField(Settings.getProperty("davmail.caldavAlarmSound"), 15);
    forceActiveSyncUpdateCheckBox = new JCheckBox();
    forceActiveSyncUpdateCheckBox.setSelected(Settings.getBooleanProperty("davmail.forceActiveSyncUpdate"));
    defaultDomainField = new JTextField(Settings.getProperty("davmail.defaultDomain"), 15);
    showStartupBannerCheckBox = new JCheckBox();
    showStartupBannerCheckBox.setSelected(Settings.getBooleanProperty("davmail.showStartupBanner", true));
    disableGuiNotificationsCheckBox = new JCheckBox();
    disableGuiNotificationsCheckBox/*from  w ww .  jav  a2  s. c  om*/
            .setSelected(Settings.getBooleanProperty("davmail.disableGuiNotifications", false));
    imapAutoExpungeCheckBox = new JCheckBox();
    imapAutoExpungeCheckBox.setSelected(Settings.getBooleanProperty("davmail.imapAutoExpunge", true));
    popMarkReadOnRetrCheckBox = new JCheckBox();
    popMarkReadOnRetrCheckBox.setSelected(Settings.getBooleanProperty("davmail.popMarkReadOnRetr", false));
    smtpSaveInSentCheckBox = new JCheckBox();
    smtpSaveInSentCheckBox.setSelected(Settings.getBooleanProperty("davmail.smtpSaveInSent", true));
    disableUpdateCheck = new JCheckBox();
    disableUpdateCheck.setSelected(Settings.getBooleanProperty("davmail.disableUpdateCheck"));

    addSettingComponent(otherSettingsPanel, BundleMessage.format("UI_ENABLE_EWS"), enableEwsComboBox,
            BundleMessage.format("UI_ENABLE_EWS_HELP"));
    addSettingComponent(otherSettingsPanel, BundleMessage.format("UI_CALDAV_EDIT_NOTIFICATIONS"),
            caldavEditNotificationsField, BundleMessage.format("UI_CALDAV_EDIT_NOTIFICATIONS_HELP"));
    addSettingComponent(otherSettingsPanel, BundleMessage.format("UI_CALDAV_ALARM_SOUND"),
            caldavAlarmSoundField, BundleMessage.format("UI_CALDAV_ALARM_SOUND_HELP"));
    addSettingComponent(otherSettingsPanel, BundleMessage.format("UI_FORCE_ACTIVESYNC_UPDATE"),
            forceActiveSyncUpdateCheckBox, BundleMessage.format("UI_FORCE_ACTIVESYNC_UPDATE_HELP"));
    addSettingComponent(otherSettingsPanel, BundleMessage.format("UI_DEFAULT_DOMAIN"), defaultDomainField,
            BundleMessage.format("UI_DEFAULT_DOMAIN_HELP"));
    addSettingComponent(otherSettingsPanel, BundleMessage.format("UI_SHOW_STARTUP_BANNER"),
            showStartupBannerCheckBox, BundleMessage.format("UI_SHOW_STARTUP_BANNER_HELP"));
    addSettingComponent(otherSettingsPanel, BundleMessage.format("UI_DISABLE_GUI_NOTIFICATIONS"),
            disableGuiNotificationsCheckBox, BundleMessage.format("UI_DISABLE_GUI_NOTIFICATIONS_HELP"));
    addSettingComponent(otherSettingsPanel, BundleMessage.format("UI_IMAP_AUTO_EXPUNGE"),
            imapAutoExpungeCheckBox, BundleMessage.format("UI_IMAP_AUTO_EXPUNGE_HELP"));
    addSettingComponent(otherSettingsPanel, BundleMessage.format("UI_POP_MARK_READ"), popMarkReadOnRetrCheckBox,
            BundleMessage.format("UI_POP_MARK_READ_HELP"));
    addSettingComponent(otherSettingsPanel, BundleMessage.format("UI_SAVE_IN_SENT"), smtpSaveInSentCheckBox,
            BundleMessage.format("UI_SAVE_IN_SENT_HELP"));
    addSettingComponent(otherSettingsPanel, BundleMessage.format("UI_DISABLE_UPDATE_CHECK"), disableUpdateCheck,
            BundleMessage.format("UI_DISABLE_UPDATE_CHECK_HELP"));

    updateMaximumSize(otherSettingsPanel);
    return otherSettingsPanel;
}

From source file:JXTransformer.java

private JPanel createDemoPanel() {
        JPanel buttonPanel = new JPanel(new GridLayout(3, 2));
        TitledBorder titledBorder = BorderFactory.createTitledBorder("Try three sliders below !");
        Font titleFont = titledBorder.getTitleFont();
        titledBorder.setTitleFont(titleFont.deriveFont(titleFont.getSize2D() + 10));
        titledBorder.setTitleJustification(TitledBorder.CENTER);
        buttonPanel.setBorder(titledBorder);
        JButton b = new JButton("JButton");
        b.setPreferredSize(new Dimension(100, 50));
        buttonPanel.add(createTransformer(b));

        Vector<String> v = new Vector<String>();
        v.add("One");
        v.add("Two");
        v.add("Three");
        JList list = new JList(v);
        buttonPanel.add(createTransformer(list));

        buttonPanel.add(createTransformer(new JCheckBox("JCheckBox")));

        JSlider slider = new JSlider(0, 100);
        slider.setLabelTable(slider.createStandardLabels(25, 0));
        slider.setPaintLabels(true);/*  w ww  .j  av  a2s.  co  m*/
        slider.setPaintTicks(true);
        slider.setMajorTickSpacing(10);
        buttonPanel.add(createTransformer(slider));

        buttonPanel.add(createTransformer(new JRadioButton("JRadioButton")));
        final JLabel label = new JLabel("JLabel");
        label.addMouseListener(new MouseAdapter() {
            public void mouseEntered(MouseEvent e) {
                Font font = label.getFont();
                label.setFont(font.deriveFont(font.getSize2D() + 10));
            }

            public void mouseExited(MouseEvent e) {
                Font font = label.getFont();
                label.setFont(font.deriveFont(font.getSize2D() - 10));
            }
        });
        buttonPanel.add(createTransformer(label));

        return buttonPanel;
    }

From source file:kr.ac.kaist.swrc.jhannanum.demo.GUIDemo.java

/**
 * Returns the panel for the work flow.// w  ww .  j  av  a 2  s . co m
 * 
 * @return the panel for the work flow
 */
private JComponent createWorkflow() {
    JPanel workflowPanel = new JPanel(new GridLayout(1, 3));

    listModelMajor2 = new DefaultListModel();
    listModelMajor3 = new DefaultListModel();
    listModelSupplement1 = new DefaultListModel();
    listModelSupplement2 = new DefaultListModel();
    listModelSupplement3 = new DefaultListModel();

    listPluginMajor2 = new JList(listModelMajor2);
    listPluginMajor3 = new JList(listModelMajor3);
    listPluginSupplement1 = new JList(listModelSupplement1);
    listPluginSupplement2 = new JList(listModelSupplement2);
    listPluginSupplement3 = new JList(listModelSupplement3);

    // phase1
    JPanel phasePanel = new JPanel(new GridLayout(1, 1));
    phasePanel.setBorder(BorderFactory.createTitledBorder("Phase1. Plain Text Processing"));
    JPanel listPanel = new JPanel(new GridLayout(1, 1));
    listPanel.setBorder(BorderFactory.createTitledBorder("Supplement Plug-in"));
    JScrollPane scroll = new JScrollPane();
    scroll.setViewportView(listPluginSupplement1);
    listPanel.add(scroll);
    phasePanel.add(listPanel);
    workflowPanel.add(phasePanel);

    // phase2
    phasePanel = new JPanel(new GridLayout(1, 2));
    phasePanel.setBorder(BorderFactory.createTitledBorder("Phase2. Morphological Analysis"));
    listPanel = new JPanel(new GridLayout(1, 1));
    listPanel.setBorder(BorderFactory.createTitledBorder("Major Plug-in"));
    scroll = new JScrollPane();
    scroll.setViewportView(listPluginMajor2);
    listPanel.add(scroll);
    phasePanel.add(listPanel);

    listPanel = new JPanel(new GridLayout(1, 1));
    listPanel.setBorder(BorderFactory.createTitledBorder("Supplement Plug-in"));
    scroll = new JScrollPane();
    scroll.setViewportView(listPluginSupplement2);
    listPanel.add(scroll);
    phasePanel.add(listPanel);

    workflowPanel.add(phasePanel);

    // phase3
    phasePanel = new JPanel(new GridLayout(1, 2));
    phasePanel.setBorder(BorderFactory.createTitledBorder("Phase3. Part Of Speech Tagging"));
    listPanel = new JPanel(new GridLayout(1, 1));
    listPanel.setBorder(BorderFactory.createTitledBorder("Major Plug-in"));
    scroll = new JScrollPane();
    scroll.setViewportView(listPluginMajor3);
    listPanel.add(scroll);
    phasePanel.add(listPanel);

    listPanel = new JPanel(new GridLayout(1, 1));
    listPanel.setBorder(BorderFactory.createTitledBorder("Supplement Plug-in"));
    scroll = new JScrollPane();
    scroll.setViewportView(listPluginSupplement3);
    listPanel.add(scroll);
    phasePanel.add(listPanel);

    workflowPanel.add(phasePanel);

    /////////////////////////////////////////////////////////////////////////////////////

    JPanel controlPanel = new JPanel(new GridLayout(4, 1));
    controlPanel.setBorder(BorderFactory.createTitledBorder("Workflow Control"));
    buttonActivate = new JButton("Activate the workflow");
    buttonAnalysis = new JButton("Analyze Text");
    buttonReset = new JButton("Close the workflow");

    JPanel threadPanel = new JPanel(new GridLayout(1, 1));
    radioMultiThread = new JRadioButton("Mutli-thread Mode", true);
    radioSingleThread = new JRadioButton("Single-thread Mode", false);
    threadPanel.setBorder(BorderFactory.createTitledBorder("Thread Mode"));
    threadPanel.add(radioMultiThread);
    threadPanel.add(radioSingleThread);
    ButtonGroup groupThread = new ButtonGroup();
    groupThread.add(radioMultiThread);
    groupThread.add(radioSingleThread);

    controlPanel.add(threadPanel);
    controlPanel.add(buttonActivate);
    controlPanel.add(buttonAnalysis);
    controlPanel.add(buttonReset);

    buttonAnalysis.setEnabled(false);
    buttonReset.setEnabled(false);

    /////////////////////////////////////////////////////////////////////////////////////

    JPanel pluginInfoPanel = new JPanel(new GridLayout(1, 1));
    pluginInfoPanel.setBorder(BorderFactory.createTitledBorder("Plug-in Information"));
    areaPluginInfo = new JTextArea();
    areaPluginInfo.setLineWrap(true);
    scroll = new JScrollPane();
    scroll.setViewportView(areaPluginInfo);
    pluginInfoPanel.add(scroll);

    JPanel infoPanel = new JPanel(new GridLayout(1, 2));
    infoPanel.add(pluginInfoPanel);
    infoPanel.add(controlPanel);

    JPanel panel = new JPanel(new GridLayout(2, 1));
    workflowPanel.setBorder(BorderFactory.createTitledBorder("HanNanum Workflow"));
    panel.add(workflowPanel);
    panel.add(infoPanel);

    return panel;
}

From source file:it.staiger.jmeter.protocol.http.config.gui.DynamicFilePanel.java

/**
 * Create a panel containing the import options.
 *
 * @return a panel containing the import options.
 *//*  www  .java2s .co  m*/
protected JPanel makeImportPanel() {

    JPanel importPanel = new JPanel(new BorderLayout());

    importPanel.setBorder(BorderFactory.createTitledBorder("Import Files:"));// $NON-NLS-1$

    importBtn = new JButton("Add multiple"); // $NON-NLS-1$
    importBtn.setActionCommand(IMPORT);
    importBtn.addActionListener(this);

    importPanel.add(getImportInfo(), BorderLayout.NORTH);
    importPanel.add(importBtn, BorderLayout.SOUTH);

    return importPanel;
}

From source file:lu.lippmann.cdb.graph.GraphViewImpl.java

/**
 * //from www  .  j  av a 2  s .co m
 * @param args
 * @throws UnsupportedLookAndFeelException
 */
public static final void main(String[] args) throws UnsupportedLookAndFeelException {

    LookAndFeelUtil.init();

    final JXFrame f = new JXFrame();
    f.setDefaultCloseOperation(JXFrame.EXIT_ON_CLOSE);

    final GraphView view = new GraphViewImpl(new EventPublisherBushImpl(), new CommandDispatcherBushImpl());

    view.setViewMode(ViewMode.Add);
    view.init();

    final int panelWidth = 800;
    final int panelHeigth = 800;

    final VisualizationViewer<CNode, CEdge> vv = view.getVisualisationViewer();

    vv.setPreferredSize(new Dimension(panelWidth, panelHeigth));

    f.setSize(new Dimension(panelWidth, panelHeigth));
    LogoHelper.setLogo(f);
    f.setTitle("GraphView test");
    //f.setLayout(new BorderLayout());

    final GraphWithOperations gwo = new GraphWithOperations();
    final CGraph cg = new CGraph();
    final FRLayout<CNode, CEdge> layout = new FRLayout<CNode, CEdge>(gwo);
    cg.setInternalLayout(layout);
    view.setCGraph(cg);

    /*
    final JRadioButton hyperView = new JRadioButton("Hyperbolic View");
      hyperView.addItemListener(new ItemListener(){
    public void itemStateChanged(ItemEvent e) {
       ((GraphViewImpl)view).lensSupport.activate(e.getStateChange() == ItemEvent.SELECTED);
    }
      });
     */

    CadralGraphMouse gm = ((CadralGraphMouse) view.getVisualisationViewer().getGraphMouse());
    gm.setClickedGraph(gwo);

    final GraphWithOperations g = (GraphWithOperations) view.getVisualisationViewer().getModel()
            .getGraphLayout().getGraph();
    final CNode n1 = new CNode("N1");
    g.addVertex(n1);
    layout.setLocation(n1, new Point2D.Double(400, 400));
    /*
    final CNode n2 = new CNode("N2");
    g.addVertex(n2);
    final CNode n3 = new CNode("N3");
    g.addVertex(n3);
    g.addEdge(new CEdge("E1"),n1,n2,EdgeType.DIRECTED);
    layout.setLocation(n1,new Point2D.Double(250,250));
    layout.setLocation(n3,new Point2D.Double(100,250));
     */
    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());
        }
    });
    JPanel controls = new JPanel();
    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);
    JPanel modeControls = new JPanel(new BorderLayout());
    modeControls.setBorder(BorderFactory.createTitledBorder("Mouse Mode"));
    modeControls.add(gm.getModeComboBox());
    //hyperControls.add(hyperView);

    Container content = f.getContentPane();
    controls.add(zoomControls);
    // controls.add(hyperControls);
    controls.add(modeControls);
    content.add(controls, BorderLayout.SOUTH);

    //GraphZoomScrollPane gzsp = new GraphZoomScrollPane(vv);
    content.add(view.asComponent());

    //f.add(view.asComponent());
    f.setVisible(true);
    f.pack();
}

From source file:com.isencia.passerelle.hmi.generic.GenericHMI.java

private JPanel createCompositePanel(final JPanel b, final JComponent c, final String name) {
    final JPanel compositeBox = new JPanel(new VerticalLayout(5));
    int r = b.getBackground().getRed() - 20;
    if (r < 1) {
        r = 0;/*w  ww.  j  a va  2 s . c  o m*/
    }
    if (r > 254) {
        r = 255;
    }
    int g = b.getBackground().getGreen() - 20;
    if (g < 1) {
        g = 0;
    }
    if (g > 254) {
        g = 255;
    }
    int bl = b.getBackground().getBlue() - 20;
    if (bl < 1) {
        bl = 0;
    }
    if (bl > 254) {
        bl = 255;
    }

    compositeBox.setBackground(new Color(r, g, bl));
    final JPanel title = new JPanel(new BorderLayout());
    title.setBackground(new Color(r, g, bl));
    /*
     * ImageIcon icon = new ImageIcon( Toolkit .getDefaultToolkit()
     * .getImage( (getClass()
     * .getResource("/com/isencia/passerelle/hmi/resources/composite.gif"
     * )))); JLabel lab = new JLabel(icon);
     * 
     * title.add(lab, BorderLayout.LINE_START);
     */
    final JLabel lab2 = new JLabel(name);
    final Font f = lab2.getFont();
    lab2.setFont(new Font(f.getName(), f.getStyle(), f.getSize() + 6));
    lab2.setForeground(new Color(49, 106, 196));
    title.add(lab2);
    compositeBox.add(title);
    final Border loweredbevel = BorderFactory.createLoweredBevelBorder();
    final TitledBorder border = BorderFactory.createTitledBorder(loweredbevel);

    compositeBox.setBorder(border);
    compositeBox.setName(name);
    c.setBackground(new Color(r, g, bl));
    compositeBox.add(c);
    return compositeBox;
}

From source file:geovista.network.gui.NodeLinkView.java

protected void addControls(final JPanel jp) {

    // Satellite//www. j  a  v  a  2s.c  o  m
    // JComboBox modeBox = graphMouse.getModeComboBox();
    // modeBox.addItemListener(((DefaultModalGraphMouse)satellite.getGraphMouse()).getModeListener());

    // Control Panel
    jp.setBackground(Color.WHITE);
    jp.setLayout(new BorderLayout());
    jp.add(vv, BorderLayout.CENTER);
    JPanel control_panel = new JPanel(new GridLayout(5, 1));
    jp.add(control_panel, BorderLayout.EAST);

    // File_Layout Panel
    Class[] combos = getCombos();
    final JComboBox jcb = new JComboBox(combos);
    jcb.setRenderer(new DefaultListCellRenderer() {
        @Override
        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);
    final Box file_layout_panel = Box.createVerticalBox();
    file_layout_panel.setBorder(BorderFactory.createTitledBorder("File_Layout"));
    final JComboBox graph_chooser = new JComboBox(g_names);
    graph_chooser.addActionListener(new GraphChooser(jcb));
    JPanel layoutPanel = new JPanel();
    jcb.setAlignmentX(Component.CENTER_ALIGNMENT);
    layoutPanel.add(jcb);
    graph_chooser.setAlignmentX(Component.CENTER_ALIGNMENT);
    layoutPanel.add(graph_chooser);
    file_layout_panel.add(layoutPanel);

    // Basic Operation Panel

    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 reset = new JButton("reset");
    reset.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            Layout<Integer, Number> layout = vv.getGraphLayout();
            layout.initialize();
            Relaxer relaxer = vv.getModel().getRelaxer();
            if (relaxer != null) {
                relaxer.stop();
                relaxer.prerelax();
                relaxer.relax();
            }
        }
    });

    // Tranform and picking part
    final DefaultModalGraphMouse<Integer, Number> graphMouse = new DefaultModalGraphMouse<Integer, Number>();
    vv.setGraphMouse(graphMouse);
    JComboBox modeBox = graphMouse.getModeComboBox();
    modeBox.addItemListener(((DefaultModalGraphMouse<Integer, Number>) vv.getGraphMouse()).getModeListener());

    JButton collapse = new JButton("Collapse");
    JButton expand = new JButton("Expand");

    final Box basic_panel = Box.createVerticalBox();
    basic_panel.setBorder(BorderFactory.createTitledBorder("Basic_Operation"));
    JPanel zoomPanel = new JPanel();
    // plus.setAlignmentX(Component.CENTER_ALIGNMENT);
    zoomPanel.add(plus);
    // minus.setAlignmentX(Component.CENTER_ALIGNMENT);
    zoomPanel.add(minus);
    // modeBox.setAlignmentX(Component.CENTER_ALIGNMENT);
    zoomPanel.add(modeBox);
    // reset.setAlignmentX(Component.CENTER_ALIGNMENT);
    zoomPanel.add(reset);
    // collapse.setAlignmentY(Component.CENTER_ALIGNMENT);
    zoomPanel.add(collapse);
    // expand.setAlignmentY(Component.CENTER_ALIGNMENT);
    zoomPanel.add(expand);

    basic_panel.add(zoomPanel);

    // Vertex Part
    String[] vertexScoreType = { "VertexScore", "Degree", "BarycenterScorer", "BetweennessCentrality",
            "ClosenessCentrality", "DistanceCentralityScorer", "EigenvectorCentrality" };
    final JComboBox vertexScoreList = new JComboBox(vertexScoreType);
    vertexScoreList.setSelectedIndex(0);

    vertexScoreList.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            // Renderer.VertexLabel.Position position =
            // (Renderer.VertexLabel.Position)e.getItem();
            // vv.getRenderer().getVertexLabelRenderer().setPosition(position);
            if (vertexScoreList.getSelectedIndex() == 0) {

                // vertexScores = new VertexScoreTransformer<Integer,
                // Double>(voltage_scores);
                // vv.getRenderContext().setVertexShapeTransformer(new
                // ConstantTransformer(null));
                // vssa.setScaling(false);
                vv.getRenderContext().setVertexLabelTransformer(nonvertexLabel);
                vv.repaint();
            }

            if (vertexScoreList.getSelectedIndex() == 1) {
                // vertexScores = new VertexScoreTransformer<Integer,
                // Double>(degreeScorer);
                /*
                 * vssa = new
                 * VertexShapeSizeAspect<Integer,Number>((Graph<Integer
                 * ,Number>)g, transformerDegree);
                 * vv.getRenderContext().setVertexShapeTransformer(vssa);
                 * vssa.setScaling(true);
                 */

                vv.getRenderContext().setVertexLabelTransformer(vertexLabelDegree);
                vv.repaint();
            }
            if (vertexScoreList.getSelectedIndex() == 2) {
                vssa = new VertexShapeSizeAspect<Integer, Number>((Graph<Integer, Number>) g,
                        transformerBarycenter);
                vv.getRenderContext().setVertexShapeTransformer(vssa);
                vssa.setScaling(true);
                vv.getRenderContext().setVertexLabelTransformer(vertexLabelBarycenter);
                vv.repaint();
            }

            if (vertexScoreList.getSelectedIndex() == 3) {

                // betweennessCentrality= new BetweennessCentrality(g);
                // voltages = new VertexScoreTransformer<Integer,
                // Double>(betweennessCentrality);
                vssa = new VertexShapeSizeAspect<Integer, Number>((Graph<Integer, Number>) g,
                        transformerBetweenness);
                vv.getRenderContext().setVertexShapeTransformer(vssa);
                vssa.setScaling(true);
                vv.getRenderContext().setVertexLabelTransformer(vertexLabelBetweenness);
                vv.repaint();
            }
            if (vertexScoreList.getSelectedIndex() == 4) {
                vssa = new VertexShapeSizeAspect<Integer, Number>((Graph<Integer, Number>) g,
                        transformerCloseness);
                vv.getRenderContext().setVertexShapeTransformer(vssa);
                vssa.setScaling(true);
                vv.getRenderContext().setVertexLabelTransformer(vertexLabelCloseness);
                vv.repaint();
            }
            if (vertexScoreList.getSelectedIndex() == 5) {
                vssa = new VertexShapeSizeAspect<Integer, Number>((Graph<Integer, Number>) g,
                        transformerDistanceCentrality);
                vv.getRenderContext().setVertexShapeTransformer(vssa);
                vssa.setScaling(true);
                vv.getRenderContext().setVertexLabelTransformer(vertexLabelDistanceCentrality);
                vv.repaint();
            }
            if (vertexScoreList.getSelectedIndex() == 6) {
                vssa = new VertexShapeSizeAspect<Integer, Number>((Graph<Integer, Number>) g,
                        transformerEigenvector);
                vv.getRenderContext().setVertexShapeTransformer(vssa);
                vssa.setScaling(true);
                vv.getRenderContext().setVertexLabelTransformer(vertexLabelEigenvector);
                vv.repaint();
            }

        }
    });
    // cb.setSelectedItem(Renderer.VertexLabel.Position.SE);

    /*
     * v_shape = new JCheckBox("shape by degree");
     * v_shape.addActionListener(this); v_size = new
     * JCheckBox("size by vertexScores"); v_size.addActionListener(this);
     * v_size.setSelected(true); v_aspect = new
     * JCheckBox("stretch by degree ratio");
     * v_aspect.addActionListener(this);
     */
    v_small = new JCheckBox("filter when degree < " + VertexDisplayPredicate.MIN_DEGREE);
    v_small.addActionListener(this);
    e_labels = new JCheckBox("show edge labels");
    e_labels.addActionListener(this);

    // Vertex Panel
    final Box vertex_panel = Box.createVerticalBox();
    vertex_panel.setBorder(BorderFactory.createTitledBorder("Vertices"));
    // vertex_panel.add(v_stroke);
    vertex_panel.add(vertexScoreList);
    // vertex_panel.add(v_degree_labels);
    /*
     * vertex_panel.add(v_shape); vertex_panel.add(v_size);
     * vertex_panel.add(v_aspect);
     */
    vertex_panel.add(v_small);

    // Edge Part
    final Box edge_panel = Box.createVerticalBox();
    edge_panel.setBorder(BorderFactory.createTitledBorder("Edges"));
    edge_panel.add(e_labels);

    final JToggleButton groupVertices = new JToggleButton("Group Clusters");
    // Create slider to adjust the number of edges to remove when clustering
    final JSlider edgeBetweennessSlider = new JSlider(JSlider.HORIZONTAL);
    edgeBetweennessSlider.setBackground(Color.WHITE);
    edgeBetweennessSlider.setPreferredSize(new Dimension(210, 50));
    edgeBetweennessSlider.setPaintTicks(true);
    edgeBetweennessSlider.setMaximum(g.getEdgeCount());
    edgeBetweennessSlider.setMinimum(0);
    edgeBetweennessSlider.setValue(0);
    edgeBetweennessSlider.setMajorTickSpacing(10);
    edgeBetweennessSlider.setPaintLabels(true);
    edgeBetweennessSlider.setPaintTicks(true);

    // Cluster Part
    final Box cluster_panel = Box.createVerticalBox();
    cluster_panel.setBorder(BorderFactory.createTitledBorder("Cluster"));
    cluster_panel.add(edgeBetweennessSlider);

    final String COMMANDSTRING = "Edges removed for clusters: ";
    final String eastSize = COMMANDSTRING + edgeBetweennessSlider.getValue();

    final TitledBorder sliderBorder = BorderFactory.createTitledBorder(eastSize);
    cluster_panel.setBorder(sliderBorder);
    cluster_panel.add(Box.createVerticalGlue());
    groupVertices.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            clusterAndRecolor(layout, edgeBetweennessSlider.getValue(), similarColors,
                    e.getStateChange() == ItemEvent.SELECTED);
            vv.repaint();
        }
    });

    clusterAndRecolor(layout, 0, similarColors, groupVertices.isSelected());

    edgeBetweennessSlider.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            JSlider source = (JSlider) e.getSource();
            if (!source.getValueIsAdjusting()) {
                int numEdgesToRemove = source.getValue();
                clusterAndRecolor(layout, numEdgesToRemove, similarColors, groupVertices.isSelected());
                sliderBorder.setTitle(COMMANDSTRING + edgeBetweennessSlider.getValue());
                cluster_panel.repaint();
                vv.validate();
                vv.repaint();
            }
        }
    });
    cluster_panel.add(groupVertices);

    control_panel.add(file_layout_panel);
    control_panel.add(vertex_panel);
    control_panel.add(edge_panel);
    control_panel.add(cluster_panel);
    control_panel.add(basic_panel);
}