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

public CGgui() {
    //main window frame
    f.setResizable(false);//w  ww  .ja  va2s  .  c om
    f.getContentPane().setLayout(new BorderLayout());
    f.getContentPane().add(fCenter, BorderLayout.CENTER);
    f.getContentPane().add(fEast, BorderLayout.EAST);

    //menu
    mnuFile.add(mnuLoad);
    mnuLoad.add(mnuItemOpenFasta);
    mnuLoad.add(mnuItemOpenBed);
    mnuFile.add(mnuSaveData);
    mnuSaveData.add(mnuItemSavePositions);
    mnuSaveData.add(mnuItemSaveClusters);

    //mnuFile.add(mnuItemOpenDataFile);
    mnuFile.add(mnuSaveCharts);
    mnuSaveCharts.add(mnuItemSaveChrt);
    mnuSaveCharts.add(mnuItemSaveMinChrt);
    mnuSaveCharts.add(mnuItemSaveClusterChrt);
    mnuSaveCharts.add(mnuItemSaveGrayChrt);
    mnuSaveCharts.add(mnuItemSaveGrayMinChrt);
    mnuSaveCharts.add(mnuItemSaveGrayClusterChrt);
    mnuFile.add(mnuItemClearData);
    mnuFile.add(mnuItemQuit);
    mnuEdit.add(mnuItemChartProps);
    mnuEdit.add(mnuItemMinimaProps);
    mnuEdit.add(mnuItemClusterProps);
    mnuEdit.add(mnuItemFindMin);
    mnuEdit.add(mnuItemSetAxes);
    mnuEdit.add(mnuItemShowGrid);
    //   mnuHelp.add(mnuItemMan);
    //   mnuHelp.add(mnuItemAbout);
    mb.add(mnuFile);
    mb.add(mnuEdit);
    //   mb.add(mnuHelp);
    f.setJMenuBar(mb);

    //progressbar
    jprogressbar.setVisible(false);
    jprogressbar.setBorderPainted(false);
    f.getContentPane().add(jprogressbar, BorderLayout.SOUTH);

    //chart area
    //histogram
    ChartArea.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    chart = ChartFactory.createXYAreaChart("Fragment Length Histogram", "Fragment Length (l)", "Frequency f(l)",
            histogramdataset, PlotOrientation.VERTICAL, true, true, false);
    chart.addSubtitle(0, new TextTitle("n = " + CurrCG));
    XYPlot xyplot = (XYPlot) chart.getPlot();
    xyplot.setForegroundAlpha(0.85F);
    xyplot.setDomainCrosshairVisible(false);
    chartpanel = new ChartPanel(chart);
    ChartArea.add("Fragment Length", chartpanel);

    //minima
    minchart = ChartFactory.createXYLineChart("Local Minima", "Fragment Length (l)",
            "Number of Matches per Fragment", minimadataset, PlotOrientation.VERTICAL, true, true, false);
    XYPlot minxyplot = (XYPlot) minchart.getPlot();
    minxyplot.setForegroundAlpha(0.85F);
    minchartpanel = new ChartPanel(minchart);
    ChartArea.add("Minima", minchartpanel);

    //optimization
    clusterchart = ChartFactory.createScatterPlot("Average Cluster Size vs. Maximum Fragment Length",
            "Number (n) of Matches per Fragment",
            "Number of Overlapping Fragments per Cluster/Max Fragment Length", clusterdataset,
            PlotOrientation.VERTICAL, true, true, false);

    XYPlot clusterplot = (XYPlot) clusterchart.getPlot();
    clusterplot.setForegroundAlpha(0.85F);
    clusterchartpanel = new ChartPanel(clusterchart);
    ChartArea.add("Optimization", clusterchartpanel);

    //text area
    SeqText.setLineWrap(true);
    SeqText.setWrapStyleWord(true);
    SeqText.setEditable(false);
    jScrollPane.setBorder(BorderFactory
            .createCompoundBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Debug"),
                    BorderFactory.createEmptyBorder(5, 5, 5, 5)), jScrollPane.getBorder()));
    textPanel.add(jScrollPane);
    //this next line is a hack to fix the ScrollPane size when the chart is scrolled
    jScrollPane.setPreferredSize(jScrollPane.getPreferredSize());
    //auto scroll to added text
    SeqText.setAutoscrolls(true);
    jScrollPane.setAutoscrolls(true);

    //center panel layout
    GroupLayout centerlayout = new GroupLayout(fCenter);
    fCenter.setLayout(centerlayout);
    ////Create a sequential and a parallel groups
    SequentialGroup h1 = centerlayout.createSequentialGroup();
    SequentialGroup v1 = centerlayout.createSequentialGroup();
    ////grouping
    h1.addGroup(centerlayout.createParallelGroup().addComponent(ChartArea).addComponent(textPanel));
    centerlayout.setHorizontalGroup(h1);
    ////more grouping
    v1.addGroup(centerlayout.createParallelGroup().addComponent(ChartArea));
    v1.addGroup(centerlayout.createParallelGroup().addComponent(textPanel));
    centerlayout.setVerticalGroup(v1);

    //CG Panel (search settings panel)
    CGPanel.setBorder(BorderFactory.createCompoundBorder(
            BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Search Settings"),
                    BorderFactory.createEmptyBorder(5, 5, 5, 5)),
            CGPanel.getBorder()));
    //set subpanel1 layout
    GroupLayout CGsublayout1 = new GroupLayout(CGsubPanel1);
    CGsubPanel1.setLayout(CGsublayout1);
    ////Create a sequential and a parallel groups
    SequentialGroup h4 = CGsublayout1.createSequentialGroup();
    SequentialGroup v4 = CGsublayout1.createSequentialGroup();
    ////grouping
    h4.addGroup(CGsublayout1.createParallelGroup().addComponent(searchPatternLabel).addComponent(minCGsLabel)
            .addComponent(maxCGsLabel).addComponent(CGstepLabel).addComponent(smoothCheckBox)
            .addComponent(CGApplyButton).addComponent(CGsetCurrLabel));
    h4.addGroup(CGsublayout1.createParallelGroup().addComponent(searchPatternText).addComponent(minCGsText)
            .addComponent(maxCGsText).addComponent(CGstepText).addComponent(smoothText)
            .addComponent(CGResetButton).addComponent(CGcurrText));
    CGsublayout1.setHorizontalGroup(h4);
    ////more grouping
    v4.addGroup(CGsublayout1.createParallelGroup(GroupLayout.Alignment.BASELINE)
            .addComponent(searchPatternLabel).addComponent(searchPatternText));
    v4.addContainerGap(5, 5);
    v4.addGroup(CGsublayout1.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(minCGsLabel)
            .addComponent(minCGsText));
    v4.addContainerGap(5, 5);
    v4.addGroup(CGsublayout1.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(maxCGsLabel)
            .addComponent(maxCGsText));
    v4.addContainerGap(5, 5);
    v4.addGroup(CGsublayout1.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(CGstepLabel)
            .addComponent(CGstepText));
    v4.addContainerGap(5, 5);
    v4.addGroup(CGsublayout1.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(smoothCheckBox)
            .addComponent(smoothText));
    v4.addContainerGap(5, 5);
    v4.addGroup(CGsublayout1.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(CGApplyButton)
            .addComponent(CGResetButton));
    v4.addContainerGap(15, 15);
    v4.addGroup(CGsublayout1.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(CGsetCurrLabel)
            .addComponent(CGcurrText));
    CGsublayout1.setVerticalGroup(v4);

    //set subpanel2 layout
    GroupLayout CGsublayout2 = new GroupLayout(CGsubPanel2);
    CGsubPanel2.setLayout(CGsublayout2);
    ////Create a sequential and a parallel groups
    SequentialGroup hSettingsSub2 = CGsublayout2.createSequentialGroup();
    SequentialGroup vSettingsSub2 = CGsublayout2.createSequentialGroup();

    ////horizontal grouping
    hSettingsSub2.addGroup(CGsublayout2.createParallelGroup().addComponent(CGsetCurrLabel));
    hSettingsSub2.addContainerGap(25, 25);
    hSettingsSub2.addGroup(CGsublayout2.createParallelGroup().addComponent(CGcurrText));
    hSettingsSub2.addContainerGap(25, 25);
    hSettingsSub2.addGroup(CGsublayout2.createParallelGroup().addComponent(CGsetCurrButton));
    CGsublayout2.setHorizontalGroup(hSettingsSub2);
    ////vertical grouping
    vSettingsSub2.addGroup(CGsublayout2.createParallelGroup(GroupLayout.Alignment.BASELINE)
            .addComponent(CGsetCurrLabel).addComponent(CGcurrText).addComponent(CGsetCurrButton));
    CGsublayout2.setVerticalGroup(vSettingsSub2);

    //set overall layout (subpanel3)
    GroupLayout CGsublayout3 = new GroupLayout(CGsubPanel3);
    CGsubPanel3.setLayout(CGsublayout3);
    ////Create a sequential and a parallel groups
    SequentialGroup h5 = CGsublayout3.createSequentialGroup();
    SequentialGroup v5 = CGsublayout3.createSequentialGroup();
    ////grouping
    h5.addGroup(CGsublayout3.createParallelGroup().addComponent(caseCheckBox).addComponent(CGsubPanel1)
            .addComponent(CGsubPanel2));
    CGsublayout3.setHorizontalGroup(h5);
    ////more grouping
    v5.addGroup(CGsublayout3.createParallelGroup().addComponent(caseCheckBox));
    v5.addContainerGap(5, 5);
    v5.addGroup(CGsublayout3.createParallelGroup().addComponent(CGsubPanel1));
    v5.addContainerGap(5, 5);
    v5.addGroup(CGsublayout3.createParallelGroup().addComponent(CGsubPanel2));
    CGsublayout3.setVerticalGroup(v5);
    //add to resizable container
    CGPanel.add(CGsubPanel3);
    //button and slider listeners
    CGApplyButton.addActionListener(new ListenCGApplyButton());
    CGResetButton.addActionListener(new ListenCGResetButton());
    CGsetCurrButton.addActionListener(new ListenCGsetCurrButton());
    CGcurrText.addActionListener(new ListenCGsetCurrButton());

    //minimum area
    findminPanel.setVisible(true);
    findminPanel.setBorder(BorderFactory.createCompoundBorder(
            BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Find Minimum"),
                    BorderFactory.createEmptyBorder(5, 5, 5, 5)),
            findminPanel.getBorder()));
    GroupLayout minlayout = new GroupLayout(findminPanel);
    findminPanel.setLayout(minlayout);

    ////Create a sequential and a parallel groups
    SequentialGroup h2 = minlayout.createSequentialGroup();
    SequentialGroup v2 = minlayout.createSequentialGroup();

    ////group find minimum and find all buttons
    SequentialGroup hFindMinButtons = minlayout.createSequentialGroup();
    SequentialGroup vFindMinButtons = minlayout.createSequentialGroup();
    hFindMinButtons.addGroup(minlayout.createParallelGroup().addComponent(CalcButton));
    hFindMinButtons.addGroup(minlayout.createParallelGroup().addComponent(CalcAllButton));
    vFindMinButtons.addGroup(minlayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
            .addComponent(CalcButton).addComponent(CalcAllButton));
    ////general grouping
    h2.addGroup(minlayout.createParallelGroup().addComponent(minLabel).addComponent(maxLabel)
            .addComponent(ClearButton));
    h2.addContainerGap(5, 5);
    h2.addGroup(minlayout.createParallelGroup().addComponent(minText).addComponent(maxText)
            .addGroup(hFindMinButtons));
    h2.addContainerGap(5, 5);
    h2.addGroup(minlayout.createParallelGroup().addComponent(minGrabButton).addComponent(maxGrabButton)
            .addComponent(CancelButton));
    minlayout.setHorizontalGroup(h2);
    ////more grouping
    v2.addGroup(minlayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(minLabel)
            .addComponent(minText).addComponent(minGrabButton));
    v2.addContainerGap(5, 5);
    v2.addGroup(minlayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(maxLabel)
            .addComponent(maxText).addComponent(maxGrabButton));
    v2.addContainerGap(5, 5);
    v2.addContainerGap(5, 5);
    v2.addGroup(minlayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(ClearButton)
            .addGroup(vFindMinButtons).addComponent(CancelButton));
    minlayout.setVerticalGroup(v2);
    //add button listeners
    ClearButton.addActionListener(new ListenClearButton());
    CalcButton.addActionListener(new ListenCalcButton());
    CalcAllButton.addActionListener(new ListenCalcAllButton());
    CancelButton.addActionListener(new ListenCancelButton());
    minGrabButton.addActionListener(new ListenminGrabButton());
    maxGrabButton.addActionListener(new ListenmaxGrabButton());

    //axes panel
    mnuItemSetAxes.setState(false);
    setaxesPanel.setVisible(false);
    setaxesPanel.setBorder(BorderFactory.createCompoundBorder(
            BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Set Domain"),
                    BorderFactory.createEmptyBorder(5, 5, 5, 5)),
            setaxesPanel.getBorder()));
    GroupLayout setaxeslayout = new GroupLayout(setaxesPanel);
    setaxesPanel.setLayout(setaxeslayout);
    ////Create a sequential and a parallel groups
    SequentialGroup h6 = setaxeslayout.createSequentialGroup();
    SequentialGroup v6 = setaxeslayout.createSequentialGroup();
    ////grouping
    h6.addGroup(setaxeslayout.createParallelGroup().addComponent(mindomainLabel).addComponent(maxdomainLabel)
            .addComponent(SetDomainButton));
    h6.addContainerGap(5, 5);
    h6.addGroup(setaxeslayout.createParallelGroup().addComponent(mindomainText).addComponent(maxdomainText)
            .addComponent(ResetDomainButton));
    setaxeslayout.setHorizontalGroup(h6);
    ////more grouping
    v6.addGroup(setaxeslayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(mindomainLabel)
            .addComponent(mindomainText));
    v6.addContainerGap(5, 5);
    v6.addGroup(setaxeslayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(maxdomainLabel)
            .addComponent(maxdomainText));
    v6.addContainerGap(5, 5);
    v6.addGroup(setaxeslayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(SetDomainButton)
            .addComponent(ResetDomainButton));
    setaxeslayout.setVerticalGroup(v6);
    //add button listeners
    SetDomainButton.addActionListener(new ListenSetDomainButton());
    ResetDomainButton.addActionListener(new ListenResetDomainButton());

    //east panel layout
    GroupLayout eastlayout = new GroupLayout(fEast);
    fEast.setLayout(eastlayout);
    ////Create a sequential and a parallel groups
    SequentialGroup h3 = eastlayout.createSequentialGroup();
    SequentialGroup v3 = eastlayout.createSequentialGroup();
    ////grouping
    h3.addGroup(eastlayout.createParallelGroup().addComponent(CGPanel).addComponent(findminPanel)
            .addComponent(setaxesPanel));
    eastlayout.setHorizontalGroup(h3);
    ////more grouping
    v3.addGroup(eastlayout.createParallelGroup().addComponent(CGPanel));
    v3.addGroup(eastlayout.createParallelGroup().addComponent(findminPanel));
    v3.addGroup(eastlayout.createParallelGroup().addComponent(setaxesPanel));
    eastlayout.setVerticalGroup(v3);

    //listen for exit signals
    f.addWindowListener(new ListenCloseWdw());
    mnuItemQuit.addActionListener(new ListenMenuQuit());

    //listen for exit signals
    f.addWindowListener(new ListenCloseWdw());
    mnuItemClearData.addActionListener(new ListenClearData());

    //listen for open signal
    mnuItemOpenFasta.addActionListener(new ListenMenuOpenFasta());

    //listen for open signal
    mnuItemOpenBed.addActionListener(new ListenMenuOpenBed());

    //listen for save position signal
    mnuItemSavePositions.addActionListener(new ListenMenuSavePositions());

    //listen for save cluster signal
    mnuItemSaveClusters.addActionListener(new ListenMenuSaveClusters());

    //listen for save histogram chart signal
    mnuItemSaveChrt.addActionListener(new ListenMenuSaveChrt());

    //listen for save chart signal
    mnuItemSaveMinChrt.addActionListener(new ListenMenuSaveMinChrt());

    //listen for save cluster chart signal
    mnuItemSaveClusterChrt.addActionListener(new ListenMenuSaveClusterChrt());

    //listen for save histogram chart in grayscale signal;
    mnuItemSaveGrayChrt.addActionListener(new ListenMenuSaveGrayChrt());

    //listen for save chart signal
    mnuItemSaveGrayMinChrt.addActionListener(new ListenMenuSaveGrayMinChrt());

    //listen for save cluster chart signal
    mnuItemSaveGrayClusterChrt.addActionListener(new ListenMenuSaveGrayClusterChrt());

    //listen for edit histogram properties signal
    mnuItemChartProps.addActionListener(new ListenMenuChartProps());

    //listen for edit minima chart properties signal
    mnuItemMinimaProps.addActionListener(new ListenMenuMinimaProps());

    //listen for edit optimization chart properties signal
    mnuItemClusterProps.addActionListener(new ListenMenuClusterProps());

    //listen for find minimum signal
    mnuItemFindMin.addActionListener(new ListenMenuFindMin());

    //listen for find minimum signal
    mnuItemSetAxes.addActionListener(new ListenMenuSetAxes());

    //listen for show gridlines
    mnuItemShowGrid.addActionListener(new ListenMenuShowGrid());

    //other menu items

    //garbage collect
    //System.gc();
}

