static JTable sexyTableWithoutDrag() { final JTable table = tableWithToolTips(); tablePopupMenu(table, sexyTableWithoutDrag_popupMenuMaker(table)); // Disable Ctrl+PageUp and Ctrl+PageDown table.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, InputEvent.CTRL_MASK), "none"); //table.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, InputEvent.CTRL_MASK), "none"); /*table.registerKeyboardAction( null, KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, InputEvent.CTRL_MASK), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT );*/ table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) .put(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, InputEvent.CTRL_MASK), "none"); table.getInputMap(JComponent.WHEN_FOCUSED) .put(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, InputEvent.CTRL_MASK), "none"); table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) .put(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, InputEvent.CTRL_MASK), "none"); table.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW) .put(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, InputEvent.CTRL_MASK), "none"); ((InputMap) UIManager.get("Table.ancestorInputMap")).put(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, InputEvent.CTRL_MASK), "none"); ret table; } static VF2 sexyTableWithoutDrag_popupMenuMaker(JTable t) { final WeakReference ref = weakRef(t); ret voidfunc(JPopupMenu menu, int row) { final JTable table = ref!; final S item = first(getTableLine(table, row)); MouseEvent e = tablePopupMenu_mouseEvent!; final int col = table.columnAtPoint(e.getPoint()); final O value = table.getModel().getValueAt(row, col); //print("Cell type: " + getClassName(value)); if (value instanceof ImageIcon) { addMenuItem(menu, "Copy image to clipboard", r { copyImageToClipboard(((ImageIcon) value).getImage()); }); } else { final S text = str(value); addMenuItem(menu, "Copy text to clipboard", r { copyTextToClipboard(text); print("Copied text to clipboard: " + quote(text)); }); } addMenuItem(menu, "Set row height...", r { final JTextField tf = jTextField(table.getRowHeight()); showTitledForm("Set row height", "Pixels", tf, r { table.setRowHeight(parseInt(trim(tf.getText()))) }); }); }; }