JDK-6227508 : REGRESSION: Tab key dosnt allways work
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 5.0
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2005-02-09
  • Updated: 2011-01-19
  • Resolved: 2005-09-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 b53Fixed
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.5.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode, sharing)


ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
When pressing tab in the supplied sample focus dosnt move when focus is in the  textfield

###@###.###  from the AWT team says: I think that this a bug in LayoutComparator. We have fixed several bugs in it and these fixes may unciver athoner problems in this class.


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run sample
Press tab key

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Focus in the checkbox
ACTUAL -
Focus in the textfield

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.WindowEvent;

import javax.swing.*;


public class TabTester{
  public static void main(String[] args) {
    new TabTester();
  }
  public TabTester(){
    JFrame jf = new JFrame("aJFrame"){
      protected void processWindowEvent(WindowEvent e) {
        super.processWindowEvent(e);
        if (e.getID() == WindowEvent.WINDOW_CLOSING){
          System.exit(0);
        }
      }
    };
    jf.setVisible(true);
    JDialog dlg = new JDialog(jf, "aJDialog");
    
    JPanel panel = new JPanel(new GridBagLayout());
    JFormattedTextField ft = new JFormattedTextField();
    
    Dimension dim = new Dimension(100, ft.getPreferredSize().height);
    ft.setPreferredSize(dim);
    ft.setMinimumSize(dim);
    GridBagConstraints gc = new GridBagConstraints();
    gc.gridx=5;
    gc.gridy=1;
    gc.gridwidth=10;
    panel.add(ft, gc);
    
    gc.gridy=3;
    panel.add(new JCheckBox("aJCheckBox"), gc);
    
    gc.weightx = 1.0;
    gc.gridwidth = 1;
    gc.gridy = 0;
    gc.gridx = 0;
    
    for (int nCnt = 0; nCnt < 7; nCnt++) {
      gc.gridy++;
      panel.add(getlabel(), gc);
    }
    
    gc.gridx=0;
    gc.gridy=0;
    for (int nCnt = 0; nCnt < 7; nCnt++) {
      panel.add(getlabel(), gc);
      gc.gridx++;
    }
    dlg.getContentPane().add(panel);
    dlg.pack();
    dlg.setVisible(true);
  }
  
  private JLabel getlabel(){
    Dimension dim = new Dimension(5, 9); // Changing height to >=10 makes tab work, if its <10 it dosnt work
    JLabel aLabel = new JLabel(" ");
    aLabel.setMinimumSize(dim);
    aLabel.setMaximumSize(dim);
    aLabel.setPreferredSize(dim);
    return aLabel;
  }
}
---------- END SOURCE ----------

Release Regression From : 1.4.2
The above release value was the last known release where this 
bug was known to work. Since then there has been a regression.
###@###.### 2005-2-09 22:53:08 GMT
###@###.### 2005-07-07 12:51:31 GMT

Comments
EVALUATION The fix is common with 5070991.
23-08-2005

SUGGESTED FIX See 5070991.
23-08-2005

EVALUATION Looks like 5070991. ###@###.### 2005-06-22 14:50:04 GMT
22-06-2005