From source file:es.urjc.ia.fia.genericSearch.statistics.JUNGStatistics.java

@Override
public void showStatistics() {

    // Layout: tree and radial
    treeLayout = new TreeLayout<AuxVertex, ACTION>(this.tree, 35, 100);
    radialLayout = new RadialTreeLayout<AuxVertex, ACTION>(this.tree, 35, 130);

    radialLayout.setSize(new Dimension(200 * (this.tree.getHeight() + 1), 200 * (this.tree.getHeight() + 1)));

    // The BasicVisualizationServer<V,E> is parameterized by the edge types
    vv = new VisualizationViewer<AuxVertex, ACTION>(treeLayout);
    vv.setPreferredSize(new Dimension(800, 600)); //Sets the viewing area size
    vv.setBackground(Color.white); // Background color

    vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<AuxVertex>());
    vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line<AuxVertex, ACTION>());

    // Setup up a new vertex to paint transformer
    Transformer<AuxVertex, Paint> vertexPaint = new Transformer<AuxVertex, Paint>() {
        @Override/*from w  w w  .  ja v a  2  s  .  c o  m*/
        public Paint transform(AuxVertex arg0) {
            if (arg0.getState().isSolution() && arg0.isExplored()) {
                return Color.GREEN;
            } else if (arg0.isExplored()) {
                return Color.CYAN;
            } else if (arg0.isDuplicated()) {
                return Color.GRAY;
            } else {
                return Color.WHITE;
            }
        }
    };

    // Tooltip for vertex
    Transformer<AuxVertex, String> toolTipsState = new Transformer<AuxVertex, String>() {

        @Override
        public String transform(AuxVertex arg0) {
            String sortInfo = "";
            if (arg0.isExplored()) {
                if (arg0.getState().isSolution() && arg0.isExplored()) {
                    sortInfo = "<u><i>Solution state " + arg0.getExplored() + "</i></u>";
                } else {
                    sortInfo = "<u><i>Explored state " + arg0.getExplored() + "</i></u>";
                }
            } else if (arg0.isDuplicated()) {
                sortInfo = "<u><i>Duplicated state </i></u>";
            } else {
                sortInfo = "<u><i>Unexplored state</i></u>";
            }
            return "<html><p>" + sortInfo + "</p>" + "<p>State: " + arg0.getState().toString() + "</p>"
                    + "<p>Cost: " + arg0.getState().getSolutionCost() + "</p></html>";
        }

    };
    vv.setVertexToolTipTransformer(toolTipsState);

    // Tooltip for edge
    Transformer<ACTION, String> toolTipsAction = new Transformer<ACTION, String>() {

        @Override
        public String transform(ACTION arg0) {
            return "Cost: " + arg0.cost();
        }

    };
    vv.setEdgeToolTipTransformer(toolTipsAction);

    vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line<AuxVertex, ACTION>());
    vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller<ACTION>());

    vv.getRenderContext().setVertexFillPaintTransformer(vertexPaint);
    vv.getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR);

    // Create a graph mouse and add it to the visualization component
    DefaultModalGraphMouse<State<ACTION>, ACTION> gm = new DefaultModalGraphMouse<State<ACTION>, ACTION>();
    gm.setMode(ModalGraphMouse.Mode.TRANSFORMING);
    vv.setGraphMouse(gm);
    vv.addKeyListener(gm.getModeKeyListener());

    JFrame vFrame = new JFrame("Statistics Tree View");
    vFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    /*
    vFrame.getContentPane().add(vv);
    vFrame.pack();
    vFrame.setVisible(true);
    */

    rings = new Rings();
    Container content = vFrame.getContentPane();
    final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv);
    content.add(panel);

    JComboBox modeBox = gm.getModeComboBox();
    modeBox.addItemListener(gm.getModeListener());
    gm.setMode(ModalGraphMouse.Mode.TRANSFORMING);

    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() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1 / 1.1f, vv.getCenter());
        }
    });

    JToggleButton radial = new JToggleButton("Radial");
    radial.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {

                LayoutTransition<AuxVertex, ACTION> lt = new LayoutTransition<AuxVertex, ACTION>(vv, treeLayout,
                        radialLayout);
                Animator animator = new Animator(lt);
                animator.start();
                vv.getRenderContext().getMultiLayerTransformer().setToIdentity();
                vv.addPreRenderPaintable(rings);
            } else {
                LayoutTransition<AuxVertex, ACTION> lt = new LayoutTransition<AuxVertex, ACTION>(vv,
                        radialLayout, treeLayout);
                Animator animator = new Animator(lt);
                animator.start();
                vv.getRenderContext().getMultiLayerTransformer().setToIdentity();
                vv.removePreRenderPaintable(rings);
            }
            vv.repaint();
        }
    });

    JPanel scaleGrid = new JPanel(new GridLayout(1, 0));
    scaleGrid.setBorder(BorderFactory.createTitledBorder("Zoom"));

    /*
     * Statistics 
     */
    JLabel stats = new JLabel();
    long totalTime = endTime.getTime() - initTime.getTime();
    stats.setText("<html>" + "<b>Total States:</b> " + this.totalStates + "<br>" + "<b>Explored States:</b> "
            + this.explorerStates + "<br>" + "<b>Duplicated States (detected):</b> " + this.duplicatedStates
            + "<br>" + "<b>Solution States:</b> " + this.solutionStates + "<br>" + "<b>Total time: </b>"
            + totalTime + " milliseconds" + "</html>");

    JPanel legend = new JPanel();
    legend.setLayout(new BoxLayout(legend, BoxLayout.Y_AXIS));

    JLabel len = new JLabel("<html><b>Lengend</b></html>");
    JLabel lexpl = new JLabel("Explored state");
    lexpl.setBackground(Color.CYAN);
    lexpl.setOpaque(true);
    JLabel lune = new JLabel("Unexplored state");
    lune.setBackground(Color.WHITE);
    lune.setOpaque(true);
    JLabel ldupl = new JLabel("Duplicated state");
    ldupl.setBackground(Color.GRAY);
    ldupl.setOpaque(true);
    JLabel lsol = new JLabel("Solution state");
    lsol.setBackground(Color.GREEN);
    lsol.setOpaque(true);

    legend.add(len);
    legend.add(lexpl);
    legend.add(lune);
    legend.add(ldupl);
    legend.add(lsol);

    JPanel controls = new JPanel();
    controls.add(stats);
    scaleGrid.add(plus);
    scaleGrid.add(minus);
    controls.add(radial);
    controls.add(scaleGrid);
    //controls.add(modeBox);
    controls.add(legend);

    content.add(controls, BorderLayout.SOUTH);

    vFrame.pack();
    vFrame.setVisible(true);
}

