harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r640916 - /harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/appletviewer/AppletFrame.java
Date Tue, 25 Mar 2008 17:58:46 GMT
Author: ayza
Date: Tue Mar 25 10:58:44 2008
New Revision: 640916

URL: http://svn.apache.org/viewvc?rev=640916&view=rev
Log:
Applying patch from HARMONY-5537 ([jdktools][appletviewer] Applet doesn't change size after
appletviewer changes one.)

Modified:
    harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/appletviewer/AppletFrame.java

Modified: harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/appletviewer/AppletFrame.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/appletviewer/AppletFrame.java?rev=640916&r1=640915&r2=640916&view=diff
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/appletviewer/AppletFrame.java
(original)
+++ harmony/enhanced/jdktools/trunk/modules/tools/src/main/java/org/apache/harmony/tools/appletviewer/AppletFrame.java
Tue Mar 25 10:58:44 2008
@@ -26,6 +26,8 @@
 import java.awt.GridLayout;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
+import java.awt.event.ComponentAdapter;
+import java.awt.event.ComponentEvent;
 import java.awt.event.ItemEvent;
 import java.awt.event.ItemListener;
 import java.awt.event.WindowEvent;
@@ -58,6 +60,7 @@
 class AppletFrame extends JFrame {
     private final Applet applet;
     private final JLabel statusLabel;
+    JPanel appletPanel;
     
     private static ShutdownHandler shutdownHandler = new ShutdownHandler();
     
@@ -66,6 +69,7 @@
         applet = ViewerAppletContext.loadApplet(appletInfo);
 
         applet.setPreferredSize(new Dimension(appletInfo.getWidth(), appletInfo.getHeight()));
+       
 
         shutdownHandler.addFrame(this);
         
@@ -74,9 +78,10 @@
         
         // Create applet pane
         setLayout(new BorderLayout());
-        JPanel appletPanel = new JPanel();
-        appletPanel.add(applet);
-        add(appletPanel, BorderLayout.WEST);
+        appletPanel = new JPanel();
+        appletPanel.setLayout(new BorderLayout());
+        appletPanel.add(applet, BorderLayout.CENTER);
+        add(appletPanel, BorderLayout.CENTER);
         
         // Create status pane
         JPanel panel = new JPanel();
@@ -89,6 +94,14 @@
         panel.add(statusLabel, BorderLayout.WEST);
         add(panel, BorderLayout.SOUTH);
         appletInfo.setStatusLabel(statusLabel);
+
+        addComponentListener(new ComponentAdapter(){
+            public void componentResized(ComponentEvent e){
+                if(e.getComponent() == AppletFrame.this){
+                    applet.setPreferredSize(new Dimension(appletPanel.getWidth(), appletPanel.getHeight()));
+                }                
+            }
+        });
 
         // Start applet and make frame visible
         // Init should be called after pack to make components displayable



Mime
View raw message