Example usage for java.awt.event ItemEvent SELECTED

List of usage examples for java.awt.event ItemEvent SELECTED

Introduction

In this page you can find the example usage for java.awt.event ItemEvent SELECTED.

Prototype

int SELECTED

To view the source code for java.awt.event ItemEvent SELECTED.

Click Source Link

Document

This state-change value indicates that an item was selected.

Usage

From source file:org.zaproxy.zap.extension.reveal.ExtensionReveal.java

private JToggleButton getRevealButton() {
    if (revealButton == null) {
        revealButton = new ZapToggleButton();
        revealButton.setIcon(new ImageIcon(ExtensionReveal.class.getResource("resources/icons/044.png"))); // 'light off' icon
        revealButton.setToolTipText(Constant.messages.getString("reveal.button.enable"));
        revealButton/*from   w  w w  . j a  va  2s . c om*/
                .setSelectedIcon(new ImageIcon(ExtensionReveal.class.getResource("resources/icons/043.png"))); // 'light on' icon
        revealButton.setSelectedToolTipText(Constant.messages.getString("reveal.button.disable"));

        revealButton.addItemListener(new ItemListener() {

            @Override
            public void itemStateChanged(ItemEvent e) {
                setReveal(ItemEvent.SELECTED == e.getStateChange());
            }
        });
    }
    return revealButton;
}

From source file:op.care.med.structure.DlgTradeForm.java

private void cmbDaysWeeksItemStateChanged(ItemEvent e) {
    if (initPhase)
        return;/*  w  w w .ja va 2 s  . com*/
    if (e.getStateChange() == ItemEvent.SELECTED) {
        Integer i = SYSTools.checkInteger(txtExpiresIn.getText());
        if (i == null || i.compareTo(0) <= 0) {
            i = 7;
            txtExpiresIn.setText("7");
        }
        if (cmbDaysWeeks.getSelectedIndex() == 1) {
            tradeForm.setDaysToExpireAfterOpened(i * 7);
        } else {
            tradeForm.setDaysToExpireAfterOpened(i);
        }
    }
}

From source file:ru.develgame.jflickrorganizer.MainForm.java

@PostConstruct
public void init() {
    jTablePhotos.setModel(tablePhotosDataModel);
    jTablePhotos.setRowHeight(COLUMN_PIC_MIN_HEIGHT);

    if (authorizer.getUser().getSyncFolder() != null)
        jTextFieldBackupFolder.setText(authorizer.getUser().getSyncFolder());

    jTablePhotos.getTableHeader().setReorderingAllowed(false);
    jScrollPane2.getViewport().setBackground(jTablePhotos.getBackground());

    jTreeAlbums.setModel(treeAlbumsDataModel);
    jTreeAlbums.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    jTreeAlbums.setCellRenderer(new AlbumTreeCellRender(jTreeAlbums.getCellRenderer()));
    jTreeAlbums.setSelectionRow(0);/*from  www.ja  v  a  2  s.  c o m*/

    albumFilter = new AlbumFilter(null);
    listFilters.addCondition(albumFilter);

    jTreeAlbums.addTreeSelectionListener(e -> {
        Album selectedAlbum = ((TreeAlbumsDataModel.AlbumNode) jTreeAlbums.getLastSelectedPathComponent())
                .getAlbum();

        AlbumFilter newAlbumFilter = new AlbumFilter(selectedAlbum);

        listFilters.replaceFilter(albumFilter, newAlbumFilter);
        albumFilter = newAlbumFilter;

        tablePhotosDataModel.loadData();

        // TODO - updateStatusBar
    });

    jComboBoxVisibility.setModel(visibilityComboBoxDataModel);
    visibilityFilter = new VisibilityFilter((WrapperVisibility) jComboBoxVisibility.getSelectedItem());
    listFilters.addCondition(visibilityFilter);

    jComboBoxVisibility.addItemListener(e -> {
        if (e.getStateChange() == ItemEvent.SELECTED) {
            VisibilityFilter newVisibilityFilter = new VisibilityFilter(
                    (WrapperVisibility) jComboBoxVisibility.getSelectedItem());

            listFilters.replaceFilter(visibilityFilter, newVisibilityFilter);
            visibilityFilter = newVisibilityFilter;

            tablePhotosDataModel.loadData();
        }
    });

    updateStatusBar();

    tablePhotosDataModel.addTableModelListener(e -> {
        updateStatusBar();
    });

    DateTableCellRenderer dateTableCellRenderer = new DateTableCellRenderer();

    jTablePhotos.getColumnModel().getColumn(COLUMN_DATE_TAKEN).setCellRenderer(dateTableCellRenderer);

    jTablePhotos.getColumnModel().getColumn(COLUMN_DATE_UPLOADED).setCellRenderer(dateTableCellRenderer);

    jButtonChooseBackupFolder.setEnabled(!authorizer.isOfflineMode());
    jButtonBackup.setEnabled(!authorizer.isOfflineMode());
    jTextFieldBackupFolder.setEnabled(!authorizer.isOfflineMode());
    jLabelBackupFolder.setEnabled(!authorizer.isOfflineMode());
}