From source file:davmail.ui.SettingsFrame.java

protected JPanel getProxyPanel() {
    JPanel proxyPanel = new JPanel(new GridLayout(7, 2));
    proxyPanel.setBorder(BorderFactory.createTitledBorder(BundleMessage.format("UI_PROXY")));

    boolean useSystemProxies = Settings.getBooleanProperty("davmail.useSystemProxies", Boolean.FALSE);
    boolean enableProxy = Settings.getBooleanProperty("davmail.enableProxy");
    useSystemProxiesField = new JCheckBox();
    useSystemProxiesField.setSelected(useSystemProxies);
    enableProxyField = new JCheckBox();
    enableProxyField.setSelected(enableProxy);
    httpProxyField = new JTextField(Settings.getProperty("davmail.proxyHost"), 15);
    httpProxyPortField = new JTextField(Settings.getProperty("davmail.proxyPort"), 4);
    httpProxyUserField = new JTextField(Settings.getProperty("davmail.proxyUser"), 10);
    httpProxyPasswordField = new JPasswordField(Settings.getProperty("davmail.proxyPassword"), 10);
    noProxyForField = new JTextField(Settings.getProperty("davmail.noProxyFor"), 15);

    enableProxyField.setEnabled(!useSystemProxies);
    httpProxyField.setEnabled(enableProxy);
    httpProxyPortField.setEnabled(enableProxy);
    httpProxyUserField.setEnabled(enableProxy || useSystemProxies);
    httpProxyPasswordField.setEnabled(enableProxy || useSystemProxies);
    noProxyForField.setEnabled(enableProxy || useSystemProxies);

    useSystemProxiesField.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            boolean newUseSystemProxies = useSystemProxiesField.isSelected();
            boolean newEnableProxy = enableProxyField.isSelected();
            enableProxyField.setEnabled(!newUseSystemProxies);
            httpProxyField.setEnabled(!newUseSystemProxies && newEnableProxy);
            httpProxyPortField.setEnabled(!newUseSystemProxies && newEnableProxy);
            httpProxyUserField.setEnabled(newUseSystemProxies || newEnableProxy);
            httpProxyPasswordField.setEnabled(newUseSystemProxies || newEnableProxy);
            noProxyForField.setEnabled(newUseSystemProxies || newEnableProxy);
        }//ww w .  j  a  v a2s  . c  o  m
    });
    enableProxyField.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            boolean newEnableProxy = enableProxyField.isSelected();
            httpProxyField.setEnabled(newEnableProxy);
            httpProxyPortField.setEnabled(newEnableProxy);
            httpProxyUserField.setEnabled(newEnableProxy);
            httpProxyPasswordField.setEnabled(newEnableProxy);
            noProxyForField.setEnabled(newEnableProxy);
        }
    });

    addSettingComponent(proxyPanel, BundleMessage.format("UI_USE_SYSTEM_PROXIES"), useSystemProxiesField);
    addSettingComponent(proxyPanel, BundleMessage.format("UI_ENABLE_PROXY"), enableProxyField);
    addSettingComponent(proxyPanel, BundleMessage.format("UI_PROXY_SERVER"), httpProxyField);
    addSettingComponent(proxyPanel, BundleMessage.format("UI_PROXY_PORT"), httpProxyPortField);
    addSettingComponent(proxyPanel, BundleMessage.format("UI_PROXY_USER"), httpProxyUserField);
    addSettingComponent(proxyPanel, BundleMessage.format("UI_PROXY_PASSWORD"), httpProxyPasswordField);
    addSettingComponent(proxyPanel, BundleMessage.format("UI_NO_PROXY"), noProxyForField);
    updateMaximumSize(proxyPanel);
    return proxyPanel;
}

