[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] FYI: fixed isShowing in java.awt.Window
From: |
Roman Kennke |
Subject: |
[cp-patches] FYI: fixed isShowing in java.awt.Window |
Date: |
Wed, 18 May 2005 15:03:19 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021204 |
Bogdan Grigurescu discovered a bug in Classpath, which prevented AWT
Windows from painting lightweight components. Attached is a simple
testcase that demostrates this.
The problem was that the Window was not considered as showing, because
its parent Frame is not showing. I committed the attached patch that
fixes this.
2005-05-18 Roman Kennke <address@hidden>
* java/awt/Window.java
(isShowing): A Window can be showing even if its parent is not
showing.
/Roman
Index: java/awt/Window.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/Window.java,v
retrieving revision 1.46
diff -u -r1.46 Window.java
--- java/awt/Window.java 26 Apr 2005 18:56:18 -0000 1.46
+++ java/awt/Window.java 18 May 2005 12:55:36 -0000
@@ -772,12 +772,16 @@
/**
* Tests whether or not this window is visible on the screen.
*
+ * In contrast to the normal behaviour of Container, which is that
+ * a container is showing if its parent is visible and showing, a Window
+ * is even showing, if its parent (i.e. an invisible Frame) is not showing.
+ *
* @return <code>true</code> if this window is visible, <code>false</code>
* otherwise.
*/
public boolean isShowing()
{
- return super.isShowing();
+ return isVisible();
}
public void setLocationRelativeTo (Component c)
import java.awt.event.*;
import java.awt.*;
public class AWTTest
extends Window {
public static final int image_width = 320;
public static final int image_height = 240;
public AWTTest() {
super(new Frame());
setLocation(0, 0);
setSize(image_width, image_height);
setLayout(new BorderLayout());
setBackground(Color.white);
TxtPanel tp = new TxtPanel();
add(tp, BorderLayout.CENTER);
}
public static void main(String[] args) {
AWTTest awtest = new AWTTest();
awtest.setVisible(true);
}
}
class TxtPanel
extends Container {
public TxtPanel() {
}
public void paint(Graphics g) {
System.err.println("painting");
g.drawString("Badger, badger, badger!", 50, 50);
}
}
- [cp-patches] FYI: fixed isShowing in java.awt.Window,
Roman Kennke <=