use of javax.swing.JPopupMenu in project zaproxy by zaproxy.
the class SpiderPanel method getUrlsTable.
/**
* Gets the scan results table.
*
* @return the scan results table
*/
private JXTable getUrlsTable() {
if (urlsTable == null) {
// Create the table with a default, empty TableModel and the proper settings
urlsTable = new ZapTable(EMPTY_URLS_TABLE_MODEL);
urlsTable.setColumnSelectionAllowed(false);
urlsTable.setCellSelectionEnabled(false);
urlsTable.setRowSelectionAllowed(true);
urlsTable.setAutoCreateRowSorter(true);
urlsTable.setAutoCreateColumnsFromModel(false);
urlsTable.getColumnExt(0).setCellRenderer(new DefaultTableRenderer(new MappedValue(StringValues.EMPTY, IconValues.NONE), JLabel.CENTER));
urlsTable.getColumnExt(0).setHighlighters(new ProcessedCellItemIconHighlighter(0));
urlsTable.getColumnModel().getColumn(0).setMinWidth(80);
// processed
urlsTable.getColumnModel().getColumn(0).setPreferredWidth(90);
urlsTable.getColumnModel().getColumn(1).setMinWidth(60);
// method
urlsTable.getColumnModel().getColumn(1).setPreferredWidth(70);
// name
urlsTable.getColumnModel().getColumn(2).setMinWidth(300);
urlsTable.getColumnModel().getColumn(3).setMinWidth(50);
// flags
urlsTable.getColumnModel().getColumn(3).setPreferredWidth(250);
urlsTable.setName(PANEL_NAME);
urlsTable.setDoubleBuffered(true);
urlsTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
urlsTable.setComponentPopupMenu(new JPopupMenu() {
private static final long serialVersionUID = 6608291059686282641L;
@Override
public void show(Component invoker, int x, int y) {
View.getSingleton().getPopupMenu().show(invoker, x, y);
}
});
}
return urlsTable;
}
use of javax.swing.JPopupMenu in project zaproxy by zaproxy.
the class PopupMenuUtils method insertSeparatorIfNeeded.
/**
* Inserts a separator at the given {@code position} if it exists a non separator menu component at the given
* {@code position} and if there isn't, already, a separator immediately before the insert {@code position} (to prevent
* consecutive separators).
*
* @param popupMenu the pop up menu that will be processed
* @param position the position where a separator might be inserted
* @return {@code true} if the separator was inserted, {@code false} otherwise.
* @see javax.swing.JPopupMenu.Separator
*/
public static boolean insertSeparatorIfNeeded(JPopupMenu popupMenu, int position) {
final int menuComponentCount = popupMenu.getComponentCount();
if (menuComponentCount == 0 || position <= 0 || position > menuComponentCount) {
return false;
}
final Component currentComponent = popupMenu.getComponent(position);
if (isPopupMenuSeparator(currentComponent)) {
return false;
}
final Component previousComponent = popupMenu.getComponent(position - 1);
if (isPopupMenuSeparator(previousComponent)) {
return false;
}
popupMenu.insert(new JPopupMenu.Separator(), position);
return true;
}
use of javax.swing.JPopupMenu in project otapij by FellowTraveler.
the class MainPage method jTable8MouseClicked.
//GEN-LAST:event_jTable8MouseEntered
private void jTable8MouseClicked(java.awt.event.MouseEvent evt) {
//GEN-FIRST:event_jTable8MouseClicked
System.out.println("Count:" + evt.getClickCount());
if (evt.getButton() == java.awt.event.MouseEvent.BUTTON3) {
System.out.println("Right Click");
int r = jTable8.rowAtPoint(evt.getPoint());
if (r >= 0 && r < jTable8.getRowCount()) {
jTable8.setRowSelectionInterval(r, r);
} else {
jTable8.clearSelection();
}
if (jTable8.getSelectedRow() > -1) {
JPopupMenu popupMenu = new JPopupMenu();
PaymentInboxRightClickListener menuListener = new PaymentInboxRightClickListener();
JMenuItem menuItem = new JMenuItem("Test");
popupMenu.add(menuItem);
menuItem.addActionListener(menuListener);
menuItem = new JMenuItem("Test1");
popupMenu.add(menuItem);
menuItem.addActionListener(menuListener);
popupMenu.show(evt.getComponent(), evt.getX(), evt.getY());
}
}
if (evt.getClickCount() == 2) {
String key = (String) jTable8.getModel().getValueAt(jTable8.getSelectedRow(), 3);
String subject = (String) jTable8.getModel().getValueAt(jTable8.getSelectedRow(), 0);
System.out.println("In NYMBOX double clcik, key:" + key);
String[] row = (String[]) nymBox.get(key);
if (row != null) {
NymBoxDetailsDialog nymDialog = new NymBoxDetailsDialog(this, true, row[7] == "true" ? "Verified" : "Not Verified", row[6], subject);
nymDialog.setVisible(true);
}
}
}
use of javax.swing.JPopupMenu in project ACS by ACS-Community.
the class SmartTextPane method getPopup.
/**
* Insert the method's description here.
* Creation date: (18.2.2002 17:58:02)
* @return javax.swing.JPopupMenu
*/
public javax.swing.JPopupMenu getPopup() {
if (popup == null) {
popup = new JPopupMenu("Smart text pane");
JMenuItem saveItem = new JMenuItem("Save");
saveItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
saveTextToFile();
}
});
popup.add(saveItem);
}
return popup;
}
use of javax.swing.JPopupMenu in project ACS by ACS-Community.
the class ConnectionWidget method initialize.
/**
* Init the GUI
*/
private void initialize() {
popMenu = new JPopupMenu();
reconnectMI = new JMenuItem("Reconnect");
popMenu.add(reconnectMI);
reconnectMI.addActionListener(this);
}
Aggregations