Example usage for javax.swing JCheckBoxMenuItem JCheckBoxMenuItem

List of usage examples for javax.swing JCheckBoxMenuItem JCheckBoxMenuItem

Introduction

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

Prototype

public JCheckBoxMenuItem(Action a) 

Source Link

Document

Creates a menu item whose properties are taken from the Action supplied.

Usage

From source file:com.monead.semantic.workbench.SemanticWorkbench.java

/**
 * Create the configuration menu/*  w  w  w .  j av a 2s. c o  m*/
 * 
 * @return The configuration menu
 */
private JMenu setupConfigurationMenu() {
    final JMenu menu = new JMenu("Configure");
    ButtonGroup buttonGroup;

    menu.setMnemonic(KeyEvent.VK_C);
    menu.setToolTipText("Menu items related to configuration");

    buttonGroup = new ButtonGroup();
    setupOutputAssertionLanguage = new JCheckBoxMenuItem[FORMATS.length + 1];
    setupOutputAssertionLanguage[0] = new JCheckBoxMenuItem("Output Format: Auto");
    buttonGroup.add(setupOutputAssertionLanguage[0]);
    menu.add(setupOutputAssertionLanguage[0]);

    for (int index = 0; index < FORMATS.length; ++index) {
        setupOutputAssertionLanguage[index + 1] = new JCheckBoxMenuItem("Output Format: " + FORMATS[index]);
        buttonGroup.add(setupOutputAssertionLanguage[index + 1]);
        menu.add(setupOutputAssertionLanguage[index + 1]);
    }
    setupOutputAssertionLanguage[0].setSelected(true);

    menu.addSeparator();

    buttonGroup = new ButtonGroup();
    setupOutputModelTypeAssertions = new JCheckBoxMenuItem("Output Assertions Only");
    buttonGroup.add(setupOutputModelTypeAssertions);
    menu.add(setupOutputModelTypeAssertions);

    setupOutputModelTypeAssertionsAndInferences = new JCheckBoxMenuItem("Output Assertions and Inferences");
    buttonGroup.add(setupOutputModelTypeAssertionsAndInferences);
    menu.add(setupOutputModelTypeAssertionsAndInferences);

    setupOutputModelTypeAssertions.setSelected(true);

    menu.addSeparator();

    setupAllowMultilineResultOutput = new JCheckBoxMenuItem(
            "Allow Multiple Lines of Text Per Row in SPARQL Query Output");
    setupAllowMultilineResultOutput.setToolTipText("Wrap long values into multiple lines in a display cell");
    setupAllowMultilineResultOutput.setSelected(false);
    menu.add(setupAllowMultilineResultOutput);

    setupOutputFqnNamespaces = new JCheckBoxMenuItem("Show FQN Namespaces Instead of Prefixes in Query Output");
    setupOutputFqnNamespaces
            .setToolTipText("Use the fully qualified namespace. If unchecked use the prefix, if defined");
    setupOutputFqnNamespaces.setSelected(false);
    menu.add(setupOutputFqnNamespaces);

    setupOutputDatatypesForLiterals = new JCheckBoxMenuItem("Show Datatypes on Literals");
    setupOutputDatatypesForLiterals.setToolTipText("Display the datatype after the value, e.g. 4^^xsd:integer");
    setupOutputDatatypesForLiterals.setSelected(false);
    menu.add(setupOutputDatatypesForLiterals);

    setupOutputFlagLiteralValues = new JCheckBoxMenuItem("Flag Literal Values in Query Output");
    setupOutputFlagLiteralValues.setToolTipText("Includes the text 'Lit:' in front of any literal values");
    setupOutputFlagLiteralValues.setSelected(false);
    menu.add(setupOutputFlagLiteralValues);

    setupApplyFormattingToLiteralValues = new JCheckBoxMenuItem("Apply Formatting to Literal Values");
    setupApplyFormattingToLiteralValues.setToolTipText(
            "Apply the XSD-based formatting defined in the configuration to literal values in SPARQL results and tree view display");
    setupApplyFormattingToLiteralValues.setSelected(true);
    menu.add(setupApplyFormattingToLiteralValues);

    setupDisplayImagesInSparqlResults = new JCheckBoxMenuItem(
            "Display Images in Query Output (Slows Results Retrieval)");
    setupDisplayImagesInSparqlResults.setToolTipText("Attempts to download images linked in the results. "
            + "Can run very slowly depending on number and size of images");
    setupDisplayImagesInSparqlResults.setSelected(true);
    menu.add(setupDisplayImagesInSparqlResults);

    menu.addSeparator();

    buttonGroup = new ButtonGroup();
    setupExportSparqlResultsAsCsv = new JCheckBoxMenuItem(
            "Export SPARQL Results to " + EXPORT_FORMAT_LABEL_CSV);
    setupExportSparqlResultsAsCsv.setToolTipText("Export to Comma Separated Value format");
    buttonGroup.add(setupExportSparqlResultsAsCsv);
    menu.add(setupExportSparqlResultsAsCsv);

    setupExportSparqlResultsAsTsv = new JCheckBoxMenuItem(
            "Export SPARQL Results to " + EXPORT_FORMAT_LABEL_TSV);
    setupExportSparqlResultsAsTsv.setToolTipText("Export to Tab Separated Value format");
    buttonGroup.add(setupExportSparqlResultsAsTsv);
    menu.add(setupExportSparqlResultsAsTsv);

    menu.addSeparator();

    setupSparqlResultsToFile = new JCheckBoxMenuItem("Send SPARQL Results Directly to File");
    setupSparqlResultsToFile.setToolTipText(
            "For large results sets this permits writing to file without trying to render on screen");
    menu.add(setupSparqlResultsToFile);

    menu.addSeparator();

    setupEnableStrictMode = new JCheckBoxMenuItem("Enable Strict Checking Mode");
    setupEnableStrictMode.setSelected(true);
    setupEnableStrictMode.addActionListener(new ReasonerConfigurationChange());
    menu.add(setupEnableStrictMode);

    menu.addSeparator();

    setupFont = new JMenuItem("Font");
    setupFont.setMnemonic(KeyEvent.VK_F);
    setupFont.setToolTipText("Set the font used for the display");
    setupFont.addActionListener(new FontSetupListener());
    menu.add(setupFont);

    menu.addSeparator();

    setupProxyEnabled = new JCheckBoxMenuItem("Enable Proxy");
    setupProxyEnabled.setToolTipText("Pass network SPARQL requests through a proxy");
    setupProxyEnabled.addActionListener(new ProxyStatusChangeListener());
    menu.add(setupProxyEnabled);

    setupProxyConfiguration = new JMenuItem("Proxy Settings");
    setupProxyConfiguration.setToolTipText("Configure the proxy");
    setupProxyConfiguration.addActionListener(new ProxySetupListener());
    menu.add(setupProxyConfiguration);

    return menu;
}

