[gui][PATCH] JWindow without an owner
Olga Rodimina
rodimina@redhat.com
Fri Jul 2 18:55:00 GMT 2004
On Thu, 2004-07-01 at 14:47, Michael Koch wrote:
> --BEGIN PGP SIGNED MESSAGE--
> Hash: SHA1
>
> Am Mittwoch, 30. Juni 2004 21:56 schrieb Olga Rodimina:
> > Hi,
> >
> > This patch makes JWindow() without an owner to work again. It might
> > not be the best way to fix this, but it does fix the problem. With
> > this patch one can create JWindow with no parent and also
> > HeavyWeightMenu's work again because they are dependent on JWindow.
> >
> > Please let me know if there is a better way to fix this. Any
> > comments are greatly appreciated.
> >
> > I'll be committing this patch to java-gui-branch later in the day.
>
> This patch broke compiling java-gui-branch with jikes.
>
Hi, I'll be committing attached patch to java-gui-branch to fix the
problem above. Thanks to Bryce & Tom F. for their help on this.
Olga.
-------------- next part --------------
? .snprj
? libjava.proj
? patch
? java/awt/patch
? javax/swing/patch
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.2660.2.241
diff -u -r1.2660.2.241 ChangeLog
--- ChangeLog 2 Jul 2004 06:04:42 -0000 1.2660.2.241
+++ ChangeLog 2 Jul 2004 18:42:42 -0000
@@ -1,3 +1,14 @@
+2004-07-02 Olga Rodimina <rodimina@redhat.com>
+
+ * java/awt/Window.java: Reverted changes from my
+ previous patch for creating window without an owner.
+ * javax/swing/SwingUtilities.java:
+ (SwingUtilities.OwnerFrame): made static.
+ (OwnerFrame.setVisible): New method. Overridden with
+ empty implementation.
+ (OwnerFrame.isShowing): New method. Ovverridden
+ to return always true.
+
2004-07-02 Thomas Fitzsimmons <fitzsim@redhat.com>
* java/awt/Panel.java (dispatchEventImpl): Override to prevent
Index: java/awt/Window.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/Window.java,v
retrieving revision 1.32.12.6
diff -u -r1.32.12.6 Window.java
--- java/awt/Window.java 30 Jun 2004 20:47:50 -0000 1.32.12.6
+++ java/awt/Window.java 2 Jul 2004 18:42:44 -0000
@@ -53,7 +53,6 @@
import java.util.Vector;
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
-import javax.swing.SwingUtilities;
/**
* This class represents a top-level window with no decorations.
@@ -119,11 +118,7 @@
*/
public Window(Frame owner)
{
- this();
-
- // Construct a Window with no parent if owner is of type OwnerFrame.
- if (!(owner instanceof SwingUtilities.OwnerFrame))
- setWindowOwner (owner, owner.getGraphicsConfiguration ());
+ this (owner, owner.getGraphicsConfiguration ());
}
/**
@@ -138,7 +133,7 @@
*/
public Window(Window owner)
{
- setWindowOwner(owner, owner.getGraphicsConfiguration ());
+ this (owner, owner.getGraphicsConfiguration ());
}
/**
@@ -154,20 +149,14 @@
public Window(Window owner, GraphicsConfiguration gc)
{
this ();
- setWindowOwner(owner, owner.getGraphicsConfiguration ());
- }
-
-
- private void setWindowOwner (Window owner, GraphicsConfiguration gc)
- {
+
synchronized (getTreeLock())
{
if (owner == null)
throw new IllegalArgumentException ("owner must not be null");
-
- parent = owner;
- owner.ownedWindows.add(new WeakReference(this));
-
+
+ parent = owner;
+ owner.ownedWindows.add(new WeakReference(this));
}
// FIXME: make this text visible in the window.
@@ -185,10 +174,9 @@
// .getDefaultScreenDevice()
// .getDefaultConfiguration();
// else
- graphicsConfiguration = gc;
-
+ graphicsConfiguration = gc;
}
-
+
GraphicsConfiguration getGraphicsConfigurationImpl()
{
if (graphicsConfiguration != null)
Index: javax/swing/SwingUtilities.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/SwingUtilities.java,v
retrieving revision 1.6.2.10
diff -u -r1.6.2.10 SwingUtilities.java
--- javax/swing/SwingUtilities.java 30 Jun 2004 20:47:51 -0000 1.6.2.10
+++ javax/swing/SwingUtilities.java 2 Jul 2004 18:42:47 -0000
@@ -891,14 +891,21 @@
}
/**
- * This frame should be used when constructing a Window/JDialog without
+ * This frame should be used when constructing a Window/JDialog without
* a parent. In this case, we are forced to use this frame as a window's
* parent, because we simply cannot pass null instead of parent to Window
* constructor, since doing it will result in NullPointerException.
*/
- private class OwnerFrame extends Frame{
- public OwnerFrame(){
- super();
+ private static class OwnerFrame extends Frame
+ {
+ public void setVisible(boolean b)
+ {
+ // Do nothing here.
+ }
+
+ public boolean isShowing()
+ {
+ return true;
+ }
}
-}
}
More information about the Java-patches
mailing list