reviewed (and tested) all key bindings on Windows

This commit is contained in:
Karl Tauber
2020-02-26 23:47:38 +01:00
parent 1a4a7831f6
commit 60557fc8c8
4 changed files with 81 additions and 31 deletions

View File

@@ -48,10 +48,10 @@ class FlatInputMaps
modifyInputMap( defaults, "ComboBox.ancestorInputMap", modifyInputMap( defaults, "ComboBox.ancestorInputMap",
"SPACE", "spacePopup", "SPACE", "spacePopup",
"UP", "selectPrevious", "UP", "selectPrevious2",
"DOWN", "selectNext", "DOWN", "selectNext2",
"KP_UP", "selectPrevious", "KP_UP", "selectPrevious2",
"KP_DOWN", "selectNext", "KP_DOWN", "selectNext2",
mac( "alt UP", null ), "togglePopup", mac( "alt UP", null ), "togglePopup",
mac( "alt DOWN", null ), "togglePopup", mac( "alt DOWN", null ), "togglePopup",
@@ -64,11 +64,16 @@ class FlatInputMaps
"F2", "editFileName", "F2", "editFileName",
"BACK_SPACE", "Go Up" "BACK_SPACE", "Go Up"
); );
}
modifyInputMap( defaults, "Slider.focusInputMap", // join ltr and rtl bindings to fix up/down/etc keys in right-to-left component orientation
"ctrl PAGE_DOWN", "negativeBlockIncrement", Object[] bindings = (Object[]) defaults.get( "PopupMenu.selectedWindowInputMapBindings" );
"ctrl PAGE_UP", "positiveBlockIncrement" Object[] rtlBindings = (Object[]) defaults.get( "PopupMenu.selectedWindowInputMapBindings.RightToLeft" );
); if( bindings != null && rtlBindings != null ) {
Object[] newBindings = new Object[bindings.length + rtlBindings.length];
System.arraycopy( bindings, 0, newBindings, 0, bindings.length );
System.arraycopy( rtlBindings, 0, newBindings, bindings.length, rtlBindings.length );
defaults.put( "PopupMenu.selectedWindowInputMapBindings.RightToLeft", newBindings );
} }
modifyInputMap( defaults, "TabbedPane.ancestorInputMap", modifyInputMap( defaults, "TabbedPane.ancestorInputMap",
@@ -76,6 +81,14 @@ class FlatInputMaps
"shift ctrl TAB", "navigatePrevious" "shift ctrl TAB", "navigatePrevious"
); );
modifyInputMap( defaults, "Table.ancestorInputMap",
// swap to make it consistent with List and Tree
"HOME", "selectFirstRow",
"END", "selectLastRow",
mac( "ctrl HOME", null ), "selectFirstColumn",
mac( "ctrl END", null ), "selectLastColumn"
);
if( !SystemInfo.IS_MAC ) { if( !SystemInfo.IS_MAC ) {
modifyInputMap( defaults, "Tree.focusInputMap", modifyInputMap( defaults, "Tree.focusInputMap",
"ADD", "expand", "ADD", "expand",

View File

@@ -165,6 +165,7 @@ public class FlatComponentsTest
JLabel scrollPaneLabel = new JLabel(); JLabel scrollPaneLabel = new JLabel();
JScrollPane scrollPane13 = new JScrollPane(); JScrollPane scrollPane13 = new JScrollPane();
JPanel panel1 = new JPanel(); JPanel panel1 = new JPanel();
JButton button19 = new JButton();
JScrollBar scrollBar2 = new JScrollBar(); JScrollBar scrollBar2 = new JScrollBar();
JScrollBar scrollBar3 = new JScrollBar(); JScrollBar scrollBar3 = new JScrollBar();
JScrollBar scrollBar7 = new JScrollBar(); JScrollBar scrollBar7 = new JScrollBar();
@@ -803,8 +804,14 @@ public class FlatComponentsTest
//======== panel1 ======== //======== panel1 ========
{ {
panel1.setPreferredSize(new Dimension(200, 200)); panel1.setPreferredSize(new Dimension(800, 400));
panel1.setLayout(new BorderLayout()); panel1.setLayout(new BorderLayout());
//---- button19 ----
button19.setText("I'm a large button");
button19.setVerticalAlignment(SwingConstants.TOP);
button19.setHorizontalAlignment(SwingConstants.LEFT);
panel1.add(button19, BorderLayout.CENTER);
} }
scrollPane13.setViewportView(panel1); scrollPane13.setViewportView(panel1);
} }

View File

@@ -1,4 +1,4 @@
JFDML JFormDesigner: "7.0.0.0.194" Java: "13.0.1" encoding: "UTF-8" JFDML JFormDesigner: "7.0.1.0.272" Java: "13.0.1" encoding: "UTF-8"
new FormModel { new FormModel {
contentType: "form/swing" contentType: "form/swing"
@@ -728,7 +728,15 @@ new FormModel {
"verticalScrollBarPolicy": 22 "verticalScrollBarPolicy": 22
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.BorderLayout ) ) { add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.BorderLayout ) ) {
name: "panel1" name: "panel1"
"preferredSize": new java.awt.Dimension( 200, 200 ) "preferredSize": new java.awt.Dimension( 800, 400 )
add( new FormComponent( "javax.swing.JButton" ) {
name: "button19"
"text": "I'm a large button"
"verticalAlignment": 1
"horizontalAlignment": 2
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "Center"
} )
} ) } )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 13,grow,width 70,height 70" "value": "cell 1 13,grow,width 70,height 70"