From source file:com.monead.semantic.workbench.SemanticWorkbench.java

/**
 * Create the filters menu/*w  w w  . jav a 2  s  .c  o m*/
 * 
 * @return The filters menu
 */
private JMenu setupFiltersMenu() {
    final JMenu menu = new JMenu("Tree Filter");

    menu.setMnemonic(KeyEvent.VK_F);
    menu.setToolTipText("Menu items related to filtering values out of the model's tree");

    filterEnableFilters = new JCheckBoxMenuItem("Enable Filters");
    filterEnableFilters.setSelected(true);
    filterEnableFilters
            .setToolTipText("Enforce the filtered list of classes and properties when creating the tree view");
    menu.add(filterEnableFilters);

    filterShowAnonymousNodes = new JCheckBoxMenuItem("Show Anonymous Nodes");
    filterShowAnonymousNodes.setSelected(false);
    filterShowAnonymousNodes.setToolTipText("Include anonymous nodes in the tree view");
    menu.add(filterShowAnonymousNodes);

    showFqnInTree = new JCheckBoxMenuItem("Show FQN In Tree");
    showFqnInTree.setSelected(false);
    showFqnInTree
            .setToolTipText("Show the fully qualified name for classes, properties and objects in the tree");
    menu.add(showFqnInTree);

    menu.addSeparator();

    filterEditFilteredClasses = new JMenuItem("Edit List of Filtered Classes");
    filterEditFilteredClasses
            .setToolTipText("Present the list of filtered classes and allow them to be edited");
    filterEditFilteredClasses.addActionListener(new EditFilteredClassesListener());
    menu.add(filterEditFilteredClasses);

    filterEditFilteredProperties = new JMenuItem("Edit List of Filtered Properties");
    filterEditFilteredProperties
            .setToolTipText("Present the list of filtered properties and allow them to be edited");
    filterEditFilteredProperties.addActionListener(new EditFilteredPropertiesListener());
    menu.add(filterEditFilteredProperties);

    menu.addSeparator();

    filterSetMaximumIndividualsPerClassInTree = new JMenuItem("Set Maximum Individuals Per Class in Tree");
    filterSetMaximumIndividualsPerClassInTree
            .setToolTipText("Limit number of individuals shown for each class in the tree view.");
    filterSetMaximumIndividualsPerClassInTree
            .addActionListener(new SetMaximumIndividualsPerClassInTreeListener());
    menu.add(filterSetMaximumIndividualsPerClassInTree);

    return menu;
}