From source file:model.utilities.ExchangeNetwork.java

/**
 * Create the network: both the structure and the visualization
 *//* w ww  .j  a  va 2 s  . co m*/
public ExchangeNetwork(GoodType type) {

    assert MacroII.hasGUI(); //don't bother with any of this if there is no inventory
    //create the graph!
    inventoryGraph = new DirectedSparseGraph<>();
    //record your good type
    this.type = type;

    //create the layout used for vertices
    Layout<EconomicAgent, InventoryEdge> layout = new SpringLayout<EconomicAgent, InventoryEdge>(
            inventoryGraph);
    //new DAGLayout<EconomicAgent, InventoryEdge>(inventoryGraph);
    layout.setSize(new Dimension(600, 600)); //set size
    //create the viewer
    vv = new VisualizationViewer<>(layout);
    //tell it how to color the vertices
    vv.getRenderContext().setVertexFillPaintTransformer(vertexPainter);
    //tell it to print the name of the vertices
    vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<EconomicAgent>());
    //call to string to label edges
    vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller<InventoryEdge>()); //edges will have name
    //have the thickness of lines grow
    vv.getRenderContext().setEdgeStrokeTransformer(InventoryEdge.edgeStrokeTransformer);

    //now set up the visualization so that clicking on an agent gives you info about him
    //set up the mouse to select
    ModalGraphMouse mouse = new DefaultModalGraphMouse<>();
    mouse.setMode(ModalGraphMouse.Mode.PICKING);
    vv.setGraphMouse(mouse);
    //make selection communicate to Mason through inspectors
    vv.getPickedVertexState().addItemListener(new ItemListener() {
        @Override
        //when you have a selection, this logEvent is fired
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) //if e is selected
            {
                EconomicAgent agent = (EconomicAgent) e.getItem(); //cast it to agent
                Inspector inspector = agent.getInspector(MacroII.getGUI()); //notice how you get back the outer instance

                //now for the moronic, let's talk to MASON in java 1.3 language because computer science people are too smart
                //to use generics or arraylists
                Bag inspectors = new Bag(1);
                inspectors.add(inspector);
                Bag names = new Bag(1);
                names.add(agent.toString());
                MacroII.getGUI().controller.setInspectors(inspectors, names);
            }
        }
    });

}

From source file:org.uncommons.watchmaker.swing.evolutionmonitor.PopulationFitnessView.java

/**
 * Creates the GUI controls for toggling graph display options.
 * @return A component that can be added to the main panel.
 *//*w  ww. ja  va2 s .  com*/
private JComponent createControls(boolean islands) {
    JPanel controls = new JPanel(new FlowLayout(FlowLayout.RIGHT));

    allDataButton.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent ev) {
            updateDomainAxisRange();
        }
    });
    String text = "Last " + SHOW_FIXED_GENERATIONS + (islands ? " Epochs" : " Generations");
    JRadioButton recentDataButton = new JRadioButton(text, true);
    ButtonGroup buttonGroup = new ButtonGroup();
    buttonGroup.add(allDataButton);
    buttonGroup.add(recentDataButton);

    controls.add(allDataButton);
    controls.add(recentDataButton);

    final JCheckBox meanCheckBox = new JCheckBox("Show Mean", true);
    meanCheckBox.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent itemEvent) {
            if (itemEvent.getStateChange() == ItemEvent.SELECTED) {
                dataSet.addSeries(meanSeries);
            } else {
                dataSet.removeSeries(meanSeries);
            }
        }
    });
    controls.add(meanCheckBox);

    invertCheckBox.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent itemEvent) {
            rangeAxis.setInverted(invertCheckBox.isSelected());
        }
    });
    controls.add(invertCheckBox);

    return controls;
}

