Re: Accessing Swing component data
- From: Nigel Wade <nmw@xxxxxxxxxxxx>
- Date: Tue, 20 Feb 2007 12:09:09 +0000
Knute Johnson wrote:
Do methods that don't modify Swing components have to be called from the
EDT? Methods such as JTextField.getText(), JCheckBox.isSelected() etc.
Thanks,
I would say not.
What happens behind the scenes when a JCheckBox is selected? Can you be sure
that your thread requesting the state won't interfere in some subtle and
unpredictable way with the EDT if that thread is changing the check box
selected state because the user has just clicked on it?
How about if you call getText() whilst the user is entering text into your
JTextField?
You may be able to constrain your GUI operation to a limited set of
circumstances in which it works, and is ok. But, to me, that would just be a
bug waiting to happen.
--
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw@xxxxxxxxxxxx
Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555
.
- References:
- Accessing Swing component data
- From: Knute Johnson
- Accessing Swing component data
- Prev by Date: Text Editing (JTextComponent, etc.)
- Next by Date: Keyboard Traversal of Tree (standard?)
- Previous by thread: Re: Accessing Swing component data
- Next by thread: JMF: A-Law Plugin for JMF... anyone has it?
- Index(es):