From source file:net.sourceforge.pmd.cpd.GUI.java

public GUI() {
    frame = new JFrame("PMD Duplicate Code Detector (v " + PMDVersion.VERSION + ')');

    timeField.setEditable(false);//from  w w w . ja  v  a  2  s . c  o  m

    JMenu fileMenu = new JMenu("File");
    fileMenu.setMnemonic('f');

    addSaveOptionsTo(fileMenu);

    JMenuItem exitItem = new JMenuItem("Exit");
    exitItem.setMnemonic('x');
    exitItem.addActionListener(new CancelListener());
    fileMenu.add(exitItem);
    JMenu viewMenu = new JMenu("View");
    fileMenu.setMnemonic('v');
    JMenuItem trimItem = new JCheckBoxMenuItem("Trim leading whitespace");
    trimItem.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            AbstractButton button = (AbstractButton) e.getItem();
            GUI.this.trimLeadingWhitespace = button.isSelected();
        }
    });
    viewMenu.add(trimItem);
    JMenuBar menuBar = new JMenuBar();
    menuBar.add(fileMenu);
    menuBar.add(viewMenu);
    frame.setJMenuBar(menuBar);

    // first make all the buttons
    JButton browseButton = new JButton("Browse");
    browseButton.setMnemonic('b');
    browseButton.addActionListener(new BrowseListener());
    goButton = new JButton("Go");
    goButton.setMnemonic('g');
    goButton.addActionListener(new GoListener());
    cancelButton = new JButton("Cancel");
    cancelButton.addActionListener(new CancelListener());

    JPanel settingsPanel = makeSettingsPanel(browseButton, goButton, cancelButton);
    progressPanel = makeProgressPanel();
    JPanel resultsPanel = makeResultsPanel();

    adjustLanguageControlsFor((LanguageConfig) LANGUAGE_SETS[0][1]);

    frame.getContentPane().setLayout(new BorderLayout());
    JPanel topPanel = new JPanel();
    topPanel.setLayout(new BorderLayout());
    topPanel.add(settingsPanel, BorderLayout.NORTH);
    topPanel.add(progressPanel, BorderLayout.CENTER);
    setProgressControls(false); // not running now
    frame.getContentPane().add(topPanel, BorderLayout.NORTH);
    frame.getContentPane().add(resultsPanel, BorderLayout.CENTER);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.pack();
    frame.setVisible(true);
}

From source file:org.apache.pdfbox.debugger.PDFDebugger.java

private JMenu createViewMenu() {
    JMenu viewMenu = new JMenu("View");
    viewMenu.setMnemonic('V');
    if (isPageMode) {
        viewModeItem = new JMenuItem("Show Internal Structure");
    } else {//  w w  w.java  2  s.  c o  m
        viewModeItem = new JMenuItem("Show Pages");
    }
    viewModeItem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            if (isPageMode) {
                viewModeItem.setText("Show Pages");
                isPageMode = false;
            } else {
                viewModeItem.setText("Show Internal Structure");
                isPageMode = true;
            }
            if (document != null) {
                initTree();
            }
        }
    });
    viewMenu.add(viewModeItem);

    ZoomMenu zoomMenu = ZoomMenu.getInstance();
    zoomMenu.setEnableMenu(false);
    viewMenu.add(zoomMenu.getMenu());

    RotationMenu rotationMenu = RotationMenu.getInstance();
    rotationMenu.setEnableMenu(false);
    viewMenu.add(rotationMenu.getMenu());

    viewMenu.addSeparator();

    showTextStripper = new JCheckBoxMenuItem("Show TextStripper TextPositions");
    showTextStripper.setEnabled(false);
    viewMenu.add(showTextStripper);

    showTextStripperBeads = new JCheckBoxMenuItem("Show TextStripper Beads");
    showTextStripperBeads.setEnabled(false);
    viewMenu.add(showTextStripperBeads);

    showFontBBox = new JCheckBoxMenuItem("Show Approximate Text Bounds");
    showFontBBox.setEnabled(false);
    viewMenu.add(showFontBBox);

    showGlyphBounds = new JCheckBoxMenuItem("Show Glyph Bounds");
    showGlyphBounds.setEnabled(false);
    viewMenu.add(showGlyphBounds);

    return viewMenu;
}

