Re: Coordinating multiple JTextField updates across panels
John B. Matthews wrote:
In article
<4a366bb8$0$32356$5a62ac22@per-qv1-newsreader-01.iinet.net.au>,
"Jarrick Chagma" <jarrick@large.com> wrote:
[...]
Do you realise that there are many, many panels and that
this is the cause of the problem?
How many is "many, many"? I see apparently simultaneous updates with 256
separate JPanels. I really don't think that's the problem. Perhaps you
could supply a short example: <http://pscode.org/sscce.html>.
Here's an SSCCE with a thousand JTextFields being updated. I see his
problem on my computer. A really fast computer might not.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class test extends JFrame implements Runnable {
JTextField[] fields = new JTextField[1000];
int n;
public test() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(new GridLayout(25,40));
for (int i=0; i<fields.length; i++) {
fields[i] = new JTextField("000");
add(fields[i]);
}
pack();
setVisible(true);
}
public void run() {
while (true) {
for (int i=0; i<fields.length; i++)
fields[i].setText(Integer.toString(n));
++n;
try {
Thread.sleep(1000);
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
}
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
test t = new test();
new Thread(t).start();
}
});
}
}
--
Knute Johnson
email s/nospam/knute2009/
--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access