-
Bug
-
Resolution: Fixed
-
P4
-
8u101, 9
-
b04
-
x86_64
-
windows_7
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8335336 | 23.0.1 | Alexey Ivanov | P4 | Resolved | Fixed | b02 |
JDK-8335338 | 21.0.5-oracle | Alexey Ivanov | P4 | Resolved | Fixed | b01 |
JDK-8335680 | 21.0.5 | Matthias Baesken | P4 | Resolved | Fixed | b01 |
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
Once user has opened a JFileChooser dialog and switched to "Details" view, any existing and future JTables will have selectNextRowCell, selectPreviousRowCell, selectNextColumnCell, and selectPreviousColumnCell functionality removed from their respective actionMaps. User can no longer navigate inside tables via TAB and SHIFT-TAB after closing the JFileChooser.
From FilePane.createDetailsView() we see the following:
public JPanel createDetailsView() {
....
final JTable detailsTable = new JTable(getDetailsTableModel()) {
.....
}
...
// TAB/SHIFT-TAB should transfer focus and ENTER should select an item.
// We don't want them to navigate within the table
ActionMap am = SwingUtilities.getUIActionMap(detailsTable);
am.remove("selectNextRowCell");
am.remove("selectPreviousRowCell");
am.remove("selectNextColumnCell");
am.remove("selectPreviousColumnCell");
Actions are removed from JTable actionMap and are not subsequently replaced after FileChooser dialog is disposed.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Open a JFileChooser
2. Click on "Details"
3. Place cursor in JTable
4. Press Tab
5. Press Shift-Tab
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
EXPECTED:
AFTER STEP 4: Currently selected cell adjusts to the next column
AFTER STEP 5: Currently selected cell adjusts to the previous column
ACTUAL -
ACTUAL:
AFTER STEP 4: No effect
AFTER STEP 5: No effect
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JTable;
import javax.swing.WindowConstants;
public class FileChooserBug
{
public static void main( String[] args )
{
JFrame mainFrame = new JFrame();
mainFrame.setDefaultCloseOperation( WindowConstants.EXIT_ON_CLOSE );
mainFrame.setPreferredSize( new Dimension( 200, 100 ) );
mainFrame.setSize( new Dimension( 200, 100 ) );
mainFrame.setLayout( new BorderLayout() );
Object[][] rowData = { { 1, 1 }, { 2, 2 } };
Object[] columnNames = { "Col 1", "Col 2" };
JTable table = new JTable( rowData, columnNames );
JButton button = new JButton( new AbstractAction( "Button" )
{
@Override
public void actionPerformed( ActionEvent e )
{
JFileChooser fc = new JFileChooser();
int returnVal = fc.showOpenDialog( mainFrame );
if( returnVal == JFileChooser.APPROVE_OPTION )
{
System.out.println( fc.getSelectedFile().getName() );
}
}
} );
mainFrame.add( button );
mainFrame.add( table, BorderLayout.SOUTH );
mainFrame.setVisible( true );
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Create a copy of the actionMap created by SwingUtilities.getUIActionMap( new JTable() ) before FilePane.createDetailsView() is called. Set the copied actionMap to SwingUtilities.getUIActionMap( new JTable() ) after createDetailsView method call.
- backported by
-
JDK-8335336 FilePane.createDetailsView() removes JTable TAB, SHIFT-TAB functionality
- Resolved
-
JDK-8335338 FilePane.createDetailsView() removes JTable TAB, SHIFT-TAB functionality
- Resolved
-
JDK-8335680 FilePane.createDetailsView() removes JTable TAB, SHIFT-TAB functionality
- Resolved
- relates to
-
JDK-6967482 TAB-key does not work in JTables after selecting details-view in JFileChooser
- Resolved
- links to
-
Commit openjdk/jdk21u-dev/4f822299
-
Commit openjdk/jdk23u/e2db30a5
-
Commit openjdk/jdk/711e7238
-
Review openjdk/jdk/19725
-
Review(master) openjdk/jdk21u-dev/807
-
Review(master) openjdk/jdk23u/6