From source file:org.broad.igv.hic.MainWindow.java

private JMenuBar createMenuBar(final JPanel hiCPanel) {

    JMenuBar menuBar = new JMenuBar();

    //======== fileMenu ========
    JMenu fileMenu = new JMenu("File");

    //---- loadMenuItem ----
    JMenuItem loadMenuItem = new JMenuItem();
    loadMenuItem.setText("Load...");
    loadMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            loadMenuItemActionPerformed(e);
        }/*  w w  w  .j  a  v a2s .  c o  m*/
    });
    fileMenu.add(loadMenuItem);

    //---- loadFromURL ----
    JMenuItem loadFromURL = new JMenuItem();
    JMenuItem getEigenvector = new JMenuItem();
    final JCheckBoxMenuItem viewDNAseI;

    loadFromURL.setText("Load from URL ...");
    loadFromURL.setName("loadFromURL");
    loadFromURL.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            loadFromURLActionPerformed(e);
        }
    });
    fileMenu.add(loadFromURL);
    fileMenu.addSeparator();

    // Pre-defined datasets.  TODO -- generate from a file
    addPredefinedLoadItems(fileMenu);

    JMenuItem saveToImage = new JMenuItem();
    saveToImage.setText("Save to image");
    saveToImage.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            BufferedImage image = (BufferedImage) createImage(1000, 1000);
            Graphics g = image.createGraphics();
            hiCPanel.paint(g);

            JFileChooser fc = new JFileChooser();
            fc.setSelectedFile(new File("image.png"));
            int actionDialog = fc.showSaveDialog(null);
            if (actionDialog == JFileChooser.APPROVE_OPTION) {
                File file = fc.getSelectedFile();
                if (file.exists()) {
                    actionDialog = JOptionPane.showConfirmDialog(null, "Replace existing file?");
                    if (actionDialog == JOptionPane.NO_OPTION || actionDialog == JOptionPane.CANCEL_OPTION)
                        return;
                }
                try {
                    // default if they give no format or invalid format
                    String fmt = "jpg";
                    int ind = file.getName().indexOf(".");
                    if (ind != -1) {
                        String ext = file.getName().substring(ind + 1);
                        String[] strs = ImageIO.getWriterFormatNames();
                        for (String aStr : strs)
                            if (ext.equals(aStr))
                                fmt = ext;
                    }
                    ImageIO.write(image.getSubimage(0, 0, 600, 600), fmt, file);
                } catch (IOException ie) {
                    System.err.println("Unable to write " + file + ": " + ie);
                }
            }
        }
    });
    fileMenu.add(saveToImage);
    getEigenvector = new JMenuItem("Get principal eigenvector");
    getEigenvector.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            getEigenvectorActionPerformed(e);
        }
    });
    fileMenu.add(getEigenvector);
    //---- exit ----
    JMenuItem exit = new JMenuItem();
    exit.setText("Exit");
    exit.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            exitActionPerformed(e);
        }
    });
    fileMenu.add(exit);

    menuBar.add(fileMenu);

    //======== Tracks menu ========

    JMenu tracksMenu = new JMenu("Tracks");

    viewEigenvector = new JCheckBoxMenuItem("View Eigenvector...");
    viewEigenvector.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (viewEigenvector.isSelected()) {
                if (eigenvectorTrack == null) {
                    eigenvectorTrack = new EigenvectorTrack("eigen", "Eigenvectors");
                }
                updateEigenvectorTrack();
            } else {
                trackPanel.setEigenvectorTrack(null);
                if (HiCTrackManager.getLoadedTracks().isEmpty()) {
                    trackPanel.setVisible(false);
                }
            }
        }
    });
    viewEigenvector.setEnabled(false);
    tracksMenu.add(viewEigenvector);

    JMenuItem loadItem = new JMenuItem("Load...");
    loadItem.addActionListener(new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            HiCTrackManager.loadHostedTrack(MainWindow.this);
        }

    });
    tracksMenu.add(loadItem);

    JMenuItem loadFromFileItem = new JMenuItem("Load from file...");
    loadFromFileItem.addActionListener(new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            HiCTrackManager.loadTrackFromFile(MainWindow.this);
        }

    });
    tracksMenu.add(loadFromFileItem);

    menuBar.add(tracksMenu);

    //======== Extras menu ========
    JMenu extrasMenu = new JMenu("Extras");

    JMenuItem dumpPearsons = new JMenuItem("Dump pearsons matrix ...");
    dumpPearsons.addActionListener(new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            BasicMatrix pearsons = hic.zd.getPearsons();
            try {
                String chr1 = hic.getChromosomes()[hic.zd.getChr1()].getName();
                String chr2 = hic.getChromosomes()[hic.zd.getChr2()].getName();
                int binSize = hic.zd.getBinSize();
                File initFile = new File("pearsons_" + chr1 + "_" + "_" + chr2 + "_" + binSize + ".bin");
                File f = FileDialogUtils.chooseFile("Save pearsons", null, initFile, FileDialogUtils.SAVE);
                if (f != null) {
                    ScratchPad.dumpPearsonsBinary(pearsons, chr1, chr2, hic.zd.getBinSize(), f);
                }
            } catch (IOException e) {
                e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
            }
        }

    });

    JMenuItem dumpEigenvector = new JMenuItem("Dump eigenvector ...");
    dumpEigenvector.addActionListener(new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            try {
                ScratchPad.dumpEigenvector(hic);
            } catch (IOException e) {
                e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
            }
        }

    });
    extrasMenu.add(dumpEigenvector);

    JMenuItem readPearsons = new JMenuItem("Read pearsons...");
    readPearsons.addActionListener(new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            try {
                File f = FileDialogUtils.chooseFile("Pearsons file (Yunfan format)");
                if (f != null) {
                    BasicMatrix bm = ScratchPad.readPearsons(f.getAbsolutePath());

                    hic.zd.setPearsons(bm);
                }
            } catch (IOException e) {
                e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
            }
        }

    });
    extrasMenu.add(readPearsons);

    extrasMenu.add(dumpPearsons);
    menuBar.add(extrasMenu);

    return menuBar;
}

