| ECS Home Automation and Security Archives |
| Subject: From: Date: | looking for some Java expertise (large menu frames taking a
*long* time to display) Mark Gilmore Wed, 21 Feb 2007 10:50:32 -0500 |
hi everyone,
i have recently noticed that *all* JAVA menu frames that contain a
lot of elements (over 200 or so)
can take a REALLY long time to display.
specifically, it is the Frame.setVisible(true) call that is the culprit.
the delay is proportional *only* to the number of elements in the frame.
it happens with both normal Frames and JFrames.
it happens in both Applets and stand-alone pgms.
this can be seen in 3 places:
1) click the value of an Integer Object
FireFox:
The *initial* display can take as long as *30 seconds*
During this time,
\WINDOWS\system32\rundll32.exe is pegging the CPU AT 98+%
What this DLL has to do with a JAVA
menu is beyond me (GatesWare).
Thereafter, it takes 2-3 seconds
I.E.:
There is no long delay on 1st display (as
with FireFox)
It takes 2-3 seconds every time (acceptable,
but see #2).
2) if you have a lot of objects (i have 390), click the ADD
button in an ECS Page:
FireFox: It takes 10+ seconds to display the Object
menu every time
(rundll32.exe does not seem to come into
play for this one)
IE: same as FireFox
3) compile/run the JAVA pgm below.
This is a minimal pgm that reproduces the problem.
It takes 14 seconds to display a frame containing 500 labels.
any theories or suggestions would be greatly appreciated !
i would also like to know who is (or is not ?) having similar problems.
thanks,
Mark Gilmore
http://OmnipotenceSoftware.com
423-745-0026
********************************************
TEST PGM:
import java.lang.*;
import java.awt.*;
import java.awt.Component;
import java.awt.Label;
import javax.swing.JFrame;
public class X
{
public static void main(String[] arg)
{
X1 x1 = new X1();
x1.main(arg);
}
}
class X1
{
public void main(String[] arg)
{
JFrame jframe = new JFrame("MenuLookDemo");
jframe.getContentPane().setLayout(new
FlowLayout(FlowLayout.CENTER, 2, 2));
int x;
System.out.println("Create frame");
Label lb[] = new Label[500]; // create frame with
500 labels
for (x = 0; x < 500; x++)
{
lb[x] = new Label(Integer.toString(x));
jframe.getContentPane().add(lb[x]);
}
jframe.setSize(800, 400);
System.out.println("Display frame");
jframe.setVisible(true); // display it (takes FOREVER)
System.out.println("Wait 5 seconds");
try {Thread.sleep(5000);}
catch (InterruptedException e0) {};
System.exit(0);
}
}
Mark Gilmore
http://OmnipotenceSoftware.com