-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
1.4.0
-
x86
-
windows_2000
Name: sv35042 Date: 10/08/2002
FULL PRODUCT VERSION :
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)
FULL OPERATING SYSTEM VERSION :
Microsoft Windows 2000 [Version 5.00.2195]
Patch 2 installed.
A DESCRIPTION OF THE PROBLEM :
When a JFormattedTextField is created with a mask of "(###)
###-####", the field correctly disallows the user from using
the left cursor key to move to the left of the first left
parenthesis. The farthest left they can move using the left
cursor key is the first numeric character slot (the second
character position).
However, pressing the Home key instantly moves the cursor to
the beginning of the field, bypassing the navigation controls.
The enclosed "FFBug.java" class can be used to demonstrate this.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
After compiling and executing the "FFBug.java" class:
1. Put the focus in the second field. The text cursor should
now be on the second character position, after the left
parenthesis.
2. Press the left cursor key. Nothing should happen.
3. Press the Home key.
EXPECTED VERSUS ACTUAL BEHAVIOR :
Pressing the Home key should do nothing, just like pressing
the left cursor key. However, pressing the Home key at this
point moves the text cursor to the beginning of the field,
bypassing the navigation controls.
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.*;
import java.awt.event.*;
import java.text.*;
import javax.swing.*;
import javax.swing.text.*;
public class FFBug {
public static void main(String[] args) {
JFrame frame = new JFrame("FFBug");
JPanel pane = (JPanel) frame.getContentPane();
pane.setLayout(new FlowLayout());
JTextField field = new JTextField();
field.setText("4255551212");
JFormattedTextField phonefield = null;
try {
phonefield =
new JFormattedTextField(new MaskFormatter("(###) ###-####"));
phonefield.setColumns(10);
} catch (ParseException ex) {ex.printStackTrace();}
pane.add(field);
pane.add(phonefield);
frame.addWindowListener(new WindowAdapter()
{ public void windowClosing(WindowEvent evt) { System.exit(0); } });
frame.pack();
frame.show();
}
}
---------- END SOURCE ----------
(Review ID: 143538)
======================================================================
FULL PRODUCT VERSION :
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)
FULL OPERATING SYSTEM VERSION :
Microsoft Windows 2000 [Version 5.00.2195]
Patch 2 installed.
A DESCRIPTION OF THE PROBLEM :
When a JFormattedTextField is created with a mask of "(###)
###-####", the field correctly disallows the user from using
the left cursor key to move to the left of the first left
parenthesis. The farthest left they can move using the left
cursor key is the first numeric character slot (the second
character position).
However, pressing the Home key instantly moves the cursor to
the beginning of the field, bypassing the navigation controls.
The enclosed "FFBug.java" class can be used to demonstrate this.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
After compiling and executing the "FFBug.java" class:
1. Put the focus in the second field. The text cursor should
now be on the second character position, after the left
parenthesis.
2. Press the left cursor key. Nothing should happen.
3. Press the Home key.
EXPECTED VERSUS ACTUAL BEHAVIOR :
Pressing the Home key should do nothing, just like pressing
the left cursor key. However, pressing the Home key at this
point moves the text cursor to the beginning of the field,
bypassing the navigation controls.
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.*;
import java.awt.event.*;
import java.text.*;
import javax.swing.*;
import javax.swing.text.*;
public class FFBug {
public static void main(String[] args) {
JFrame frame = new JFrame("FFBug");
JPanel pane = (JPanel) frame.getContentPane();
pane.setLayout(new FlowLayout());
JTextField field = new JTextField();
field.setText("4255551212");
JFormattedTextField phonefield = null;
try {
phonefield =
new JFormattedTextField(new MaskFormatter("(###) ###-####"));
phonefield.setColumns(10);
} catch (ParseException ex) {ex.printStackTrace();}
pane.add(field);
pane.add(phonefield);
frame.addWindowListener(new WindowAdapter()
{ public void windowClosing(WindowEvent evt) { System.exit(0); } });
frame.pack();
frame.show();
}
}
---------- END SOURCE ----------
(Review ID: 143538)
======================================================================