Java Code Examples for javax.swing.JMenuItem#isSelected()

The following examples show how to use javax.swing.JMenuItem#isSelected() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NbMenuItem.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
     * @param it
     * @return instance of NbMenuItem constructed from parameter it */
    public NbMenuItem(JMenuItem it) {
        setName(it.getText());//getLabel();
        this.accelerator = (it.getAccelerator() == null) ? null : it.getAccelerator().toString();
        this.mnemo = (char) it.getMnemonic();
//        System.out.println("NbMenuItem ["+name+"] - mnemo: ["+it.getMnemonic()+"]"); why are the mnemonic always in capital?
        this.enabled = it.isEnabled();
        this.checkbox = it instanceof JCheckBoxMenuItem;
        this.radiobutton = it instanceof JRadioButtonMenuItem;
        this.checked = it.isSelected();
    }
 
Example 2
Source File: NbMenuItem.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
     * @param it
     * @return instance of NbMenuItem constructed from parameter it */
    public NbMenuItem(JMenuItem it) {
        setName(it.getText());//getLabel();
        this.accelerator = (it.getAccelerator() == null) ? null : it.getAccelerator().toString();
        this.mnemo = (char) it.getMnemonic();
//        System.out.println("NbMenuItem ["+name+"] - mnemo: ["+it.getMnemonic()+"]"); why are the mnemonic always in capital?
        this.enabled = it.isEnabled();
        this.checkbox = it instanceof JCheckBoxMenuItem;
        this.radiobutton = it instanceof JRadioButtonMenuItem;
        this.checked = it.isSelected();
    }
 
Example 3
Source File: TableColumnManager.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
public void actionPerformed(ActionEvent event)
   {
	JMenuItem item = (JMenuItem)event.getSource();

	if (item.isSelected())
	{
		showColumn(item.getText());
	}
	else
	{
		hideColumn(item.getText());
	}
}
 
Example 4
Source File: FlatMenuItemRenderer.java    From FlatLaf with Apache License 2.0 4 votes vote down vote up
protected static boolean isArmedOrSelected( JMenuItem menuItem ) {
	return menuItem.isArmed() || (menuItem instanceof JMenu && menuItem.isSelected());
}
 
Example 5
Source File: UIRes.java    From RipplePower with Apache License 2.0 4 votes vote down vote up
public void paintIcon(Component c, Graphics g, int x, int y) {
	JMenuItem b = (JMenuItem) c;
	if (b.isSelected()) {
		drawCheck(g, x, y + 1);
	}
}