From source file:org.xulux.swing.listeners.PrePostFieldListener.java

/**
 * Sets the correct value when a checkbox is
 * clicked. It will call the post after the
 * value is adjusted./*from   w w w  . j  av  a 2s  . co m*/
 *
 * @todo optimize this using native boolean ??
 * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
 */
public void itemStateChanged(ItemEvent e) {
    // make sure we don't end up in a loop by checking
    // the fact if the widget is currently refreshing or not..
    //        if (isProcessing()) {
    //            return;
    //        }
    if (widget.isRefreshing()) {
        return;
    }
    boolean refresh = false;
    // reset the hold events to process previous events..
    if (widget instanceof CheckBox || widget instanceof RadioButton || widget instanceof ToggleButton) {
        if (e.getStateChange() == ItemEvent.SELECTED) {
            widget.setValue("true");
            refresh = true;

        } else if (e.getStateChange() == ItemEvent.DESELECTED) {
            widget.setValue("false");
            refresh = true;
        }
        if (log.isTraceEnabled()) {
            log.trace("Checkbox or RadioButton clicked on Widget : " + widget.getName() + " value: "
                    + widget.getValue());
        }
    }
    if (refresh) {
        NyxEventQueue.getInstance().holdEvents(false);
        widget.getPart().refreshFields(widget);
        widget.getPart().updateDependandWidgets(widget);
    }
    completed();
}

From source file:org.zaproxy.zap.extension.fuzz.httpfuzzer.ui.HttpFuzzResultsContentPanel.java