From source file:org.broad.igv.track.TrackMenuUtils.java

/**
 * Return popup menu with items applicable to data tracks
 *
 * @return//from w w  w  .j av  a  2  s.  co  m
 */
public static void addDataItems(JPopupMenu menu, final Collection<Track> tracks) {

    if (log.isDebugEnabled()) {
        log.debug("enter getDataPopupMenu");
    }

    final String[] labels = { "Heatmap", "Bar Chart", "Scatterplot", "Line Plot" };
    final Class[] renderers = { HeatmapRenderer.class, BarChartRenderer.class, PointsRenderer.class,
            LineplotRenderer.class };

    //JLabel popupTitle = new JLabel(LEADING_HEADING_SPACER + title, JLabel.CENTER);

    JLabel rendererHeading = new JLabel(LEADING_HEADING_SPACER + "Type of Graph", JLabel.LEFT);
    rendererHeading.setFont(UIConstants.boldFont);

    menu.add(rendererHeading);

    // Get existing selections
    Set<Class> currentRenderers = new HashSet<Class>();
    for (Track track : tracks) {
        if (track.getRenderer() != null) {
            currentRenderers.add(track.getRenderer().getClass());
        }
    }

    // Create and renderer menu items
    for (int i = 0; i < labels.length; i++) {
        JCheckBoxMenuItem item = new JCheckBoxMenuItem(labels[i]);
        final Class rendererClass = renderers[i];
        if (currentRenderers.contains(rendererClass)) {
            item.setSelected(true);
        }
        item.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                changeRenderer(tracks, rendererClass);
            }
        });
        menu.add(item);
    }
    menu.addSeparator();

    // Get union of all valid window functions for selected tracks
    Set<WindowFunction> avaibleWindowFunctions = new HashSet();
    for (Track track : tracks) {
        avaibleWindowFunctions.addAll(track.getAvailableWindowFunctions());
    }
    avaibleWindowFunctions.add(WindowFunction.none);

    // dataPopupMenu.addSeparator();
    // Collection all window functions for selected tracks
    Set<WindowFunction> currentWindowFunctions = new HashSet<WindowFunction>();
    for (Track track : tracks) {
        if (track.getWindowFunction() != null) {
            currentWindowFunctions.add(track.getWindowFunction());
        }
    }

    if (avaibleWindowFunctions.size() > 1 || currentWindowFunctions.size() > 1) {
        JLabel statisticsHeading = new JLabel(LEADING_HEADING_SPACER + "Windowing Function", JLabel.LEFT);
        statisticsHeading.setFont(UIConstants.boldFont);

        menu.add(statisticsHeading);

        for (final WindowFunction wf : ORDERED_WINDOW_FUNCTIONS) {
            JCheckBoxMenuItem item = new JCheckBoxMenuItem(wf.getDisplayName());
            if (avaibleWindowFunctions.contains(wf) || currentWindowFunctions.contains(wf)) {
                if (currentWindowFunctions.contains(wf)) {
                    item.setSelected(true);
                }
                item.addActionListener(new ActionListener() {

                    public void actionPerformed(ActionEvent evt) {
                        changeStatType(wf.toString(), tracks);
                    }
                });
                menu.add(item);
            }
        }
        menu.addSeparator();
    }

    menu.add(getDataRangeItem(tracks));
    menu.add(getHeatmapScaleItem(tracks));

    if (tracks.size() > 0) {
        menu.add(getLogScaleItem(tracks));
    }

    menu.add(getAutoscaleItem(tracks));

    menu.add(getShowDataRangeItem(tracks));

    menu.addSeparator();
    menu.add(getChangeKMPlotItem(tracks));

}

