mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-12 06:57:13 -06:00
Table: fixed inconsistent table selection / move shortcuts (issue #95)
This commit is contained in:
@@ -85,8 +85,12 @@ class FlatInputMaps
|
|||||||
// swap to make it consistent with List and Tree
|
// swap to make it consistent with List and Tree
|
||||||
"HOME", "selectFirstRow",
|
"HOME", "selectFirstRow",
|
||||||
"END", "selectLastRow",
|
"END", "selectLastRow",
|
||||||
|
"shift HOME", "selectFirstRowExtendSelection",
|
||||||
|
"shift END", "selectLastRowExtendSelection",
|
||||||
mac( "ctrl HOME", null ), "selectFirstColumn",
|
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 ) {
|
if( !SystemInfo.IS_MAC ) {
|
||||||
@@ -501,6 +505,9 @@ class FlatInputMaps
|
|||||||
"alt KP_LEFT", "selectParent",
|
"alt KP_LEFT", "selectParent",
|
||||||
"alt KP_RIGHT", "selectChild",
|
"alt KP_RIGHT", "selectChild",
|
||||||
|
|
||||||
|
"shift HOME", "selectFirstExtendSelection",
|
||||||
|
"shift END", "selectLastExtendSelection",
|
||||||
|
|
||||||
"meta A", "selectAll",
|
"meta A", "selectAll",
|
||||||
"meta C", "copy",
|
"meta C", "copy",
|
||||||
"meta V", "paste",
|
"meta V", "paste",
|
||||||
@@ -545,8 +552,6 @@ class FlatInputMaps
|
|||||||
"shift ctrl SPACE", null,
|
"shift ctrl SPACE", null,
|
||||||
"shift ctrl UP", null,
|
"shift ctrl UP", null,
|
||||||
"shift DELETE", null,
|
"shift DELETE", null,
|
||||||
"shift END", null,
|
|
||||||
"shift HOME", null,
|
|
||||||
"shift INSERT", null,
|
"shift INSERT", null,
|
||||||
"shift PAGE_DOWN", null,
|
"shift PAGE_DOWN", null,
|
||||||
"shift PAGE_UP", null,
|
"shift PAGE_UP", null,
|
||||||
|
|||||||
@@ -83,6 +83,14 @@ public class FlatComponents2Test
|
|||||||
scrollPane5.setCorner( JScrollPane.UPPER_TRAILING_CORNER, button );
|
scrollPane5.setCorner( JScrollPane.UPPER_TRAILING_CORNER, button );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void rowSelectionChanged() {
|
||||||
|
table1.setRowSelectionAllowed( rowSelectionCheckBox.isSelected() );
|
||||||
|
}
|
||||||
|
|
||||||
|
private void columnSelectionChanged() {
|
||||||
|
table1.setColumnSelectionAllowed( columnSelectionCheckBox.isSelected() );
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings( { "unchecked", "rawtypes" } )
|
@SuppressWarnings( { "unchecked", "rawtypes" } )
|
||||||
private void initComponents() {
|
private void initComponents() {
|
||||||
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
|
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
|
||||||
@@ -104,6 +112,8 @@ public class FlatComponents2Test
|
|||||||
table1 = new JTable();
|
table1 = new JTable();
|
||||||
dndCheckBox = new JCheckBox();
|
dndCheckBox = new JCheckBox();
|
||||||
tableHeaderButtonCheckBox = new JCheckBox();
|
tableHeaderButtonCheckBox = new JCheckBox();
|
||||||
|
rowSelectionCheckBox = new JCheckBox();
|
||||||
|
columnSelectionCheckBox = new JCheckBox();
|
||||||
|
|
||||||
//======== this ========
|
//======== this ========
|
||||||
setLayout(new MigLayout(
|
setLayout(new MigLayout(
|
||||||
@@ -312,6 +322,17 @@ public class FlatComponents2Test
|
|||||||
tableHeaderButtonCheckBox.setText("show button in table header");
|
tableHeaderButtonCheckBox.setText("show button in table header");
|
||||||
tableHeaderButtonCheckBox.addActionListener(e -> tableHeaderButtonChanged());
|
tableHeaderButtonCheckBox.addActionListener(e -> tableHeaderButtonChanged());
|
||||||
add(tableHeaderButtonCheckBox, "cell 0 4 3 1");
|
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
|
// JFormDesigner - End of component initialization //GEN-END:initComponents
|
||||||
|
|
||||||
((JComboBox)((DefaultCellEditor)table1.getColumnModel().getColumn( 3 ).getCellEditor()).getComponent()).setEditable( true );
|
((JComboBox)((DefaultCellEditor)table1.getColumnModel().getColumn( 3 ).getCellEditor()).getComponent()).setEditable( true );
|
||||||
@@ -326,6 +347,8 @@ public class FlatComponents2Test
|
|||||||
private JTable table1;
|
private JTable table1;
|
||||||
private JCheckBox dndCheckBox;
|
private JCheckBox dndCheckBox;
|
||||||
private JCheckBox tableHeaderButtonCheckBox;
|
private JCheckBox tableHeaderButtonCheckBox;
|
||||||
|
private JCheckBox rowSelectionCheckBox;
|
||||||
|
private JCheckBox columnSelectionCheckBox;
|
||||||
// JFormDesigner - End of variables declaration //GEN-END:variables
|
// JFormDesigner - End of variables declaration //GEN-END:variables
|
||||||
|
|
||||||
//---- class DummyTransferHandler -----------------------------------------
|
//---- class DummyTransferHandler -----------------------------------------
|
||||||
|
|||||||
@@ -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 {
|
new FormModel {
|
||||||
contentType: "form/swing"
|
contentType: "form/swing"
|
||||||
@@ -295,6 +295,27 @@ new FormModel {
|
|||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 0 4 3 1"
|
"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 ) {
|
}, new FormLayoutConstraints( null ) {
|
||||||
"location": new java.awt.Point( 0, 0 )
|
"location": new java.awt.Point( 0, 0 )
|
||||||
"size": new java.awt.Dimension( 790, 715 )
|
"size": new java.awt.Dimension( 790, 715 )
|
||||||
|
|||||||
@@ -573,9 +573,9 @@ Table.ancestorInputMap [lazy] 34 javax.swing.plaf.InputMapUIResource
|
|||||||
UP selectPreviousRow
|
UP selectPreviousRow
|
||||||
shift alt TAB focusHeader
|
shift alt TAB focusHeader
|
||||||
shift DOWN selectNextRowExtendSelection
|
shift DOWN selectNextRowExtendSelection
|
||||||
shift END selectLastColumnExtendSelection
|
shift END selectLastRowExtendSelection
|
||||||
shift ENTER selectPreviousRowCell
|
shift ENTER selectPreviousRowCell
|
||||||
shift HOME selectFirstColumnExtendSelection
|
shift HOME selectFirstRowExtendSelection
|
||||||
shift KP_DOWN selectNextRowExtendSelection
|
shift KP_DOWN selectNextRowExtendSelection
|
||||||
shift KP_LEFT selectPreviousColumnExtendSelection
|
shift KP_LEFT selectPreviousColumnExtendSelection
|
||||||
shift KP_RIGHT selectNextColumnExtendSelection
|
shift KP_RIGHT selectNextColumnExtendSelection
|
||||||
@@ -894,7 +894,7 @@ Tree.focusInputMap.RightToLeft [lazy] 12 javax.swing.plaf.InputMapUIResource
|
|||||||
shift KP_RIGHT selectParent
|
shift KP_RIGHT selectParent
|
||||||
shift LEFT selectChild
|
shift LEFT selectChild
|
||||||
shift RIGHT selectParent
|
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_LEFT selectParent
|
||||||
alt KP_RIGHT selectChild
|
alt KP_RIGHT selectChild
|
||||||
alt LEFT selectParent
|
alt LEFT selectParent
|
||||||
@@ -915,6 +915,8 @@ Tree.focusInputMap [lazy] 27 javax.swing.plaf.InputMapUIResource
|
|||||||
RIGHT selectChild
|
RIGHT selectChild
|
||||||
UP selectPrevious
|
UP selectPrevious
|
||||||
shift DOWN selectNextExtendSelection
|
shift DOWN selectNextExtendSelection
|
||||||
|
shift END selectLastExtendSelection
|
||||||
|
shift HOME selectFirstExtendSelection
|
||||||
shift KP_DOWN selectNextExtendSelection
|
shift KP_DOWN selectNextExtendSelection
|
||||||
shift KP_LEFT selectParent
|
shift KP_LEFT selectParent
|
||||||
shift KP_RIGHT selectChild
|
shift KP_RIGHT selectChild
|
||||||
|
|||||||
@@ -583,8 +583,8 @@ Table.ancestorInputMap [lazy] 71 javax.swing.plaf.InputMapUIResource
|
|||||||
TAB selectNextColumnCell
|
TAB selectNextColumnCell
|
||||||
UP selectPreviousRow
|
UP selectPreviousRow
|
||||||
shift ctrl DOWN selectNextRowExtendSelection
|
shift ctrl DOWN selectNextRowExtendSelection
|
||||||
shift ctrl END selectLastRowExtendSelection
|
shift ctrl END selectLastColumnExtendSelection
|
||||||
shift ctrl HOME selectFirstRowExtendSelection
|
shift ctrl HOME selectFirstColumnExtendSelection
|
||||||
shift ctrl KP_DOWN selectNextRowExtendSelection
|
shift ctrl KP_DOWN selectNextRowExtendSelection
|
||||||
shift ctrl KP_LEFT selectPreviousColumnExtendSelection
|
shift ctrl KP_LEFT selectPreviousColumnExtendSelection
|
||||||
shift ctrl KP_RIGHT selectNextColumnExtendSelection
|
shift ctrl KP_RIGHT selectNextColumnExtendSelection
|
||||||
@@ -597,9 +597,9 @@ Table.ancestorInputMap [lazy] 71 javax.swing.plaf.InputMapUIResource
|
|||||||
shift ctrl UP selectPreviousRowExtendSelection
|
shift ctrl UP selectPreviousRowExtendSelection
|
||||||
shift DELETE cut
|
shift DELETE cut
|
||||||
shift DOWN selectNextRowExtendSelection
|
shift DOWN selectNextRowExtendSelection
|
||||||
shift END selectLastColumnExtendSelection
|
shift END selectLastRowExtendSelection
|
||||||
shift ENTER selectPreviousRowCell
|
shift ENTER selectPreviousRowCell
|
||||||
shift HOME selectFirstColumnExtendSelection
|
shift HOME selectFirstRowExtendSelection
|
||||||
shift INSERT paste
|
shift INSERT paste
|
||||||
shift KP_DOWN selectNextRowExtendSelection
|
shift KP_DOWN selectNextRowExtendSelection
|
||||||
shift KP_LEFT selectPreviousColumnExtendSelection
|
shift KP_LEFT selectPreviousColumnExtendSelection
|
||||||
|
|||||||
Reference in New Issue
Block a user