summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorRoman Kennke <roman@kennke.org>2007-03-01 01:01:00 +0000
committerRoman Kennke <roman@kennke.org>2007-03-01 01:01:00 +0000
commitcfefacbbbe53e7e4a2db4e0c90c3156af6a51687 (patch)
tree10d3dfe774329c7534d87df300a9c13362bcdc26 /java
parent7a510c3e2531682ca47fc78d068e55114abd371d (diff)
downloadclasspath-cfefacbbbe53e7e4a2db4e0c90c3156af6a51687.tar.gz
2007-03-01 Roman Kennke <kennke@aicas.com>
* java/awt/Canvas.java (graphicsConfiguration): Removed duplicate (from Component) field. (Canvas(GraphicsConfiguration)): Set the Component's graphicsConfig field. (getGraphicsConfigurationImpl): Removed. * java/awt/Component.java (getGraphicsConfiguration): Moved implementation here. Synchronize on tree lock to prevent threading nastiness. Don't query peer and instead return the setting of the graphicsConfig field. (getGraphicsConfigurationImpl): Removed. * java/awt/Window.java (graphicsConfiguration): Removed duplicate (from Component) field. (Window): Set the Component's graphicsConfig field. (Window(GraphicsConfiguration)): Set the Component's graphicsConfig field. (Window(Window,GraphicsConfiguration)): Set the Component's graphicsConfig field. (getGraphicsConfigurationImpl): Removed. (getGraphicsConfiguration): Fetch the local graphics env here if not already done and return that.
Diffstat (limited to 'java')
-rw-r--r--java/awt/Canvas.java14
-rw-r--r--java/awt/Component.java39
-rw-r--r--java/awt/Window.java32
3 files changed, 32 insertions, 53 deletions
diff --git a/java/awt/Canvas.java b/java/awt/Canvas.java
index 843fded44..95db1f57e 100644
--- a/java/awt/Canvas.java
+++ b/java/awt/Canvas.java
@@ -75,11 +75,6 @@ public class Canvas
private static transient long next_canvas_number;
/**
- * The graphics configuration associated with the canvas.
- */
- transient GraphicsConfiguration graphicsConfiguration;
-
- /**
* The buffer strategy associated with this canvas.
*/
transient BufferStrategy bufferStrategy;
@@ -100,14 +95,7 @@ public class Canvas
*/
public Canvas(GraphicsConfiguration graphicsConfiguration)
{
- this.graphicsConfiguration = graphicsConfiguration;
- }
-
- GraphicsConfiguration getGraphicsConfigurationImpl()
- {
- if (graphicsConfiguration != null)
- return graphicsConfiguration;
- return super.getGraphicsConfigurationImpl();
+ this.graphicsConfig = graphicsConfiguration;
}
/**
diff --git a/java/awt/Component.java b/java/awt/Component.java
index 7f2cbb423..f8bed1761 100644
--- a/java/awt/Component.java
+++ b/java/awt/Component.java
@@ -726,7 +726,23 @@ public abstract class Component
*/
public GraphicsConfiguration getGraphicsConfiguration()
{
- return getGraphicsConfigurationImpl();
+ GraphicsConfiguration conf = null;
+ synchronized (getTreeLock())
+ {
+ if (graphicsConfig != null)
+ {
+ conf = graphicsConfig;
+ }
+ else
+ {
+ Component par = getParent();
+ if (par != null)
+ {
+ conf = parent.getGraphicsConfiguration();
+ }
+ }
+ }
+ return conf;
}
/**
@@ -5434,27 +5450,6 @@ p * <li>the set of backward traversal keys
}
/**
- * Implementation method that allows classes such as Canvas and Window to
- * override the graphics configuration without violating the published API.
- *
- * @return the graphics configuration
- */
- GraphicsConfiguration getGraphicsConfigurationImpl()
- {
- if (peer != null)
- {
- GraphicsConfiguration config = peer.getGraphicsConfiguration();
- if (config != null)
- return config;
- }
-
- if (parent != null)
- return parent.getGraphicsConfiguration();
-
- return null;
- }
-
- /**
* Translate an AWT 1.1 event ({@link AWTEvent}) into an AWT 1.0
* event ({@link Event}).
*
diff --git a/java/awt/Window.java b/java/awt/Window.java
index 41dff5577..2a59375ce 100644
--- a/java/awt/Window.java
+++ b/java/awt/Window.java
@@ -87,7 +87,6 @@ public class Window extends Container implements Accessible
private transient WindowListener windowListener;
private transient WindowFocusListener windowFocusListener;
private transient WindowStateListener windowStateListener;
- private transient GraphicsConfiguration graphicsConfiguration;
private transient boolean shown;
@@ -132,13 +131,13 @@ public class Window extends Container implements Accessible
setLayout(new BorderLayout());
GraphicsEnvironment g = GraphicsEnvironment.getLocalGraphicsEnvironment();
- graphicsConfiguration = g.getDefaultScreenDevice().getDefaultConfiguration();
+ graphicsConfig = g.getDefaultScreenDevice().getDefaultConfiguration();
}
Window(GraphicsConfiguration gc)
{
this();
- graphicsConfiguration = gc;
+ graphicsConfig = gc;
}
/**
@@ -204,19 +203,11 @@ public class Window extends Container implements Accessible
throw new IllegalArgumentException ("gc must be from a screen device");
if (gc == null)
- graphicsConfiguration = GraphicsEnvironment.getLocalGraphicsEnvironment()
- .getDefaultScreenDevice()
- .getDefaultConfiguration();
+ graphicsConfig = GraphicsEnvironment.getLocalGraphicsEnvironment()
+ .getDefaultScreenDevice()
+ .getDefaultConfiguration();
else
- graphicsConfiguration = gc;
- }
-
- GraphicsConfiguration getGraphicsConfigurationImpl()
- {
- if (graphicsConfiguration != null)
- return graphicsConfiguration;
-
- return super.getGraphicsConfigurationImpl();
+ graphicsConfig = gc;
}
/**
@@ -1073,9 +1064,14 @@ public class Window extends Container implements Accessible
*/
public GraphicsConfiguration getGraphicsConfiguration()
{
- if (graphicsConfiguration != null) return graphicsConfiguration;
- if (peer != null) return peer.getGraphicsConfiguration();
- return null;
+ GraphicsConfiguration conf = graphicsConfig;
+ if (conf == null)
+ {
+ conf = GraphicsEnvironment.getLocalGraphicsEnvironment()
+ .getDefaultScreenDevice().getDefaultConfiguration();
+ graphicsConfig = conf;
+ }
+ return conf;
}
protected void processWindowFocusEvent(WindowEvent event)