JDK-4214363 : isFocusCycleRoot() of true doesn't always honor SHIFT-TAB
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.2.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 1999-02-24
  • Updated: 2000-11-03
  • Resolved: 2000-11-03
Related Reports
Duplicate :  
Description

Name: clC74495			Date: 02/24/99


In JDK 1.2 as well as Swing 1.1.1 Beta1, if I have a JPanel where
isFocusCycleRoot() returns true:

import javax.swing.*;
public class FocusCycleConstrainedJPanel extends JPanel {
  public boolean isFocusCycleRoot() {
    return true;
  }
}

Shift-Tab sometimes doesn't honor the closed focus cycle in the panel,
it tabs out of the panel.

Sample program follows. It is a 3x3 grid, where middle row is in a different
panel (with the closed focus cycle). [Metal look and feel if it matters.]

Pressing TAB, TAB, TAB, takes me to first component in inner panel. SHIFT-TAB
takes me out of panel, instead of to last component in inner panel.

If I SHIFT-TAB into inner panel from back end, I have yet to have SHIFT-TAB
get me out of panel at beginning.

However, when I TAB into inner panel, then this sometimes, but not always,
allows me to SHIFT-TAB out of panel.

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class FocusCycleSample {
  public static void main(String args[]) {
    JFrame frame = new JFrame("Focus Cycle Sample");

    Container contentPane = frame.getContentPane();
    contentPane.setLayout(new GridBagLayout());
    GridBagConstraints constraints = new GridBagConstraints();
    constraints.weightx    = 1.0;
    constraints.weighty    = 1.0;
    constraints.gridwidth  = 1;
    constraints.gridheight = 1;
    constraints.fill       = GridBagConstraints.BOTH;

    // Row One
    constraints.gridy=0;
    for (int i=0; i<3; i++) {
      JButton button = new JButton("" + i);
      constraints.gridx=i;
      contentPane.add(button, constraints);
    }

    // Row Two
    JPanel panel = new FocusCycleConstrainedJPanel();
    panel.setLayout(new GridLayout(1,3));
    for (int i=0; i<3; i++) {
      JButton button = new JButton("" + (i+3));
      panel.add(button);
    }
    constraints.gridx=0;
    constraints.gridy=1;
    constraints.gridwidth=3;
    contentPane.add(panel, constraints);

    // Row Three
    constraints.gridy=2;
    constraints.gridwidth=1;
    for (int i=0; i<3; i++) {
      JButton button = new JButton("" + (i+6));
      constraints.gridx=i;
      contentPane.add(button, constraints);
    }

    frame.setSize(300, 200);
    frame.setVisible(true);
  }
}
(Review ID: 54635)
======================================================================

Comments
EVALUATION Yes, unfortunately, I can reproduce this. The most mysterious aspect of it is that it appears to be inconsitent. hania.gajewska@Eng 1999-09-19 Name: keR10081 Date: 11/03/2000 This bug is no longer reproducible after focus management enhancement putback and will be closed as a duplicate of 4290675. There is another slight problem with the test case but this is another bug. ###@###.### ====================================================================== Name: keR10081 Date: 11/03/2000 This bug is no longer reproducible after focus management enhancement putback and will be closed as a duplicate of 4290675. There is another slight problem with the test case but this is another bug. ###@###.### ====================================================================== Name: keR10081 Date: 11/03/2000 This bug is no longer reproducible after focus management enhancement putback and will be closed as a duplicate of 4290675. There is another slight problem with the test case but this is another bug. ###@###.### ======================================================================
11-06-2004