View File

@@ -26,17 +26,17 @@ ComboBox.ancestorInputMap [lazy] 15 javax.swing.plaf.InputMapUIResource
alt KP_DOWN togglePopup alt KP_DOWN togglePopup
alt KP_UP togglePopup alt KP_UP togglePopup
alt UP togglePopup alt UP togglePopup
DOWN selectNext DOWN selectNext2
END endPassThrough END endPassThrough
ENTER enterPressed ENTER enterPressed
ESCAPE hidePopup ESCAPE hidePopup
HOME homePassThrough HOME homePassThrough
KP_DOWN selectNext KP_DOWN selectNext2
KP_UP selectPrevious KP_UP selectPrevious2
PAGE_DOWN pageDownPassThrough PAGE_DOWN pageDownPassThrough
PAGE_UP pageUpPassThrough PAGE_UP pageUpPassThrough
SPACE spacePopup SPACE spacePopup
UP selectPrevious UP selectPrevious2
#---- Desktop ---- #---- Desktop ----
@@ -327,15 +327,39 @@ PasswordField.focusInputMap [lazy] 37 javax.swing.plaf.InputMapUIResource
#---- PopupMenu ---- #---- PopupMenu ----
PopupMenu.selectedWindowInputMapBindings.RightToLeft length=8 [Ljava.lang.Object; PopupMenu.selectedWindowInputMapBindings.RightToLeft length=32 [Ljava.lang.Object;
[0] LEFT [0] ESCAPE
[1] selectChild [1] cancel
[2] KP_LEFT [2] DOWN
[3] selectChild [3] selectNext
[4] RIGHT [4] KP_DOWN
[5] selectParent [5] selectNext
[6] KP_RIGHT [6] UP
[7] selectParent [7] selectPrevious
[8] KP_UP
[9] selectPrevious
[10] LEFT
[11] selectParent
[12] KP_LEFT
[13] selectParent
[14] RIGHT
[15] selectChild
[16] KP_RIGHT
[17] selectChild
[18] ENTER
[19] return
[20] ctrl ENTER
[21] return
[22] SPACE
[23] return
[24] LEFT
[25] selectChild
[26] KP_LEFT
[27] selectChild
[28] RIGHT
[29] selectParent
[30] KP_RIGHT
[31] selectParent
PopupMenu.selectedWindowInputMapBindings length=24 [Ljava.lang.Object; PopupMenu.selectedWindowInputMapBindings length=24 [Ljava.lang.Object;
[0] ESCAPE [0] ESCAPE
[1] cancel [1] cancel
@@ -428,9 +452,7 @@ Slider.focusInputMap.RightToLeft [lazy] 4 javax.swing.plaf.InputMapUIResource
KP_RIGHT negativeUnitIncrement KP_RIGHT negativeUnitIncrement
LEFT positiveUnitIncrement LEFT positiveUnitIncrement
RIGHT negativeUnitIncrement RIGHT negativeUnitIncrement
Slider.focusInputMap [lazy] 14 javax.swing.plaf.InputMapUIResource [UI] Slider.focusInputMap [lazy] 12 javax.swing.plaf.InputMapUIResource [UI]
ctrl PAGE_DOWN negativeBlockIncrement
ctrl PAGE_UP positiveBlockIncrement
DOWN negativeUnitIncrement DOWN negativeUnitIncrement
END maxScroll END maxScroll
HOME minScroll HOME minScroll
@@ -523,8 +545,8 @@ Table.ancestorInputMap [lazy] 71 javax.swing.plaf.InputMapUIResource
ctrl BACK_SLASH clearSelection ctrl BACK_SLASH clearSelection
ctrl C copy ctrl C copy
ctrl DOWN selectNextRowChangeLead ctrl DOWN selectNextRowChangeLead
ctrl END selectLastRow ctrl END selectLastColumn
ctrl HOME selectFirstRow ctrl HOME selectFirstColumn
ctrl INSERT copy ctrl INSERT copy
ctrl KP_DOWN selectNextRowChangeLead ctrl KP_DOWN selectNextRowChangeLead
ctrl KP_LEFT selectPreviousColumnChangeLead ctrl KP_LEFT selectPreviousColumnChangeLead
@@ -542,12 +564,12 @@ Table.ancestorInputMap [lazy] 71 javax.swing.plaf.InputMapUIResource
COPY copy COPY copy
CUT cut CUT cut
DOWN selectNextRow DOWN selectNextRow
END selectLastColumn END selectLastRow
ENTER selectNextRowCell ENTER selectNextRowCell
ESCAPE cancel ESCAPE cancel
F2 startEditing F2 startEditing
F8 focusHeader F8 focusHeader
HOME selectFirstColumn HOME selectFirstRow
KP_DOWN selectNextRow KP_DOWN selectNextRow
KP_LEFT selectPreviousColumn KP_LEFT selectPreviousColumn
KP_RIGHT selectNextColumn KP_RIGHT selectNextColumn