Relates :
|
|
Relates :
|
|
Relates :
|
SYNOPSIS -------- appletviewer cannot show swing components OPERATING SYSTEMS ----------------- Redhat Enterprise Linux 6 Windows XP FULL JDK VERSION ---------------- java version "1.7.0-ea" Java(TM) SE Runtime Environment (build 1.7.0-ea-b132) Java HotSpot(TM) Client VM (build 21.0-b03, mixed mode) DESCRIPTION ----------- This is not reproducible when the applet is run in the browser. This is reproducible using appletviewer. This looks very similar to CR 7002612, which was closed as a duplicate of CR 6986229. However, issue can reproduce this issue on 7-b132 despite the fix for 6986229 being delivered in b123. Appletviewer cannot show its inner components just after starting. When I resize the appletviewer's window, I can see the inner components correctly. A similar AWT sample didn't have the problem. Adding invalidate() at the end of the init() method in the testcase works around issue. --- swing.html --- <html> <body> <applet code="swing.class" height=300 width=300> </applet> </body> </html> ------------------ --- swing.java --- import java.awt.*; import javax.swing.*; import java.applet.Applet; public class swing extends JApplet { public void init(){ Container c = this.getContentPane(); c.setLayout(new BorderLayout()); JScrollPane scrollPane = new JScrollPane(); scrollPane.getViewport().add(new JTextArea()); c.add("Center",scrollPane); c.add("South",new JTextField()); // workaround // invalidate () ; } } ------------------ REPRODUCTION INSTRUCTIONS ------------------------- Compile the sample code and load html by appletviewer. Note that the appletviewer doesn't show inner components. It shows grey background. WORKAROUND ---------- See testcase (add invalidate()).
|