use of javax.swing.JCheckBoxMenuItem in project processing by processing.
the class Toolkit method newJCheckBoxMenuItem.
public static JCheckBoxMenuItem newJCheckBoxMenuItem(String title, int what) {
JCheckBoxMenuItem menuItem = new JCheckBoxMenuItem(title);
int modifiers = awtToolkit.getMenuShortcutKeyMask();
menuItem.setAccelerator(KeyStroke.getKeyStroke(what, modifiers));
return menuItem;
}
use of javax.swing.JCheckBoxMenuItem in project jadx by skylot.
the class MainWindow method initMenuAndToolbar.
private void initMenuAndToolbar() {
Action openAction = new AbstractAction(NLS.str("file.open"), ICON_OPEN) {
@Override
public void actionPerformed(ActionEvent e) {
openFile();
}
};
openAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("file.open"));
openAction.putValue(Action.ACCELERATOR_KEY, getKeyStroke(KeyEvent.VK_O, KeyEvent.CTRL_DOWN_MASK));
Action saveAllAction = new AbstractAction(NLS.str("file.save_all"), ICON_SAVE_ALL) {
@Override
public void actionPerformed(ActionEvent e) {
saveAll(false);
}
};
saveAllAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("file.save_all"));
saveAllAction.putValue(Action.ACCELERATOR_KEY, getKeyStroke(KeyEvent.VK_S, KeyEvent.CTRL_DOWN_MASK));
Action exportAction = new AbstractAction(NLS.str("file.export_gradle"), ICON_EXPORT) {
@Override
public void actionPerformed(ActionEvent e) {
saveAll(true);
}
};
exportAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("file.export_gradle"));
exportAction.putValue(Action.ACCELERATOR_KEY, getKeyStroke(KeyEvent.VK_E, KeyEvent.CTRL_DOWN_MASK));
JMenu recentFiles = new JMenu(NLS.str("menu.recent_files"));
recentFiles.addMenuListener(new RecentFilesMenuListener(recentFiles));
Action prefsAction = new AbstractAction(NLS.str("menu.preferences"), ICON_PREF) {
@Override
public void actionPerformed(ActionEvent e) {
new JadxSettingsWindow(MainWindow.this, settings).setVisible(true);
}
};
prefsAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("menu.preferences"));
prefsAction.putValue(Action.ACCELERATOR_KEY, getKeyStroke(KeyEvent.VK_P, KeyEvent.CTRL_DOWN_MASK | KeyEvent.SHIFT_DOWN_MASK));
Action exitAction = new AbstractAction(NLS.str("file.exit"), ICON_CLOSE) {
@Override
public void actionPerformed(ActionEvent e) {
dispose();
}
};
isFlattenPackage = settings.isFlattenPackage();
flatPkgMenuItem = new JCheckBoxMenuItem(NLS.str("menu.flatten"), ICON_FLAT_PKG);
flatPkgMenuItem.setState(isFlattenPackage);
Action syncAction = new AbstractAction(NLS.str("menu.sync"), ICON_SYNC) {
@Override
public void actionPerformed(ActionEvent e) {
syncWithEditor();
}
};
syncAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("menu.sync"));
syncAction.putValue(Action.ACCELERATOR_KEY, getKeyStroke(KeyEvent.VK_T, KeyEvent.CTRL_DOWN_MASK));
Action textSearchAction = new AbstractAction(NLS.str("menu.text_search"), ICON_SEARCH) {
@Override
public void actionPerformed(ActionEvent e) {
new SearchDialog(MainWindow.this, EnumSet.of(SearchOptions.CODE)).setVisible(true);
}
};
textSearchAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("menu.text_search"));
textSearchAction.putValue(Action.ACCELERATOR_KEY, getKeyStroke(KeyEvent.VK_F, KeyEvent.CTRL_DOWN_MASK | KeyEvent.SHIFT_DOWN_MASK));
Action clsSearchAction = new AbstractAction(NLS.str("menu.class_search"), ICON_FIND) {
@Override
public void actionPerformed(ActionEvent e) {
new SearchDialog(MainWindow.this, EnumSet.of(SearchOptions.CLASS)).setVisible(true);
}
};
clsSearchAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("menu.class_search"));
clsSearchAction.putValue(Action.ACCELERATOR_KEY, getKeyStroke(KeyEvent.VK_N, KeyEvent.CTRL_DOWN_MASK));
Action deobfAction = new AbstractAction(NLS.str("preferences.deobfuscation"), ICON_DEOBF) {
@Override
public void actionPerformed(ActionEvent e) {
toggleDeobfuscation();
}
};
deobfAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("preferences.deobfuscation"));
deobfAction.putValue(Action.ACCELERATOR_KEY, getKeyStroke(KeyEvent.VK_D, KeyEvent.CTRL_DOWN_MASK | KeyEvent.ALT_DOWN_MASK));
deobfToggleBtn = new JToggleButton(deobfAction);
deobfToggleBtn.setSelected(settings.isDeobfuscationOn());
deobfToggleBtn.setText("");
deobfMenuItem = new JCheckBoxMenuItem(deobfAction);
deobfMenuItem.setState(settings.isDeobfuscationOn());
Action logAction = new AbstractAction(NLS.str("menu.log"), ICON_LOG) {
@Override
public void actionPerformed(ActionEvent e) {
new LogViewer(settings).setVisible(true);
}
};
logAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("menu.log"));
logAction.putValue(Action.ACCELERATOR_KEY, getKeyStroke(KeyEvent.VK_L, KeyEvent.CTRL_DOWN_MASK | KeyEvent.SHIFT_DOWN_MASK));
Action aboutAction = new AbstractAction(NLS.str("menu.about")) {
@Override
public void actionPerformed(ActionEvent e) {
new AboutDialog().setVisible(true);
}
};
Action backAction = new AbstractAction(NLS.str("nav.back"), ICON_BACK) {
@Override
public void actionPerformed(ActionEvent e) {
tabbedPane.navBack();
}
};
backAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("nav.back"));
backAction.putValue(Action.ACCELERATOR_KEY, getKeyStroke(KeyEvent.VK_LEFT, KeyEvent.CTRL_DOWN_MASK | KeyEvent.ALT_DOWN_MASK));
Action forwardAction = new AbstractAction(NLS.str("nav.forward"), ICON_FORWARD) {
@Override
public void actionPerformed(ActionEvent e) {
tabbedPane.navForward();
}
};
forwardAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("nav.forward"));
forwardAction.putValue(Action.ACCELERATOR_KEY, getKeyStroke(KeyEvent.VK_RIGHT, KeyEvent.CTRL_DOWN_MASK | KeyEvent.ALT_DOWN_MASK));
JMenu file = new JMenu(NLS.str("menu.file"));
file.setMnemonic(KeyEvent.VK_F);
file.add(openAction);
file.add(saveAllAction);
file.add(exportAction);
file.addSeparator();
file.add(recentFiles);
file.addSeparator();
file.add(prefsAction);
file.addSeparator();
file.add(exitAction);
JMenu view = new JMenu(NLS.str("menu.view"));
view.setMnemonic(KeyEvent.VK_V);
view.add(flatPkgMenuItem);
view.add(syncAction);
JMenu nav = new JMenu(NLS.str("menu.navigation"));
nav.setMnemonic(KeyEvent.VK_N);
nav.add(textSearchAction);
nav.add(clsSearchAction);
nav.addSeparator();
nav.add(backAction);
nav.add(forwardAction);
JMenu tools = new JMenu(NLS.str("menu.tools"));
tools.setMnemonic(KeyEvent.VK_T);
tools.add(deobfMenuItem);
tools.add(logAction);
JMenu help = new JMenu(NLS.str("menu.help"));
help.setMnemonic(KeyEvent.VK_H);
help.add(aboutAction);
JMenuBar menuBar = new JMenuBar();
menuBar.add(file);
menuBar.add(view);
menuBar.add(nav);
menuBar.add(tools);
menuBar.add(help);
setJMenuBar(menuBar);
flatPkgButton = new JToggleButton(ICON_FLAT_PKG);
flatPkgButton.setSelected(isFlattenPackage);
ActionListener flatPkgAction = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
toggleFlattenPackage();
}
};
flatPkgMenuItem.addActionListener(flatPkgAction);
flatPkgButton.addActionListener(flatPkgAction);
flatPkgButton.setToolTipText(NLS.str("menu.flatten"));
updateLink = new Link("", JadxUpdate.JADX_RELEASES_URL);
updateLink.setVisible(false);
JToolBar toolbar = new JToolBar();
toolbar.setFloatable(false);
toolbar.add(openAction);
toolbar.add(saveAllAction);
toolbar.add(exportAction);
toolbar.addSeparator();
toolbar.add(syncAction);
toolbar.add(flatPkgButton);
toolbar.addSeparator();
toolbar.add(textSearchAction);
toolbar.add(clsSearchAction);
toolbar.addSeparator();
toolbar.add(backAction);
toolbar.add(forwardAction);
toolbar.addSeparator();
toolbar.add(deobfToggleBtn);
toolbar.addSeparator();
toolbar.add(logAction);
toolbar.addSeparator();
toolbar.add(prefsAction);
toolbar.addSeparator();
toolbar.add(Box.createHorizontalGlue());
toolbar.add(updateLink);
mainPanel.add(toolbar, BorderLayout.NORTH);
}
use of javax.swing.JCheckBoxMenuItem in project gephi by gephi.
the class ColumnSelectionPanel method showColumnSelectionPopup.
public static void showColumnSelectionPopup(ColumnSelectionModel[] columns, Component c) {
JPopupMenu popup = new JPopupMenu();
for (int col = 0; col < columns.length; col++) {
final ColumnSelectionModel column = columns[col];
final JCheckBoxMenuItem checkBox = new JCheckBoxMenuItem();
checkBox.setText(column.getName());
checkBox.setSelected(column.isSelected());
checkBox.setEnabled(column.isEnabled());
checkBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
column.setSelected(checkBox.isSelected());
}
});
popup.add(checkBox);
}
popup.show(c, 8, 8);
}
use of javax.swing.JCheckBoxMenuItem in project jdk8u_jdk by JetBrains.
the class DimensionEncapsulation method run.
@Override
public void run() {
runTest(new Panel());
runTest(new Button());
runTest(new Checkbox());
runTest(new Canvas());
runTest(new Choice());
runTest(new Label());
runTest(new Scrollbar());
runTest(new TextArea());
runTest(new TextField());
runTest(new Dialog(new JFrame()));
runTest(new Frame());
runTest(new Window(new JFrame()));
runTest(new FileDialog(new JFrame()));
runTest(new List());
runTest(new ScrollPane());
runTest(new JFrame());
runTest(new JDialog(new JFrame()));
runTest(new JWindow(new JFrame()));
runTest(new JLabel("hi"));
runTest(new JMenu());
runTest(new JTree());
runTest(new JTable());
runTest(new JMenuItem());
runTest(new JCheckBoxMenuItem());
runTest(new JToggleButton());
runTest(new JSpinner());
runTest(new JSlider());
runTest(Box.createVerticalBox());
runTest(Box.createHorizontalBox());
runTest(new JTextField());
runTest(new JTextArea());
runTest(new JTextPane());
runTest(new JPasswordField());
runTest(new JFormattedTextField());
runTest(new JEditorPane());
runTest(new JButton());
runTest(new JColorChooser());
runTest(new JFileChooser());
runTest(new JCheckBox());
runTest(new JInternalFrame());
runTest(new JDesktopPane());
runTest(new JTableHeader());
runTest(new JLayeredPane());
runTest(new JRootPane());
runTest(new JMenuBar());
runTest(new JOptionPane());
runTest(new JRadioButton());
runTest(new JRadioButtonMenuItem());
runTest(new JPopupMenu());
//runTest(new JScrollBar()); --> don't test defines max and min in
// terms of preferred
runTest(new JScrollPane());
runTest(new JViewport());
runTest(new JSplitPane());
runTest(new JTabbedPane());
runTest(new JToolBar());
runTest(new JSeparator());
runTest(new JProgressBar());
if (!failures.isEmpty()) {
System.out.println("These classes failed");
for (final Component failure : failures) {
System.out.println(failure.getClass());
}
throw new RuntimeException("Test failed");
}
}
use of javax.swing.JCheckBoxMenuItem in project pcgen by PCGen.
the class JDynamicTable method createMenuItem.
private JCheckBoxMenuItem createMenuItem(TableColumn column) {
JCheckBoxMenuItem item = new JCheckBoxMenuItem();
boolean visible = dynamicColumnModel.isVisible(column);
item.setSelected(visible);
item.setAction(new MenuAction(column, visible));
return item;
}
Aggregations