From source file:org.fhcrc.cpl.viewer.quant.gui.ProteinQuantSummaryFrame.java

License:asdf

/**
 * Initialize the GUI components// ww  w. j  a va  2s.  co  m
 */
protected void initGUI() {
    //Global stuff
    setSize(fullWidth, fullHeight);

    eventPropertiesTable = new QuantEvent.QuantEventPropertiesTable();
    eventPropertiesTable.setVisible(true);
    JScrollPane eventPropsScrollPane = new JScrollPane();
    eventPropsScrollPane.setViewportView(eventPropertiesTable);
    eventPropsScrollPane.setSize(propertiesWidth, propertiesHeight);
    eventPropertiesDialog = new JDialog(this, "Event Properties");
    eventPropertiesDialog.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
    eventPropertiesDialog.setSize(propertiesWidth, propertiesHeight);
    eventPropertiesDialog.setContentPane(eventPropsScrollPane);

    ListenerHelper helper = new ListenerHelper(this);
    setTitle("Protein Summary");
    setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.BOTH;
    gbc.anchor = GridBagConstraints.PAGE_START;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.insets = new Insets(5, 5, 5, 5);
    gbc.weighty = 1;
    gbc.weightx = 1;

    try {
        (getOwner()).setIconImage(ImageIO.read(WorkbenchFrame.class.getResourceAsStream("icon.gif")));
    } catch (Exception e) {
    }

    try {
        Localizer.renderSwixml("org/fhcrc/cpl/viewer/quant/gui/ProteinQuantSummaryFrame.xml", this);
        assert null != contentPanel;
        setContentPane(contentPanel);
    } catch (Exception x) {
        ApplicationContext.errorMessage("error creating dialog", x);
        throw new RuntimeException(x);
    }

    buttonSelectAllVisible.setEnabled(false);
    helper.addListener(buttonSelectAllVisible, "buttonSelectAllVisible_actionPerformed");
    buttonDeselectAll.setEnabled(false);
    helper.addListener(buttonDeselectAll, "buttonDeselectAll_actionPerformed");

    buildTurkHITsButton.setEnabled(false);
    helper.addListener(buildTurkHITsButton, "buttonBuildTurkHITs_actionPerformed");
    loadSelectedEventsButton.setEnabled(false);
    helper.addListener(loadSelectedEventsButton, "buttonLoadSelected_actionPerformed");
    autoAssessSelectedEventsButton.setEnabled(false);
    helper.addListener(autoAssessSelectedEventsButton, "buttonAutoAssess_actionPerformed");

    showPropertiesButton.setEnabled(false);
    helper.addListener(showPropertiesButton, "buttonShowProperties_actionPerformed");
    showProteinRatiosButton.setEnabled(false);
    helper.addListener(showProteinRatiosButton, "buttonShowProteinRatios_actionPerformed");

    //summary panel
    summaryPanel.setBorder(BorderFactory.createLineBorder(Color.gray));
    summaryPanel.setPreferredSize(new Dimension(fullWidth, summaryPanelHeight));
    summaryPanel.setMinimumSize(new Dimension(200, summaryPanelHeight));
    gbc.fill = GridBagConstraints.NONE;

    gbc.gridwidth = 1;
    summaryPanel.add(buttonSelectAllVisible, gbc);
    summaryPanel.add(buttonDeselectAll, gbc);
    gbc.gridwidth = GridBagConstraints.RELATIVE;
    summaryPanel.add(showPropertiesButton, gbc);
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    summaryPanel.add(showProteinRatiosButton, gbc);

    gbc.gridwidth = 1;

    summaryPanel.add(loadSelectedEventsButton, gbc);
    gbc.gridwidth = GridBagConstraints.RELATIVE;
    summaryPanel.add(autoAssessSelectedEventsButton, gbc);
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    summaryPanel.add(buildTurkHITsButton, gbc);

    gbc.fill = GridBagConstraints.BOTH;

    eventsScrollPane = new JScrollPane();
    eventsScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    eventsScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);

    eventsPanel = new JPanel();
    eventsPanel.setLayout(new GridBagLayout());

    eventsTable = new QuantEventsSummaryTable();
    eventsTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    eventsTable.getSelectionModel().addListSelectionListener(new EventsTableListSelectionHandler());
    eventsScrollPane.setViewportView(eventsTable);
    eventsScrollPane.setMinimumSize(new Dimension(400, 400));

    gbc.insets = new Insets(0, 0, 0, 0);
    mainPanel.add(eventsScrollPane, gbc);

    logRatioHistogramPanel = new PanelWithLogRatioHistAndFields();
    logRatioHistogramPanel.setBorder(BorderFactory.createTitledBorder("Log Ratios"));
    logRatioHistogramPanel.setPreferredSize(new Dimension(width - 10, 300));
    gbc.fill = GridBagConstraints.BOTH;
    gbc.weighty = 100;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    add(logRatioHistogramPanel, gbc);

    //status message
    messageLabel = new JLabel();
    messageLabel.setBackground(Color.WHITE);
    messageLabel.setFont(Font.decode("verdana plain 12"));
    messageLabel.setText(" ");
    statusPanel = new JPanel();
    gbc.weighty = 1;
    statusPanel.setPreferredSize(new Dimension(width - 10, 50));
    statusPanel.add(messageLabel, gbc);
    add(statusPanel, gbc);

    //per-protein event summary table; disembodied
    //todo: move this into its own class? it's getting kind of complicated
    proteinRatiosTable = new JTable();
    proteinRatiosTable.setVisible(true);
    ListSelectionModel proteinTableSelectionModel = proteinRatiosTable.getSelectionModel();
    proteinTableSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    proteinTableSelectionModel.addListSelectionListener(new ProteinTableListSelectionHandler());
    JScrollPane proteinRatiosScrollPane = new JScrollPane();
    proteinRatiosScrollPane.setViewportView(proteinRatiosTable);
    proteinRatiosScrollPane.setPreferredSize(new Dimension(proteinDialogWidth,
            proteinDialogHeight - PROTEINTABLE_HISTPANEL_HEIGHT - PROTEINTABLE_SCATTERPLOTPANEL_HEIGHT - 70));
    proteinRatiosDialog = new JDialog(this, "Protein Ratios");
    proteinRatiosDialog.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
    proteinRatiosDialog.setSize(proteinDialogWidth, proteinDialogHeight);
    JPanel proteinRatiosContentPanel = new JPanel();
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.fill = GridBagConstraints.BOTH;
    proteinRatiosContentPanel.add(proteinRatiosScrollPane, gbc);
    proteinRatiosDialog.setContentPane(proteinRatiosContentPanel);
    perProteinLogRatioHistogramPanel = new PanelWithLogRatioHistAndFields();
    perProteinLogRatioHistogramPanel.addRangeUpdateListener(new ProteinTableLogRatioHistogramListener());

    perProteinLogRatioHistogramPanel.setBorder(BorderFactory.createTitledBorder("Log Ratios"));
    perProteinLogRatioHistogramPanel
            .setPreferredSize(new Dimension(proteinDialogWidth - 10, PROTEINTABLE_HISTPANEL_HEIGHT));
    gbc.fill = GridBagConstraints.BOTH;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    proteinRatiosDialog.add(perProteinLogRatioHistogramPanel, gbc);

    perProteinPeptideLogRatioPanel = new JPanel();
    perProteinPeptideLogRatioPanel.setBorder(BorderFactory.createTitledBorder("By Peptide"));
    perProteinPeptideLogRatioPanel
            .setPreferredSize(new Dimension(proteinDialogWidth - 10, PROTEINTABLE_SCATTERPLOTPANEL_HEIGHT));
    proteinRatiosDialog.add(perProteinPeptideLogRatioPanel, gbc);
}

