diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatInputMaps.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatInputMaps.java index ae2e2f15..8f5b5a9d 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatInputMaps.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatInputMaps.java @@ -85,8 +85,12 @@ class FlatInputMaps // swap to make it consistent with List and Tree "HOME", "selectFirstRow", "END", "selectLastRow", + "shift HOME", "selectFirstRowExtendSelection", + "shift END", "selectLastRowExtendSelection", mac( "ctrl HOME", null ), "selectFirstColumn", - mac( "ctrl END", null ), "selectLastColumn" + mac( "ctrl END", null ), "selectLastColumn", + mac( "shift ctrl HOME", null ), "selectFirstColumnExtendSelection", + mac( "shift ctrl END", null ), "selectLastColumnExtendSelection" ); if( !SystemInfo.IS_MAC ) { @@ -501,6 +505,9 @@ class FlatInputMaps "alt KP_LEFT", "selectParent", "alt KP_RIGHT", "selectChild", + "shift HOME", "selectFirstExtendSelection", + "shift END", "selectLastExtendSelection", + "meta A", "selectAll", "meta C", "copy", "meta V", "paste", @@ -545,8 +552,6 @@ class FlatInputMaps "shift ctrl SPACE", null, "shift ctrl UP", null, "shift DELETE", null, - "shift END", null, - "shift HOME", null, "shift INSERT", null, "shift PAGE_DOWN", null, "shift PAGE_UP", null, diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponents2Test.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponents2Test.java index 56d3f67c..2df78574 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponents2Test.java +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponents2Test.java @@ -83,6 +83,14 @@ public class FlatComponents2Test scrollPane5.setCorner( JScrollPane.UPPER_TRAILING_CORNER, button ); } + private void rowSelectionChanged() { + table1.setRowSelectionAllowed( rowSelectionCheckBox.isSelected() ); + } + + private void columnSelectionChanged() { + table1.setColumnSelectionAllowed( columnSelectionCheckBox.isSelected() ); + } + @SuppressWarnings( { "unchecked", "rawtypes" } ) private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents @@ -104,6 +112,8 @@ public class FlatComponents2Test table1 = new JTable(); dndCheckBox = new JCheckBox(); tableHeaderButtonCheckBox = new JCheckBox(); + rowSelectionCheckBox = new JCheckBox(); + columnSelectionCheckBox = new JCheckBox(); //======== this ======== setLayout(new MigLayout( @@ -312,6 +322,17 @@ public class FlatComponents2Test tableHeaderButtonCheckBox.setText("show button in table header"); tableHeaderButtonCheckBox.addActionListener(e -> tableHeaderButtonChanged()); add(tableHeaderButtonCheckBox, "cell 0 4 3 1"); + + //---- rowSelectionCheckBox ---- + rowSelectionCheckBox.setText("row selection"); + rowSelectionCheckBox.setSelected(true); + rowSelectionCheckBox.addActionListener(e -> rowSelectionChanged()); + add(rowSelectionCheckBox, "cell 0 4 3 1"); + + //---- columnSelectionCheckBox ---- + columnSelectionCheckBox.setText("column selection"); + columnSelectionCheckBox.addActionListener(e -> columnSelectionChanged()); + add(columnSelectionCheckBox, "cell 0 4 3 1"); // JFormDesigner - End of component initialization //GEN-END:initComponents ((JComboBox)((DefaultCellEditor)table1.getColumnModel().getColumn( 3 ).getCellEditor()).getComponent()).setEditable( true ); @@ -326,6 +347,8 @@ public class FlatComponents2Test private JTable table1; private JCheckBox dndCheckBox; private JCheckBox tableHeaderButtonCheckBox; + private JCheckBox rowSelectionCheckBox; + private JCheckBox columnSelectionCheckBox; // JFormDesigner - End of variables declaration //GEN-END:variables //---- class DummyTransferHandler ----------------------------------------- diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponents2Test.jfd b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponents2Test.jfd index 7b992ea7..d3a970fb 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponents2Test.jfd +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatComponents2Test.jfd @@ -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.2" encoding: "UTF-8" new FormModel { contentType: "form/swing" @@ -295,6 +295,27 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 0 4 3 1" } ) + add( new FormComponent( "javax.swing.JCheckBox" ) { + name: "rowSelectionCheckBox" + "text": "row selection" + "selected": true + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "rowSelectionChanged", false ) ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 4 3 1" + } ) + add( new FormComponent( "javax.swing.JCheckBox" ) { + name: "columnSelectionCheckBox" + "text": "column selection" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "columnSelectionChanged", false ) ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 4 3 1" + } ) }, new FormLayoutConstraints( null ) { "location": new java.awt.Point( 0, 0 ) "size": new java.awt.Dimension( 790, 715 ) diff --git a/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/uidefaults/FlatLightLaf_InputMap_1.8.0_202-mac.txt b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/uidefaults/FlatLightLaf_InputMap_1.8.0_202-mac.txt index 6d2b12d1..1271f945 100644 --- a/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/uidefaults/FlatLightLaf_InputMap_1.8.0_202-mac.txt +++ b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/uidefaults/FlatLightLaf_InputMap_1.8.0_202-mac.txt @@ -573,9 +573,9 @@ Table.ancestorInputMap [lazy] 34 javax.swing.plaf.InputMapUIResource UP selectPreviousRow shift alt TAB focusHeader shift DOWN selectNextRowExtendSelection - shift END selectLastColumnExtendSelection + shift END selectLastRowExtendSelection shift ENTER selectPreviousRowCell - shift HOME selectFirstColumnExtendSelection + shift HOME selectFirstRowExtendSelection shift KP_DOWN selectNextRowExtendSelection shift KP_LEFT selectPreviousColumnExtendSelection shift KP_RIGHT selectNextColumnExtendSelection @@ -894,7 +894,7 @@ Tree.focusInputMap.RightToLeft [lazy] 12 javax.swing.plaf.InputMapUIResource shift KP_RIGHT selectParent shift LEFT selectChild shift RIGHT selectParent -Tree.focusInputMap [lazy] 27 javax.swing.plaf.InputMapUIResource [UI] +Tree.focusInputMap [lazy] 29 javax.swing.plaf.InputMapUIResource [UI] alt KP_LEFT selectParent alt KP_RIGHT selectChild alt LEFT selectParent @@ -915,6 +915,8 @@ Tree.focusInputMap [lazy] 27 javax.swing.plaf.InputMapUIResource RIGHT selectChild UP selectPrevious shift DOWN selectNextExtendSelection + shift END selectLastExtendSelection + shift HOME selectFirstExtendSelection shift KP_DOWN selectNextExtendSelection shift KP_LEFT selectParent shift KP_RIGHT selectChild diff --git a/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/uidefaults/FlatLightLaf_InputMap_1.8.0_202.txt b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/uidefaults/FlatLightLaf_InputMap_1.8.0_202.txt index 54a4e89a..ee36305d 100644 --- a/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/uidefaults/FlatLightLaf_InputMap_1.8.0_202.txt +++ b/flatlaf-testing/src/main/resources/com/formdev/flatlaf/testing/uidefaults/FlatLightLaf_InputMap_1.8.0_202.txt @@ -583,8 +583,8 @@ Table.ancestorInputMap [lazy] 71 javax.swing.plaf.InputMapUIResource TAB selectNextColumnCell UP selectPreviousRow shift ctrl DOWN selectNextRowExtendSelection - shift ctrl END selectLastRowExtendSelection - shift ctrl HOME selectFirstRowExtendSelection + shift ctrl END selectLastColumnExtendSelection + shift ctrl HOME selectFirstColumnExtendSelection shift ctrl KP_DOWN selectNextRowExtendSelection shift ctrl KP_LEFT selectPreviousColumnExtendSelection shift ctrl KP_RIGHT selectNextColumnExtendSelection @@ -597,9 +597,9 @@ Table.ancestorInputMap [lazy] 71 javax.swing.plaf.InputMapUIResource shift ctrl UP selectPreviousRowExtendSelection shift DELETE cut shift DOWN selectNextRowExtendSelection - shift END selectLastColumnExtendSelection + shift END selectLastRowExtendSelection shift ENTER selectPreviousRowCell - shift HOME selectFirstColumnExtendSelection + shift HOME selectFirstRowExtendSelection shift INSERT paste shift KP_DOWN selectNextRowExtendSelection shift KP_LEFT selectPreviousColumnExtendSelection