EDT and SwingUtilities.invokeLater help
- From: pek <kimwlias@xxxxxxxxx>
- Date: Mon, 22 Oct 2007 21:51:05 -0000
OK, I got really confused about when to use SwingUtilities or not.
For example.
Let's say that I have a simple class that extends JFrame, a private
JButton field testButton and a private JLabel field testLabel.
Somewhere down the code I right the following:
testButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e){
testLabel.setText("testButton");
}
});
Does this needs to be converted to :
public void actionPerformed(ActionEvent e){
SwingUtilities.invokeLater(new Runnable(){
public void run(){
testLabel.setText("testButton");
}
})
});
or not? And why..?
When exactly do I need to use SwingUtilities?
If I have a thread that changes a JLabel inside/outside the class, do
I need it?
If the thread instead of changing the testLabel invokes
testButton.doClick(), will I still need to use SwingUtilities..?
Overall, is there any good reference in the internet to explain all
these..?
Thank you very very very very much for your help..
.
- Follow-Ups:
- Re: EDT and SwingUtilities.invokeLater help
- From: Roedy Green
- Re: EDT and SwingUtilities.invokeLater help
- From: Nigel Wade
- Re: EDT and SwingUtilities.invokeLater help
- Prev by Date: JSP Questions
- Next by Date: EDT and SwingUtilities.invokeLater help
- Previous by thread: JSP Questions
- Next by thread: Re: EDT and SwingUtilities.invokeLater help
- Index(es):