public HttpFuzzResultsContentPanel() {
    super(new BorderLayout());

    tabbedPane = new JTabbedPane();

    toolbar = new JToolBar();
    toolbar.setFloatable(false);//from   ww  w.  j  a  v a 2 s  .  c  o m
    toolbar.setRollover(true);

    messageCountLabel = new JLabel(Constant.messages.getString("fuzz.httpfuzzer.results.toolbar.messagesSent"));
    messageCountValueLabel = new JLabel("0");

    errorCountLabel = new JLabel(Constant.messages.getString("fuzz.httpfuzzer.results.toolbar.errors"));
    errorCountValueLabel = new JLabel("0");

    showErrorsToggleButton = new ZapToggleButton(
            Constant.messages.getString("fuzz.httpfuzzer.results.toolbar.button.showErrors.label"));
    showErrorsToggleButton.setEnabled(false);
    showErrorsToggleButton.setToolTipText(
            Constant.messages.getString("fuzz.httpfuzzer.results.toolbar.button.showErrors.tooltip"));
    showErrorsToggleButton.setSelectedToolTipText(
            Constant.messages.getString("fuzz.httpfuzzer.results.toolbar.button.showErrors.tooltip.selected"));
    showErrorsToggleButton.setDisabledToolTipText(
            Constant.messages.getString("fuzz.httpfuzzer.results.toolbar.button.showErrors.tooltip.disabled"));
    showErrorsToggleButton
            .setIcon(new ImageIcon(HttpFuzzResultsContentPanel.class.getResource("/resource/icon/16/050.png")));
    showErrorsToggleButton.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            if (ItemEvent.SELECTED == e.getStateChange()) {
                showTabs();
            } else {
                hideErrorsTab();
            }
        }
    });

    toolbar.add(Box.createHorizontalStrut(4));
    toolbar.add(messageCountLabel);
    toolbar.add(Box.createHorizontalStrut(4));
    toolbar.add(messageCountValueLabel);
    toolbar.add(Box.createHorizontalStrut(32));

    toolbar.add(errorCountLabel);
    toolbar.add(Box.createHorizontalStrut(4));
    toolbar.add(errorCountValueLabel);

    toolbar.add(Box.createHorizontalStrut(16));
    toolbar.add(showErrorsToggleButton);

    JButton button = new JButton(Constant.messages.getString("fuzz.httpfuzzer.results.toolbar.button.export"));
    button.setIcon(new ImageIcon(HttpFuzzResultsContentPanel.class.getResource("/resource/icon/16/115.png")));
    button.addActionListener((new AbstractAction() {
        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent e) {
            WritableFileChooser chooser = new WritableFileChooser(
                    Model.getSingleton().getOptionsParam().getUserDirectory()) {

                private static final long serialVersionUID = -1660943014924270012L;

                @Override
                public void approveSelection() {
                    File file = getSelectedFile();
                    if (file != null) {
                        String filePath = file.getAbsolutePath();
                        if (!filePath.toLowerCase(Locale.ROOT).endsWith(CSV_EXTENSION)) {
                            setSelectedFile(new File(filePath + CSV_EXTENSION));
                        }
                    }

                    super.approveSelection();
                }
            };
            chooser.setSelectedFile(new File(
                    Constant.messages.getString("fuzz.httpfuzzer.results.toolbar.button.export.defaultName")));
            if (chooser
                    .showSaveDialog(View.getSingleton().getMainFrame()) == WritableFileChooser.APPROVE_OPTION) {

                boolean success = true;
                try (CSVPrinter pw = new CSVPrinter(
                        Files.newBufferedWriter(chooser.getSelectedFile().toPath(), StandardCharsets.UTF_8),
                        CSVFormat.DEFAULT)) {
                    pw.printRecord(currentFuzzer.getMessagesModel().getHeaders());
                    int count = currentFuzzer.getMessagesModel().getRowCount();
                    for (int i = 0; i < count; i++) {
                        List<Object> valueOfRow = currentFuzzer.getMessagesModel().getEntry(i)
                                .getValuesOfHeaders();
                        String customStateValue = fuzzResultTable.getCustomStateValue(
                                currentFuzzer.getMessagesModel().getEntry(i).getCustomStates());
                        valueOfRow.add(13, customStateValue);
                        pw.printRecord(valueOfRow);
                    }
                } catch (Exception ex) {
                    success = false;
                    JOptionPane.showMessageDialog(View.getSingleton().getMainFrame(),
                            Constant.messages
                                    .getString("fuzz.httpfuzzer.results.toolbar.button.export.showMessageError")
                                    + "\n" + ex.getLocalizedMessage());
                    logger.error("Export Failed: " + ex);
                }
                // Delay the presentation of success message, to ensure all the data was
                // already flushed.
                if (success) {
                    JOptionPane.showMessageDialog(View.getSingleton().getMainFrame(), Constant.messages
                            .getString("fuzz.httpfuzzer.results.toolbar.button.export.showMessageSuccessful"));
                }
            }
        }
    }));
    toolbar.add(Box.createHorizontalGlue());
    toolbar.add(button);
    mainPanel = new JPanel(new BorderLayout());

    fuzzResultTable = new HttpFuzzerResultsTable(RESULTS_PANEL_NAME, EMPTY_RESULTS_MODEL);
    errorsTable = new HttpFuzzerErrorsTable(ERRORS_PANEL_NAME, EMPTY_ERRORS_MODEL);

    fuzzResultTableScrollPane = new JScrollPane();
    fuzzResultTableScrollPane.setViewportView(fuzzResultTable);

    errorsTableScrollPane = new JScrollPane();
    errorsTableScrollPane.setViewportView(errorsTable);

    mainPanel.add(fuzzResultTableScrollPane);

    add(toolbar, BorderLayout.PAGE_START);
    add(mainPanel, BorderLayout.CENTER);
}

From source file:com.emr.schemas.TableRelationsForm.java

/**
 * Constructor//from ww  w  .j a v  a 2 s .com
 * @param tables {@link List} List of source tables
 */
