+2004-07-17 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/awt/EmbeddedWindow.java
+ (static): Removed.
+ (addNotify): Set peer via reflection.
+ (setWindowPeer): Removed.
+ * gnu/java/awt/natEmbeddedWindow.cc: Removed.
+ * Makefile.am (nat_source_files):
+ Removed gnu/java/awt/natEmbeddedWindow.cc.
+ * Makefile.in: Regenerated.
+
2004-07-17 Richard Earnshaw <rearnsha@arm.com>
* configure.in(ZIP, GCJH): Remove white space around '=' in variable
gnu/gcj/runtime/natStackTrace.cc \
gnu/gcj/runtime/natStringBuffer.cc \
gnu/gcj/runtime/natVMClassLoader.cc \
-gnu/java/awt/natEmbeddedWindow.cc \
gnu/java/lang/natMainThread.cc \
gnu/java/net/natPlainDatagramSocketImpl.cc \
gnu/java/net/natPlainSocketImpl.cc \
gnu/gcj/runtime/natStackTrace.cc \
gnu/gcj/runtime/natStringBuffer.cc \
gnu/gcj/runtime/natVMClassLoader.cc \
-gnu/java/awt/natEmbeddedWindow.cc \
gnu/java/lang/natMainThread.cc \
gnu/java/net/natPlainDatagramSocketImpl.cc \
gnu/java/net/natPlainSocketImpl.cc \
gnu/gcj/io/shs.lo gnu/gcj/runtime/natFinalizerThread.lo \
gnu/gcj/runtime/natNameFinder.lo gnu/gcj/runtime/natSharedLibLoader.lo \
gnu/gcj/runtime/natStackTrace.lo gnu/gcj/runtime/natStringBuffer.lo \
-gnu/gcj/runtime/natVMClassLoader.lo gnu/java/awt/natEmbeddedWindow.lo \
-gnu/java/lang/natMainThread.lo \
+gnu/gcj/runtime/natVMClassLoader.lo gnu/java/lang/natMainThread.lo \
gnu/java/net/natPlainDatagramSocketImpl.lo \
gnu/java/net/natPlainSocketImpl.lo \
gnu/java/net/protocol/core/natCoreInputStream.lo \
.deps/gnu/java/awt/EventModifier.P \
.deps/gnu/java/awt/image/ImageDecoder.P \
.deps/gnu/java/awt/image/XBMDecoder.P \
-.deps/gnu/java/awt/natEmbeddedWindow.P \
.deps/gnu/java/awt/peer/ClasspathFontPeer.P \
.deps/gnu/java/awt/peer/EmbeddedWindowPeer.P \
.deps/gnu/java/awt/peer/GLightweightPeer.P \
import gnu.classpath.Configuration;
import gnu.java.awt.peer.EmbeddedWindowPeer;
+
+import java.awt.Component;
import java.awt.Frame;
import java.awt.Toolkit;
+import java.lang.reflect.Field;
/**
* Represents an AWT window that can be embedded into another
* application.
*
- * @author Michael Koch <konqueror@gmx.de>
+ * @author Michael Koch (konqueror@gmx.de)
*/
public class EmbeddedWindow extends Frame
{
- static
- {
- if (Configuration.INIT_LOAD_LIBRARY)
- System.loadLibrary("javaawt");
- }
-
private long handle;
/**
throw new UnsupportedOperationException
("Embedded windows are not supported by the current peers: " + tk.getClass());
- setWindowPeer (((EmbeddedWindowSupport) tk).createEmbeddedWindow (this));
+ // Circumvent the package-privateness of the AWT internal
+ // java.awt.Component.peer member variable.
+ try
+ {
+ Field peerField = Component.class.getDeclaredField("peer");
+ peerField.set(this, ((EmbeddedWindowSupport) tk).createEmbeddedWindow (this));
+ }
+ catch (IllegalAccessException e)
+ {
+ // This should never happen.
+ }
+ catch (NoSuchFieldException e)
+ {
+ // This should never happen.
+ }
+
super.addNotify();
}
- // 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);
-
/**
* If the native peer for this embedded window has been created,
* then setHandle will embed the window. If not, setHandle tells
+++ /dev/null
-/* Copyright (C) 2003 Free Software Foundation
-
- This file is part of libgcj.
-
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
-
-#include <gnu/java/awt/EmbeddedWindow.h>
-#include <gnu/java/awt/peer/EmbeddedWindowPeer.h>
-#include <java/awt/peer/ComponentPeer.h>
-
-void
-gnu::java::awt::EmbeddedWindow::setWindowPeer (gnu::java::awt::peer::EmbeddedWindowPeer* w)
-{
- if (!peer)
- peer = reinterpret_cast< ::java::awt::peer::ComponentPeer *> (w);
-}