Re: javax.swing.JTextField
Hi again, > What's strange is that JFormattedTextField, which inherits from JTextField, > doesn't fire the action event... Oh, I see, it specifically overrides the > action map. Is it correct that JFormattedTextField's getActions() just > returns null, rather than invoking its super-class, or at least providing > the same action for the enter key? Whoops, I think you looked at the wrong method. There is an inner class (AccessibleJFormattedTextField) which also has getActions() and returns null (which is wrong for sure, but shouldn't affect your issue). The getActions() method of the JFormattedTextField does indeed return super.getActions() so the NotifyAction should be included here. However, when I try this with Sun's JDK, it only fires an ActionEvent if a valid value according to the installed Formatter has been entered. Unfortunately, this does not work in Classpath this way. Would you mind filing a bug report? /Roman signature.asc Description: Dies ist ein digital signierter Nachrichtenteil ___ Classpath mailing list Classpath@gnu.org http://lists.gnu.org/mailman/listinfo/classpath
Re: javax.swing.JTextField
Hi Christopher, > > I tested with current CVS HEAD and there it seems to work. And I believe, > > nobody worked on that in the last weeks, so it should at least be in 0.19 > > too. You can find the associated sourcecode in javax/swing/JTextField.java > > starting at line 95 (the notifyAction stuff). > > I apologize; I thought that the fileTextField of JFileChooser (in the Metal > plaf) had an action listener (as it should), but I looked more closely and > it doesn't. When I added it, the action event was indeed fired. > (In passing, I had read the code that you referred to; I simply didn't > know enough about the way keymaps were installed to recognize it as such.) Yeah, this area is a little bit complicated and confusing. > What's strange is that JFormattedTextField, which inherits from JTextField, > doesn't fire the action event... Oh, I see, it specifically overrides the > action map. Is it correct that JFormattedTextField's getActions() just > returns null, rather than invoking its super-class, or at least providing > the same action for the enter key? It should definitely call super.getActions() and add some actions on its own there. I'll fix this. Thank you for reporting and helping, Roman signature.asc Description: Dies ist ein digital signierter Nachrichtenteil ___ Classpath mailing list Classpath@gnu.org http://lists.gnu.org/mailman/listinfo/classpath
Re: javax.swing.JTextField
On Mon, 2005-12-19 at 22:40 -0500, Christopher Lansdown wrote: > Hi, > > JTextField doesn't seem to send any ActionEvent's when VK_ENTER is pressed, > and looking through the source it doesn't seem to try to catch this. > Hi Chris, I ran a little test program and it seems to work for me. Are you trying to activate the ActionEvent programmatically, or were you actually typing the ENTER key into the text area? Are you using the newest Classpath? Here's a little test program to run, type in some text and hit enter. Every time you hit enter "hi" is printed to the console. Works for me. If this little program doesn't work for anyone, or if you can write a small program that shows what's wrong, please file a bug or email the list again. Test Program: import java.awt.event.*; import javax.swing.*; public class Test { public static void main(String[] args) { JFrame jf = new JFrame(); final JTextField text = new JTextField(10); text.addActionListener (new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println ("hi"); } } ); jf.add(text); jf.pack(); jf.setVisible(true); } } --Tony ___ Classpath mailing list Classpath@gnu.org http://lists.gnu.org/mailman/listinfo/classpath
Re: javax.swing.JTextField
On 12/20, Roman Kennke wrote: > Hi Christopher, > > Am Montag, den 19.12.2005, 22:40 -0500 schrieb Christopher Lansdown: > > Hi, > > > > JTextField doesn't seem to send any ActionEvent's when VK_ENTER is pressed, > > and looking through the source it doesn't seem to try to catch this. > > > > Is anyone working on this currently? > > Which version of Classpath have you tried? CVS as of a day or two ago. > I tested with current CVS HEAD and there it seems to work. And I believe, > nobody worked on that in the last weeks, so it should at least be in 0.19 > too. You can find the associated sourcecode in javax/swing/JTextField.java > starting at line 95 (the notifyAction stuff). I apologize; I thought that the fileTextField of JFileChooser (in the Metal plaf) had an action listener (as it should), but I looked more closely and it doesn't. When I added it, the action event was indeed fired. (In passing, I had read the code that you referred to; I simply didn't know enough about the way keymaps were installed to recognize it as such.) What's strange is that JFormattedTextField, which inherits from JTextField, doesn't fire the action event... Oh, I see, it specifically overrides the action map. Is it correct that JFormattedTextField's getActions() just returns null, rather than invoking its super-class, or at least providing the same action for the enter key? > If you still have problems, I would like to see a testcase where it > fails. Many thanks, Chris Lansdown -- "Let us endeavor so to live that when we come to die even the undertaker will be sorry." -- Mark Twain, "Pudd'nhead Wilson's Calendar" == Evil Overlord Quote of the Day (www.eviloverlord.com) = 97. My dungeon cells will not be furnished with objects that contain reflective surfaces or anything that can be unravelled. ___ Classpath mailing list Classpath@gnu.org http://lists.gnu.org/mailman/listinfo/classpath
Re: javax.swing.JTextField
Hi Christopher, Am Montag, den 19.12.2005, 22:40 -0500 schrieb Christopher Lansdown: > Hi, > > JTextField doesn't seem to send any ActionEvent's when VK_ENTER is pressed, > and looking through the source it doesn't seem to try to catch this. > > Is anyone working on this currently? Which version of Classpath have you tried? I tested with current CVS HEAD and there it seems to work. And I believe, nobody worked on that in the last weeks, so it should at least be in 0.19 too. You can find the associated sourcecode in javax/swing/JTextField.java starting at line 95 (the notifyAction stuff). If you still have problems, I would like to see a testcase where it fails. Cheers, Roman signature.asc Description: Dies ist ein digital signierter Nachrichtenteil ___ Classpath mailing list Classpath@gnu.org http://lists.gnu.org/mailman/listinfo/classpath
javax.swing.JTextField
Hi, JTextField doesn't seem to send any ActionEvent's when VK_ENTER is pressed, and looking through the source it doesn't seem to try to catch this. Is anyone working on this currently? Thanks, Chris Lansdown -- "Let us endeavor so to live that when we come to die even the undertaker will be sorry." -- Mark Twain, "Pudd'nhead Wilson's Calendar" == Evil Overlord Quote of the Day (www.eviloverlord.com) = 7. When I've captured my adversary and he says, "Look, before you kill me, will you at least tell me what this is all about?" I'll say, "No." and shoot him. No, on second thought I'll shoot him then say "No." ___ Classpath mailing list Classpath@gnu.org http://lists.gnu.org/mailman/listinfo/classpath