-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
5.0
-
x86
-
windows_2000, windows_xp
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)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
in 1.4.2 if you did this:
jformattedTextField.addActionListener(this);
then when you press enter in the JFormattedTextfield, the action performed was always called.
But now under 1.5.0 the actionPerformed is only called when there is a change in the jformattedtestfield! This is very annoying change for our customers..
I tracked it down to the JFormattedTextField.CommitAction and then the isEnabled() method. in 1.5 there is an extra test if the formattedtextfield is editted yes or now. That isn't there in 1.4
The problem is that sometimes the textfield is prefiled with a default value then people don't have to type anything to trigger a search or something with that value by pressing enter in that field.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
JFormattedTextField field = new JFormattedTextField();
field.addActionListener(new ActionListener()
{
public actionPerformed(ActionEvent event)
{
System.out.println("This is not called in 1.5 when there is no change");
}
});
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
same as 1.4 an enter should always trigger the action.
ACTUAL -
no action trigger
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class Test extends JFrame
{
public void init()
{
getContentPane().setLayout(new BorderLayout());
JFormattedTextField field = new JFormattedTextField();
field.addActionListener(new ActionListener()
{ public void actionPerformed(ActionEvent event)
{System.out.println("This is not called in 1.5 when there is no change");
}
});
getContentPane().add(field,BorderLayout.NORTH);
}
public static void main(String args [])
{
JFrame test = new Test("Test Frame");
test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
test.setLocation(100,100);
test.setSize(200,200);
test.show();
}
public Test(String title)
{ super(title);
init();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
i am stil looking for it but i think i now need to listen for key events and test for the enter key myself..
###@###.### 2005-04-18 11:57:47 GMT
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)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
in 1.4.2 if you did this:
jformattedTextField.addActionListener(this);
then when you press enter in the JFormattedTextfield, the action performed was always called.
But now under 1.5.0 the actionPerformed is only called when there is a change in the jformattedtestfield! This is very annoying change for our customers..
I tracked it down to the JFormattedTextField.CommitAction and then the isEnabled() method. in 1.5 there is an extra test if the formattedtextfield is editted yes or now. That isn't there in 1.4
The problem is that sometimes the textfield is prefiled with a default value then people don't have to type anything to trigger a search or something with that value by pressing enter in that field.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
JFormattedTextField field = new JFormattedTextField();
field.addActionListener(new ActionListener()
{
public actionPerformed(ActionEvent event)
{
System.out.println("This is not called in 1.5 when there is no change");
}
});
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
same as 1.4 an enter should always trigger the action.
ACTUAL -
no action trigger
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class Test extends JFrame
{
public void init()
{
getContentPane().setLayout(new BorderLayout());
JFormattedTextField field = new JFormattedTextField();
field.addActionListener(new ActionListener()
{ public void actionPerformed(ActionEvent event)
{System.out.println("This is not called in 1.5 when there is no change");
}
});
getContentPane().add(field,BorderLayout.NORTH);
}
public static void main(String args [])
{
JFrame test = new Test("Test Frame");
test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
test.setLocation(100,100);
test.setSize(200,200);
test.show();
}
public Test(String title)
{ super(title);
init();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
i am stil looking for it but i think i now need to listen for key events and test for the enter key myself..
###@###.### 2005-04-18 11:57:47 GMT
- relates to
-
JDK-4741926 JFormattedTextField/JSpinner always consumes certain key events
-
- Resolved
-