From source file:edu.pdi2.visual.PDI.java

private void initGUI() {
    try {//  www. java 2s  . c om
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        getContentPane().setLayout(null);

        this.setTitle("Procesamiento Digital de Imagenes"); //$NON-NLS-1$
        getContentPane().setBackground(new java.awt.Color(212, 208, 200));
        this.setResizable(false);
        this.addFocusListener(new FocusAdapter() {
            public void focusGained(FocusEvent evt) {
                thisFocusGained(evt);
            }
        });
        {
            jMenuBar1 = new JMenuBar();
            setJMenuBar(jMenuBar1);
            {
                jMenu1 = new JMenu();
                jMenuBar1.add(jMenu1);
                jMenu1.setText("File"); //$NON-NLS-1$
                {
                    jMenuItem1 = new JMenuItem();
                    // jMenu1.add(jMenuItem1);
                    jMenu1.add(getJMenuOpenImage());
                    jMenu1.add(getJSeparator1());
                    jMenu1.add(getJMenuItemExit());

                    jMenuItem1.setText("Open Image"); //$NON-NLS-1$
                    jMenuItem1.addMouseListener(new MouseAdapter() {
                        public void mouseReleased(MouseEvent evt) {
                            jMenuItem1MouseReleased(evt);
                        }

                    });
                }
            }
            {
                jMenu3 = new JMenu();
                jMenuBar1.add(jMenu3);
                jMenuBar1.add(getJMenuView());
                jMenu3.setText("Options"); //$NON-NLS-1$
                jMenu3.setEnabled(false);
                {
                    jMenuItem3 = new JMenuItem();
                    jMenu3.add(getJMenuItem2());
                    jMenu3.add(jMenuItem3);
                    jMenuItem3.setText("False Color Image"); //$NON-NLS-1$
                    jMenuItem3.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            menuFalseColorActionPerformed(evt);
                        }
                    });
                }
                {
                    jMenuItem4 = new JMenuItem();
                    jMenu3.add(jMenuItem4);
                    jMenuItem4.setText("Mesh"); //$NON-NLS-1$
                    jMenuItem4.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            jMenuItem4ActionPerformed(evt);
                        }
                    });
                }
                {
                    jMenu4 = new JMenu();
                    jMenu3.add(jMenu4);
                    jMenu3.add(getJMenuItem5());
                    jMenu3.add(getJGenerarSignature());
                    jMenu4.setText("Image"); //$NON-NLS-1$
                    {
                        jmiCorrectedReflectance = new JMenuItem();
                        jMenu4.add(jmiCorrectedReflectance);
                        jmiCorrectedReflectance.setText("Corrected Reflectance"); //$NON-NLS-1$
                        jmiCorrectedReflectance.setAccelerator(KeyStroke.getKeyStroke("ctrl pressed 1")); //$NON-NLS-1$
                        jmiCorrectedReflectance.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                jmiCorrectedRadianceActionPerformed(evt);
                            }
                        });
                    }
                    {
                        jmiCorrectedRadiance = new JMenuItem();
                        jMenu4.add(jmiCorrectedRadiance);
                        jmiCorrectedRadiance.setText("Corrected Radiance"); //$NON-NLS-1$
                        jmiCorrectedRadiance.setAccelerator(KeyStroke.getKeyStroke("ctrl pressed 2"));
                        jmiCorrectedRadiance.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                jmiCorrectedReflectanceActionPerformed(evt);
                            }
                        });
                    }
                }
            }
        }
        // First we create the instance of DisplayThumbnail with a 0.1
        // scale.
        // dt.setBorder(BorderFactory.createTitledBorder(""));
        // We must register mouse motion listeners to it !

        // Now we create the instance of DisplayJAI to show the region
        // corresponding to the viewport.

        // Set it size.
        {
            image = new JPanel();

            getContentPane().add(image);
            image.setBounds(1, 10, 590, dHeight + 10);
            {
                dj = new DisplayJAIWithAnnotations();
                image.add(dj);
                dj.setBounds(0, 0, dWidth, dHeight);
                dj.setPreferredSize(new Dimension(dWidth, dHeight));
                dj.setMinimumSize(new Dimension(dWidth, dHeight));
                dj.setMaximumSize(new Dimension(dWidth, dHeight));
                dj.setBorder(BorderFactory.createTitledBorder(""));
                dj.addMouseListener(new MouseAdapter() {
                    public void mousePressed(MouseEvent evt) {
                        djMousePressed(evt);
                    }
                });
                dj.addMouseMotionListener(new MouseMotionAdapter() {
                    public void mouseMoved(MouseEvent evt) {
                        djMouseMoved(evt);
                    }

                    public void mouseDragged(MouseEvent evt) {
                        djMouseDragged(evt);
                    }
                });
            }
            getContentPane().add(getLatLon());
        }

        pack();
        this.setSize(604, 579);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:br.edu.unifei.mestrado.view.GraphPartitioningVisualization.java

