Re: textfield focus
Ted <[email protected]>
| Newsgroups | gmane.comp.embedded.carlsbad-cubes |
|---|---|
| Message-ID | <[email protected]> |
Extend it like so:
public class FocusTextField extends JTextField {
public FocusTextField() {
super();
addFocusListener(new FocusListener() {
public void focusGained(FocusEvent e) {
}
public void focusLost(FocusEvent e) {
fireActionPerformed();
}
});
}
}
This text field will fire a regular action event upon losing focus, so
you can use the swix Action attribute to specify the listener:
<focustextfield id="tf1" key="profile namelist" Columns="80"
Text="Swixm1" Action="tfAction"/>
Be sure to register your new class with a tag:
swix.getTaglib().registerTag( "focustextfield", FocusTextField.class);
where swix is your SwingEngine (by the way, in a previous post I kept
calling that "SwixEngine" -sorry!).
It would be nice if Swix supported setters starting with "add" and
objects as settings for attributes other than Action.
Ted Hesselroth
[email protected] wrote:
>What is the correct way to handle an action that would be triggered when
>the focus is lost from a textfield?
>
>Thanks
>
>Alan
>
>
>_______________________________________________
>Forum mailing list
>[email protected]
>http://carlsbadcubes.com/mailman/listinfo/forum_carlsbadcubes.com
>
>