private void createKeybindings(JTable table) { table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "Enter"); table.getActionMap().put("Enter", new AbstractAction() { @Override public void actionPerformed(ActionEvent ae) { //do something on JTable enter pressed } }); }
/** * Update the input and action maps with new ToggleAction */ private void installToggleAction( boolean isToggleDynamic, boolean isToggleLarger, String key, String keyStroke) { Action action = new ToggleAction(isToggleDynamic, isToggleLarger); KeyStroke ks = KeyStroke.getKeyStroke( keyStroke ); this.tableAdjust.getInputMap().put(ks, key); this.tableAdjust.getActionMap().put(key, action); }
/** * Update the input and action maps with a new ColumnAction */ private void installColumnAction( boolean isSelectedColumn, boolean isAdjust, String key, String keyStroke) { Action action = new ColumnAction(isSelectedColumn, isAdjust); KeyStroke ks = KeyStroke.getKeyStroke( keyStroke ); this.tableAdjust.getInputMap().put(ks, key); this.tableAdjust.getActionMap().put(key, action); }
this.tableValues.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put( KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0), null ); this.tableValues.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put( KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.SHIFT_DOWN_MASK), null this.tableValues.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_F, InputEvent.CTRL_DOWN_MASK), "search");
JTable table = ...; table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put( KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0), "none"); table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put( KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.SHIFT_DOWN_MASK), "none");
this.networkTable.getColumnModel().getColumn(3).setCellRenderer(centerHorizontalAlignment); this.networkTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put( KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0), null); this.networkTable.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put( KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.SHIFT_DOWN_MASK), null);
private boolean isNavigationKey(JTable table, KeyEvent event) { InputMap inputMap = table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); return inputMap != null && inputMap.get(KeyStroke.getKeyStroke(event.getKeyCode(), 0)) != null; }
private void installColumnAction(boolean isSelectedColumn, boolean isAdjust, String key, String keyStroke) { Action action = new ColumnAction(isSelectedColumn, isAdjust); KeyStroke ks = KeyStroke.getKeyStroke(keyStroke); table.getInputMap().put(ks, key); table.getActionMap().put(key, action); }
private void installToggleAction(boolean isToggleDynamic, boolean isToggleLarger, String key, String keyStroke) { Action action = new ToggleAction(isToggleDynamic, isToggleLarger); KeyStroke ks = KeyStroke.getKeyStroke(keyStroke); table.getInputMap().put(ks, key); table.getActionMap().put(key, action); }
private void installColumnAction(final boolean isSelectedColumn, final boolean isAdjust, final String key, final String keyStroke) { final Action action = new ColumnAction(isSelectedColumn, isAdjust); final KeyStroke ks = KeyStroke.getKeyStroke(keyStroke); table.getInputMap().put(ks, key); table.getActionMap().put(key, action); }
private void installToggleAction(final boolean isToggleDynamic, final boolean isToggleLarger, final String key, final String keyStroke) { final Action action = new ToggleAction(isToggleDynamic, isToggleLarger); final KeyStroke ks = KeyStroke.getKeyStroke(keyStroke); table.getInputMap().put(ks, key); table.getActionMap().put(key, action); }
private void installColumnAction( boolean isSelectedColumn, boolean isAdjust, String key, String keyStroke) { Action action = new ColumnAction(isSelectedColumn, isAdjust); KeyStroke ks = KeyStroke.getKeyStroke(keyStroke); table.getInputMap().put(ks, key); table.getActionMap().put(key, action); }
private void installToggleAction( boolean isToggleDynamic, boolean isToggleLarger, String key, String keyStroke) { Action action = new ToggleAction(isToggleDynamic, isToggleLarger); KeyStroke ks = KeyStroke.getKeyStroke(keyStroke); table.getInputMap().put(ks, key); table.getActionMap().put(key, action); }
private void createKeybindings(JTable table) { table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "Enter"); table.getActionMap().put("Enter", new AbstractAction() { @Override public void actionPerformed(ActionEvent ae) {} }); }
KeyStroke keyStroke = KeyStroke.getKeyStroke("TAB"); Object actionKey = table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) .get(keyStroke ); final Action action = table.getActionMap().get(actionKey); Action wrapper = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { JTable table = (JTable) e.getSource(); int lastRow = table.getRowCount() - 1; int lastColumn = table.getColumnCount() -1; if (table.getSelectionModel().getLeadSelectionIndex() == lastRow && table.getColumnModel().getSelectionModel() .getLeadSelectionIndex() == lastColumn) { return; } action.actionPerformed(e); } }; table.getActionMap().put(actionKey, wrapper);
/** Creates new form PanelInitProject * @param project the web project; if it is null, all available web extensions will be shown * @param filter one of the options <code>ALL_FRAMEWORKS</code>, <code>USED_FRAMEWORKS</code>, <code>UNUSED_FRAMEWORKS</code> * @param ignoredFrameworks the list of frameworks to be ignored when creating list; null is allowed */ public PanelSupportedFrameworksVisual(PanelSupportedFrameworks panel, ExtenderController controller, WebProject project, int filter, List ignoredFrameworks) { this.panel = panel; this.controller = controller; this.ignoredFrameworks = ignoredFrameworks; initComponents(); model = new FrameworksTableModel(); jTableFrameworks.setModel(model); jTableFrameworks.getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put( KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "none"); //NOI18N createFrameworksList(project, filter); FrameworksTableCellRenderer renderer = new FrameworksTableCellRenderer(); renderer.setBooleanRenderer(jTableFrameworks.getDefaultRenderer(Boolean.class)); jTableFrameworks.setDefaultRenderer(WebFrameworkProvider.class, renderer); jTableFrameworks.setDefaultRenderer(Boolean.class, renderer); initTableVisualProperties(jTableFrameworks); this.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(PanelSupportedFrameworksVisual.class, "ACS_NWP2_Frameworks_A11YDesc")); // NOI18N // Provide a name in the title bar. setName(NbBundle.getMessage(PanelSupportedFrameworksVisual.class, "LBL_NWP2_Frameworks")); //NOI18N putClientProperty ("NewProjectWizard_Title", NbBundle.getMessage(PanelSupportedFrameworksVisual.class, "TXT_NewWebApp")); //NOI18N }
/** * Sets the bindings for the specified table. * * @param table * the {@link JTable}. */ public void setTable(JTable table) { this.table = table; this.columnModel = table.getColumnModel(); this.columnSelectionModel = columnModel.getSelectionModel(); this.inputs = table.getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); this.actions = table.getActionMap(); setupSelectNextEditableCell(); setupEnter(); setupTab(); }
private void init(JLabel label, String[] columns, TableSorter sorter) { tableModel = new CommitTableModel(columns); tableModel.addTableModelListener(this); if(sorter == null) { sorter = new TableSorter(tableModel); } this.sorter = sorter; table = new SortedTable(this.sorter); table.getTableHeader().setReorderingAllowed(false); table.setDefaultRenderer(String.class, new CommitStringsCellRenderer()); table.setDefaultRenderer(Boolean.class, new CheckboxCellRenderer()); table.setDefaultEditor(Boolean.class, new CheckboxCellEditor()); table.getTableHeader().setReorderingAllowed(true); table.setRowHeight(table.getRowHeight() * 6 / 5); table.addAncestorListener(this); component = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); label.setLabelFor(table); table.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CommitTable.class, "ACSD_CommitTable")); // NOI18N table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put( KeyStroke.getKeyStroke(KeyEvent.VK_F10, KeyEvent.SHIFT_DOWN_MASK ), "org.openide.actions.PopupAction"); // NOI18N table.getActionMap().put("org.openide.actions.PopupAction", new AbstractAction() { // NOI18N @Override public void actionPerformed(ActionEvent e) { showPopup(org.netbeans.modules.versioning.util.Utils.getPositionForPopup(table)); } }); table.addMouseListener(this); setColumns(columns); }
void register(JRootPane rootPane, JTable table) { register(rootPane, myNewAction); register(rootPane, myImportAction); register(rootPane, myExportAction); register(table, myCopyAction); removeRecursively(table.getActionMap(), TransferHandler.getCopyAction().getValue(Action.NAME)); KeyStroke alternativeCopyKeyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, KeyEvent.CTRL_DOWN_MASK); table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) .put(alternativeCopyKeyStroke, myCopyAction.getValue(Action.ACTION_COMMAND_KEY)); register(table, myMoveUpAction); register(table, myMoveDownAction); register(table, myEditAction); register(table, myDeleteAction); }
public PhpFrameworksPanelVisual(PhpFrameworksPanel wizardPanel, Map<PhpFrameworkProvider, PhpModuleExtender> extenders) { assert extenders != null; this.extenders = extenders; // Provide a name in the title bar. setName(wizardPanel.getSteps()[STEP_INDEX]); putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, STEP_INDEX); // Step name (actually the whole list for reference). putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, wizardPanel.getSteps()); initComponents(); // frameworks model = new FrameworksTableModel(); frameworksTable.setModel(model); // #214843 frameworksTable.getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put( KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "none"); // NOI18N createFrameworksList(); FrameworksTableCellRenderer renderer = new FrameworksTableCellRenderer(model); renderer.setBooleanRenderer(frameworksTable.getDefaultRenderer(Boolean.class)); frameworksTable.setDefaultRenderer(PhpFrameworkProvider.class, renderer); frameworksTable.setDefaultRenderer(Boolean.class, renderer); initTableVisualProperties(); changeDescriptionAndPanel(); }