use of javax.swing.JToggleButton in project zaproxy by zaproxy.
the class HttpPanelSender method getButtonUseCookies.
private JToggleButton getButtonUseCookies() {
if (useCookies == null) {
useCookies = new JToggleButton(new ImageIcon(HttpPanelSender.class.getResource("/resource/icon/fugue/cookie.png")), true);
useCookies.setToolTipText(Constant.messages.getString("manReq.checkBox.useCookies"));
useCookies.addItemListener(e -> setUseCookies(e.getStateChange() == ItemEvent.SELECTED));
}
return useCookies;
}
use of javax.swing.JToggleButton in project jadx by skylot.
the class MainWindow method initMenuAndToolbar.
private void initMenuAndToolbar() {
Action openAction = new AbstractAction(NLS.str("file.open_action"), ICON_OPEN) {
@Override
public void actionPerformed(ActionEvent e) {
openFileOrProject();
}
};
openAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("file.open_action"));
openAction.putValue(Action.ACCELERATOR_KEY, getKeyStroke(KeyEvent.VK_O, UiUtils.ctrlButton()));
Action addFilesAction = new AbstractAction(NLS.str("file.add_files_action"), ICON_ADD_FILES) {
@Override
public void actionPerformed(ActionEvent e) {
addFiles();
}
};
addFilesAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("file.add_files_action"));
newProjectAction = new AbstractAction(NLS.str("file.new_project")) {
@Override
public void actionPerformed(ActionEvent e) {
newProject();
}
};
newProjectAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("file.new_project"));
saveProjectAction = new AbstractAction(NLS.str("file.save_project")) {
@Override
public void actionPerformed(ActionEvent e) {
saveProject();
}
};
saveProjectAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("file.save_project"));
Action saveProjectAsAction = new AbstractAction(NLS.str("file.save_project_as")) {
@Override
public void actionPerformed(ActionEvent e) {
saveProjectAs();
}
};
saveProjectAsAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("file.save_project_as"));
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, UiUtils.ctrlButton()));
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, UiUtils.ctrlButton()));
JMenu recentProjects = new JMenu(NLS.str("menu.recent_projects"));
recentProjects.addMenuListener(new RecentProjectsMenuListener(recentProjects));
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, UiUtils.ctrlButton() | KeyEvent.SHIFT_DOWN_MASK));
Action exitAction = new AbstractAction(NLS.str("file.exit"), ICON_EXIT) {
@Override
public void actionPerformed(ActionEvent e) {
closeWindow();
}
};
isFlattenPackage = settings.isFlattenPackage();
flatPkgMenuItem = new JCheckBoxMenuItem(NLS.str("menu.flatten"), ICON_FLAT_PKG);
flatPkgMenuItem.setState(isFlattenPackage);
JCheckBoxMenuItem heapUsageBarMenuItem = new JCheckBoxMenuItem(NLS.str("menu.heapUsageBar"));
heapUsageBarMenuItem.setState(settings.isShowHeapUsageBar());
heapUsageBarMenuItem.addActionListener(event -> {
settings.setShowHeapUsageBar(!settings.isShowHeapUsageBar());
heapUsageBar.setVisible(settings.isShowHeapUsageBar());
});
JCheckBoxMenuItem alwaysSelectOpened = new JCheckBoxMenuItem(NLS.str("menu.alwaysSelectOpened"));
alwaysSelectOpened.setState(settings.isAlwaysSelectOpened());
alwaysSelectOpened.addActionListener(event -> {
settings.setAlwaysSelectOpened(!settings.isAlwaysSelectOpened());
if (settings.isAlwaysSelectOpened()) {
this.syncWithEditor();
}
});
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, UiUtils.ctrlButton()));
Action textSearchAction = new AbstractAction(NLS.str("menu.text_search"), ICON_SEARCH) {
@Override
public void actionPerformed(ActionEvent e) {
ContentPanel panel = tabbedPane.getSelectedCodePanel();
if (panel instanceof AbstractCodeContentPanel) {
AbstractCodeArea codeArea = ((AbstractCodeContentPanel) panel).getCodeArea();
String preferText = codeArea.getSelectedText();
if (StringUtils.isEmpty(preferText)) {
preferText = codeArea.getWordUnderCaret();
}
if (!StringUtils.isEmpty(preferText)) {
SearchDialog.searchText(MainWindow.this, preferText);
return;
}
}
SearchDialog.search(MainWindow.this, SearchDialog.SearchPreset.TEXT);
}
};
textSearchAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("menu.text_search"));
textSearchAction.putValue(Action.ACCELERATOR_KEY, getKeyStroke(KeyEvent.VK_F, UiUtils.ctrlButton() | KeyEvent.SHIFT_DOWN_MASK));
Action clsSearchAction = new AbstractAction(NLS.str("menu.class_search"), ICON_FIND) {
@Override
public void actionPerformed(ActionEvent e) {
SearchDialog.search(MainWindow.this, SearchDialog.SearchPreset.CLASS);
}
};
clsSearchAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("menu.class_search"));
clsSearchAction.putValue(Action.ACCELERATOR_KEY, getKeyStroke(KeyEvent.VK_N, UiUtils.ctrlButton()));
Action commentSearchAction = new AbstractAction(NLS.str("menu.comment_search"), ICON_COMMENT_SEARCH) {
@Override
public void actionPerformed(ActionEvent e) {
SearchDialog.search(MainWindow.this, SearchDialog.SearchPreset.COMMENT);
}
};
commentSearchAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("menu.comment_search"));
commentSearchAction.putValue(Action.ACCELERATOR_KEY, getKeyStroke(KeyEvent.VK_SEMICOLON, UiUtils.ctrlButton() | KeyEvent.SHIFT_DOWN_MASK));
Action deobfAction = new AbstractAction(NLS.str("menu.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, UiUtils.ctrlButton() | 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) {
LogViewerDialog.open(MainWindow.this);
}
};
logAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("menu.log"));
logAction.putValue(Action.ACCELERATOR_KEY, getKeyStroke(KeyEvent.VK_L, UiUtils.ctrlButton() | KeyEvent.SHIFT_DOWN_MASK));
Action aboutAction = new AbstractAction(NLS.str("menu.about"), ICON_INFO) {
@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_ESCAPE, 0));
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.ALT_DOWN_MASK, SystemInfo.IS_MAC));
Action quarkAction = new AbstractAction("Quark Engine", ICON_QUARK) {
@Override
public void actionPerformed(ActionEvent e) {
new QuarkDialog(MainWindow.this).setVisible(true);
}
};
quarkAction.putValue(Action.SHORT_DESCRIPTION, "Quark Engine");
Action openDeviceAction = new AbstractAction(NLS.str("debugger.process_selector"), ICON_DEBUGGER) {
@Override
public void actionPerformed(ActionEvent e) {
ADBDialog dialog = new ADBDialog(MainWindow.this);
dialog.setVisible(true);
}
};
openDeviceAction.putValue(Action.SHORT_DESCRIPTION, NLS.str("debugger.process_selector"));
JMenu file = new JMenu(NLS.str("menu.file"));
file.setMnemonic(KeyEvent.VK_F);
file.add(openAction);
file.add(addFilesAction);
file.addSeparator();
file.add(newProjectAction);
file.add(saveProjectAction);
file.add(saveProjectAsAction);
file.addSeparator();
file.add(saveAllAction);
file.add(exportAction);
file.addSeparator();
file.add(recentProjects);
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);
view.add(heapUsageBarMenuItem);
view.add(alwaysSelectOpened);
JMenu nav = new JMenu(NLS.str("menu.navigation"));
nav.setMnemonic(KeyEvent.VK_N);
nav.add(textSearchAction);
nav.add(clsSearchAction);
nav.add(commentSearchAction);
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(quarkAction);
tools.add(openDeviceAction);
JMenu help = new JMenu(NLS.str("menu.help"));
help.setMnemonic(KeyEvent.VK_H);
help.add(logAction);
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 = 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(addFilesAction);
toolbar.addSeparator();
toolbar.add(saveAllAction);
toolbar.add(exportAction);
toolbar.addSeparator();
toolbar.add(syncAction);
toolbar.add(flatPkgButton);
toolbar.addSeparator();
toolbar.add(textSearchAction);
toolbar.add(clsSearchAction);
toolbar.add(commentSearchAction);
toolbar.addSeparator();
toolbar.add(backAction);
toolbar.add(forwardAction);
toolbar.addSeparator();
toolbar.add(deobfToggleBtn);
toolbar.add(quarkAction);
toolbar.add(openDeviceAction);
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.JToggleButton in project vcell by virtualcell.
the class VFrap_OverlayEditorPanelJAI method getEraseButton.
public JToggleButton getEraseButton() {
if (eraseButton == null) {
eraseButton = new JToggleButton(new ImageIcon(getClass().getResource("/images/eraser.gif")));
eraseButton.setPreferredSize(new Dimension(32, 32));
eraseButton.setMargin(new Insets(2, 2, 2, 2));
eraseButton.setToolTipText("Erase");
}
return eraseButton;
}
use of javax.swing.JToggleButton in project vcell by virtualcell.
the class VFrap_OverlayEditorPanelJAI method getAutoCropButton.
public JToggleButton getAutoCropButton() {
if (autoCropButton == null) {
autoCropButton = new JToggleButton(new ImageIcon(getClass().getResource("/images/autoCrop.gif")));
autoCropButton.setPreferredSize(new Dimension(32, 32));
autoCropButton.setMargin(new Insets(2, 2, 2, 2));
autoCropButton.setToolTipText("Auto Crop");
autoCropButton.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
try {
waitCursor(true);
if (isAutoCroppable()) {
Rectangle cropRect = null;
if (imageDataset != null) {
cropRect = imageDataset.getNonzeroBoundingRectangle();
}
imagePane.setCrop(new Point((int) (cropRect.x * imagePane.getZoom()), (int) (cropRect.y * imagePane.getZoom())), new Point((int) ((cropRect.x + cropRect.width) * imagePane.getZoom()), (int) ((cropRect.y + cropRect.height) * imagePane.getZoom())));
waitCursor(false);
if (!cropConfirm(cropRect)) {
imagePane.setCrop(null, null);
return;
}
waitCursor(true);
imagePane.setCrop(null, null);
firePropertyChange(FRAP_DATA_CROP_PROPERTY, null, cropRect);
} else {
DialogUtils.showInfoDialog(VFrap_OverlayEditorPanelJAI.this, "AutoCrop: No zero values around outer edges.");
}
} catch (Exception e1) {
e1.printStackTrace();
DialogUtils.showErrorDialog(VFrap_OverlayEditorPanelJAI.this, "Error AutoCrop:\n" + e1.getMessage());
} finally {
waitCursor(false);
}
}
});
}
return autoCropButton;
}
use of javax.swing.JToggleButton in project vcell by virtualcell.
the class VFrap_OverlayEditorPanelJAI method getPaintButton.
public JToggleButton getPaintButton() {
if (paintButton == null) {
paintButton = new JToggleButton(new ImageIcon(getClass().getResource("/images/paint.gif")));
paintButton.setSelected(true);
paintButton.setPreferredSize(new Dimension(32, 32));
paintButton.setMargin(new Insets(2, 2, 2, 2));
paintButton.setToolTipText("Paint");
}
return paintButton;
}
Aggregations