public TableRelationsForm(List tables, SchemerMapper parent) {
    fileManager = null;
    dbManager = null;
    emrConn = null;
    this.parent = parent;
    this.tables = tables; //source tables

    //Create KenyaEMR DB connection
    fileManager = new FileManager();
    String[] settings = fileManager.getConnectionSettings("emr_database.properties", "emr");
    if (settings == null) {
        //Connection settings not found
        JOptionPane.showMessageDialog(null,
                "Database Settings not found. Please set the connection settings for the database first.",
                "KenyaEMR Database settings", JOptionPane.ERROR_MESSAGE);
        //Open KenyaEMRConnectionForm form
    } else {
        if (settings.length < 1) {
            JOptionPane.showMessageDialog(null,
                    "Database Settings not found. Please set the connection settings for the database first.",
                    "KenyaEMR Database settings", JOptionPane.ERROR_MESSAGE);
            //Open KenyaEMRConnectionForm form
        } else {
            //Connection settings are ok
            //We establish a connection
            dbManager = new DatabaseManager(settings[0], settings[1], settings[3], settings[4], settings[5]);
            emrConn = dbManager.getConnection();
            if (emrConn == null) {
                JOptionPane.showMessageDialog(null, "Test Connection Failed", "Connection Test",
                        JOptionPane.ERROR_MESSAGE);
            }
        }
    }

    //get all columns and add them to the columns list
    for (Object table : tables) {
        String tablename = (String) table;
        populateTableColumnsToList(tablename);
    }

    model = new DefaultTableModel(
            new Object[] { "Primary Table", "Column", "Reference Table", "Foreign Column" }, 10);

    initComponents();
    this.setClosable(true);
    foreignTables = tables;
    combo1 = new JComboBox();//Combobox for the primary tables
    combo2 = new JComboBox();
    combo3 = new JComboBox();
    combo4 = new JComboBox();
    combo1.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent event) {
            if (event.getStateChange() == ItemEvent.SELECTED) {
                String selectedTable = (String) event.getItem();
                //populate primary table columns
                primaryColumns = getTableColumns(selectedTable);
                DefaultComboBoxModel combo2_model = new DefaultComboBoxModel(
                        primaryColumns.toArray(new String[primaryColumns.size()]));
                JComboBox comboBox = new JComboBox();
                comboBox.setModel(combo2_model);
                relationsTable.getColumnModel().getColumn(1).setCellEditor(new DefaultCellEditor(comboBox));

            }
        }
    });

    combo3.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent event) {
            if (event.getStateChange() == ItemEvent.SELECTED) {
                String selectedTable = (String) event.getItem();
                //populate foreign table columns
                foreignColumns = getTableColumns(selectedTable);
                DefaultComboBoxModel combo3_model = new DefaultComboBoxModel(
                        foreignColumns.toArray(new String[foreignColumns.size()]));
                JComboBox comboBox = new JComboBox();
                comboBox.setModel(combo3_model);
                relationsTable.getColumnModel().getColumn(3).setCellEditor(new DefaultCellEditor(comboBox));
            }
        }
    });
    ComboBoxTableCellEditor primaryTableEditor = new ComboBoxTableCellEditor(tables, combo1);
    ComboBoxTableCellEditor primaryTableColumns = new ComboBoxTableCellEditor(primaryColumns, combo2);

    ComboBoxTableCellEditor foreignTableEditor = new ComboBoxTableCellEditor(foreignTables, combo3);//TODO: remove selected primary table from list

    ComboBoxTableCellEditor foreignTableColumns = new ComboBoxTableCellEditor(foreignColumns, combo4);
    relationsTable.getColumnModel().getColumn(0).setCellEditor(primaryTableEditor);
    relationsTable.getColumnModel().getColumn(1).setCellEditor(primaryTableColumns);
    relationsTable.getColumnModel().getColumn(2).setCellEditor(foreignTableEditor);
    relationsTable.getColumnModel().getColumn(3).setCellEditor(foreignTableColumns);

    columnsList.setCellRenderer(new CheckboxListCellRenderer());
    SourceTablesListener listSelectionListener = new SourceTablesListener(new JTextArea(), selected_columns);
    columnsList.addListSelectionListener(listSelectionListener);
    columnsList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    columnsList.setSelectionModel(new DefaultListSelectionModel() {
        @Override
        public void setSelectionInterval(int index0, int index1) {
            if (isSelectedIndex(index0))
                super.removeSelectionInterval(index0, index1);
            else
                super.addSelectionInterval(index0, index1);
        }
    });
}

