-
Bug
-
Resolution: Fixed
-
P3
-
1.4.0, 1.4.1
-
None
-
04
-
x86
-
windows_nt, windows_2000
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2108032 | 1.4.2 | Andrey Pikalev | P3 | Resolved | Fixed | mantis |
JDK-2108031 | 1.4.1_02 | Andrey Pikalev | P3 | Resolved | Fixed | 02 |
JApplet is a container and should have a new focus traversal policy and should be a focus cycle root. Without a focus policy, Tab and Shift-Tab will not move to other components when using components added to the content pane of an applet.
The requestFocus() call seems to work on components since the mnemonic and setLabelFor bindings are still valid.
This regression was introduced in 1.4 as a result of the new focus manager enhancements. This last worked in 1.3.1.
Test case:
>>>>>>>>>>>>>>>>>>>>>>>>>> JAppletTest.java
import javax.swing.*;
import java.awt.event.KeyEvent;
/**
* Test case for FocusManager regression. JApplet non-focus traversal policy.
* To reproduce: Use the appletviewer to start the applet. TAB and SHIFT-TAB
* have no effect on focus traversal.
*
* Note: the mnemonic key bindings still work.
*/
public class JAppletTest extends JApplet {
// Running the panel in a JApplet doens't allow focus traversal.
public void init() {
setContentPane(createPanel());
}
private static JPanel createPanel() {
JTextField tf = new JTextField("text in Text field");
JLabel label = new JLabel("Label for Text Field");
label.setDisplayedMnemonic(KeyEvent.VK_L);
label.setLabelFor(tf);
JButton button = new JButton("Button");
// XXX - Hmmmm.... shouldn't there be a setDisplayedMnemonic in JButton?
// Perhaps there should be a setMnemoic in JLabel?
button.setMnemonic(KeyEvent.VK_B);
JPanel panel = new JPanel();
panel.add(button);
panel.add(label);
panel.add(tf);
return panel;
}
// Running the panel in a JFrame allows focus traversal.
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setContentPane(createPanel());
frame.pack();
frame.setVisible(true);
}
}
<<<<<<<<<<<<<<<<<<< JAppletTest.java
>>>>>>>>>>>>>>>>>>> JAppletTest.html
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title></title>
</head>
<body>
<h1></h1>
<applet code="JAppletTest.class" width="400" height="200"></applet>
<hr>
<!-- Created: Mon Jun 24 15:37:58 Pacific Daylight Time 2002 -->
<!-- hhmts start -->
Last modified: Mon Jun 24 15:38:27 Pacific Daylight Time 2002
<!-- hhmts end -->
</body>
</html>
The requestFocus() call seems to work on components since the mnemonic and setLabelFor bindings are still valid.
This regression was introduced in 1.4 as a result of the new focus manager enhancements. This last worked in 1.3.1.
Test case:
>>>>>>>>>>>>>>>>>>>>>>>>>> JAppletTest.java
import javax.swing.*;
import java.awt.event.KeyEvent;
/**
* Test case for FocusManager regression. JApplet non-focus traversal policy.
* To reproduce: Use the appletviewer to start the applet. TAB and SHIFT-TAB
* have no effect on focus traversal.
*
* Note: the mnemonic key bindings still work.
*/
public class JAppletTest extends JApplet {
// Running the panel in a JApplet doens't allow focus traversal.
public void init() {
setContentPane(createPanel());
}
private static JPanel createPanel() {
JTextField tf = new JTextField("text in Text field");
JLabel label = new JLabel("Label for Text Field");
label.setDisplayedMnemonic(KeyEvent.VK_L);
label.setLabelFor(tf);
JButton button = new JButton("Button");
// XXX - Hmmmm.... shouldn't there be a setDisplayedMnemonic in JButton?
// Perhaps there should be a setMnemoic in JLabel?
button.setMnemonic(KeyEvent.VK_B);
JPanel panel = new JPanel();
panel.add(button);
panel.add(label);
panel.add(tf);
return panel;
}
// Running the panel in a JFrame allows focus traversal.
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setContentPane(createPanel());
frame.pack();
frame.setVisible(true);
}
}
<<<<<<<<<<<<<<<<<<< JAppletTest.java
>>>>>>>>>>>>>>>>>>> JAppletTest.html
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title></title>
</head>
<body>
<h1></h1>
<applet code="JAppletTest.class" width="400" height="200"></applet>
<hr>
<!-- Created: Mon Jun 24 15:37:58 Pacific Daylight Time 2002 -->
<!-- hhmts start -->
Last modified: Mon Jun 24 15:38:27 Pacific Daylight Time 2002
<!-- hhmts end -->
</body>
</html>
- backported by
-
JDK-2108031 1.4 REGRESSION: JApplet should have a focus traversal policy.
-
- Resolved
-
-
JDK-2108032 1.4 REGRESSION: JApplet should have a focus traversal policy.
-
- Resolved
-
- duplicates
-
JDK-4789387 REGRESSION: tab navigation does not work in applets
-
- Closed
-
-
JDK-4705205 Cannot move focus using TAB / Shift TAB key, when running SwingSet2 demo under a
-
- Closed
-
- relates to
-
JDK-4719336 Ability for non focusCycleRoots to provide focusTraversalPolicy
-
- Resolved
-