import javax.swing.JMenuItem;
public class Main {
public static void main(String[] argv) throws Exception {
JMenuItem item = new JMenuItem("Label") {
public void menuSelectionChanged(boolean isSelected) {
super.menuSelectionChanged(isSelected);
if (isSelected) {
System.out.println("The menu item is selected");
} else {
System.out.println("The menu item is no longer selected");
}
}
};
}
}
|