/[classpath]/classpath/gnu/java/awt/EmbeddedWindow.java
ViewVC logotype

Diff of /classpath/gnu/java/awt/EmbeddedWindow.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by mkoch, Thu Jul 1 08:03:13 2004 UTC revision 1.3 by mkoch, Sat Jul 17 07:17:04 2004 UTC
# Line 40  package gnu.java.awt; Line 40  package gnu.java.awt;
40    
41  import gnu.classpath.Configuration;  import gnu.classpath.Configuration;
42  import gnu.java.awt.peer.EmbeddedWindowPeer;  import gnu.java.awt.peer.EmbeddedWindowPeer;
43    
44    import java.awt.Component;
45  import java.awt.Frame;  import java.awt.Frame;
46  import java.awt.Toolkit;  import java.awt.Toolkit;
47    import java.lang.reflect.Field;
48    
49  /**  /**
50   * Represents an AWT window that can be embedded into another   * Represents an AWT window that can be embedded into another
51   * application.   * application.
52   *   *
53   * @author Michael Koch <konqueror@gmx.de>   * @author Michael Koch (konqueror@gmx.de)
54   */   */
55  public class EmbeddedWindow extends Frame  public class EmbeddedWindow extends Frame
56  {  {
   static  
   {  
     if (Configuration.INIT_LOAD_LIBRARY)  
       System.loadLibrary("javaawt");  
   }  
     
57    private long handle;    private long handle;
58        
59    /**    /**
# Line 93  public class EmbeddedWindow extends Fram Line 90  public class EmbeddedWindow extends Fram
90        throw new UnsupportedOperationException        throw new UnsupportedOperationException
91          ("Embedded windows are not supported by the current peers: " + tk.getClass());          ("Embedded windows are not supported by the current peers: " + tk.getClass());
92    
93      setWindowPeer (((EmbeddedWindowSupport) tk).createEmbeddedWindow (this));      // Circumvent the package-privateness of the AWT internal
94        // java.awt.Component.peer member variable.
95        try
96          {
97            Field peerField = Component.class.getDeclaredField("peer");
98            peerField.set(this, ((EmbeddedWindowSupport) tk).createEmbeddedWindow (this));
99          }
100        catch (IllegalAccessException e)
101          {
102            // This should never happen.
103          }
104        catch (NoSuchFieldException e)
105          {
106            // This should never happen.
107          }
108    
109      super.addNotify();      super.addNotify();
110    }    }
111    
   // This method is only made native to circumvent the package-privateness of  
   // an AWT internal java.awt.Component.peer member variable.  
   native void setWindowPeer (EmbeddedWindowPeer peer);  
   
112    /**    /**
113     * If the native peer for this embedded window has been created,     * If the native peer for this embedded window has been created,
114     * then setHandle will embed the window.  If not, setHandle tells     * then setHandle will embed the window.  If not, setHandle tells

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26