private void createView(final int partitions) {

    clusterer = new PartitionClusterer(partitions);

    final Graph<NodeWrapper, EdgeWrapper> graph = getGraph();

    // Create a simple layout frame
    // specify the Fruchterman-Rheingold layout algorithm
    layout = new AggregateLayout<NodeWrapper, EdgeWrapper>(new FRLayout<NodeWrapper, EdgeWrapper>(graph));

    vv = new VisualizationViewer<NodeWrapper, EdgeWrapper>(layout);
    vv.setBackground(Color.white);

    if (vertexLabelTransformer == null) {
        vertexLabelTransformer = new Transformer<NodeWrapper, String>() {
            @Override/*from  w ww .  j a  v  a  2 s  .c  o  m*/
            public String transform(NodeWrapper v) {
                // TODO: voltar o D quando necessrio
                return "V" + v.getId() + ":" + v.getWeight();// + ":" +
                // v.getD();
            }
        };
    }
    vv.getRenderContext().setVertexLabelTransformer(vertexLabelTransformer);

    // MapTransformer.<NodeWrapper, String>
    // getInstance(LazyMap.<NodeWrapper, String> decorate(
    // new HashMap<NodeWrapper, String>(), new
    // ToStringLabeller<NodeWrapper>())));
    vv.getRenderContext().setEdgeLabelTransformer(edgeLabelTransformer);

    // UTIL: Alguma coisa, talvez o LazyMap no estava repintando a aresta
    // com o peso alterado

    // MapTransformer.<EdgeWrapper, String>
    // getInstance(LazyMap.<EdgeWrapper, String> decorate(
    // new HashMap<EdgeWrapper, String>(), new
    // ToStringLabeller<EdgeWrapper>() {
    // @Override
    // public String transform(EdgeWrapper v) {
    // logger.warn("A:" + v.getId() + ":" + v.getWeight());
    // return "A:" + v.getId() + ":" + v.getWeight();
    // }
    // })));
    // Tell the renderer to use our own customized color rendering

    vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line<NodeWrapper, EdgeWrapper>());

    vv.getRenderContext().setVertexShapeTransformer(vertexShapeTransformer);
    vv.getRenderContext().setVertexFillPaintTransformer(vertexFillPaintTransformer);
    vv.getRenderContext().setVertexDrawPaintTransformer(vertexDrawPaintTransformer);
    vv.getRenderContext().setVertexStrokeTransformer(vertexStrokeTransformer);

    vv.getRenderContext().setEdgeDrawPaintTransformer(new Transformer<EdgeWrapper, Paint>() {

        // UTIL: Define as cores das arestas
        @Override
        public Paint transform(EdgeWrapper linkToProcess) {
            // if para mostrar arestas com as duas pontas no mesmo vertices
            if (linkToProcess.getStartNode().getId() == linkToProcess.getEndNode().getId()) {
                return Color.red;
            }
            Set<NodeWrapper> nodes = vv.getPickedVertexState().getPicked();
            for (NodeWrapper node : nodes) {
                for (EdgeWrapper link : node.getEdges()) {
                    if (link.getId() == linkToProcess.getId()) {
                        return Color.orange;
                    }
                }
            }
            if (linkToProcess.isEdgeOnCut()) {
                return Color.green;
            }
            return Color.blue;
        }
    });

    // MapTransformer.<EdgeWrapper, Paint> getInstance(edgePaints));

    vv.getRenderContext().setEdgeStrokeTransformer(new Transformer<EdgeWrapper, Stroke>() {
        protected final Stroke THIN = new BasicStroke(1);
        // protected final Stroke THICK = new BasicStroke(2);
        protected final Stroke STRONG_THICK = new BasicStroke(3);

        public Stroke transform(EdgeWrapper e) {
            // if para mostrar arestas com as duas pontas no mesmo vertices
            if (e.getStartNode().getId() == e.getEndNode().getId()) {
                return STRONG_THICK;
            }

            // Paint c = edgePaints.get(e);
            // if (c == Color.red)
            return THIN;
            // else
            // return THIN;
        }
    });

    DefaultModalGraphMouse gm = new DefaultModalGraphMouse();
    vv.setGraphMouse(gm);

    groupVertices = new JToggleButton("Group Clusters");
    groupVertices.setSelected(true);

    groupVertices.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            clusterAndRecolor(layout, e.getStateChange() == ItemEvent.SELECTED,
                    getGroupCircleVertices().isSelected());
            vv.repaint();
        }
    });

    clusterAndRecolor(layout, groupVertices.isSelected(), getGroupCircleVertices().isSelected());

    Container content = getContentPane();
    content.add(new GraphZoomScrollPane(vv));
    JPanel south = new JPanel(new GridLayout(1, 4));
    JPanel grid1 = new JPanel(new GridLayout(2, 1));
    grid1.add(groupVertices);
    grid1.add(getGroupCircleVertices());
    south.add(grid1);

    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 grid2 = new JPanel(new GridLayout(2, 1));
    grid2.setBorder(BorderFactory.createTitledBorder("Scale"));
    south.add(grid2);
    grid2.add(plus);
    grid2.add(minus);
    JPanel grid3 = new JPanel(new GridLayout(1, 2));
    south.add(grid3);
    grid3.add(getIterationLabel());
    grid3.add(getCutLabel());

    JPanel p = new JPanel();
    p.setBorder(BorderFactory.createTitledBorder("Mouse Mode"));
    p.add(gm.getModeComboBox());
    south.add(p);
    content.add(south, BorderLayout.SOUTH);
    vv.repaint();
}

From source file:cloud.gui.CloudGUI.java