From source file:org.jax.bham.test.MultiHaplotypeBlockTestGraphPanel.java

/**
 * a function to initialize the components for this panel
 *///from  w  w w .j a  v a2 s .  c o m
private void initialize() {
    this.chromosomeComboBox.addItem("All Chromosomes");
    List<Integer> chromoList = SequenceUtilities.toIntegerList(this.testToPlot.getAvailableChromosomes());
    Collections.sort(chromoList);
    for (Integer chromoNum : chromoList) {
        this.chromosomeComboBox.addItem(chromoNum);
    }
    if (!chromoList.isEmpty()) {
        this.chromosomeComboBox.setSelectedIndex(1);
    }
    this.chromosomeComboBox.addItemListener(new ItemListener() {
        /**
         * {@inheritDoc}
         */
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                MultiHaplotypeBlockTestGraphPanel.this.chromosomeSelectionChanged();
            }
        }
    });

    JToolBar toolBar = new JToolBar();
    toolBar.add(new JLabel("Chromosome:"));

    // limit the size or the toolbar will try to make the drop-down huge
    this.chromosomeComboBox.setMaximumSize(this.chromosomeComboBox.getPreferredSize());
    toolBar.add(this.chromosomeComboBox);

    this.add(toolBar, BorderLayout.PAGE_START);

    this.add(this.chartPanel, BorderLayout.CENTER);

    this.chromosomeSelectionChanged();
}

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

public UnicodeLabelDemo() {

    // create a simple graph for the demo
    graph = new DirectedSparseGraph<Integer, Number>();
    Integer[] v = createVertices(10);
    createEdges(v);/* ww  w  .  j a va2s .c  om*/

    vv = new VisualizationViewer<Integer, Number>(new FRLayout<Integer, Number>(graph));
    vv.getRenderContext().setVertexLabelTransformer(new UnicodeVertexStringer<Integer>(v));
    vv.getRenderContext().setVertexLabelRenderer(new DefaultVertexLabelRenderer(Color.cyan));
    vv.getRenderContext().setEdgeLabelRenderer(new DefaultEdgeLabelRenderer(Color.cyan));
    VertexIconShapeTransformer<Integer> vertexIconShapeFunction = new VertexIconShapeTransformer<Integer>(
            new EllipseVertexShapeTransformer<Integer>());
    DefaultVertexIconTransformer<Integer> vertexIconFunction = new DefaultVertexIconTransformer<Integer>();
    vv.getRenderContext().setVertexShapeTransformer(vertexIconShapeFunction);
    vv.getRenderContext().setVertexIconTransformer(vertexIconFunction);
    loadImages(v, vertexIconFunction.getIconMap());
    vertexIconShapeFunction.setIconMap(vertexIconFunction.getIconMap());
    vv.getRenderContext().setVertexFillPaintTransformer(
            new PickableVertexPaintTransformer<Integer>(vv.getPickedVertexState(), Color.white, Color.yellow));
    vv.getRenderContext().setEdgeDrawPaintTransformer(
            new PickableEdgePaintTransformer<Number>(vv.getPickedEdgeState(), Color.black, Color.lightGray));

    vv.setBackground(Color.white);

    // add my listener for ToolTips
    vv.setVertexToolTipTransformer(new ToStringLabeller<Integer>());

    // create a frome to hold the graph
    final JFrame frame = new JFrame();
    Container content = frame.getContentPane();
    final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv);
    content.add(panel);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    final ModalGraphMouse gm = new DefaultModalGraphMouse<Integer, Number>();
    vv.setGraphMouse(gm);

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

    JCheckBox lo = new JCheckBox("Show Labels");
    lo.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            showLabels = e.getStateChange() == ItemEvent.SELECTED;
            vv.repaint();
        }
    });
    lo.setSelected(true);

    JPanel controls = new JPanel();
    controls.add(plus);
    controls.add(minus);
    controls.add(lo);
    controls.add(((DefaultModalGraphMouse<Integer, Number>) gm).getModeComboBox());
    content.add(controls, BorderLayout.SOUTH);

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