|
Quick Lists
|
|
Bug ID:
|
4515750
|
|
Votes
|
0
|
|
Synopsis
|
JTextField & non-editable JTextArea bind return key - default btn not accessible
|
|
Category
|
java:classes_swing
|
|
Reported Against
|
1.4
, 1.3.1
|
|
Release Fixed
|
1.4.1(hopper)
|
|
State
|
10-Fix Delivered,
Verified,
request for enhancement
|
|
Priority:
|
4-Low
|
|
Related Bugs
|
4193995
,
4694015
|
|
Submit Date
|
17-OCT-2001
|
|
Description
|
JTextField swallows the return key, which makes it difficult for the user to access the default button on a dialog box when the focus is on the JTextField component.
The Java Look and Feel Design Guidelines do not specify any binding for JTextField for Return/Enter.
JTextArea has a similar problem. An editable JTextArea needs to bind the return key, but this does not make sense when the JTextArea is non-editable (but focusable).
There may be other text components with similar problems.
Components that needlessly swallow the return key negatively affect keyboard accessibility of swing applications.
-----------------------------------------------------
Here is a test case for the bug.
-- TextTest.java
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.text.*;
public class TextTest {
static JTextComponent ed;
public static void main(String[] args) {
JFrame f = new JFrame("test");
f.setVisible(true);
JDialog frame = new JDialog(f,"TextTest");
JButton button = new JButton("west");
frame.getContentPane().add(button,BorderLayout.WEST);
button = new JButton("button");
frame.getContentPane().add(button,BorderLayout.SOUTH);
button.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent ae) {
System.out.println("button pressed "+ae);
ed.setEditable(!ed.isEditable());
}
});
frame.getRootPane().setDefaultButton(button);
JTextComponent editor = new JTextArea("JTextArea");
ed = editor;
//editor.setEditable(false);
//editor.disable();
frame.getContentPane().add(editor,BorderLayout.NORTH);
editor = new JTextArea("JTextArea");
editor.setEditable(false);
//editor.disable();
frame.getContentPane().add(editor,BorderLayout.CENTER);
frame.pack();
frame.setVisible(true);
}
}
---
Select TextField or TextArea by mouse.
Press enter.
Button 'button' should be pressed and "button pressed" should be printed to sistem out.
xxxxx@xxxxx 2002-04-18
|
|
Work Around
|
N/A
|
|
Evaluation
|
Sounds like a good idea
xxxxx@xxxxx 2001-11-13
|
|
Comments
|
Submitted On 21-FEB-2002
carej
A similar situation applies to tabs. Non-editable
JTextAreas should not swallow TAB characters, thus
interupting the focus cycle.
Submitted On 10-OCT-2003
p.sladen
I haven't used swing for a while... and bugs/issues like
this still haven't been fixed!!... have you got anyone
working on bug fixes? :(
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |