summaryrefslogtreecommitdiff
path: root/java/awt
diff options
context:
space:
mode:
authorAndrew John Hughes <gnu_andrew@member.fsf.org>2006-05-29 16:19:43 +0000
committerAndrew John Hughes <gnu_andrew@member.fsf.org>2006-05-29 16:19:43 +0000
commitedd2a15cd1b0c0771bde794ca558397414515e7f (patch)
tree7a03d9df49a3eafa27a831ff321ce65168bfa16b /java/awt
parent5418bfcd1dcd18878b4d0910610513c6247632ec (diff)
downloadclasspath-edd2a15cd1b0c0771bde794ca558397414515e7f.tar.gz
2006-05-29 Andrew John Hughes <gnu_andrew@member.fsf.org>
* Merge of HEAD to generics-branch (2006-05-20 to 2006-05-29)
Diffstat (limited to 'java/awt')
-rw-r--r--java/awt/Graphics2D.java2
-rw-r--r--java/awt/Window.java90
-rw-r--r--java/awt/dnd/DragGestureRecognizer.java13
3 files changed, 73 insertions, 32 deletions
diff --git a/java/awt/Graphics2D.java b/java/awt/Graphics2D.java
index 53d7ca5e6..a833038c3 100644
--- a/java/awt/Graphics2D.java
+++ b/java/awt/Graphics2D.java
@@ -62,7 +62,7 @@ import java.util.Map;
* <code>Graphics2D</code> (*);</li>
* <li>a {@link BufferedImage} - see
* {@link BufferedImage#createGraphics()} (*);</li>
- * <li>a {@link PrinterJob} - in the
+ * <li>a {@link java.awt.print.PrinterJob} - in the
* {@link Printable#print(Graphics, PageFormat, int)} method, the incoming
* {@link Graphics} should always be an instance of <code>Graphics2D</code>
* (*).</li>
diff --git a/java/awt/Window.java b/java/awt/Window.java
index aa0689ce8..4861dd0a4 100644
--- a/java/awt/Window.java
+++ b/java/awt/Window.java
@@ -42,6 +42,7 @@ import gnu.classpath.NotImplementedException;
import java.awt.event.ComponentEvent;
import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowFocusListener;
@@ -132,33 +133,7 @@ public class Window extends Container implements Accessible
// cycle roots.
focusCycleRoot = true;
setLayout(new BorderLayout());
-
- addWindowFocusListener (new WindowAdapter ()
- {
- public void windowGainedFocus (WindowEvent event)
- {
- if (windowFocusOwner != null)
- {
- // FIXME: move this section and the other similar
- // sections in Component into a separate method.
- EventQueue eq = Toolkit.getDefaultToolkit ().getSystemEventQueue ();
- synchronized (eq)
- {
- KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
- Component currentFocusOwner = manager.getGlobalPermanentFocusOwner ();
- if (currentFocusOwner != null)
- {
- eq.postEvent (new FocusEvent (currentFocusOwner, FocusEvent.FOCUS_LOST,
- false, windowFocusOwner));
- eq.postEvent (new FocusEvent (windowFocusOwner, FocusEvent.FOCUS_GAINED,
- false, currentFocusOwner));
- }
- else
- eq.postEvent (new FocusEvent (windowFocusOwner, FocusEvent.FOCUS_GAINED, false));
- }
- }
- }
- });
+ addWindowFocusListener();
GraphicsEnvironment g = GraphicsEnvironment.getLocalGraphicsEnvironment();
graphicsConfiguration = g.getDefaultScreenDevice().getDefaultConfiguration();
@@ -169,7 +144,68 @@ public class Window extends Container implements Accessible
this();
graphicsConfiguration = gc;
}
+
+ private void addWindowFocusListener()
+ {
+ addWindowFocusListener(new WindowAdapter()
+ {
+ public void windowGainedFocus(WindowEvent event)
+ {
+ EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue();
+ if (windowFocusOwner != null)
+ {
+ synchronized (eq)
+ {
+ KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
+ Component currentFocusOwner = manager.getGlobalPermanentFocusOwner();
+ if (currentFocusOwner != null)
+ {
+ eq.postEvent(new FocusEvent(currentFocusOwner,
+ FocusEvent.FOCUS_LOST, false,
+ windowFocusOwner));
+ eq.postEvent(new FocusEvent(windowFocusOwner,
+ FocusEvent.FOCUS_GAINED, false,
+ currentFocusOwner));
+ }
+ else
+ eq.postEvent(new FocusEvent(windowFocusOwner,
+ FocusEvent.FOCUS_GAINED, false));
+ }
+ }
+ else
+ eq.postEvent(new FocusEvent(Window.this, FocusEvent.FOCUS_GAINED,
+ false));
+ }
+ public void windowLostFocus(WindowEvent event)
+ {
+ EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue();
+ if (windowFocusOwner != null)
+ {
+ synchronized (eq)
+ {
+ KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
+ Component currentFocusOwner = manager.getGlobalPermanentFocusOwner();
+ if (currentFocusOwner != null)
+ {
+ eq.postEvent(new FocusEvent(currentFocusOwner,
+ FocusEvent.FOCUS_GAINED, false,
+ windowFocusOwner));
+ eq.postEvent(new FocusEvent(windowFocusOwner,
+ FocusEvent.FOCUS_LOST, false,
+ currentFocusOwner));
+ }
+ else
+ eq.postEvent(new FocusEvent(windowFocusOwner,
+ FocusEvent.FOCUS_LOST, false));
+ }
+ }
+ else
+ eq.postEvent(new FocusEvent(Window.this, FocusEvent.FOCUS_LOST, false));
+ }
+ });
+ }
+
/**
* Initializes a new instance of <code>Window</code> with the specified
* parent. The window will initially be invisible.
diff --git a/java/awt/dnd/DragGestureRecognizer.java b/java/awt/dnd/DragGestureRecognizer.java
index f855ba63f..759ec9ac2 100644
--- a/java/awt/dnd/DragGestureRecognizer.java
+++ b/java/awt/dnd/DragGestureRecognizer.java
@@ -1,5 +1,5 @@
/* DragGestureRecognizer.java --
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -132,7 +132,7 @@ public abstract class DragGestureRecognizer implements Serializable
public void resetRecognizer()
throws NotImplementedException
{
- throw new Error("not implemented");
+ events = new ArrayList();
}
/**
@@ -156,10 +156,15 @@ public abstract class DragGestureRecognizer implements Serializable
dragGestureListener = null;
}
+ /**
+ * Fires a <code>DragGestureEvent</code> to the DragGestureListener
+ * associated with this object, if there is one.
+ */
protected void fireDragGestureRecognized(int dragAction, Point p)
- throws NotImplementedException
{
- throw new Error("not implemented");
+ if(dragGestureListener != null)
+ dragGestureListener.dragGestureRecognized
+ (new DragGestureEvent(this, dragAction, p, events));
}
protected void appendEvent(InputEvent e)