本文整理了Java中javax.swing.JTable.getInputMap()
方法的一些代码示例,展示了JTable.getInputMap()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTable.getInputMap()
方法的具体详情如下:
包路径:javax.swing.JTable
类名称:JTable
方法名:getInputMap
暂无
代码示例来源:origin: stackoverflow.com
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
}
});
}
代码示例来源:origin: ron190/jsql-injection
/**
* 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);
}
代码示例来源:origin: ron190/jsql-injection
/**
* 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);
}
代码示例来源:origin: ron190/jsql-injection
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");
代码示例来源:origin: stackoverflow.com
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");
代码示例来源:origin: ron190/jsql-injection
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);
代码示例来源:origin: de.sciss/jtreetable
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;
}
代码示例来源:origin: kaikramer/keystore-explorer
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);
}
代码示例来源:origin: kaikramer/keystore-explorer
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);
}
代码示例来源:origin: net.sf.kerner-utils/kerner-utils
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);
}
代码示例来源:origin: net.sf.kerner-utils/kerner-utils
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);
}
代码示例来源:origin: bspkrs/MCPMappingViewer
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);
}
代码示例来源:origin: bspkrs/MCPMappingViewer
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);
}
代码示例来源:origin: stackoverflow.com
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) {}
});
}
代码示例来源:origin: stackoverflow.com
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);
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-project
/** 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
}
代码示例来源:origin: com.anrisoftware.prefdialog/prefdialog-misc-swing
/**
* 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();
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-mercurial
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);
}
代码示例来源:origin: pavelfatin/typometer
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);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-project
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();
}
内容来源于网络,如有侵权,请联系作者删除!