From source file:org.broad.igv.track.TrackMenuUtils.java

private static JMenuItem getDrawBorderItem() {
    // Change track height by attribute

    final JCheckBoxMenuItem drawBorderItem = new JCheckBoxMenuItem("Draw borders");
    drawBorderItem.setSelected(FeatureTrack.isDrawBorder());
    drawBorderItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            FeatureTrack.setDrawBorder(drawBorderItem.isSelected());
            IGV.getInstance().repaintDataPanels();
        }//from   ww w  .  java  2s. c  o  m
    });

    return drawBorderItem;
}

From source file:org.broad.igv.track.TrackMenuUtils.java

public static JMenuItem getLogScaleItem(final Collection<Track> selectedTracks) {
    // Change track height by attribute

    final JCheckBoxMenuItem logScaleItem = new JCheckBoxMenuItem("Log scale");
    final boolean logScale = selectedTracks.iterator().next().getDataRange().isLog();
    logScaleItem.setSelected(logScale);//from   w w  w  .ja  va2 s  .  c  o  m
    logScaleItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            DataRange.Type scaleType = logScaleItem.isSelected() ? DataRange.Type.LOG : DataRange.Type.LINEAR;
            for (Track t : selectedTracks) {
                t.getDataRange().setType(scaleType);
            }
            IGV.getInstance().repaintDataPanels();
        }
    });

    return logScaleItem;
}

From source file:org.broad.igv.track.TrackMenuUtils.java

private static JMenuItem getAutoscaleItem(final Collection<Track> selectedTracks) {

    final JCheckBoxMenuItem autoscaleItem = new JCheckBoxMenuItem("Autoscale");
    if (selectedTracks.size() == 0) {
        autoscaleItem.setEnabled(false);

    } else {/*from www  .  j a  v  a 2 s .c om*/
        boolean autoScale = false;
        for (Track t : selectedTracks) {
            if (t instanceof DataTrack && ((DataTrack) t).isAutoscale()) {
                autoScale = true;
                break;
            }
        }

        autoscaleItem.setSelected(autoScale);
        autoscaleItem.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent evt) {

                boolean autoScale = autoscaleItem.isSelected();
                for (Track t : selectedTracks) {
                    if (t instanceof DataTrack) {
                        ((DataTrack) t).setAutoscale(autoScale);
                    }
                }
                IGV.getInstance().repaintDataPanels();
            }
        });
    }
    return autoscaleItem;
}

From source file:org.broad.igv.track.TrackMenuUtils.java

public static JMenuItem getShowDataRangeItem(final Collection<Track> selectedTracks) {

    final JCheckBoxMenuItem item = new JCheckBoxMenuItem("Show Data Range");
    if (selectedTracks.size() == 0) {
        item.setEnabled(false);/*from  ww  w. ja  va  2 s.  c  om*/

    } else {
        boolean showDataRange = true;
        for (Track t : selectedTracks) {
            if (!t.isShowDataRange()) {
                showDataRange = false;
                break;
            }
        }

        item.setSelected(showDataRange);
        item.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent evt) {

                boolean showDataRange = item.isSelected();
                for (Track t : selectedTracks) {
                    if (t instanceof DataTrack) {
                        ((DataTrack) t).setShowDataRange(showDataRange);
                    }
                }
                IGV.getInstance().repaintDataPanels();
            }
        });
    }
    return item;
}