-
Bug
-
Resolution: Fixed
-
P4
-
1.4.0, 1.4.1, 1.4.1_01, 1.4.1_02, 1.4.2
-
04
-
x86
-
windows_nt, windows_2000
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2058444 | 5.0 | Bino George | P4 | Resolved | Fixed | tiger |
Name: jk109818 Date: 09/10/2002
FULL PRODUCT VERSION :
java version "1.4.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_01-b03)
Java HotSpot(TM) Client VM (build 1.4.0_01-b03, mixed mode)
java version "1.4.1-rc"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-rc-b19)
Java HotSpot(TM) Client VM (build 1.4.1-rc-b19, mixed mode)
FULL OPERATING SYSTEM VERSION :
all Windows OS
A DESCRIPTION OF THE PROBLEM :
a call to java.awt.Container.add can be very slow (about 3
seconds or even more) in Applets!
REGRESSION. Last worked in version 1.3.1
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. compile source code
2. start html-file with the appletviewer
3. click on the "two" button
(the center panel will become blue)
4. click on the "one" button
it tooks about 3 seconds to switch the panel
(see output to console)
EXPECTED VERSUS ACTUAL BEHAVIOR :
switch of the panels should simply be faster
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
/*
* Java14test.java 1.0 02/09/10
*/
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class Java14test extends Applet implements ActionListener
{
Panel p1 = new Panel();
Panel p2 = new Panel();
Panel p3 = new Panel();
Button b1 = new Button("one");
Button b2 = new Button("two");
public void init()
{
setLayout(new BorderLayout());
p1.setLayout(new BorderLayout());
p1.add(BorderLayout.WEST, b1);
p1.add(BorderLayout.EAST, b2);
p2.setLayout(null);
p3.setLayout(null);
p2.setBackground(Color.yellow);
p3.setBackground(Color.blue);
p1.add(BorderLayout.CENTER, p2);
add(BorderLayout.CENTER, p1);
b1.addActionListener(this);
b2.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
Object obj = ae.getSource();
if (obj == b1)
{
long time1 = System.currentTimeMillis();
p1.removeAll();
long time2 = System.currentTimeMillis();
p1.add(BorderLayout.WEST, b1);
long time3 = System.currentTimeMillis();
p1.add(BorderLayout.EAST, b2);
long time4 = System.currentTimeMillis();
p1.add(BorderLayout.CENTER, p2);
long time5 = System.currentTimeMillis();
invalidate();
long time6 = System.currentTimeMillis();
p2.repaint();
long time7 = System.currentTimeMillis();
validate();
long time8 = System.currentTimeMillis();
System.out.println("<<<<< Change-Status:");
System.out.println("removeAll: " + (time2-time1)+"ms");
System.out.println("add button1: " + (time3-time2)+"ms");
System.out.println("add button2: " + (time4-time3)+"ms");
System.out.println("add Panel 1: " + (time5-time4)+"ms");
System.out.println("showing : " + (time8-time5)+"ms");
System.out.println("all : " + (time8-time1)+"ms");
}
else if (obj == b2)
{
long time1 = System.currentTimeMillis();
p1.removeAll();
long time2 = System.currentTimeMillis();
p1.add(BorderLayout.WEST, b1);
long time3 = System.currentTimeMillis();
p1.add(BorderLayout.EAST, b2);
long time4 = System.currentTimeMillis();
p1.add(BorderLayout.CENTER, p3);
long time5 = System.currentTimeMillis();
invalidate();
long time6 = System.currentTimeMillis();
p3.repaint();
long time7 = System.currentTimeMillis();
validate();
long time8 = System.currentTimeMillis();
System.out.println("<<<<< Change-Status:");
System.out.println("removeAll: " + (time2-time1)+"ms");
System.out.println("add button1: " + (time3-time2)+"ms");
System.out.println("add button2: " + (time4-time3)+"ms");
System.out.println("add Panel 2: " + (time5-time4)+"ms");
System.out.println("showing : " + (time8-time5)+"ms");
System.out.println("all : " + (time8-time1)+"ms");
}
}
}
<html>
<applet code=Java14test.class
height=150 width=200>
</applet>
</html>
---------- END SOURCE ----------
CUSTOMER WORKAROUND :
use CardLayout instead of removing old panel
and adding new one
Release Regression From : 1.3.1_04
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
(Review ID: 164280)
======================================================================
- backported by
-
JDK-2058444 1.4 REGRESSION: java.awt.Container.add is very slow in Applets
- Resolved
- duplicates
-
JDK-4673954 Applets consume 100% CPU usage by using 1.4 plugin
- Closed
-
JDK-4770534 rendering/repaint slow and distorted with 1.4.1
- Closed
-
JDK-4873526 REGRESSION: remove/add panel to applet noticably slower in 1.4.x
- Closed
-
JDK-4878438 CPU spikes to 100% with awt applet using appletviewer and plugin IE5
- Closed
-
JDK-4884034 REGRESSION: included test program slow under 1.4.x
- Closed
-
JDK-4827244 adding component takes too long (5seconds on 1.4 against 10ms on 1.3)
- Closed
- relates to
-
JDK-4973362 Severe performance degradation from 1.3.x to 1.4.x for Z-order switching in appl
- Resolved
-
JDK-4895361 1.4 REGRESSION: Performance problem with awt Panel.add(), slow in 1.4
- Resolved
-
JDK-5038176 security policy runtime settings not working for applets
- Closed