private JPanel createAddInstancePanel() {
    JPanel addInstancePanel = new JPanel();
    addInstancePanel.setBorder(BorderFactory.createTitledBorder("Launch Instance"));
    addInstancePanel.setLayout(new BoxLayout(addInstancePanel, BoxLayout.Y_AXIS));
    //--------------------------//      
    JPanel labelPanel = new JPanel();
    labelPanel.setBorder(BorderFactory.createEmptyBorder());
    labelPanel.setLayout(new BorderLayout());
    JLabel addANewInstancelbl = new JLabel("Add a new instance with the following configuration:");
    labelPanel.add(addANewInstancelbl);//w w w.j  a va  2  s . c  om
    addInstancePanel.add(labelPanel);
    //--------------------------//      
    JPanel nodeConfigurationsPanel = new JPanel();
    nodeConfigurationsPanel.setLayout(new GridLayout(4, 2));
    nodeConfigurationsPanel.setBorder(BorderFactory.createEmptyBorder());

    JLabel cpuSpeedlbl = new JLabel("CPU Speed (GHz)");
    nodeConfigurationsPanel.add(cpuSpeedlbl);

    cpuSpeed = new JComboBox(CPU_SPEEDS);
    cpuSpeed.setSelectedItem("2.0");
    nodeConfigurationsPanel.add(cpuSpeed);

    JLabel bandwidthlbl = new JLabel("Bandwidth (MB/s):");
    nodeConfigurationsPanel.add(bandwidthlbl);

    bandwidthes = new JComboBox(BANDWIDTHES);
    bandwidthes.setSelectedItem("2");
    nodeConfigurationsPanel.add(bandwidthes);

    JLabel memoryLbl = new JLabel("Memory (GB)");
    nodeConfigurationsPanel.add(memoryLbl);

    memories = new JComboBox(MEMORIES);
    memories.setSelectedIndex(2);
    nodeConfigurationsPanel.add(memories);

    JLabel simultaneousDownloadsLbl = new JLabel("Simulatenous Downloads:");
    nodeConfigurationsPanel.add(simultaneousDownloadsLbl);

    sDownloads = new JTextArea("70");
    nodeConfigurationsPanel.add(sDownloads);

    addInstancePanel.add(nodeConfigurationsPanel);
    //--------------------------//      
    JPanel addInstanceButtonPanel = new JPanel();
    addInstanceButtonPanel.setBorder(BorderFactory.createEmptyBorder());
    addInstanceButtonPanel.setLayout(new GridLayout(2, 2));

    addInstanceButton = new JButton("Launch Instance");
    addInstanceButtonPanel.add(addInstanceButton);

    addInstancePanel.add(addInstanceButtonPanel);
    return addInstancePanel;
}

From source file:JXButtonPanel.java

private JXButtonPanel createRadioJXButtonPanel() {
    JXButtonPanel panel = new JXButtonPanel();
    panel.setLayout(new GridLayout(0, 1));
    JRadioButton one = new JRadioButton("One");
    panel.add(one);// ww w  . j  a v  a  2  s.com
    radioGroup.add(one);
    JRadioButton two = new JRadioButton("Two");
    panel.add(two);
    radioGroup.add(two);
    JRadioButton three = new JRadioButton("Three");
    panel.add(three);
    radioGroup.add(three);
    JRadioButton four = new JRadioButton("Four");
    panel.add(four);
    radioGroup.add(four);
    one.setSelected(true);
    panel.setBorder(BorderFactory.createTitledBorder("JXButtonPanel"));
    return panel;
}

From source file:org.fhcrc.cpl.viewer.quant.gui.QuantitationReviewer.java

/**
 * Initialize all GUI components and display the UI
 *//* w  w  w  .  j a  v  a  2 s. c o m*/
