Example usage for javax.swing JCheckBoxMenuItem setName

List of usage examples for javax.swing JCheckBoxMenuItem setName

Introduction

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

Prototype

public void setName(String name) 

Source Link

Document

Sets the name of the component to the specified string.

Usage

From source file:org.esa.beam.visat.toolviews.stat.MaskSelectionToolSupport.java

public JCheckBoxMenuItem createMaskSelectionModeMenuItem() {
    final JCheckBoxMenuItem menuItem = new JCheckBoxMenuItem(String.format("Select Mask '%s'", maskName));
    menuItem.setName("maskSelectionMode");
    menuItem.addActionListener(new ActionListener() {
        @Override//from ww  w  . ja va2  s  .c  o m
        public void actionPerformed(ActionEvent e) {
            if (menuItem.isSelected()) {
                if (plotAreaSelectionTool == null) {
                    plotAreaSelectionTool = new PlotAreaSelectionTool(chartPanel,
                            MaskSelectionToolSupport.this);
                    plotAreaSelectionTool.setAreaType(areaType);
                    plotAreaSelectionTool.setFillPaint(createAlphaColor(maskColor, 50));
                }
                plotAreaSelectionTool.install();
            } else {
                if (plotAreaSelectionTool != null) {
                    plotAreaSelectionTool.uninstall();
                }
            }
        }
    });
    return menuItem;
}