summaryrefslogtreecommitdiff
path: root/java/awt/Window.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/awt/Window.java')
-rw-r--r--java/awt/Window.java96
1 files changed, 64 insertions, 32 deletions
diff --git a/java/awt/Window.java b/java/awt/Window.java
index d9e90c0ea..8bc4715ae 100644
--- a/java/awt/Window.java
+++ b/java/awt/Window.java
@@ -38,8 +38,6 @@ exception statement from your version. */
package java.awt;
-import gnu.classpath.NotImplementedException;
-
import java.awt.event.ComponentEvent;
import java.awt.event.FocusEvent;
import java.awt.event.WindowAdapter;
@@ -132,33 +130,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 +141,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.
@@ -1046,12 +1079,11 @@ public class Window extends Container implements Accessible
/**
* @since 1.2
*
- * @deprecated
+ * @deprecated replaced by Component.applyComponentOrientation.
*/
public void applyResourceBundle(ResourceBundle rb)
- throws NotImplementedException
{
- throw new Error ("Not implemented");
+ applyComponentOrientation(ComponentOrientation.getOrientation(rb));
}
/**