protected void initGUI() {
    settingsCLM = new ProteinQuantChartsCLM(false);

    setTitle("Qurate");
    try {
        setIconImage(ImageIO.read(WorkbenchFrame.class.getResourceAsStream("icon.gif")));
    } catch (Exception e) {
    }

    try {
        Localizer.renderSwixml("org/fhcrc/cpl/viewer/quant/gui/QuantitationReviewer.xml", this);
        assert null != contentPanel;
    } catch (Exception x) {
        ApplicationContext.errorMessage("error creating dialog", x);
        throw new RuntimeException(x);
    }

    //Menu
    openFileAction = new OpenFileAction(this);
    createChartsAction = new CreateChartsAction();
    filterPepXMLAction = new FilterPepXMLAction(this);
    proteinSummaryAction = new ProteinSummaryAction(this);

    try {
        JMenuBar jmenu = (JMenuBar) Localizer.getSwingEngine(this)
                .render("org/fhcrc/cpl/viewer/quant/gui/QuantitationReviewerMenu.xml");
        for (int i = 0; i < jmenu.getMenuCount(); i++)
            jmenu.getMenu(i).getPopupMenu().setLightWeightPopupEnabled(false);
        this.setJMenuBar(jmenu);
    } catch (Exception x) {
        ApplicationContext.errorMessage(TextProvider.getText("ERROR_LOADING_MENUS"), x);
        throw new RuntimeException(x);
    }

    //Global stuff
    setSize(fullWidth, fullHeight);
    setContentPane(contentPanel);
    ListenerHelper helper = new ListenerHelper(this);

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.BOTH;
    gbc.anchor = GridBagConstraints.PAGE_START;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.insets = new Insets(5, 5, 5, 5);
    gbc.weighty = 1;
    gbc.weightx = 1;

    leftPanel.setLayout(new GridBagLayout());
    leftPanel.setBorder(BorderFactory.createLineBorder(Color.gray));

    //Properties panel stuff
    propertiesTable = new QuantEvent.QuantEventPropertiesTable();
    propertiesScrollPane = new JScrollPane();
    propertiesScrollPane.setViewportView(propertiesTable);
    propertiesScrollPane.setMinimumSize(new Dimension(propertiesWidth, propertiesHeight));

    //event summary table; disembodied
    eventSummaryTable = new QuantEventsSummaryTable();
    eventSummaryTable.setVisible(true);
    ListSelectionModel tableSelectionModel = eventSummaryTable.getSelectionModel();
    tableSelectionModel.addListSelectionListener(new EventSummaryTableListSelectionHandler());
    JScrollPane eventSummaryScrollPane = new JScrollPane();
    eventSummaryScrollPane.setViewportView(eventSummaryTable);
    eventSummaryScrollPane.setSize(propertiesWidth, propertiesHeight);
    eventSummaryFrame = new Frame("All Events");
    eventSummaryFrame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent event) {
            eventSummaryFrame.setVisible(false);
        }
    });
    eventSummaryFrame.setSize(950, 450);
    eventSummaryFrame.add(eventSummaryScrollPane);

    //fields related to navigation
    navigationPanel = new JPanel();
    backButton = new JButton("<");
    backButton.setToolTipText("Previous Event");
    backButton.setMaximumSize(new Dimension(50, 30));
    backButton.setEnabled(false);
    forwardButton = new JButton(">");
    forwardButton.setToolTipText("Next Event");
    forwardButton.setMaximumSize(new Dimension(50, 30));
    forwardButton.setEnabled(false);
    showEventSummaryButton = new JButton("Show All");
    showEventSummaryButton.setToolTipText("Show all events in a table");
    showEventSummaryButton.setEnabled(false);

    helper.addListener(backButton, "buttonBack_actionPerformed");
    helper.addListener(forwardButton, "buttonForward_actionPerformed");
    helper.addListener(showEventSummaryButton, "buttonShowEventSummary_actionPerformed");

    gbc.fill = GridBagConstraints.NONE;
    gbc.gridwidth = GridBagConstraints.RELATIVE;
    gbc.anchor = GridBagConstraints.WEST;
    navigationPanel.add(backButton, gbc);
    gbc.gridwidth = GridBagConstraints.RELATIVE;
    navigationPanel.add(forwardButton, gbc);
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    navigationPanel.add(showEventSummaryButton, gbc);
    gbc.fill = GridBagConstraints.BOTH;
    navigationPanel.setBorder(BorderFactory.createTitledBorder("Event"));
    gbc.anchor = GridBagConstraints.PAGE_START;

    //Fields related to curation of events
    curationPanel = new JPanel();
    curationPanel.setLayout(new GridBagLayout());
    curationPanel.setBorder(BorderFactory.createTitledBorder("Curation"));
    //Quantitation curation
    JPanel quantCurationPanel = new JPanel();
    quantCurationPanel.setLayout(new GridBagLayout());
    quantCurationPanel.setBorder(BorderFactory.createTitledBorder("Quantitation"));
    quantCurationButtonGroup = new ButtonGroup();
    JRadioButton unknownRadioButton = new JRadioButton("?");
    JRadioButton goodRadioButton = new JRadioButton("Good");
    JRadioButton badRadioButton = new JRadioButton("Bad");
    onePeakRatioRadioButton = new JRadioButton("1-Peak");

    unknownRadioButton.setEnabled(false);
    goodRadioButton.setEnabled(false);
    badRadioButton.setEnabled(false);
    onePeakRatioRadioButton.setEnabled(false);

    quantCurationButtonGroup.add(unknownRadioButton);
    quantCurationButtonGroup.add(goodRadioButton);
    quantCurationButtonGroup.add(badRadioButton);
    quantCurationButtonGroup.add(onePeakRatioRadioButton);

    unknownRadioButtonModel = unknownRadioButton.getModel();
    goodRadioButtonModel = goodRadioButton.getModel();
    badRadioButtonModel = badRadioButton.getModel();
    onePeakRadioButtonModel = onePeakRatioRadioButton.getModel();

    helper.addListener(unknownRadioButton, "buttonCuration_actionPerformed");
    helper.addListener(goodRadioButton, "buttonCuration_actionPerformed");
    helper.addListener(badRadioButton, "buttonCuration_actionPerformed");
    helper.addListener(onePeakRadioButtonModel, "buttonCuration_actionPerformed");

    gbc.anchor = GridBagConstraints.WEST;
    quantCurationPanel.add(unknownRadioButton, gbc);
    quantCurationPanel.add(badRadioButton, gbc);
    quantCurationPanel.add(goodRadioButton, gbc);
    quantCurationPanel.add(onePeakRatioRadioButton, gbc);

    gbc.anchor = GridBagConstraints.PAGE_START;
    //ID curation
    JPanel idCurationPanel = new JPanel();
    idCurationPanel.setLayout(new GridBagLayout());
    idCurationPanel.setBorder(BorderFactory.createTitledBorder("ID"));
    idCurationButtonGroup = new ButtonGroup();
    JRadioButton idUnknownRadioButton = new JRadioButton("?");
    JRadioButton idGoodRadioButton = new JRadioButton("Good");
    JRadioButton idBadRadioButton = new JRadioButton("Bad");
    idUnknownRadioButton.setEnabled(false);
    idGoodRadioButton.setEnabled(false);
    idBadRadioButton.setEnabled(false);

    idCurationButtonGroup.add(idUnknownRadioButton);
    idCurationButtonGroup.add(idGoodRadioButton);
    idCurationButtonGroup.add(idBadRadioButton);
    idUnknownRadioButtonModel = idUnknownRadioButton.getModel();
    idGoodRadioButtonModel = idGoodRadioButton.getModel();
    idBadRadioButtonModel = idBadRadioButton.getModel();
    helper.addListener(idUnknownRadioButton, "buttonIDCuration_actionPerformed");
    helper.addListener(idGoodRadioButton, "buttonIDCuration_actionPerformed");
    helper.addListener(idBadRadioButton, "buttonIDCuration_actionPerformed");
    gbc.anchor = GridBagConstraints.WEST;
    idCurationPanel.add(idUnknownRadioButton, gbc);
    idCurationPanel.add(idBadRadioButton, gbc);
    idCurationPanel.add(idGoodRadioButton, gbc);

    gbc.gridwidth = GridBagConstraints.RELATIVE;
    curationPanel.add(quantCurationPanel, gbc);
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    curationPanel.add(idCurationPanel, gbc);

    //curation comment
    commentTextField = new JTextField();
    commentTextField.setToolTipText("Comment on this event");
    //saves after every keypress.  Would be more efficient to save when navigating away or saving to file
    commentTextField.addKeyListener(new KeyAdapter() {
        public void keyReleased(KeyEvent e) {
            if (quantEvents == null)
                return;
            QuantEvent quantEvent = quantEvents.get(displayedEventIndex);
            //save the comment, being careful about tabs and new lines
            quantEvent.setComment(commentTextField.getText().replace("\t", " ").replace("\n", " "));
        }

        public void keyTyped(KeyEvent e) {
        }

        public void keyPressed(KeyEvent e) {
        }
    });
    curationPanel.add(commentTextField, gbc);

    assessmentPanel = new JPanel();
    assessmentPanel.setLayout(new GridBagLayout());
    assessmentPanel.setBorder(BorderFactory.createTitledBorder("Algorithmic Assessment"));
    assessmentTypeTextField = new JTextField();
    assessmentTypeTextField.setEditable(false);
    assessmentPanel.add(assessmentTypeTextField, gbc);
    assessmentDescTextField = new JTextField();
    assessmentDescTextField.setEditable(false);
    assessmentPanel.add(assessmentDescTextField, gbc);

    //Theoretical peak distribution
    gbc.fill = GridBagConstraints.NONE;
    gbc.anchor = GridBagConstraints.CENTER;
    theoreticalPeaksPanel = new JPanel();
    theoreticalPeaksPanel.setBorder(BorderFactory.createTitledBorder("Theoretical Peaks"));
    theoreticalPeaksPanel.setLayout(new GridBagLayout());
    theoreticalPeaksPanel.setMinimumSize(new Dimension(leftPanelWidth - 10, theoreticalPeaksPanelHeight));
    theoreticalPeaksPanel.setMaximumSize(new Dimension(1200, theoreticalPeaksPanelHeight));
    showTheoreticalPeaks();

    //Add everything to the left panel
    gbc.insets = new Insets(0, 5, 0, 5);
    gbc.fill = GridBagConstraints.BOTH;
    gbc.anchor = GridBagConstraints.PAGE_START;
    leftPanel.addComponentListener(new LeftPanelResizeListener());
    gbc.weighty = 10;
    gbc.fill = GridBagConstraints.VERTICAL;
    leftPanel.add(propertiesScrollPane, gbc);
    gbc.fill = GridBagConstraints.NONE;
    gbc.weighty = 1;
    gbc.anchor = GridBagConstraints.PAGE_END;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    leftPanel.add(assessmentPanel, gbc);
    leftPanel.add(theoreticalPeaksPanel, gbc);
    gbc.fill = GridBagConstraints.HORIZONTAL;
    leftPanel.add(curationPanel, gbc);
    leftPanel.add(navigationPanel, gbc);
    gbc.fill = GridBagConstraints.BOTH;
    gbc.weighty = 1;
    gbc.anchor = GridBagConstraints.PAGE_START;

    //Chart display
    multiChartDisplay = new TabbedMultiChartDisplayPanel();
    multiChartDisplay.setResizeDelayMS(0);

    rightPanel.addComponentListener(new RightPanelResizeListener());
    rightPanel.add(multiChartDisplay, gbc);

    //status message
    messageLabel.setBackground(Color.WHITE);
    messageLabel.setFont(Font.decode("verdana plain 12"));
    messageLabel.setText(" ");

    setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    //paranoia.  Sometimes it seems Qurate doesn't exit when you close every window
    addWindowStateListener(new WindowStateListener() {
        public void windowStateChanged(WindowEvent e) {
            if (e.getNewState() == WindowEvent.WINDOW_CLOSED) {
                dispose();
                System.exit(0);
            }
        }
    });

}

From source file:graph.jung2.MyLensDemo.java

public void init() {

    // create a simple graph for the demo
    TemporalNetworkOfWikipediaNodes net = null;
    try {//w  w  w. ja va2 s  . c o m

        // net = new TemporalNetworkOfWikipediaNodes(null, null);
        net = new TemporalNetworkOfWikipediaNodes(r, level);
        graph = net.createSampleNetwork(); //getCC_EDIT_Graph();

    } catch (Exception ex) {
        Logger.getLogger(MyLensDemo.class.getName()).log(Level.SEVERE, null, ex);
    }

    //        if ( net == null ) {
    //            graph = TemporalNetworkOfWikipediaNodes.createSampleNetwork();
    //        }
    //        else {
    //            graph = net.getGraph();
    //        }

    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);
}