diff options
author | Tom Tromey <tromey@gcc.gnu.org> | 2005-09-23 21:31:04 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2005-09-23 21:31:04 +0000 |
commit | 1ea63ef8be1cc54dd0de9d82c684713a1dcf1e06 (patch) | |
tree | 3ca4b2e68dc14c3128b9c781d23f1d0b1f2bee49 /libjava/classpath/java/awt | |
parent | 9b044d19517541c95681d35a92dbc81e6e21d94f (diff) | |
download | gcc-1ea63ef8be1cc54dd0de9d82c684713a1dcf1e06.zip gcc-1ea63ef8be1cc54dd0de9d82c684713a1dcf1e06.tar.gz gcc-1ea63ef8be1cc54dd0de9d82c684713a1dcf1e06.tar.bz2 |
Imported Classpath 0.18.
* sources.am, Makefile.in: Updated.
* Makefile.am (nat_source_files): Removed natProxy.cc.
* java/lang/reflect/natProxy.cc: Removed.
* gnu/classpath/jdwp/VMFrame.java,
gnu/classpath/jdwp/VMIdManager.java,
gnu/classpath/jdwp/VMVirtualMachine.java,
java/lang/reflect/VMProxy.java: New files.
2005-09-23 Thomas Fitzsimmons <fitzsim@redhat.com>
* scripts/makemake.tcl (verbose): Add gnu/java/awt/peer/qt to BC
list.
2005-09-23 Thomas Fitzsimmons <fitzsim@redhat.com>
* gnu/java/net/DefaultContentHandlerFactory.java (getContent):
Remove ClasspathToolkit references.
2005-09-23 Thomas Fitzsimmons <fitzsim@redhat.com>
* gnu/awt/xlib/XCanvasPeer.java: Add new peer methods.
* gnu/awt/xlib/XFramePeer.java: Likewise.
* gnu/awt/xlib/XGraphicsConfiguration.java: Likewise.
2005-09-23 Thomas Fitzsimmons <fitzsim@redhat.com>
* Makefile.am (libgcjawt_la_SOURCES): Remove jawt.c. Add
classpath/native/jawt/jawt.c.
* Makefile.in: Regenerate.
* jawt.c: Remove file.
* include/Makefile.am (tool_include__HEADERS): Remove jawt.h and
jawt_md.h. Add ../classpath/include/jawt.h and
../classpath/include/jawt_md.h.
* include/Makefile.in: Regenerate.
* include/jawt.h: Regenerate.
* include/jawt_md.h: Regenerate.
From-SVN: r104586
Diffstat (limited to 'libjava/classpath/java/awt')
36 files changed, 1250 insertions, 919 deletions
diff --git a/libjava/classpath/java/awt/AWTKeyStroke.java b/libjava/classpath/java/awt/AWTKeyStroke.java index c10d53e..0e06225 100644 --- a/libjava/classpath/java/awt/AWTKeyStroke.java +++ b/libjava/classpath/java/awt/AWTKeyStroke.java @@ -412,13 +412,25 @@ public class AWTKeyStroke implements Serializable { token = t.nextToken(); if ("shift".equals(token)) - modifiers |= KeyEvent.SHIFT_DOWN_MASK; + { + modifiers |= KeyEvent.SHIFT_MASK; + modifiers |= KeyEvent.SHIFT_DOWN_MASK; + } else if ("ctrl".equals(token) || "control".equals(token)) - modifiers |= KeyEvent.CTRL_DOWN_MASK; + { + modifiers |= KeyEvent.CTRL_MASK; + modifiers |= KeyEvent.CTRL_DOWN_MASK; + } else if ("meta".equals(token)) - modifiers |= KeyEvent.META_DOWN_MASK; + { + modifiers |= KeyEvent.META_MASK; + modifiers |= KeyEvent.META_DOWN_MASK; + } else if ("alt".equals(token)) - modifiers |= KeyEvent.ALT_DOWN_MASK; + { + modifiers |= KeyEvent.ALT_MASK; + modifiers |= KeyEvent.ALT_DOWN_MASK; + } else if ("button1".equals(token)) modifiers |= KeyEvent.BUTTON1_DOWN_MASK; else if ("button2".equals(token)) diff --git a/libjava/classpath/java/awt/BorderLayout.java b/libjava/classpath/java/awt/BorderLayout.java index c9eb5dd..adf2ebf 100644 --- a/libjava/classpath/java/awt/BorderLayout.java +++ b/libjava/classpath/java/awt/BorderLayout.java @@ -48,34 +48,30 @@ package java.awt; public class BorderLayout implements LayoutManager2, java.io.Serializable { -/* - * Static Variables - */ - -/** - * Constant indicating the top of the container - */ -public static final String NORTH = "North"; + /** + * Constant indicating the top of the container + */ + public static final String NORTH = "North"; -/** - * Constant indicating the bottom of the container - */ -public static final String SOUTH = "South"; + /** + * Constant indicating the bottom of the container + */ + public static final String SOUTH = "South"; -/** - * Constant indicating the right side of the container - */ -public static final String EAST = "East"; + /** + * Constant indicating the right side of the container + */ + public static final String EAST = "East"; -/** - * Constant indicating the left side of the container - */ -public static final String WEST = "West"; + /** + * Constant indicating the left side of the container + */ + public static final String WEST = "West"; -/** - * Constant indicating the center of the container - */ -public static final String CENTER = "Center"; + /** + * Constant indicating the center of the container + */ + public static final String CENTER = "Center"; /** @@ -91,7 +87,6 @@ public static final String CENTER = "Center"; */ public static final String BEFORE_FIRST_LINE = "First"; - /** * The constant indicating the position after the last line of the * layout. The exact position depends on the writing system: For a @@ -105,7 +100,6 @@ public static final String CENTER = "Center"; */ public static final String AFTER_LAST_LINE = "Last"; - /** * The constant indicating the position before the first item of the * layout. The exact position depends on the writing system: For a @@ -119,7 +113,6 @@ public static final String CENTER = "Center"; */ public static final String BEFORE_LINE_BEGINS = "Before"; - /** * The constant indicating the position after the last item of the * layout. The exact position depends on the writing system: For a @@ -133,7 +126,6 @@ public static final String CENTER = "Center"; */ public static final String AFTER_LINE_ENDS = "After"; - /** * The constant indicating the position before the first line of the * layout. The exact position depends on the writing system: For a @@ -144,7 +136,6 @@ public static final String CENTER = "Center"; */ public static final String PAGE_START = BEFORE_FIRST_LINE; - /** * The constant indicating the position after the last line of the * layout. The exact position depends on the writing system: For a @@ -155,7 +146,6 @@ public static final String CENTER = "Center"; */ public static final String PAGE_END = AFTER_LAST_LINE; - /** * The constant indicating the position before the first item of the * layout. The exact position depends on the writing system: For a @@ -166,7 +156,6 @@ public static final String CENTER = "Center"; */ public static final String LINE_START = BEFORE_LINE_BEGINS; - /** * The constant indicating the position after the last item of the * layout. The exact position depends on the writing system: For a @@ -178,398 +167,341 @@ public static final String CENTER = "Center"; public static final String LINE_END = AFTER_LINE_ENDS; + /** + * Serialization constant. + */ + private static final long serialVersionUID = -8658291919501921765L; -// Serialization constant -private static final long serialVersionUID = -8658291919501921765L; - -/*************************************************************************/ - -/* - * Instance Variables - */ - -/** - * @serial - */ -private Component north; - -/** - * @serial - */ -private Component south; - -/** - * @serial - */ -private Component east; - -/** - * @serial - */ -private Component west; - -/** - * @serial - */ -private Component center; - -/** - * @serial - */ -private Component firstLine; - -/** - * @serial - */ -private Component lastLine; - -/** - * @serial - */ -private Component firstItem; - -/** - * @serial - */ -private Component lastItem; - -/** - * @serial The horizontal gap between components - */ -private int hgap; - -/** - * @serial The vertical gap between components - */ -private int vgap; - -/*************************************************************************/ - -/* - * Constructors - */ - -/** - * Initializes a new instance of <code>BorderLayout</code> with no - * horiztonal or vertical gaps between components. - */ -public -BorderLayout() -{ - this(0,0); -} -/*************************************************************************/ + /** + * @serial + */ + private Component north; -/** - * Initializes a new instance of <code>BorderLayout</code> with the - * specified horiztonal and vertical gaps between components. - * - * @param hgap The horizontal gap between components. - * @param vgap The vertical gap between components. - */ -public -BorderLayout(int hgap, int vgap) -{ - this.hgap = hgap; - this.vgap = vgap; -} + /** + * @serial + */ + private Component south; -/*************************************************************************/ + /** + * @serial + */ + private Component east; -/* - * Instance Variables - */ + /** + * @serial + */ + private Component west; -/** - * Returns the horitzontal gap value. - * - * @return The horitzontal gap value. + /** + * @serial */ -public int -getHgap() -{ - return(hgap); -} + private Component center; -/*************************************************************************/ - -/** - * Sets the horizontal gap to the specified value. - * - * @param hgap The new horizontal gap. - */ -public void -setHgap(int hgap) -{ - this.hgap = hgap; -} - -/*************************************************************************/ - -/** - * Returns the vertical gap value. - * - * @return The vertical gap value. - */ -public int -getVgap() -{ - return(vgap); -} + /** + * @serial + */ + private Component firstLine; -/*************************************************************************/ + /** + * @serial + */ + private Component lastLine; -/** - * Sets the vertical gap to the specified value. - * - * @param vgap The new vertical gap value. - */ -public void -setVgap(int vgap) -{ - this.vgap = vgap; -} + /** + * @serial + */ + private Component firstItem; -/*************************************************************************/ + /** + * @serial + */ + private Component lastItem; -/** - * Adds a component to the layout in the specified constraint position, - * which must be one of the string constants defined in this class. - * - * @param component The component to add. - * @param constraints The constraint string. - * - * @exception IllegalArgumentException If the constraint object is not - * a string, or is not one of the specified constants in this class. - */ -public void -addLayoutComponent(Component component, Object constraints) -{ - if (constraints != null && ! (constraints instanceof String)) - throw new IllegalArgumentException("Constraint must be a string"); + /** + * @serial The horizontal gap between components + */ + private int hgap; - addLayoutComponent((String) constraints, component); -} + /** + * @serial The vertical gap between components + */ + private int vgap; -/*************************************************************************/ -/** - * Adds a component to the layout in the specified constraint position, - * which must be one of the string constants defined in this class. - * - * @param constraints The constraint string. - * @param component The component to add. - * - * @exception IllegalArgumentException If the constraint object is not - * one of the specified constants in this class. - * - * @deprecated This method is deprecated in favor of - * <code>addLayoutComponent(Component, Object)</code>. - */ -public void -addLayoutComponent(String constraints, Component component) -{ - String str = constraints; - - if (str == null || str.equals(CENTER)) - center = component; - else if (str.equals(NORTH)) - north = component; - else if (str.equals(SOUTH)) - south = component; - else if (str.equals(EAST)) - east = component; - else if (str.equals(WEST)) - west = component; - else if (str.equals(BEFORE_FIRST_LINE)) - firstLine = component; - else if (str.equals(AFTER_LAST_LINE)) - lastLine = component; - else if (str.equals(BEFORE_LINE_BEGINS)) - firstItem = component; - else if (str.equals(AFTER_LINE_ENDS)) - lastItem = component; - else - throw new IllegalArgumentException("Constraint value not valid: " + str); -} + /** + * Initializes a new instance of <code>BorderLayout</code> with no + * horiztonal or vertical gaps between components. + */ + public BorderLayout() + { + this(0,0); + } -/*************************************************************************/ + /** + * Initializes a new instance of <code>BorderLayout</code> with the + * specified horiztonal and vertical gaps between components. + * + * @param hgap The horizontal gap between components. + * @param vgap The vertical gap between components. + */ + public BorderLayout(int hgap, int vgap) + { + this.hgap = hgap; + this.vgap = vgap; + } -/** - * Removes the specified component from the layout. - * - * @param component The component to remove from the layout. - */ -public void -removeLayoutComponent(Component component) -{ - if (north == component) - north = null; - if (south == component) - south = null; - if (east == component) - east = null; - if (west == component) - west = null; - if (center == component) - center = null; - if (firstItem == component) - firstItem = null; - if (lastItem == component) - lastItem = null; - if (firstLine == component) - firstLine = null; - if (lastLine == component) - lastLine = null; -} + /** + * Returns the horitzontal gap value. + * + * @return The horitzontal gap value. + */ + public int getHgap() + { + return(hgap); + } -/*************************************************************************/ + /** + * Sets the horizontal gap to the specified value. + * + * @param hgap The new horizontal gap. + */ + public void setHgap(int hgap) + { + this.hgap = hgap; + } -/** - * Returns the minimum size of the specified container using this layout. - * - * @param target The container to calculate the minimum size for. - * - * @return The minimum size of the container - */ -public Dimension -minimumLayoutSize(Container target) -{ - return calcSize(target, MIN); -} + /** + * Returns the vertical gap value. + * + * @return The vertical gap value. + */ + public int getVgap() + { + return(vgap); + } -/*************************************************************************/ + /** + * Sets the vertical gap to the specified value. + * + * @param vgap The new vertical gap value. + */ + public void setVgap(int vgap) + { + this.vgap = vgap; + } -/** - * Returns the preferred size of the specified container using this layout. - * - * @param target The container to calculate the preferred size for. - * - * @return The preferred size of the container - */ -public Dimension -preferredLayoutSize(Container target) -{ - return calcSize(target, PREF); -} + /** + * Adds a component to the layout in the specified constraint position, + * which must be one of the string constants defined in this class. + * + * @param component The component to add. + * @param constraints The constraint string. + * + * @exception IllegalArgumentException If the constraint object is not + * a string, or is not one of the specified constants in this class. + */ + public void addLayoutComponent(Component component, Object constraints) + { + if (constraints != null && ! (constraints instanceof String)) + throw new IllegalArgumentException("Constraint must be a string"); -/*************************************************************************/ + addLayoutComponent((String) constraints, component); + } -/** - * Returns the maximum size of the specified container using this layout. - * - * @param target The container to calculate the maximum size for. - * - * @return The maximum size of the container - */ -public Dimension -maximumLayoutSize(Container target) -{ - return calcSize(target, MAX); -} + /** + * Adds a component to the layout in the specified constraint position, + * which must be one of the string constants defined in this class. + * + * @param constraints The constraint string. + * @param component The component to add. + * + * @exception IllegalArgumentException If the constraint object is not + * one of the specified constants in this class. + * + * @deprecated This method is deprecated in favor of + * <code>addLayoutComponent(Component, Object)</code>. + */ + public void addLayoutComponent(String constraints, Component component) + { + String str = constraints; + + if (str == null || str.equals(CENTER)) + center = component; + else if (str.equals(NORTH)) + north = component; + else if (str.equals(SOUTH)) + south = component; + else if (str.equals(EAST)) + east = component; + else if (str.equals(WEST)) + west = component; + else if (str.equals(BEFORE_FIRST_LINE)) + firstLine = component; + else if (str.equals(AFTER_LAST_LINE)) + lastLine = component; + else if (str.equals(BEFORE_LINE_BEGINS)) + firstItem = component; + else if (str.equals(AFTER_LINE_ENDS)) + lastItem = component; + else + throw new IllegalArgumentException("Constraint value not valid: " + str); + } -/*************************************************************************/ + /** + * Removes the specified component from the layout. + * + * @param component The component to remove from the layout. + */ + public void removeLayoutComponent(Component component) + { + if (north == component) + north = null; + if (south == component) + south = null; + if (east == component) + east = null; + if (west == component) + west = null; + if (center == component) + center = null; + if (firstItem == component) + firstItem = null; + if (lastItem == component) + lastItem = null; + if (firstLine == component) + firstLine = null; + if (lastLine == component) + lastLine = null; + } -/** - * Returns the X axis alignment, which is a <code>float</code> indicating - * where along the X axis this container wishs to position its layout. - * 0 indicates align to the left, 1 indicates align to the right, and 0.5 - * indicates align to the center. - * - * @param parent The parent container. - * - * @return The X alignment value. - */ -public float -getLayoutAlignmentX(Container parent) -{ - return(parent.getAlignmentX()); -} + /** + * Returns the minimum size of the specified container using this layout. + * + * @param target The container to calculate the minimum size for. + * + * @return The minimum size of the container + */ + public Dimension minimumLayoutSize(Container target) + { + return calcSize(target, MIN); + } -/*************************************************************************/ + /** + * Returns the preferred size of the specified container using this layout. + * + * @param target The container to calculate the preferred size for. + * + * @return The preferred size of the container + */ + public Dimension preferredLayoutSize(Container target) + { + return calcSize(target, PREF); + } -/** - * Returns the Y axis alignment, which is a <code>float</code> indicating - * where along the Y axis this container wishs to position its layout. - * 0 indicates align to the top, 1 indicates align to the bottom, and 0.5 - * indicates align to the center. - * - * @param parent The parent container. - * - * @return The Y alignment value. - */ -public float -getLayoutAlignmentY(Container parent) -{ - return(parent.getAlignmentY()); -} + /** + * Returns the maximum size of the specified container using this layout. + * + * @param target The container to calculate the maximum size for. + * + * @return The maximum size of the container + */ + public Dimension maximumLayoutSize(Container target) + { + return calcSize(target, MAX); + } -/*************************************************************************/ + /** + * Returns the X axis alignment, which is a <code>float</code> indicating + * where along the X axis this container wishs to position its layout. + * 0 indicates align to the left, 1 indicates align to the right, and 0.5 + * indicates align to the center. + * + * @param parent The parent container. + * + * @return The X alignment value. + */ + public float getLayoutAlignmentX(Container parent) + { + return(parent.getAlignmentX()); + } -/** - * Instructs this object to discard any layout information it might - * have cached. - * - * @param parent The parent container. - */ -public void -invalidateLayout(Container parent) -{ -} + /** + * Returns the Y axis alignment, which is a <code>float</code> indicating + * where along the Y axis this container wishs to position its layout. + * 0 indicates align to the top, 1 indicates align to the bottom, and 0.5 + * indicates align to the center. + * + * @param parent The parent container. + * + * @return The Y alignment value. + */ + public float getLayoutAlignmentY(Container parent) + { + return(parent.getAlignmentY()); + } -/*************************************************************************/ + /** + * Instructs this object to discard any layout information it might + * have cached. + * + * @param parent The parent container. + */ + public void invalidateLayout(Container parent) + { + // FIXME: Implement this properly! + } -/** - * Lays out the specified container according to the constraints - * in this object. - * - * @param target The container to lay out. - */ -public void -layoutContainer(Container target) -{ - synchronized (target.getTreeLock ()) - { - Insets i = target.getInsets(); - - ComponentOrientation orient = target.getComponentOrientation (); - boolean left_to_right = orient.isLeftToRight (); - - Component my_north = north; - Component my_east = east; - Component my_south = south; - Component my_west = west; - - // Note that we currently don't handle vertical layouts. Neither - // does JDK 1.3. - if (firstLine != null) - my_north = firstLine; - if (lastLine != null) - my_south = lastLine; - if (firstItem != null) - { - if (left_to_right) - my_west = firstItem; - else - my_east = firstItem; - } - if (lastItem != null) - { - if (left_to_right) - my_east = lastItem; - else - my_west = lastItem; - } - - Dimension c = calcCompSize(center, PREF); - Dimension n = calcCompSize(my_north, PREF); - Dimension s = calcCompSize(my_south, PREF); - Dimension e = calcCompSize(my_east, PREF); - Dimension w = calcCompSize(my_west, PREF); - Dimension t = target.getSize(); - - /* + /** + * Lays out the specified container according to the constraints + * in this object. + * + * @param target The container to lay out. + */ + public void layoutContainer(Container target) + { + synchronized (target.getTreeLock ()) + { + Insets i = target.getInsets(); + + ComponentOrientation orient = target.getComponentOrientation (); + boolean left_to_right = orient.isLeftToRight (); + + Component my_north = north; + Component my_east = east; + Component my_south = south; + Component my_west = west; + + // Note that we currently don't handle vertical layouts. Neither + // does JDK 1.3. + if (firstLine != null) + my_north = firstLine; + if (lastLine != null) + my_south = lastLine; + if (firstItem != null) + { + if (left_to_right) + my_west = firstItem; + else + my_east = firstItem; + } + if (lastItem != null) + { + if (left_to_right) + my_east = lastItem; + else + my_west = lastItem; + } + + Dimension c = calcCompSize(center, PREF); + Dimension n = calcCompSize(my_north, PREF); + Dimension s = calcCompSize(my_south, PREF); + Dimension e = calcCompSize(my_east, PREF); + Dimension w = calcCompSize(my_west, PREF); + int targetWidth = target.getWidth(); + int targetHeight = target.getHeight(); + + /* <-> hgap <-> hgap +----------------------------+ } |t | } i.top @@ -588,144 +520,144 @@ layoutContainer(Container target) <----------------------> <--> ww <--> i.left i.right - */ - - int x1 = i.left; - int x2 = x1 + w.width + hgap; - int x3; - if (t.width <= i.right + e.width) - x3 = x2 + w.width + hgap; - else - x3 = t.width - i.right - e.width; - int ww = t.width - i.right - i.left; - - int y1 = i.top; - int y2 = y1 + n.height + vgap; - int midh = Math.max(e.height, Math.max(w.height, c.height)); - int y3; - if (t.height <= i.bottom + s.height) - y3 = y2 + midh + vgap; - else - y3 = t.height - i.bottom - s.height; - int hh = y3-y2-vgap; - - setBounds(center, x2, y2, x3-x2-hgap, hh); - setBounds(my_north, x1, y1, ww, n.height); - setBounds(my_south, x1, y3, ww, s.height); - setBounds(my_west, x1, y2, w.width, hh); - setBounds(my_east, x3, y2, e.width, hh); - } -} - -/*************************************************************************/ + */ + + int x1 = i.left; + int x2 = x1 + w.width + (w.width == 0 ? 0 : hgap); + int x3; + if (targetWidth <= i.right + e.width) + x3 = x2 + w.width + (w.width == 0 ? 0 : hgap); + else + x3 = targetWidth - i.right - e.width; + int ww = targetWidth - i.right - i.left; + + int y1 = i.top; + int y2 = y1 + n.height + (n.height == 0 ? 0 : vgap); + int midh = Math.max(e.height, Math.max(w.height, c.height)); + int y3; + if (targetHeight <= i.bottom + s.height) + y3 = y2 + midh + vgap; + else + y3 = targetHeight - i.bottom - s.height; + int hh = y3-y2-(s.height == 0 ? 0 : vgap); + + setBounds(center, x2, y2, x3-x2-(w.width == 0 ? 0 : hgap), hh); + setBounds(my_north, x1, y1, ww, n.height); + setBounds(my_south, x1, y3, ww, s.height); + setBounds(my_west, x1, y2, w.width, hh); + setBounds(my_east, x3, y2, e.width, hh); + } + } -/** - * Returns a string representation of this layout manager. - * - * @return A string representation of this object. - */ -public String -toString() -{ - return getClass().getName() + "[hgap=" + hgap + ",vgap=" + vgap + "]"; -} - -private void -setBounds(Component comp, int x, int y, int w, int h) -{ - if (comp == null) - return; - comp.setBounds(x, y, w, h); -} - -// Some constants for use with calcSize(). -private static final int MIN = 0; -private static final int MAX = 1; -private static final int PREF = 2; + /** + * Returns a string representation of this layout manager. + * + * @return A string representation of this object. + */ + public String toString() + { + return getClass().getName() + "[hgap=" + hgap + ",vgap=" + vgap + "]"; + } -private Dimension -calcCompSize(Component comp, int what) -{ - if (comp == null || !comp.isVisible()) - return new Dimension(0, 0); - if (what == MIN) - return comp.getMinimumSize(); - else if (what == MAX) - return comp.getMaximumSize(); - return comp.getPreferredSize(); -} + /** + * FIXME: Document me! + */ + private void setBounds(Component comp, int x, int y, int w, int h) + { + if (comp == null) + return; + comp.setBounds(x, y, w, h); + } + + // FIXME: Maybe move to top of file. + // Some constants for use with calcSize(). + private static final int MIN = 0; + private static final int MAX = 1; + private static final int PREF = 2; + + private Dimension calcCompSize(Component comp, int what) + { + if (comp == null || !comp.isVisible()) + return new Dimension(0, 0); + if (what == MIN) + return comp.getMinimumSize(); + else if (what == MAX) + return comp.getMaximumSize(); + return comp.getPreferredSize(); + } -// This is a helper function used to compute the various sizes for -// this layout. -private Dimension -calcSize(Container target, int what) -{ - synchronized (target.getTreeLock ()) - { - Insets ins = target.getInsets(); - - ComponentOrientation orient = target.getComponentOrientation (); - boolean left_to_right = orient.isLeftToRight (); - - Component my_north = north; - Component my_east = east; - Component my_south = south; - Component my_west = west; - - // Note that we currently don't handle vertical layouts. Neither - // does JDK 1.3. - if (firstLine != null) - my_north = firstLine; - if (lastLine != null) - my_south = lastLine; - if (firstItem != null) - { - if (left_to_right) - my_west = firstItem; - else - my_east = firstItem; - } - if (lastItem != null) - { - if (left_to_right) - my_east = lastItem; - else - my_west = lastItem; - } - - Dimension ndim = calcCompSize(my_north, what); - Dimension sdim = calcCompSize(my_south, what); - Dimension edim = calcCompSize(my_east, what); - Dimension wdim = calcCompSize(my_west, what); - Dimension cdim = calcCompSize(center, what); - - int width = edim.width + cdim.width + wdim.width + (hgap * 2); - // check for overflow - if (width < edim.width || width < cdim.width || width < cdim.width) + /** + * This is a helper function used to compute the various sizes for + * this layout. + */ + private Dimension calcSize(Container target, int what) + { + synchronized (target.getTreeLock ()) + { + Insets ins = target.getInsets(); + + ComponentOrientation orient = target.getComponentOrientation (); + boolean left_to_right = orient.isLeftToRight (); + + Component my_north = north; + Component my_east = east; + Component my_south = south; + Component my_west = west; + + // Note that we currently don't handle vertical layouts. Neither + // does JDK 1.3. + if (firstLine != null) + my_north = firstLine; + if (lastLine != null) + my_south = lastLine; + if (firstItem != null) + { + if (left_to_right) + my_west = firstItem; + else + my_east = firstItem; + } + if (lastItem != null) + { + if (left_to_right) + my_east = lastItem; + else + my_west = lastItem; + } + + Dimension ndim = calcCompSize(my_north, what); + Dimension sdim = calcCompSize(my_south, what); + Dimension edim = calcCompSize(my_east, what); + Dimension wdim = calcCompSize(my_west, what); + Dimension cdim = calcCompSize(center, what); + + int width = edim.width + cdim.width + wdim.width + (hgap * 2); + // Check for overflow. + if (width < edim.width || width < cdim.width || width < cdim.width) width = Integer.MAX_VALUE; - if (ndim.width > width) - width = ndim.width; - if (sdim.width > width) - width = sdim.width; + if (ndim.width > width) + width = ndim.width; + if (sdim.width > width) + width = sdim.width; - width += (ins.left + ins.right); + width += (ins.left + ins.right); - int height = edim.height; - if (cdim.height > height) - height = cdim.height; - if (wdim.height > height) - height = wdim.height; + int height = edim.height; + if (cdim.height > height) + height = cdim.height; + if (wdim.height > height) + height = wdim.height; - int addedHeight = height + (ndim.height + sdim.height + (vgap * 2) - + ins.top + ins.bottom); - // check for overflow - if (addedHeight < height) + int addedHeight = height + (ndim.height + sdim.height + (vgap * 2) + + ins.top + ins.bottom); + // Check for overflow. + if (addedHeight < height) height = Integer.MAX_VALUE; - else + else height = addedHeight; - return(new Dimension(width, height)); - } + return(new Dimension(width, height)); + } + } } -} // class BorderLayout diff --git a/libjava/classpath/java/awt/Component.java b/libjava/classpath/java/awt/Component.java index 4491904..0ae1ffa 100644 --- a/libjava/classpath/java/awt/Component.java +++ b/libjava/classpath/java/awt/Component.java @@ -897,9 +897,21 @@ public abstract class Component if(!isVisible()) { this.visible = true; - if (peer != null) - peer.setVisible(true); - invalidate(); + // Avoid NullPointerExceptions by creating a local reference. + ComponentPeer currentPeer=peer; + if (currentPeer != null) + currentPeer.setVisible(true); + + // Invalidate the parent if we have one. The component itself must + // not be invalidated. We also avoid NullPointerException with + // a local reference here. + Container currentParent = parent; + if (currentParent != null) + { + currentParent.invalidate(); + currentParent.repaint(); + } + ComponentEvent ce = new ComponentEvent(this,ComponentEvent.COMPONENT_SHOWN); getToolkit().getSystemEventQueue().postEvent(ce); @@ -930,10 +942,23 @@ public abstract class Component { if (isVisible()) { - if (peer != null) - peer.setVisible(false); + // Avoid NullPointerExceptions by creating a local reference. + ComponentPeer currentPeer=peer; + if (currentPeer != null) + currentPeer.setVisible(false); + this.visible = false; - invalidate(); + + // Invalidate the parent if we have one. The component itself must + // not be invalidated. We also avoid NullPointerException with + // a local reference here. + Container currentParent = parent; + if (currentParent != null) + { + currentParent.invalidate(); + currentParent.repaint(); + } + ComponentEvent ce = new ComponentEvent(this,ComponentEvent.COMPONENT_HIDDEN); getToolkit().getSystemEventQueue().postEvent(ce); @@ -963,10 +988,12 @@ public abstract class Component */ public void setForeground(Color c) { - firePropertyChange("foreground", foreground, c); if (peer != null) peer.setForeground(c); + + Color previous = foreground; foreground = c; + firePropertyChange("foreground", previous, c); } /** @@ -992,7 +1019,7 @@ public abstract class Component { if (background != null) return background; - return parent == null ? SystemColor.window : parent.getBackground(); + return parent == null ? null : parent.getBackground(); } /** @@ -1006,16 +1033,18 @@ public abstract class Component public void setBackground(Color c) { // return if the background is already set to that color. - if (background != null && c != null) - if (background.equals(c)) - return; + if ((c != null) && c.equals(background)) + return; + // If c is null, inherit from closest ancestor whose bg is set. if (c == null && parent != null) c = parent.getBackground(); - firePropertyChange("background", background, c); if (peer != null && c != null) peer.setBackground(c); + + Color previous = background; background = c; + firePropertyChange("background", previous, c); } /** @@ -1039,13 +1068,15 @@ public abstract class Component */ public Font getFont() { - if (font != null) - return font; + Font f = font; + if (f != null) + return f; - if (parent != null) - return parent.getFont (); + Component p = parent; + if (p != null) + return p.getFont(); else - return new Font ("Dialog", Font.PLAIN, 12); + return new Font("Dialog", Font.PLAIN, 12); } /** @@ -1058,15 +1089,16 @@ public abstract class Component */ public void setFont(Font newFont) { - if (font == newFont) - return; - - Font oldFont = font; - font = newFont; - if (peer != null) - peer.setFont(font); - firePropertyChange("font", oldFont, newFont); - invalidate(); + if((newFont != null && (font == null || !font.equals(newFont))) + || newFont == null) + { + Font oldFont = font; + font = newFont; + if (peer != null) + peer.setFont(font); + firePropertyChange("font", oldFont, newFont); + invalidate(); + } } /** @@ -1372,9 +1404,6 @@ public abstract class Component // Erase old bounds and repaint new bounds for lightweights. if (isLightweight() && isShowing ()) { - boolean shouldRepaintParent = false; - boolean shouldRepaintSelf = false; - if (parent != null) { Rectangle parentBounds = parent.getBounds(); @@ -1384,14 +1413,11 @@ public abstract class Component Rectangle newBounds = new Rectangle(parent.getX() + x, parent.getY() + y, width, height); - shouldRepaintParent = parentBounds.intersects(oldBounds); - shouldRepaintSelf = parentBounds.intersects(newBounds); + Rectangle destroyed = oldBounds.union(newBounds); + if (!destroyed.isEmpty()) + parent.repaint(0, destroyed.x, destroyed.y, destroyed.width, + destroyed.height); } - - if (shouldRepaintParent && parent != null) - parent.repaint(oldx, oldy, oldwidth, oldheight); - if (shouldRepaintSelf) - repaint(); } // Only post event if this component is visible and has changed size. @@ -1798,9 +1824,8 @@ public abstract class Component */ public void paint(Graphics g) { - // Paint the heavyweight peer - if (!isLightweight() && peer != null) - peer.paint(g); + // This is a callback method and is meant to be overridden by subclasses + // that want to perform custom painting. } /** @@ -1816,10 +1841,20 @@ public abstract class Component * * @see #paint(Graphics) * @see #repaint() + * + * @specnote In contrast to what the spec says, tests show that the exact + * behaviour is to clear the background on lightweight and + * top-level components only. Heavyweight components are not + * affected by this method and only call paint(). */ public void update(Graphics g) { - if (!isLightweight()) + // Tests show that the clearing of the background is only done in + // two cases: + // - If the component is lightweight (yes this is in contrast to the spec). + // or + // - If the component is a toplevel container. + if (isLightweight() || getParent() == null) { Rectangle clip = g.getClipBounds(); if (clip == null) @@ -1827,7 +1862,6 @@ public abstract class Component else g.clearRect(clip.x, clip.y, clip.width, clip.height); } - paint(g); } @@ -1854,7 +1888,14 @@ public abstract class Component */ public void repaint() { - repaint(0, 0, 0, width, height); + if(!isShowing()) + { + Component p = parent; + if (p != null) + p.repaint(0, getX(), getY(), width, height); + } + else + repaint(0, 0, 0, width, height); } /** @@ -1868,7 +1909,14 @@ public abstract class Component */ public void repaint(long tm) { - repaint(tm, 0, 0, width, height); + if(!isShowing()) + { + Component p = parent; + if (p != null) + p.repaint(tm, getX(), getY(), width, height); + } + else + repaint(tm, 0, 0, width, height); } /** @@ -1885,7 +1933,14 @@ public abstract class Component */ public void repaint(int x, int y, int w, int h) { - repaint(0, x, y, w, h); + if(!isShowing()) + { + Component p = parent; + if (p != null) + p.repaint(0, x + getX(), y + getY(), width, height); + } + else + repaint(0, x, y, w, h); } /** @@ -1903,14 +1958,18 @@ public abstract class Component */ public void repaint(long tm, int x, int y, int width, int height) { - // Handle lightweight repainting by forwarding to native parent - if (isLightweight() && parent != null) + if(!isShowing()) { - if (parent != null) - parent.repaint(tm, x + getX(), y + getY(), width, height); + Component p = parent; + if (p != null) + p.repaint(tm, x + getX(), y + getY(), width, height); + } + else + { + ComponentPeer p = peer; + if (p != null) + p.repaint(tm, x, y, width, height); } - else if (peer != null) - peer.repaint(tm, x, y, width, height); } /** @@ -1971,7 +2030,7 @@ public abstract class Component public boolean imageUpdate(Image img, int flags, int x, int y, int w, int h) { if ((flags & (FRAMEBITS | ALLBITS)) != 0) - repaint (); + repaint(); else if ((flags & SOMEBITS) != 0) { if (incrementalDraw) @@ -1981,10 +2040,10 @@ public abstract class Component long tm = redrawRate.longValue(); if (tm < 0) tm = 0; - repaint (tm); + repaint(tm); } else - repaint (100); + repaint(100); } } return (flags & (ALLBITS | ABORT | ERROR)) == 0; @@ -2282,8 +2341,6 @@ public abstract class Component // Some subclasses in the AWT package need to override this behavior, // hence the use of dispatchEventImpl(). dispatchEventImpl(e); - if (peer != null && ! e.consumed) - peer.handleEvent(e); } /** @@ -4183,6 +4240,10 @@ public abstract class Component param.append(",translucent"); if (isDoubleBuffered()) param.append(",doublebuffered"); + if (parent == null) + param.append(",parent==null"); + else + param.append(",parent==").append(parent.getName()); return param.toString(); } @@ -4742,7 +4803,7 @@ p * <li>the set of backward traversal keys * @param e the event to dispatch */ - void dispatchEventImpl (AWTEvent e) + void dispatchEventImpl(AWTEvent e) { Event oldEvent = translateEvent (e); @@ -4776,8 +4837,12 @@ p * <li>the set of backward traversal keys break; } } - processEvent (e); + if (e.id != PaintEvent.PAINT && e.id != PaintEvent.UPDATE) + processEvent(e); } + + if (peer != null) + peer.handleEvent(e); } /** diff --git a/libjava/classpath/java/awt/Container.java b/libjava/classpath/java/awt/Container.java index 303d13b..13d32f8 100644 --- a/libjava/classpath/java/awt/Container.java +++ b/libjava/classpath/java/awt/Container.java @@ -42,6 +42,7 @@ import java.awt.event.ContainerEvent; import java.awt.event.ContainerListener; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; +import java.awt.peer.ComponentPeer; import java.awt.peer.ContainerPeer; import java.awt.peer.LightweightPeer; import java.beans.PropertyChangeListener; @@ -59,7 +60,8 @@ import java.util.Iterator; import java.util.Set; import javax.accessibility.Accessible; -import javax.swing.SwingUtilities; + +import gnu.java.awt.AWTUtilities; /** * A generic window toolkit object that acts as a container for other objects. @@ -338,8 +340,12 @@ public class Container extends Component if (comp.parent != null) comp.parent.remove(comp); comp.parent = this; + if (peer != null) { + // Notify the component that it has a new parent. + comp.addNotify(); + if (comp.isLightweight ()) { enableEvents (comp.eventMask); @@ -348,7 +354,8 @@ public class Container extends Component } } - invalidate(); + // Invalidate the layout of the added component and its ancestors. + comp.invalidate(); if (component == null) component = new Component[4]; // FIXME, better initial size? @@ -394,6 +401,9 @@ public class Container extends Component ContainerEvent.COMPONENT_ADDED, comp); getToolkit().getSystemEventQueue().postEvent(ce); + + // Repaint this container. + repaint(); } } } @@ -429,6 +439,9 @@ public class Container extends Component ContainerEvent.COMPONENT_REMOVED, r); getToolkit().getSystemEventQueue().postEvent(ce); + + // Repaint this container. + repaint(); } } } @@ -513,6 +526,11 @@ public class Container extends Component public void invalidate() { super.invalidate(); + if (layoutMgr != null && layoutMgr instanceof LayoutManager2) + { + LayoutManager2 lm2 = (LayoutManager2) layoutMgr; + lm2.invalidateLayout(this); + } } /** @@ -534,6 +552,7 @@ public class Container extends Component */ void invalidateTree() { + super.invalidate(); // Clean cached layout state. for (int i = 0; i < ncomponents; i++) { Component comp = component[i]; @@ -541,6 +560,12 @@ public class Container extends Component if (comp instanceof Container) ((Container) comp).invalidateTree(); } + + if (layoutMgr != null && layoutMgr instanceof LayoutManager2) + { + LayoutManager2 lm2 = (LayoutManager2) layoutMgr; + lm2.invalidateLayout(this); + } } /** @@ -596,11 +621,15 @@ public class Container extends Component public void setFont(Font f) { - super.setFont(f); - // FIXME: Although it might make more sense to invalidate only - // those children whose font == null, Sun invalidates all children. - // So we'll do the same. - invalidateTree(); + if( (f != null && (font == null || !font.equals(f))) + || f == null) + { + super.setFont(f); + // FIXME: Although it might make more sense to invalidate only + // those children whose font == null, Sun invalidates all children. + // So we'll do the same. + invalidateTree(); + } } /** @@ -622,10 +651,21 @@ public class Container extends Component */ public Dimension preferredSize() { - if (layoutMgr != null) - return layoutMgr.preferredLayoutSize (this); - else - return super.preferredSize (); + synchronized(treeLock) + { + if(valid && prefSize != null) + return new Dimension(prefSize); + LayoutManager layout = getLayout(); + if (layout != null) + { + Dimension layoutSize = layout.preferredLayoutSize(this); + if(valid) + prefSize = layoutSize; + return new Dimension(layoutSize); + } + else + return super.preferredSize (); + } } /** @@ -647,8 +687,15 @@ public class Container extends Component */ public Dimension minimumSize() { - if (layoutMgr != null) - return layoutMgr.minimumLayoutSize (this); + if(valid && minSize != null) + return new Dimension(minSize); + + LayoutManager layout = getLayout(); + if (layout != null) + { + minSize = layout.minimumLayoutSize (this); + return minSize; + } else return super.minimumSize (); } @@ -660,10 +707,15 @@ public class Container extends Component */ public Dimension getMaximumSize() { - if (layoutMgr != null && layoutMgr instanceof LayoutManager2) + if (valid && maxSize != null) + return new Dimension(maxSize); + + LayoutManager layout = getLayout(); + if (layout != null && layout instanceof LayoutManager2) { - LayoutManager2 lm2 = (LayoutManager2) layoutMgr; - return lm2.maximumLayoutSize(this); + LayoutManager2 lm2 = (LayoutManager2) layout; + maxSize = lm2.maximumLayoutSize(this); + return maxSize; } else return super.getMaximumSize(); @@ -678,13 +730,7 @@ public class Container extends Component */ public float getAlignmentX() { - if (layoutMgr instanceof LayoutManager2) - { - LayoutManager2 lm2 = (LayoutManager2) layoutMgr; - return lm2.getLayoutAlignmentX(this); - } - else - return super.getAlignmentX(); + return super.getAlignmentX(); } /** @@ -696,13 +742,7 @@ public class Container extends Component */ public float getAlignmentY() { - if (layoutMgr instanceof LayoutManager2) - { - LayoutManager2 lm2 = (LayoutManager2) layoutMgr; - return lm2.getLayoutAlignmentY(this); - } - else - return super.getAlignmentY(); + return super.getAlignmentY(); } /** @@ -718,8 +758,7 @@ public class Container extends Component { if (!isShowing()) return; - // Paint self first. - super.paint(g); + // Visit heavyweights as well, in case they were // erased when we cleared the background for this container. visitChildren(g, GfxPaintVisitor.INSTANCE, false); @@ -733,10 +772,30 @@ public class Container extends Component * drawn. * * @param g The graphics context for this update. + * + * @specnote The specification suggests that this method forwards the + * update() call to all its lightweight children. Tests show + * that this is not done either in the JDK. The exact behaviour + * seems to be that the background is cleared in heavyweight + * Containers, and all other containers + * directly call paint(), causing the (lightweight) children to + * be painted. */ public void update(Graphics g) { - super.update(g); + // It seems that the JDK clears the background of containers like Panel + // and Window (within this method) but not of 'plain' Containers or + // JComponents. This could + // lead to the assumption that it only clears heavyweight containers. + // However that is not quite true. In a test with a custom Container + // that overrides isLightweight() to return false, the background is + // also not cleared. So we do a check on !(peer instanceof LightweightPeer) + // instead. + ComponentPeer p = peer; + if (p != null && !(p instanceof LightweightPeer)) + g.clearRect(0, 0, getWidth(), getHeight()); + + paint(g); } /** @@ -1198,7 +1257,7 @@ public class Container extends Component } if (focusTraversalKeys == null) - focusTraversalKeys = new Set[3]; + focusTraversalKeys = new Set[4]; keystrokes = Collections.unmodifiableSet (new HashSet (keystrokes)); firePropertyChange (name, focusTraversalKeys[id], keystrokes); @@ -1465,12 +1524,8 @@ public class Container extends Component for (int i = ncomponents - 1; i >= 0; --i) { Component comp = component[i]; - // If we're visiting heavyweights as well, - // don't recurse into Containers here. This avoids - // painting the same nested child multiple times. boolean applicable = comp.isVisible() - && (comp.isLightweight() - || !lightweightOnly && ! (comp instanceof Container)); + && (comp.isLightweight() || !lightweightOnly); if (applicable) visitChild(gfx, visitor, comp); @@ -1525,11 +1580,9 @@ public class Container extends Component void dispatchEventImpl(AWTEvent e) { // Give lightweight dispatcher a chance to handle it. - if (eventTypeEnabled (e.id) - && dispatcher != null - && dispatcher.handleEvent (e)) + if (dispatcher != null && dispatcher.handleEvent (e)) return; - + if ((e.id <= ContainerEvent.CONTAINER_LAST && e.id >= ContainerEvent.CONTAINER_FIRST) && (containerListener != null @@ -1539,6 +1592,26 @@ public class Container extends Component super.dispatchEventImpl(e); } + /** + * Tests if this container has an interest in the given event id. + * + * @param eventId The event id to check. + * + * @return <code>true</code> if a listener for the event id exists or + * if the eventMask is set for the event id. + * + * @see java.awt.Component#eventTypeEnabled(int) + */ + boolean eventTypeEnabled(int eventId) + { + if(eventId <= ContainerEvent.CONTAINER_LAST + && eventId >= ContainerEvent.CONTAINER_FIRST) + return containerListener != null + || (eventMask & AWTEvent.CONTAINER_EVENT_MASK) != 0; + else + return super.eventTypeEnabled(eventId); + } + // This is used to implement Component.transferFocus. Component findNextFocusComponent(Component child) { @@ -1603,12 +1676,11 @@ public class Container extends Component // If we're not lightweight, and we just got a lightweight // child, we need a lightweight dispatcher to feed it events. - if (! this.isLightweight()) - { - if (dispatcher == null) - dispatcher = new LightweightDispatcher (this); - } - + if (!this.isLightweight() && dispatcher == null) + dispatcher = new LightweightDispatcher (this); + + if (dispatcher != null) + dispatcher.enableEvents(component[i].eventMask); enableEvents(component[i].eventMask); if (peer != null && !isLightweight ()) @@ -1862,7 +1934,6 @@ public class Container extends Component * rather than mimic it exactly we write something which does "roughly * the same thing". */ - class LightweightDispatcher implements Serializable { private static final long serialVersionUID = 5184291520170872969L; @@ -1870,10 +1941,8 @@ class LightweightDispatcher implements Serializable private Cursor nativeCursor; private long eventMask; - private transient Component mouseEventTarget; private transient Component pressedComponent; private transient Component lastComponentEntered; - private transient Component tempComponent; private transient int pressCount; LightweightDispatcher(Container c) @@ -1881,11 +1950,17 @@ class LightweightDispatcher implements Serializable nativeContainer = c; } - void acquireComponentForMouseEvent(MouseEvent me) + void enableEvents(long l) + { + eventMask |= l; + } + + Component acquireComponentForMouseEvent(MouseEvent me) { int x = me.getX (); int y = me.getY (); + Component mouseEventTarget = null; // Find the candidate which should receive this event. Component parent = nativeContainer; Component candidate = null; @@ -1893,13 +1968,13 @@ class LightweightDispatcher implements Serializable while (candidate == null && parent != null) { candidate = - SwingUtilities.getDeepestComponentAt(parent, p.x, p.y); + AWTUtilities.getDeepestComponentAt(parent, p.x, p.y); if (candidate == null || (candidate.eventMask & me.getID()) == 0) - { - candidate = null; - p = SwingUtilities.convertPoint(parent, p.x, p.y, parent.parent); - parent = parent.parent; - } + { + candidate = null; + p = AWTUtilities.convertPoint(parent, p.x, p.y, parent.parent); + parent = parent.parent; + } } // If the only candidate we found was the native container itself, @@ -1915,25 +1990,24 @@ class LightweightDispatcher implements Serializable { // Old candidate could have been removed from // the nativeContainer so we check first. - if (SwingUtilities.isDescendingFrom(lastComponentEntered, nativeContainer)) - { - Point tp = - SwingUtilities.convertPoint(nativeContainer, - x, y, lastComponentEntered); - MouseEvent exited = new MouseEvent (lastComponentEntered, - MouseEvent.MOUSE_EXITED, - me.getWhen (), - me.getModifiersEx (), - tp.x, tp.y, - me.getClickCount (), - me.isPopupTrigger (), - me.getButton ()); - tempComponent = lastComponentEntered; - lastComponentEntered = null; - tempComponent.dispatchEvent(exited); - } + if (AWTUtilities.isDescendingFrom(lastComponentEntered, + nativeContainer)) + { + Point tp = AWTUtilities.convertPoint(nativeContainer, + x, y, lastComponentEntered); + MouseEvent exited = new MouseEvent (lastComponentEntered, + MouseEvent.MOUSE_EXITED, + me.getWhen (), + me.getModifiersEx (), + tp.x, tp.y, + me.getClickCount (), + me.isPopupTrigger (), + me.getButton ()); + lastComponentEntered.dispatchEvent (exited); + } lastComponentEntered = null; } + // If we have a candidate, maybe enter it. if (candidate != null) { @@ -1942,10 +2016,10 @@ class LightweightDispatcher implements Serializable && candidate.isShowing() && candidate != nativeContainer && candidate != lastComponentEntered) - { + { lastComponentEntered = mouseEventTarget; - Point cp = SwingUtilities.convertPoint(nativeContainer, - x, y, lastComponentEntered); + Point cp = AWTUtilities.convertPoint(nativeContainer, + x, y, lastComponentEntered); MouseEvent entered = new MouseEvent (lastComponentEntered, MouseEvent.MOUSE_ENTERED, me.getWhen (), @@ -1958,17 +2032,38 @@ class LightweightDispatcher implements Serializable } } + // Check which buttons where pressed except the last button that + // changed state. + int modifiers = me.getModifiersEx() & (MouseEvent.BUTTON1_DOWN_MASK + | MouseEvent.BUTTON2_DOWN_MASK + | MouseEvent.BUTTON3_DOWN_MASK); + switch(me.getButton()) + { + case MouseEvent.BUTTON1: + modifiers &= ~MouseEvent.BUTTON1_DOWN_MASK; + break; + case MouseEvent.BUTTON2: + modifiers &= ~MouseEvent.BUTTON2_DOWN_MASK; + break; + case MouseEvent.BUTTON3: + modifiers &= ~MouseEvent.BUTTON3_DOWN_MASK; + break; + } + if (me.getID() == MouseEvent.MOUSE_RELEASED - || me.getID() == MouseEvent.MOUSE_PRESSED && pressCount > 0 + || me.getID() == MouseEvent.MOUSE_PRESSED && modifiers > 0 || me.getID() == MouseEvent.MOUSE_DRAGGED) - // If any of the following events occur while a button is held down, - // they should be dispatched to the same component to which the - // original MOUSE_PRESSED event was dispatched: - // - MOUSE_RELEASED - // - MOUSE_PRESSED: another button pressed while the first is held down - // - MOUSE_DRAGGED - if (SwingUtilities.isDescendingFrom(pressedComponent, nativeContainer)) - mouseEventTarget = pressedComponent; + { + // If any of the following events occur while a button is held down, + // they should be dispatched to the same component to which the + // original MOUSE_PRESSED event was dispatched: + // - MOUSE_RELEASED + // - MOUSE_PRESSED: another button pressed while the first is held + // down + // - MOUSE_DRAGGED + if (AWTUtilities.isDescendingFrom(pressedComponent, nativeContainer)) + mouseEventTarget = pressedComponent; + } else if (me.getID() == MouseEvent.MOUSE_CLICKED) { // Don't dispatch CLICKED events whose target is not the same as the @@ -1978,6 +2073,7 @@ class LightweightDispatcher implements Serializable else if (pressCount == 0) pressedComponent = null; } + return mouseEventTarget; } boolean handleEvent(AWTEvent e) @@ -1986,41 +2082,42 @@ class LightweightDispatcher implements Serializable { MouseEvent me = (MouseEvent) e; - acquireComponentForMouseEvent(me); - + // Make the LightWeightDispatcher reentrant. This is necessary when + // a lightweight component does its own modal event queue. + Component mouseEventTarget = acquireComponentForMouseEvent(me); + // Avoid dispatching ENTERED and EXITED events twice. if (mouseEventTarget != null && mouseEventTarget.isShowing() && e.getID() != MouseEvent.MOUSE_ENTERED && e.getID() != MouseEvent.MOUSE_EXITED) { - MouseEvent newEvt = - SwingUtilities.convertMouseEvent(nativeContainer, me, - mouseEventTarget); - mouseEventTarget.dispatchEvent(newEvt); - switch (e.getID()) { - case MouseEvent.MOUSE_PRESSED: - if (pressCount++ == 0) - pressedComponent = mouseEventTarget; - break; - - case MouseEvent.MOUSE_RELEASED: - // Clear our memory of the original PRESSED event, only if - // we're not expecting a CLICKED event after this. If - // there is a CLICKED event after this, it will do clean up. - if (--pressCount == 0 - && mouseEventTarget != pressedComponent) - pressedComponent = null; - break; + case MouseEvent.MOUSE_PRESSED: + if (pressCount++ == 0) + pressedComponent = mouseEventTarget; + break; + case MouseEvent.MOUSE_RELEASED: + // Clear our memory of the original PRESSED event, only if + // we're not expecting a CLICKED event after this. If + // there is a CLICKED event after this, it will do clean up. + if (--pressCount == 0 + && mouseEventTarget != pressedComponent) + pressedComponent = null; + break; } - if (newEvt.isConsumed()) - e.consume(); + + MouseEvent newEvt = + AWTUtilities.convertMouseEvent(nativeContainer, me, + mouseEventTarget); + mouseEventTarget.dispatchEvent(newEvt); + + if (newEvt.isConsumed()) + e.consume(); } } - + return e.isConsumed(); } - -} // class LightweightDispatcher +} diff --git a/libjava/classpath/java/awt/EventQueue.java b/libjava/classpath/java/awt/EventQueue.java index a8b0078..15b6e1e 100644 --- a/libjava/classpath/java/awt/EventQueue.java +++ b/libjava/classpath/java/awt/EventQueue.java @@ -38,8 +38,6 @@ exception statement from your version. */ package java.awt; -import gnu.java.awt.ClasspathToolkit; - import java.awt.event.ActionEvent; import java.awt.event.InputEvent; import java.awt.event.InputMethodEvent; @@ -78,10 +76,7 @@ public class EventQueue private EventDispatchThread dispatchThread = new EventDispatchThread(this); private boolean shutdown = false; - private long lastNativeQueueAccess = 0; - private long humanLatencyThreshold = 100; - - synchronized void setShutdown (boolean b) + synchronized private void setShutdown (boolean b) { shutdown = b; } @@ -94,8 +89,8 @@ public class EventQueue // This is the exact self-shutdown condition specified in J2SE: // http://java.sun.com/j2se/1.4.2/docs/api/java/awt/doc-files/AWTThreadIssues.html - if (peekEvent() == null - && ((ClasspathToolkit) Toolkit.getDefaultToolkit()).nativeQueueEmpty()) + // FIXME: check somewhere that the native queue is empty + if (peekEvent() == null) { Frame[] frames = Frame.getFrames(); for (int i = 0; i < frames.length; ++i) @@ -127,50 +122,22 @@ public class EventQueue { if (next != null) return next.getNextEvent(); - - ClasspathToolkit tk = ((ClasspathToolkit) Toolkit.getDefaultToolkit()); - long curr = System.currentTimeMillis(); - - if (! tk.nativeQueueEmpty() && - (curr - lastNativeQueueAccess > humanLatencyThreshold)) - { - tk.iterateNativeQueue(this, false); - lastNativeQueueAccess = curr; - } while (next_in == next_out) { - // Only the EventDispatchThread associated with the top of the stack is - // allowed to get events from the native source; everyone else just - // waits on the head of the queue. - - if (isDispatchThread()) - { - // We are not allowed to return null from this method, yet it - // is possible that we actually have run out of native events - // in the enclosing while() loop, and none of the native events - // happened to cause AWT events. We therefore ought to check - // the isShutdown() condition here, before risking a "native - // wait". If we check it before entering this function we may - // wait forever for events after the shutdown condition has - // arisen. - - if (isShutdown()) - throw new InterruptedException(); - - tk.iterateNativeQueue(this, true); - lastNativeQueueAccess = System.currentTimeMillis(); - } - else - { - try - { - wait(); - } - catch (InterruptedException ie) - { - } - } + // We are not allowed to return null from this method, yet it + // is possible that we actually have run out of native events + // in the enclosing while() loop, and none of the native events + // happened to cause AWT events. We therefore ought to check + // the isShutdown() condition here, before risking a "native + // wait". If we check it before entering this function we may + // wait forever for events after the shutdown condition has + // arisen. + + if (isShutdown()) + throw new InterruptedException(); + + wait(); } AWTEvent res = queue[next_out]; @@ -298,15 +265,6 @@ public class EventQueue dispatchThread.start(); } - // Window events might represent the closing of a window, which - // might cause the end of the dispatch thread's life, so we'll wake - // it up here to give it a chance to check for shutdown. - - if (!isDispatchThread() - || (evt.getID() == WindowEvent.WINDOW_CLOSED) - || (evt.getID() == WindowEvent.WINDOW_CLOSING)) - ((ClasspathToolkit) Toolkit.getDefaultToolkit()).wakeNativeQueue(); - notify(); } @@ -478,7 +436,6 @@ public class EventQueue next_in = 0; next_out = 0; - ((ClasspathToolkit) Toolkit.getDefaultToolkit()).wakeNativeQueue(); setShutdown(true); dispatchThread = null; this.notifyAll(); diff --git a/libjava/classpath/java/awt/FlowLayout.java b/libjava/classpath/java/awt/FlowLayout.java index 4674990..7d0771d 100644 --- a/libjava/classpath/java/awt/FlowLayout.java +++ b/libjava/classpath/java/awt/FlowLayout.java @@ -205,12 +205,12 @@ public class FlowLayout implements LayoutManager, Serializable else if (align == TRAILING) myalign = left_to_right ? RIGHT : LEFT; - if (myalign == LEFT) - x = ins.left + hgap; + if (myalign == RIGHT) + x = ins.left + (d.width - new_w) + hgap; else if (myalign == CENTER) x = ins.left + (d.width - new_w) / 2 + hgap; - else - x = ins.left + (d.width - new_w) + hgap; + else // LEFT and all other values of align. + x = ins.left + hgap; for (int k = i; k < j; ++k) { @@ -269,9 +269,9 @@ public class FlowLayout implements LayoutManager, Serializable */ public void setAlignment (int align) { - if (align != LEFT && align != RIGHT && align != CENTER - && align != LEADING && align != TRAILING) - throw new IllegalArgumentException ("invalid alignment: " + align); + // The JDK accepts invalid values and treats them as + // LEFT during layout, so do we. The invalid value is even stored, + // getAlignment() returns the same invalid value. this.align = align; } diff --git a/libjava/classpath/java/awt/Font.java b/libjava/classpath/java/awt/Font.java index 30961ab..5de9458 100644 --- a/libjava/classpath/java/awt/Font.java +++ b/libjava/classpath/java/awt/Font.java @@ -353,9 +353,11 @@ private static final long serialVersionUID = -4206021311591459213L; this(null, attrs); } - /* This extra constructor is here to permit ClasspathToolkit and to build - a font with a "logical name" as well as attrs. */ - public Font (String name, Map attrs) + /* This extra constructor is here to permit ClasspathToolkit and to + build a font with a "logical name" as well as attrs. + ClasspathToolkit.getFont(String,Map) uses reflection to call this + package-private constructor. */ + Font (String name, Map attrs) { // If attrs is null, setting it to an empty HashMap will give this // Font default attributes. diff --git a/libjava/classpath/java/awt/FontMetrics.java b/libjava/classpath/java/awt/FontMetrics.java index e702a62..6dd73ec 100644 --- a/libjava/classpath/java/awt/FontMetrics.java +++ b/libjava/classpath/java/awt/FontMetrics.java @@ -193,7 +193,8 @@ public abstract class FontMetrics implements java.io.Serializable */ public int charWidth(int ch) { - return charWidth((char) ch); + char[] chars = Character.toChars(ch); + return charsWidth(chars, 0, chars.length); } /** @@ -235,7 +236,8 @@ public abstract class FontMetrics implements java.io.Serializable public int charsWidth(char[] buf, int offset, int len) { int total_width = 0; - for (int i = offset; i < len; i++) + int endOffset = offset + len; + for (int i = offset; i < endOffset; i++) total_width += charWidth(buf[i]); return total_width; } diff --git a/libjava/classpath/java/awt/Frame.java b/libjava/classpath/java/awt/Frame.java index 0cb97f8..05c9384 100644 --- a/libjava/classpath/java/awt/Frame.java +++ b/libjava/classpath/java/awt/Frame.java @@ -401,20 +401,6 @@ remove(MenuComponent menu) menuBar.remove(menu); } -/** - * Notifies this frame that it should create its native peer. - */ -private static void fireDummyEvent() -{ - EventQueue.invokeLater(new Runnable() - { - public void run() - { - // Do nothing here. - } - }); -} - public void addNotify() { @@ -423,11 +409,6 @@ addNotify() if (peer == null) peer = getToolkit ().createFrame (this); - // We now know there's a Frame (us) with a live peer, so we can start the - // fundamental queue and dispatch thread, by inserting a dummy event. - if (parent != null && parent.isDisplayable()) - fireDummyEvent(); - super.addNotify(); } @@ -436,12 +417,6 @@ public void removeNotify() if (menuBar != null) menuBar.removeNotify(); super.removeNotify(); - - // By now we've been disconnected from the peer, and the peer set to - // null. This is formally the same as saying "we just became - // un-displayable", so we wake up the event queue with a dummy event to - // see if it's time to shut down. - fireDummyEvent(); } /** diff --git a/libjava/classpath/java/awt/GraphicsConfiguration.java b/libjava/classpath/java/awt/GraphicsConfiguration.java index 6dc27793..069d741 100644 --- a/libjava/classpath/java/awt/GraphicsConfiguration.java +++ b/libjava/classpath/java/awt/GraphicsConfiguration.java @@ -126,6 +126,22 @@ public abstract class GraphicsConfiguration } /** + * Returns a buffered volatile image optimized to this device, and + * with the given transparency. Because the buffer is volatile, it + * can be optimized by native graphics accelerators. + * + * @param w the width of the buffer + * @param h the height of the buffer + * @param transparency the transparency value for the buffer + * @return the buffered image, or null if none is supported + * @throws AWTException if the capabilities cannot be met + * @since 1.5 + */ + public abstract VolatileImage createCompatibleVolatileImage(int width, + int height, + int transparency); + + /** * Returns a buffered image optimized to this device, and with the specified * transparency, so that blitting can be supported in the buffered image. * diff --git a/libjava/classpath/java/awt/GridBagLayout.java b/libjava/classpath/java/awt/GridBagLayout.java index 767610c..7f9ab24 100644 --- a/libjava/classpath/java/awt/GridBagLayout.java +++ b/libjava/classpath/java/awt/GridBagLayout.java @@ -192,16 +192,12 @@ public class GridBagLayout if (clone.gridwidth == 0) clone.gridwidth = GridBagConstraints.REMAINDER; - else if (clone.gridwidth < 0 - && clone.gridwidth != GridBagConstraints.REMAINDER - && clone.gridwidth != GridBagConstraints.RELATIVE) + else if (clone.gridwidth < 0) clone.gridwidth = 1; if (clone.gridheight == 0) clone.gridheight = GridBagConstraints.REMAINDER; - else if (clone.gridheight < 0 - && clone.gridheight != GridBagConstraints.REMAINDER - && clone.gridheight != GridBagConstraints.RELATIVE) + else if (clone.gridheight < 0) clone.gridheight = 1; comptable.put (component, clone); @@ -913,7 +909,7 @@ public class GridBagLayout sizes[start] = Math.max(sizes[start], size); weights[start] = Math.max(weights[start], weight); } - else + else if (span > 1) { int numOccupied = span; int lastOccupied = -1; diff --git a/libjava/classpath/java/awt/Label.java b/libjava/classpath/java/awt/Label.java index 8867fa1..d6db329 100644 --- a/libjava/classpath/java/awt/Label.java +++ b/libjava/classpath/java/awt/Label.java @@ -215,12 +215,17 @@ getText() public synchronized void setText(String text) { - this.text = text; - - if (peer != null) + if ((this.text == null && text != null) + || (this.text != null && ! this.text.equals(text))) { - LabelPeer lp = (LabelPeer) peer; - lp.setText (text); + this.text = text; + + if (peer != null) + { + LabelPeer lp = (LabelPeer) peer; + lp.setText (text); + } + invalidate(); } } diff --git a/libjava/classpath/java/awt/List.java b/libjava/classpath/java/awt/List.java index 5fcc79b..ab7d359 100644 --- a/libjava/classpath/java/awt/List.java +++ b/libjava/classpath/java/awt/List.java @@ -163,6 +163,7 @@ List(int rows, boolean multipleMode) { this.rows = rows; this.multipleMode = multipleMode; + selected = new int[0]; if (GraphicsEnvironment.isHeadless()) throw new HeadlessException (); diff --git a/libjava/classpath/java/awt/MenuItem.java b/libjava/classpath/java/awt/MenuItem.java index 66798c8..58dcb67 100644 --- a/libjava/classpath/java/awt/MenuItem.java +++ b/libjava/classpath/java/awt/MenuItem.java @@ -179,14 +179,11 @@ private transient ActionListener action_listeners; */ public boolean setCurrentAccessibleValue(Number number) { - if (number.intValue() == 0) - { - setEnabled(false); - return false; - } - - setEnabled(true); - return true; + boolean result = (number.intValue() != 0); + // this. is required by javac 1.3, otherwise it is confused with + // MenuItem.this.setEnabled. + this.setEnabled(result); + return result; } /* (non-Javadoc) diff --git a/libjava/classpath/java/awt/TextComponent.java b/libjava/classpath/java/awt/TextComponent.java index 9edbd88..60e72fc 100644 --- a/libjava/classpath/java/awt/TextComponent.java +++ b/libjava/classpath/java/awt/TextComponent.java @@ -475,7 +475,7 @@ select(int selectionStart, int selectionEnd) if (selectionEnd > text.length()) selectionEnd = text.length(); - if (selectionStart > getSelectionEnd()) + if (selectionStart > selectionEnd) selectionStart = selectionEnd; this.selectionStart = selectionStart; diff --git a/libjava/classpath/java/awt/Toolkit.java b/libjava/classpath/java/awt/Toolkit.java index c7c6f9f..2ca88b6 100644 --- a/libjava/classpath/java/awt/Toolkit.java +++ b/libjava/classpath/java/awt/Toolkit.java @@ -790,6 +790,9 @@ public abstract class Toolkit { // Presumably the only reason this isn't abstract is for backwards // compatibility? FIXME? + if (GraphicsEnvironment.isHeadless()) + throw new HeadlessException("No custom cursor in an headless graphics " + + "environment."); return null; } @@ -801,6 +804,9 @@ public abstract class Toolkit */ public Dimension getBestCursorSize(int preferredWidth, int preferredHeight) { + if (GraphicsEnvironment.isHeadless()) + throw new HeadlessException("No best cursor size in an headless " + + "graphics environment."); return new Dimension (0,0); } diff --git a/libjava/classpath/java/awt/Window.java b/libjava/classpath/java/awt/Window.java index e26c4e3..1689d03 100644 --- a/libjava/classpath/java/awt/Window.java +++ b/libjava/classpath/java/awt/Window.java @@ -155,6 +155,9 @@ public class Window extends Container implements Accessible } } }); + + GraphicsEnvironment g = GraphicsEnvironment.getLocalGraphicsEnvironment(); + graphicsConfiguration = g.getDefaultScreenDevice().getDefaultConfiguration(); } Window(GraphicsConfiguration gc) @@ -619,6 +622,8 @@ public class Window extends Container implements Accessible || windowStateListener != null || (eventMask & AWTEvent.WINDOW_EVENT_MASK) != 0)) processEvent(e); + else if (e.id == ComponentEvent.COMPONENT_RESIZED) + validate (); else super.dispatchEventImpl(e); } @@ -741,7 +746,25 @@ public class Window extends Container implements Accessible if (activeWindow == this) return manager.getFocusOwner (); else - return windowFocusOwner; + return null; + } + + /** + * Returns the child component of this window that would receive + * focus if this window were to become focused. If the window + * already has the top-level focus, then this method returns the + * same component as getFocusOwner. If no child component has + * requested focus within the window, then the initial focus owner + * is returned. If this is a non-focusable window, this method + * returns null. + * + * @return the child component of this window that most recently had + * the focus, or <code>null</code> + * @since 1.4 + */ + public Component getMostRecentFocusOwner () + { + return windowFocusOwner; } /** @@ -1070,44 +1093,6 @@ public class Window extends Container implements Accessible this.focusableWindowState = focusableWindowState; } - // setBoundsCallback is needed so that when a user moves a window, - // the Window's location can be updated without calling the peer's - // setBounds method. When a user moves a window the peer window's - // location is updated automatically and the windowing system sends - // a message back to the application informing it of its updated - // dimensions. We must update the AWT Window class with these new - // dimensions. But we don't want to call the peer's setBounds - // method, because the peer's dimensions have already been updated. - // (Under X, having this method prevents Configure event loops when - // moving windows: Component.setBounds -> peer.setBounds -> - // postConfigureEvent -> Component.setBounds -> ... In some cases - // Configure event loops cause windows to jitter back and forth - // continuously). - void setBoundsCallback (int x, int y, int w, int h) - { - if (this.x == x && this.y == y && width == w && height == h) - return; - invalidate(); - boolean resized = width != w || height != h; - boolean moved = this.x != x || this.y != y; - this.x = x; - this.y = y; - width = w; - height = h; - if (resized && isShowing ()) - { - ComponentEvent ce = - new ComponentEvent(this, ComponentEvent.COMPONENT_RESIZED); - getToolkit().getSystemEventQueue().postEvent(ce); - } - if (moved && isShowing ()) - { - ComponentEvent ce = - new ComponentEvent(this, ComponentEvent.COMPONENT_MOVED); - getToolkit().getSystemEventQueue().postEvent(ce); - } - } - /** * Generate a unique name for this window. * diff --git a/libjava/classpath/java/awt/datatransfer/Clipboard.java b/libjava/classpath/java/awt/datatransfer/Clipboard.java index 9953a72..5fa1d1a 100644 --- a/libjava/classpath/java/awt/datatransfer/Clipboard.java +++ b/libjava/classpath/java/awt/datatransfer/Clipboard.java @@ -1,5 +1,5 @@ /* Clipboard.java -- Class for transferring data via cut and paste. - Copyright (C) 1999, 2001 Free Software Foundation, Inc. + Copyright (C) 1999, 2001, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -38,16 +38,21 @@ exception statement from your version. */ package java.awt.datatransfer; +import java.io.IOException; +import java.util.ArrayList; + /** * This class allows data to be transferred using a cut and paste type * mechanism. * * @author Aaron M. Renn (arenn@urbanophile.com) + * @author Mark J. Wielaard (mark@klomp.org) */ public class Clipboard { /** - * The data being transferred. + * The data currently on this clipboard. For use by + * subclasses. Also returned by the public method getContents(). */ protected Transferable contents; @@ -57,7 +62,10 @@ public class Clipboard protected ClipboardOwner owner; // The clipboard name - private String name; + private final String name; + + // The flavor listeners (most likely small). + private final ArrayList listeners = new ArrayList(3); /** * Initializes a new instance of <code>Clipboard</code> with the @@ -81,7 +89,8 @@ public class Clipboard /** * Returns the contents of the clipboard. * - * @param requestor The object requesting the contents. + * @param requestor The object requesting the contents. This + * implementation ignores this parameter. * * @exception IllegalStateException If the clipboard is currently unavailable */ @@ -91,24 +100,108 @@ public class Clipboard } /** - * Sets the content and owner of this clipboard. - * If the given owner is different from the current owner - * then lostOwnership is called on the current owner. - * XXX - is this called with the old or new contents. + * Sets the content and owner of this clipboard. If the given owner + * is different from the current owner then <code>lostOwnership()</code> + * is called on the current owner with the old contents of the given + * clipboard. * * @param contents The new clipboard contents. * @param owner The new clipboard owner * * @exception IllegalStateException If the clipboard is currently unavailable */ - public synchronized void setContents(Transferable contents, ClipboardOwner owner) + public synchronized void setContents(Transferable contents, + ClipboardOwner owner) { - if (this.owner != owner) - if (this.owner != null) - this.owner.lostOwnership(this, contents); - - this.owner = owner; + Transferable oldContents = getContents(null); this.contents = contents; + if (this.owner != owner) + { + ClipboardOwner oldOwner = this.owner; + this.owner = owner; + if (oldOwner != null) + oldOwner.lostOwnership(this, oldContents); + } + + FlavorListener[] fs = getFlavorListeners(); + if (fs.length > 0) + { + // We are a bit optimistic here. We assume DataFlavors will be + // given in the same order. If the number of flavors is + // different or the order of the DataFlavors in the list then + // fire a change event. + boolean newFlavors = ((contents != null && oldContents == null) + || (contents == null && oldContents != null)); + if (!newFlavors && contents != null && oldContents != null) + { + DataFlavor[] df1 = contents.getTransferDataFlavors(); + DataFlavor[] df2 = oldContents.getTransferDataFlavors(); + newFlavors = df1.length != df2.length; + + for (int i = 0; !newFlavors && i < df1.length; i++) + newFlavors = !df1[i].equals(df2[i]); + } + + if (newFlavors) + { + FlavorEvent e = new FlavorEvent(this); + for (int i = 0; i < fs.length; i++) + fs[i].flavorsChanged(e); + } + } + } + + public DataFlavor[] getAvailableDataFlavors() + { + Transferable c = getContents(null); + if (c == null) + return new DataFlavor[0]; + else + return c.getTransferDataFlavors(); + } + + public boolean isDataFlavorAvailable(DataFlavor flavor) + { + DataFlavor[] fs = getAvailableDataFlavors(); + for (int i = 0; i < fs.length; i++) + if (flavor.equals(fs[i])) + return true; + + return false; } -} + public Object getData(DataFlavor flavor) + throws UnsupportedFlavorException, IOException + { + Transferable c = getContents(null); + if (c == null) + throw new UnsupportedFlavorException(flavor); + else + return c.getTransferData(flavor); + } + + public void addFlavorListener(FlavorListener listener) + { + synchronized(listeners) + { + listeners.add(listener); + } + } + + public void removeFlavorListener(FlavorListener listener) + { + synchronized(listeners) + { + listeners.remove(listener); + } + } + + public FlavorListener[] getFlavorListeners() + { + synchronized(listeners) + { + return (FlavorListener[]) + listeners.toArray(new FlavorListener[listeners.size()]); + } + } +} diff --git a/libjava/classpath/java/awt/datatransfer/DataFlavor.java b/libjava/classpath/java/awt/datatransfer/DataFlavor.java index e5fbd24..38f415b 100644 --- a/libjava/classpath/java/awt/datatransfer/DataFlavor.java +++ b/libjava/classpath/java/awt/datatransfer/DataFlavor.java @@ -49,6 +49,7 @@ import java.io.StringReader; import java.io.UnsupportedEncodingException; import java.nio.ByteBuffer; import java.nio.CharBuffer; +import java.rmi.Remote; /** * This class represents a particular data format used for transferring @@ -127,10 +128,9 @@ static javaFileListFlavor = new DataFlavor(java.util.List.class, + "application/x-java-file-list; class=java.util.List", "Java File List"); - // javaFileListFlavor.mimeType = "application/x-java-file-list"; - imageFlavor = new DataFlavor(java.awt.Image.class, "Java Image"); @@ -335,7 +335,8 @@ getRepresentationClassFromMime(String mimeString, ClassLoader classLoader) public DataFlavor(String mimeType, String humanPresentableName) { - this (getRepresentationClassFromMime (mimeType, null), humanPresentableName); + this (getRepresentationClassFromMime (mimeType, null), + mimeType, humanPresentableName); } /*************************************************************************/ @@ -426,17 +427,15 @@ getPrimaryType() public String getSubType() { - int idx = mimeType.indexOf("/"); - if (idx == -1) - return(""); - - String subtype = mimeType.substring(idx + 1); + int start = mimeType.indexOf("/"); + if (start == -1) + return ""; - idx = subtype.indexOf(" "); - if (idx == -1) - return(subtype); + int end = mimeType.indexOf(";", start + 1); + if (end == -1) + return mimeType.substring(start + 1); else - return(subtype.substring(0, idx)); + return mimeType.substring(start + 1, end); } /*************************************************************************/ @@ -480,6 +479,9 @@ getParameter(String paramName, String mimeString) public String getParameter(String paramName) { + if ("humanPresentableName".equals(paramName)) + return getHumanPresentableName(); + return getParameter(paramName, mimeType); } @@ -500,21 +502,28 @@ setHumanPresentableName(String humanPresentableName) /** * Tests the MIME type of this object for equality against the specified - * MIME type. + * MIME type. Ignores parameters. * * @param mimeType The MIME type to test against. * * @return <code>true</code> if the MIME type is equal to this object's - * MIME type, <code>false</code> otherwise. + * MIME type (ignoring parameters), <code>false</code> otherwise. * * @exception NullPointerException If mimeType is null. */ public boolean isMimeTypeEqual(String mimeType) { - // FIXME: Need to handle default attributes and parameters + String mime = getMimeType(); + int i = mime.indexOf(";"); + if (i != -1) + mime = mime.substring(0, i); + + i = mimeType.indexOf(";"); + if (i != -1) + mimeType = mimeType.substring(0, i); - return(this.mimeType.equals(mimeType)); + return mime.equals(mimeType); } /*************************************************************************/ @@ -599,8 +608,7 @@ isRepresentationClassSerializable() public boolean isRepresentationClassRemote() { - // FIXME: Implement - throw new RuntimeException("Not implemented"); + return Remote.class.isAssignableFrom (representationClass); } /*************************************************************************/ @@ -852,12 +860,11 @@ readExternal(ObjectInput stream) throws IOException, ClassNotFoundException public String toString() { - return("DataFlavor[representationClass=" - + representationClass.getName() - + ",mimeType=" - + mimeType - + "humanPresentableName=" - + humanPresentableName); + return(getClass().getName() + + "[representationClass=" + getRepresentationClass().getName() + + ",mimeType=" + getMimeType() + + ",humanPresentableName=" + getHumanPresentableName() + + "]"); } /*************************************************************************/ diff --git a/libjava/classpath/java/awt/event/MouseWheelEvent.java b/libjava/classpath/java/awt/event/MouseWheelEvent.java index bc603aa..d1d22d2 100644 --- a/libjava/classpath/java/awt/event/MouseWheelEvent.java +++ b/libjava/classpath/java/awt/event/MouseWheelEvent.java @@ -49,7 +49,7 @@ import javax.swing.Scrollable; /** * This event is generated for a mouse wheel rotation. The wheel (the middle * mouse button on most modern mice) can be rotated towards or away from the - * user, and is ofteh used for scrolling. + * user, and is often used for scrolling. * * <p>Because of the special use for scrolling components, MouseWheelEvents * often affect a different component than the one located at the point of diff --git a/libjava/classpath/java/awt/image/AreaAveragingScaleFilter.java b/libjava/classpath/java/awt/image/AreaAveragingScaleFilter.java index b9ca1b7..194d483 100644 --- a/libjava/classpath/java/awt/image/AreaAveragingScaleFilter.java +++ b/libjava/classpath/java/awt/image/AreaAveragingScaleFilter.java @@ -80,6 +80,7 @@ public class AreaAveragingScaleFilter extends ReplicateScaleFilter */ public void setHints(int flags) { + if (consumer != null) consumer.setHints(flags); } @@ -100,6 +101,7 @@ public class AreaAveragingScaleFilter extends ReplicateScaleFilter public void setPixels(int x, int y, int w, int h, ColorModel model, byte[] pixels, int offset, int scansize) { + if (consumer != null) consumer.setPixels(x, y, w, h, model, pixels, offset, scansize); } @@ -120,6 +122,7 @@ public class AreaAveragingScaleFilter extends ReplicateScaleFilter public void setPixels(int x, int y, int w, int h, ColorModel model, int[] pixels, int offset, int scansize) { + if (consumer != null) consumer.setPixels(x, y, w, h, model, pixels, offset, scansize); } diff --git a/libjava/classpath/java/awt/image/ConvolveOp.java b/libjava/classpath/java/awt/image/ConvolveOp.java index f841c13..49ca2a6 100644 --- a/libjava/classpath/java/awt/image/ConvolveOp.java +++ b/libjava/classpath/java/awt/image/ConvolveOp.java @@ -1,5 +1,5 @@ /* ConvolveOp.java -- - Copyright (C) 2004 Free Software Foundation -- ConvolveOp + Copyright (C) 2004, 2005 Free Software Foundation -- ConvolveOp This file is part of GNU Classpath. @@ -177,11 +177,13 @@ public class ConvolveOp implements BufferedImageOp, RasterOp } /** + * Returns (a clone of) the convolution kernel. + * * @return The convolution kernel. */ public Kernel getKernel() { - return kernel; + return (Kernel) kernel.clone(); } /* (non-Javadoc) @@ -189,8 +191,6 @@ public class ConvolveOp implements BufferedImageOp, RasterOp * java.awt.image.WritableRaster) */ public WritableRaster filter(Raster src, WritableRaster dest) { - if (src.numBands != dest.numBands) - throw new ImagingOpException(null); if (src == dest) throw new IllegalArgumentException(); if (src.getWidth() < kernel.getWidth() || @@ -199,6 +199,8 @@ public class ConvolveOp implements BufferedImageOp, RasterOp if (dest == null) dest = createCompatibleDestRaster(src); + else if (src.numBands != dest.numBands) + throw new ImagingOpException(null); // Deal with bottom edge if (edge == EDGE_ZERO_FILL) diff --git a/libjava/classpath/java/awt/image/CropImageFilter.java b/libjava/classpath/java/awt/image/CropImageFilter.java index 490f43c..4fcfdec 100644 --- a/libjava/classpath/java/awt/image/CropImageFilter.java +++ b/libjava/classpath/java/awt/image/CropImageFilter.java @@ -79,6 +79,7 @@ public class CropImageFilter extends ImageFilter */ public void setDimensions(int width, int height) { + if (consumer != null) consumer.setDimensions(this.width, this.height); } @@ -93,7 +94,8 @@ public class CropImageFilter extends ImageFilter public void setProperties(Hashtable props) { props.put("filters", "CropImageFilter"); - consumer.setProperties(props); + if (consumer != null) + consumer.setProperties(props); } /** @@ -130,9 +132,10 @@ public class CropImageFilter extends ImageFilter cropped[i * bounds.width + j] = pixels[start + bounds.x + j]; } - consumer.setPixels(bounds.x, bounds.y, - bounds.width, bounds.height, - model, cropped, 0, bounds.width); + if (consumer != null) + consumer.setPixels(0, 0, + bounds.width, bounds.height, + model, cropped, 0, bounds.width); } } @@ -170,9 +173,10 @@ public class CropImageFilter extends ImageFilter cropped[i * bounds.width + j] = pixels[start + bounds.x + j]; } - consumer.setPixels(bounds.x, bounds.y, - bounds.width, bounds.height, - model, cropped, 0, bounds.width); + if (consumer != null) + consumer.setPixels(0, 0, + bounds.width, bounds.height, + model, cropped, 0, bounds.width); } } diff --git a/libjava/classpath/java/awt/image/DirectColorModel.java b/libjava/classpath/java/awt/image/DirectColorModel.java index c98c3f8..4f37151 100644 --- a/libjava/classpath/java/awt/image/DirectColorModel.java +++ b/libjava/classpath/java/awt/image/DirectColorModel.java @@ -348,9 +348,24 @@ public class DirectColorModel extends PackedColorModel { return getComponents(getPixelFromArray(pixel), components, offset); } - + + /** + * Creates a <code>WriteableRaster</code> that has a <code>SampleModel</code> + * that is compatible with this <code>ColorModel</code>. + * + * @param w the width of the writeable raster to create + * @param h the height of the writeable raster to create + * + * @throws IllegalArgumentException if <code>w</code> or <code>h</code> + * is less than or equal to zero + */ public final WritableRaster createCompatibleWritableRaster(int w, int h) { + // Sun also makes this check here. + if(w <= 0 || h <= 0) + throw new IllegalArgumentException("width (=" + w + ") and height (=" + + h + ") must be > 0"); + SampleModel sm = createCompatibleSampleModel(w, h); Point origin = new Point(0, 0); return Raster.createWritableRaster(sm, origin); @@ -418,3 +433,4 @@ public class DirectColorModel extends PackedColorModel return super.toString(); } } + diff --git a/libjava/classpath/java/awt/image/ImageFilter.java b/libjava/classpath/java/awt/image/ImageFilter.java index 9940a2b..c39c4a4 100644 --- a/libjava/classpath/java/awt/image/ImageFilter.java +++ b/libjava/classpath/java/awt/image/ImageFilter.java @@ -125,6 +125,7 @@ public class ImageFilter implements ImageConsumer, Cloneable */ public void setDimensions(int width, int height) { + if (consumer != null) consumer.setDimensions(width, height); } @@ -137,7 +138,8 @@ public class ImageFilter implements ImageConsumer, Cloneable public void setProperties(Hashtable props) { props.put("filters", "ImageFilter"); - consumer.setProperties(props); + if (consumer != null) + consumer.setProperties(props); } /** @@ -149,6 +151,7 @@ public class ImageFilter implements ImageConsumer, Cloneable * @see ColorModel */ public void setColorModel(ColorModel model) { + if (consumer != null) consumer.setColorModel(model); } @@ -164,6 +167,7 @@ public class ImageFilter implements ImageConsumer, Cloneable */ public void setHints(int flags) { + if (consumer != null) consumer.setHints(flags); } @@ -184,6 +188,7 @@ public class ImageFilter implements ImageConsumer, Cloneable public void setPixels(int x, int y, int w, int h, ColorModel model, byte[] pixels, int offset, int scansize) { + if (consumer != null) consumer.setPixels(x, y, w, h, model, pixels, offset, scansize); } @@ -204,6 +209,7 @@ public class ImageFilter implements ImageConsumer, Cloneable public void setPixels(int x, int y, int w, int h, ColorModel model, int[] pixels, int offset, int scansize) { + if (consumer != null) consumer.setPixels(x, y, w, h, model, pixels, offset, scansize); } @@ -215,6 +221,7 @@ public class ImageFilter implements ImageConsumer, Cloneable */ public void imageComplete(int status) { + if (consumer != null) consumer.imageComplete(status); } } diff --git a/libjava/classpath/java/awt/image/PixelGrabber.java b/libjava/classpath/java/awt/image/PixelGrabber.java index b576dbf..b8ca70c 100644 --- a/libjava/classpath/java/awt/image/PixelGrabber.java +++ b/libjava/classpath/java/awt/image/PixelGrabber.java @@ -131,6 +131,9 @@ public class PixelGrabber implements ImageConsumer public PixelGrabber(ImageProducer ip, int x, int y, int w, int h, int pix[], int off, int scansize) { + if (ip == null) + throw new NullPointerException("The ImageProducer must not be null."); + this.ip = ip; this.x = x; this.y = y; @@ -179,6 +182,10 @@ public class PixelGrabber implements ImageConsumer boolean forceRGB) { this.ip = img.getSource(); + + if (this.ip == null) + throw new NullPointerException("The ImageProducer must not be null."); + this.x = x; this.y = y; width = w; @@ -209,7 +216,15 @@ public class PixelGrabber implements ImageConsumer { public void run () { - ip.startProduction (PixelGrabber.this); + try + { + ip.startProduction (PixelGrabber.this); + } + catch (Exception ex) + { + ex.printStackTrace(); + imageComplete(ImageConsumer.IMAGEABORTED); + } } }; grabberThread.start (); @@ -601,7 +616,8 @@ public class PixelGrabber implements ImageConsumer consumerStatus = status; setObserverStatus (); grabbing = false; - ip.removeConsumer (this); + if (ip != null) + ip.removeConsumer (this); notifyAll (); } diff --git a/libjava/classpath/java/awt/image/RGBImageFilter.java b/libjava/classpath/java/awt/image/RGBImageFilter.java index f7b39b9..ecfed06 100644 --- a/libjava/classpath/java/awt/image/RGBImageFilter.java +++ b/libjava/classpath/java/awt/image/RGBImageFilter.java @@ -79,10 +79,12 @@ public abstract class RGBImageFilter extends ImageFilter if( ( model instanceof IndexColorModel) && canFilterIndexColorModel ) { newmodel = filterIndexColorModel( (IndexColorModel) model ); - consumer.setColorModel(newmodel); + if (consumer != null) + consumer.setColorModel(newmodel); } else { - consumer.setColorModel(ColorModel.getRGBdefault()); + if (consumer != null) + consumer.setColorModel(ColorModel.getRGBdefault()); } } @@ -178,6 +180,7 @@ public abstract class RGBImageFilter extends ImageFilter { if(model == origmodel && (model instanceof IndexColorModel) && canFilterIndexColorModel) { + if (consumer != null) consumer.setPixels(x, y, w, h, newmodel, pixels, offset, scansize); } else @@ -185,7 +188,8 @@ public abstract class RGBImageFilter extends ImageFilter int intPixels[] = convertColorModelToDefault( x, y, w, h, model, pixels, offset, scansize ); filterRGBPixels( x, y, w, h, intPixels, offset, scansize ); - consumer.setPixels(x, y, w, h, ColorModel.getRGBdefault(), intPixels, offset, scansize); + if (consumer != null) + consumer.setPixels(x, y, w, h, ColorModel.getRGBdefault(), intPixels, offset, scansize); } } @@ -209,6 +213,7 @@ public abstract class RGBImageFilter extends ImageFilter { if(model == origmodel && (model instanceof IndexColorModel) && canFilterIndexColorModel) { + if (consumer != null) consumer.setPixels(x, y, w, h, newmodel, pixels, offset, scansize); } else @@ -216,7 +221,8 @@ public abstract class RGBImageFilter extends ImageFilter //FIXME: Store the filtered pixels in a separate temporary buffer? convertColorModelToDefault( x, y, w, h, model, pixels, offset, scansize ); filterRGBPixels( x, y, w, h, pixels, offset, scansize ); - consumer.setPixels(x, y, w, h, ColorModel.getRGBdefault(), pixels, offset, scansize); + if (consumer != null) + consumer.setPixels(x, y, w, h, ColorModel.getRGBdefault(), pixels, offset, scansize); } } diff --git a/libjava/classpath/java/awt/image/ReplicateScaleFilter.java b/libjava/classpath/java/awt/image/ReplicateScaleFilter.java index 3841e49..d76f9db 100644 --- a/libjava/classpath/java/awt/image/ReplicateScaleFilter.java +++ b/libjava/classpath/java/awt/image/ReplicateScaleFilter.java @@ -124,7 +124,8 @@ public class ReplicateScaleFilter extends ImageFilter destHeight = (int) (height * ((double) destWidth / srcWidth)); } - consumer.setDimensions(destWidth, destHeight); + if (consumer != null) + consumer.setDimensions(destWidth, destHeight); } /** @@ -136,7 +137,8 @@ public class ReplicateScaleFilter extends ImageFilter public void setProperties(Hashtable props) { props.put("filters", "ReplicateScaleFilter"); - consumer.setProperties(props); + if (consumer != null) + consumer.setProperties(props); } /** @@ -165,9 +167,10 @@ public class ReplicateScaleFilter extends ImageFilter model, pixels, offset, scansize, rx, ry, destScansize); - consumer.setPixels((int) Math.floor(x/rx), (int) Math.floor(y/ry), - (int) Math.ceil(w/rx), (int) Math.ceil(h/ry), - model, destPixels, 0, destScansize); + if (consumer != null) + consumer.setPixels((int) Math.floor(x/rx), (int) Math.floor(y/ry), + (int) Math.ceil(w/rx), (int) Math.ceil(h/ry), + model, destPixels, 0, destScansize); } /** @@ -196,9 +199,10 @@ public class ReplicateScaleFilter extends ImageFilter model, pixels, offset, scansize, rx, ry, destScansize); - consumer.setPixels((int) Math.floor(x/rx), (int) Math.floor(y/ry), - (int) Math.ceil(w/rx), (int) Math.ceil(h/ry), - model, destPixels, 0, destScansize); + if (consumer != null) + consumer.setPixels((int) Math.floor(x/rx), (int) Math.floor(y/ry), + (int) Math.ceil(w/rx), (int) Math.ceil(h/ry), + model, destPixels, 0, destScansize); } private byte[] replicatePixels(int srcx, int srcy, int srcw, int srch, diff --git a/libjava/classpath/java/awt/peer/ComponentPeer.java b/libjava/classpath/java/awt/peer/ComponentPeer.java index 7ed8f60..1ba1692 100644 --- a/libjava/classpath/java/awt/peer/ComponentPeer.java +++ b/libjava/classpath/java/awt/peer/ComponentPeer.java @@ -51,6 +51,7 @@ import java.awt.Graphics; import java.awt.GraphicsConfiguration; import java.awt.Image; import java.awt.Point; +import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.event.PaintEvent; import java.awt.image.ColorModel; @@ -184,4 +185,48 @@ public interface ComponentPeer * @since 1.2 */ void destroyBuffers(); + + /** + * Get the bounds of this component peer. + * + * @return component peer bounds + * @since 1.5 + */ + Rectangle getBounds(); + + /** + * Reparent this component under another container. + * + * @param parent + * @since 1.5 + */ + void reparent(ContainerPeer parent); + + /** + * Set the bounds of this component peer. + * + * @param x the new x co-ordinate + * @param y the new y co-ordinate + * @param width the new width + * @param height the new height + * @param z the new stacking level + * @since 1.5 + */ + void setBounds (int x, int y, int width, int height, int z); + + /** + * Check if this component supports being reparented. + * + * @return true if this component can be reparented, + * false otherwise. + * @since 1.5 + */ + boolean isReparentSupported(); + + /** + * Layout this component peer. + * + * @since 1.5 + */ + void layout(); } diff --git a/libjava/classpath/java/awt/peer/ContainerPeer.java b/libjava/classpath/java/awt/peer/ContainerPeer.java index f1373a1..76673a1 100644 --- a/libjava/classpath/java/awt/peer/ContainerPeer.java +++ b/libjava/classpath/java/awt/peer/ContainerPeer.java @@ -54,6 +54,31 @@ public interface ContainerPeer extends ComponentPeer void endLayout(); boolean isPaintPending(); - + + /** + * Check if this container peer can be restacked. + * + * @return true if this container peer supports being restacked, false otherwise + * @since 1.5 + */ + boolean isRestackSupported(); + + /** + * Cancel a pending paint event on a region of this container. + * + * @param x the x co-ordinate of the region + * @param y the y co-ordinate of the region + * @param width the width of the region + * @param height the height of the region + * @since 1.5 + */ + void cancelPendingPaint(int x, int y, int width, int height); + + /** + * Restack the component peers in this container peer. + * + * @since 1.5 + */ + void restack(); } // interface ContainerPeer diff --git a/libjava/classpath/java/awt/peer/FramePeer.java b/libjava/classpath/java/awt/peer/FramePeer.java index 13498ff..13435f8 100644 --- a/libjava/classpath/java/awt/peer/FramePeer.java +++ b/libjava/classpath/java/awt/peer/FramePeer.java @@ -51,5 +51,25 @@ public interface FramePeer extends WindowPeer int getState(); void setState(int state); void setMaximizedBounds(Rectangle r); + + /** + * Check if this frame peer supports being restacked. + * + * @return true if this frame peer can be restacked, + * false otherwise + * @since 1.5 + */ + boolean isRestackSupported(); + + /** + * Sets the bounds of this frame peer. + * + * @param x the new x co-ordinate + * @param y the new y co-ordinate + * @param width the new width + * @param height the new height + * @since 1.5 + */ + void setBoundsPrivate(int x, int y, int width, int height); } // interface FramePeer diff --git a/libjava/classpath/java/awt/peer/MenuBarPeer.java b/libjava/classpath/java/awt/peer/MenuBarPeer.java index c5f7c58..44e37e2 100644 --- a/libjava/classpath/java/awt/peer/MenuBarPeer.java +++ b/libjava/classpath/java/awt/peer/MenuBarPeer.java @@ -42,6 +42,7 @@ import java.awt.Menu; public interface MenuBarPeer extends MenuComponentPeer { + void addMenu(Menu m); void addHelpMenu(Menu menu); void delMenu(int index); } // interface MenuBarPeer diff --git a/libjava/classpath/java/awt/peer/MenuComponentPeer.java b/libjava/classpath/java/awt/peer/MenuComponentPeer.java index 1b10ca1..bfd3414 100644 --- a/libjava/classpath/java/awt/peer/MenuComponentPeer.java +++ b/libjava/classpath/java/awt/peer/MenuComponentPeer.java @@ -38,8 +38,18 @@ exception statement from your version. */ package java.awt.peer; +import java.awt.Font; + public interface MenuComponentPeer { void dispose(); + + /** + * Set the font on this menu component peer. + * + * @param font the new font + * @since 1.5 + */ + void setFont (Font font); } // interface MenuComponentPeer diff --git a/libjava/classpath/java/awt/peer/MenuPeer.java b/libjava/classpath/java/awt/peer/MenuPeer.java index c51ea73..91d0f0d 100644 --- a/libjava/classpath/java/awt/peer/MenuPeer.java +++ b/libjava/classpath/java/awt/peer/MenuPeer.java @@ -43,6 +43,7 @@ import java.awt.MenuItem; public interface MenuPeer extends MenuItemPeer { void addItem (MenuItem item); + void addSeparator (); void delItem (int index); } diff --git a/libjava/classpath/java/awt/peer/TextComponentPeer.java b/libjava/classpath/java/awt/peer/TextComponentPeer.java index cacc7d8..f807299 100644 --- a/libjava/classpath/java/awt/peer/TextComponentPeer.java +++ b/libjava/classpath/java/awt/peer/TextComponentPeer.java @@ -39,6 +39,7 @@ exception statement from your version. */ package java.awt.peer; import java.awt.Rectangle; +import java.awt.im.InputMethodRequests; public interface TextComponentPeer extends ComponentPeer { @@ -53,5 +54,13 @@ public interface TextComponentPeer extends ComponentPeer int getIndexAtPoint(int x, int y); Rectangle getCharacterBounds(int pos); long filterEvents(long filter); + + /** + * Retrieve this text component peer's input method requests. + * + * @return the input method requests made by this text component peer + * @since 1.5 + */ + InputMethodRequests getInputMethodRequests(); } // interface TextComponentPeer diff --git a/libjava/classpath/java/awt/peer/WindowPeer.java b/libjava/classpath/java/awt/peer/WindowPeer.java index 8f136dd..6c014de 100644 --- a/libjava/classpath/java/awt/peer/WindowPeer.java +++ b/libjava/classpath/java/awt/peer/WindowPeer.java @@ -42,5 +42,19 @@ public interface WindowPeer extends ContainerPeer { void toBack(); void toFront(); + + /** + * FIXME: unknown. + * @since 1.5 + */ + void updateAlwaysOnTop(); + + /** + * Request that this window peer be given the window focus. + * + * @return true if the window received focus, false otherwise + * @since 1.5 + */ + boolean requestWindowFocus(); } // interface WindowPeer |