 |
Home | Changes | Index | Search | Go
Community page to suggest, collect, complete key bindings for Swing components.
Goal
All well-behaved GUI must be usable by both mouse and keyboard gestures. Swing comes with a high-level support for the latter by key bindings (TODO: add link to tutorial) and the core components make ample use of it. So in principle it is easy to register new key strokes for new functionality in Swing. The problem is, to find approriate names and their default bindings: sources are look&feel implementations ... a task for many open eyes, that is you as part of the SwingX community. In the end, we want to have a list of bindings for each Swing component, covering every functional aspect in all OSs.
Mechanics
Not much formality: my vision is to have one section per component (preferably alphabetically ordered) and maybe a table per component listing all the functions that need to be bound in one column and key proposal with links to examples in the other. Everybody reading this is invited to contribute. If you disagree with what's already there, add your comment, counter-proposal. If there's need for discussion, we'll do it in the forum. Happy hunting!
Bindings
JButton
| Functions | Key Strokes | Context | Description |
| pressed | space, enter | when focused | Pressed the button which triggers the actionPerformed method of any listener or action |
| released | released space, released enter | when focused | |
JToggleButton?
JRadioButton?
JCheckBox?
JComboBox?
| Functions | Key Strokes | Context | Description |
| hidePopup | escape | when ancestor of focused component | Hides the popup |
| pageUpPassThrough | page_up | when ancestor of focused component | |
| pageDownPassThrough | page_down | when ancestor of focused component | |
| homePassThrough | home | when ancestor of focused component | |
| endPassThrough | end | when ancestor of focused component | |
| enterPassThrough | enter | when ancestor of focused component | |
JTextField?
| Functions | Key Strokes | Context | Description |
| copy-to-clipboard | ctrl c (Win) | when focused | Copy the text from the field into the clipboard |
| paste-from-clipboard | ctrl v (Win) | when focused | Paste the text from the clipboard into the field |
JFileChooser?
| Functions | Key Strokes | Context | Description |
| cancelSelection | escape | when ancestor of focused component | Cancels selection in the file chooser |
| refresh | F5 | when ancestor of focused component | Refreshes the file chooser |
JInternalFrame?
JDesktopPane?
| Functions | Key Strokes | Context | Description |
| restore | ctrl F5 | when ancestor of focused component | Restores the window |
| close | ctrl F4 | when ancestor of focused component | Closes the window |
| move | ctrl F7 | when ancestor of focused component | Switch to the mode where the user can move the window with cursor keys |
| resize | ctrl F8 | when ancestor of focused component | Switch to the mode where the user can resize the window with cursor keys |
| minimize | ctrl F9 | when ancestor of focused component | Minimize the window |
| maximize | ctrl F10 | when ancestor of focused component | Maximize the window |
| right | right, keypad_right | when ancestor of focused component | |
| shrinkRight | shift right, shift keypad_right | when ancestor of focused component | |
| left | left, keypad_left | when ancestor of focused component | |
| shrinkLeft | shift left, shift keypad_left | when ancestor of focused component | |
| up | up, keypad_up | when ancestor of focused component | |
| shrinkUp | shift up, shift keypad_up | when ancestor of focused component | |
| down | down, keypad_down | when ancestor of focused component | |
| shrinkDown | shift down, shift keypad_down | when ancestor of focused component | |
| escape | escape | when ancestor of focused component | |
| selectNextFrame | ctrl F6, ctrl tab, ctrl alt F6 | when ancestor of focused component | |
| selectPreviousFrame | shift ctrl alt F6 | when ancestor of focused component | |
| navigateNext | ctrl F12 | when ancestor of focused component | |
| navigatePrevious | shift ctrl F12 | when ancestor of focused component | |
JList
| Functions | Key Strokes | Context | Description |
| copy | ctrl C, copy, ctrl insert | when focused | Copy the selected object's text representation into the clipboard |
| paste | ctrl V, paste, shift insert | when focused | Paste the text from the clipboard into the list |
| cut | ctrl X, cut, shift delete | when focused | Removes the selected object from the list and adds the selected object's text representation into the clipboard |
| selectPreviousRow | up, keypad_up | when focused | Selects the previous row |
| selectPreviousRowExtendSelection | shift up, shift keypad_up, ctrl shift up, ctrl shift keypad_up | when focused | Selects the previous row and extends the selection |
| selectPreviousRowChangeLead | ctrl up, ctrl keypad_up | when focused | Selects the previous row and changes the lead. Note: normally this only moves the lead of the selection but doesn't change the selection (blue selected row stays as it is and dotted lead moves to unselected row) |
| selectNextRow | down, keypad_down | when focused | Selects the next row |
| selectNextRowExtendSelection | shift down, shift keypad_down, ctrl shift down, ctrl shift keypad_down | when focused | Selects the next row and extends the selection |
| selectNextRowChangeLead | ctrl down, ctrl keypad_down | when focused | Selects the next row and changes the lead. Note: normally this only moves the lead of the selection but doesn't change the selection (blue selected row stays as it is and dotted lead moves to unselected row) |
| selectPreviousColumn | left, keypad_left | when focused | Selects the previous column. Note: is this really supported by JList! This is needed if wrapping is enabled. |
| selectPreviousColumnExtendSelection | shift left, shift keypad_left, ctrl shift left, ctrl shift keypad_left | when focused | Selects the previous column and extends the selection. |
| selectPreviousColumnChangeLead | ctrl left, ctrl keypad_left | when focused | Selects the previous column an changes the lead. Note: normally this only moves the lead of the selection but doesn't change the selection (blue selected row stays as it is and dotted lead moves to unselected column) |
| selectNextColumn | right, keypad_right | when focused | Selects the next column. Note: is this really supported by JList! This is needed if wrapping is enabled. |
| selectNextColumnExtendSelection | shift right, shift keypad_right, ctrl shift right, ctrl shift keypad_right | when focused | Selects the next column and extends the selection. |
| selectNextColumnChangeLead | ctrl right, ctrl keypad_right | when focused | Selects the next column and changes the lead. |
| selectFirstRow | home | when focused | Selects the first row. |
| selectFirstRowExtendSelection | shift home, ctrl shift home | when focused | Selects the first row and extends the selection. |
| selectFirstRowChangeLead | ctrl home | when focused | Selects the first row and changes the lead. |
| selectLastRow | end | when focused | Selects the last row. |
| selectLastRowExtendSelection | shift end, ctrl shift end | when focused | Selects the last row and extends the selection. |
| selectLastRowChangeLead | ctrl end | when focused | Selects the last row and change the lead. |
| scrollUp | page_up | when focused | Scrolls up one block. |
| scrollUpExtendSelection | shift page_up, ctrl shift page_up | when focused | Scolls up one block and extends the selection. |
| scrollUpChangeLead | ctrl page_up | when focused | Scrolls up one block and changes the lead. |
| scrollDown | page_down | when focused | Scrolls down one block. |
| scrollDownExtendSelection | shift page_down, ctrl shift page_down | when focused | Scrolls down one block and extends the selection. |
| scrollDownChangeLead | ctrl page_down | when focused | Scrolls down one block and changes the lead. |
| selectAll | ctrl A, ctrl slash | when focused | Selects all elements. |
| clearSelection | ctrl back_slahs | when focused | Deselects all elements. |
| addToSelection | space | when focused | Adds the current lead selection to the selection model (second operation after someone changed the lead). |
| toggleAndAnchor | ctrl space | when focused | Toggles (add/remove from selection model) the selection of the current selected lead (second operation after someone changed the lead.) |
| extendto | shift space | when focused | Extends the selection to the current selected lead selection. |
| moveSelectionTo | ctrl shift space | when focused | Moves the selection to the current selected lead selection. |
JMenuBar?
JPopupMenu?
The JPopupMenu? adds its keybindings to the input map of the root pane of the window where the menu popped up. So the context is the currently focused window.
| Functions | Key Strokes | Context | Description |
| cancel | esc | when in focused window | Cancels the popup menu. |
| selectNext | down, keypad_down | when in focused window | Select the next menu item in the popup menu. |
| selectPrevious | up, keypad_up | when in focused window | Select the previous menu item in the popup menu. |
| selectParent | left, keypad_left | when in focused window | Select the parent of the current selected menu item in the popup menu. |
| selectChild | right, keypad_right | when in focused window | Select the first child of the current selected menu item in the popup menu. |
| return | enter, ctrl enter, space | when in focused window | Execute the action behind the current selected menu item and return to the selected window. |
JOptionPane?
JScrollBar?
| Functions | Key Strokes | Context | Description |
| positiveUnitIncrement | right, keypad_right, down, keypad_down | when ancestor of focused component | increments the value of the scroll bar by one unit. |
| positiveBlockIncrement | page down | when ancestor of focused component | increments the value of the scroll bar by one block. |
| negativeUnitIncrement | left, keypad_left, up, keypad_up | when ancestor of focused component | decrements the value of the scroll bar by one unit. |
| negativeBlockIncrement | page up | when ancestor of focused component | decrements the value of the scroll bar by one block. |
| minScroll | home | when ancestor of focused component | Sets the value of the scroll bar to the minimum value of the available range. |
| maxScroll | end | when ancestor of focused component | Sets the value of the scroll bar to the maximum value of the available range. |
JScrollPane?
| Functions | Key Strokes | Context | Description |
| unitScrollRight | right, keypad_right | when ancestor of focused component | Moves the viewport by one unit to the right. |
| unitScrollDown | down, keypad_down | when ancestor of focused component | Moves the viewport by one unit to the bottom. |
| unitScrollLeft | left, keypad_left | when ancestor of focused component | Moves the viewport by on unit to the left. |
| unitScrollUp | up, keypad_up | when ancestor of focused component | Moves the viewport by one unit to the top. |
| scrollUp | page up | when ancestor of focused component | Moves the viewport by one block up. |
| scrollDown | page down | when ancestor of focused component | Moves the viewport by one block down. |
| scrollLeft | ctrl page up | when ancestor of focused component | Moves the viewport by one block left. |
| scrollRight | ctrl page down | when ancestor of focused component | Moves the viewport by one block right. |
| scrollHome | ctrl home | when ancestor of focused component | Moves the viewport to the top. |
| scrollEnd | ctrl end | when ancestor of focused component | Moves the viewport to the bottom. |
JSlider
| Functions | Key Strokes | Context | Description |
| positiveUnitIncrement | right, keypad_right, up, keypad_up | when focused component | Increments the value of the slider by one unit. |
| negativeUnitIncrement | left, keypad_left, down, keypad_down | when focused component | Decrements the value of the slider by one unit. |
| positiveBlockIncrement | page up | when focused component | Increments the value of the slider by one block. |
| negativeBlockIncrement | page down | when focused component | Decrements the value of the slider by one block. |
| minScroll | home | when focused component | Sets the value of the slider to its minimum. |
| maxScroll | end | when focused component | Sets the value of the slider to its maximum. |
JSpinner
| Functions | Key Strokes | Context | Description |
| increment | up, keypad_up | when ancestor of focused component | Increases the value of the spinner. |
| decrement | down, keypad_down | when ancestor of focused component | Decreases the value of the spinner. |
JSplitPane?
| Functions | Key Strokes | Context | Description |
| positiveIncrement | right, keypad_right, down, keypad_down | when ancestor of focused component | Moves the splitter in positive direction. |
| negativeIncrement | left, keypad_left, up, keypad_up | when ancestor of focused component | Moves the splitter in negative direction. |
| selectMin | home | when ancestor of focused component | Moves the splitter to the minimum position. |
| selectMax | end | when ancestor of focused component | Moves the splitter to the maximum position. |
| startResize | F8 | when ancestor of focused component | Starts resizing mode. |
| toggleFocus | F6 | when ancestor of focused component | Toggles the focus of the splitter. |
| focusOutForward | ctrl tab | when ancestor of focused component | Moves the focus to to the next focusable component in the focus cycle. |
| focusOutBackward | ctrl shift tab | when ancestor of focused component | Moves the focus to the previous focusable component in the focus cycle. |
JTabbedPane?
| Functions | Key Strokes | Context | Description |
| navigateRight | right, keypad_right | when focused component | Navigates to the right of the tab with the current focus. |
| navigateLeft | left, keypad_left | when focused component | Navigates to the left of the tab with the current focus. |
| navigateUp | up, keypad_up | when focused component | Navigates to the top of the tab with the current focus. |
| navigateDown | down, keypad_down | when focused component | Navigates to the bottom of the tab with the current focus. |
| requestFocusForVisibleComponent | ctrl down, ctrl keypad_down | when focused component | Requests focus for the tab of the visible component. |
| navigatePageDown | ctrl page_down | when ancestor of focused component | Navigates down ... |
| navigatePageUp | ctrl page_up | when ancestor of focused component | Navigates up ... |
| requestFocus | ctrl up, ctrl keypad_up | when ancestor of focused component | Requests focus. |
JTable
| Functions | Key Strokes | Context | Description |
| copy | ctrl C, copy | when ancestor of focused component | Moves the object from the selected cell into the clipboard. |
| paste | ctrl V, paste | when ancestor of focused component | Pastes the object from the clipboard to the selected cell. |
| cut | ctrl X, cut | when ancestor of focused component | Moves the object from the selected cell into the clipboard and deletes in the selected cell. |
| selectNextColumn | right, keypad_right | when ancestor of focused component | Moves the focus to the cell in the next column and selects the cell. |
| selectNextColumnExtendSelection | shift right, shift keypad_right, ctrl shift right, ctrl shift keypad_right | when ancestor of focused component | Moves the focus to the cell in the next column and extends the selection to this cell. |
| selectNextColumnChangeLead | ctrl right, ctrl keypad_right | when ancestor of focused component | Moves the focus to the cell in the next column and changes the lead of the selection to this cell. |
| selectPreviousColumn | left, keypad_left | when ancestor of focused component | Moves the focus to the cell in the previous column and changes the selection to this cell. |
| selectPreviousColumnExtendSelection | shift left, shift keypad_left, ctrl shift left, ctrl shift keypad_left | when ancestor of focused component | Moves the focus to the cell in the previous column and extends the selection to this cell. |
| selectPreviousColumnChangeLead | ctrl left, ctrl keypad_left | when ancestor of focused component | Moves the focus to the cell in the previous column and changes the selection lead to this cell. |
| selectNextRow | down, keypad_down | when ancestor of focused component | Moves the focus to the cell in the next row and changes the selection to this cell. |
| selectNextRowExtendSelection | shift down, shift keypad_down, ctrl shift down, ctrl shift keypad_down | when ancestor of focused component | Moves the focus to the cell in the next row and extends the selection to this cell. |
| selectNextRowChangeLead | ctrl down, ctrl keypad_down | when ancestor of focused component | Moves the focus to the cell in the next row and changes the selection lead to this cell. |
| selectPreviousRow | up, keypad_up | when ancestor of focused component | Moves the focus to the cell in the previous row and changes the selection to this cell. |
| selectPreviousRowExtendSelection | shift up, shift keypad_up, ctrl shift up, ctrl shift keypad_up | when ancestor of focused component | Moves the focus to the cell in the previous row and extends the selection to this row. |
| selectPreviousRowChangeLead | ctrl up, ctrl keypad_up | when ancestor of focused component | Moves the focus to the cell in the previous row and changes the lead to this cell. |
| selectFirstColumn | home | when ancestor of focused component | Moves the focus to the cell in the first column and changes the selection to this cell. |
| selectFirstColumnExtendSelection | shift home, ctrl shift home | when ancestor of focused component | Moves the focus to the cell in the first column and extends the selection to this cell. |
| selectLastColumn | end | when ancestor of focused component | Moves the focus to the cell in the last column and changes the selection to the cell. |
| selectLastColumnExtendSelection | shift end, ctrl shift end | when ancestor of focused component | Moves the focus to the cell in the last column and extends the selection to the cell. |
| selectFirstRow | ctrl home | when ancestor of focused component | Moves the focus to the cell in the first row and changes the selection to this cell. |
| selectLastRow | ctrl end | when ancestor of focused component | Moves the focus to the cell in the last row and changes the selection to this cell. |
| scrollUpChangeSelection | page_up | when ancestor of focused component | Scrolls up one block increment and changes the selection to the cell. |
| scrollUpExtendSelection | shift page_up, ctrl shift page_up | when ancestor of focused component | Scrolls up one block increment and extends the selection to the cell. |
Links
|