--- a/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java Wed May 14 07:53:12 2008 -0700
@@ -504,7 +504,7 @@
}
// Found position of metadata for image 0
- imageStartPosition.add(new Long(stream.getStreamPosition()));
+ imageStartPosition.add(Long.valueOf(stream.getStreamPosition()));
} catch (IOException e) {
throw new IIOException("I/O error reading header!", e);
}
--- a/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFWritableImageMetadata.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFWritableImageMetadata.java Wed May 14 07:53:12 2008 -0700
@@ -98,7 +98,7 @@
try {
return data.getBytes("ISO-8859-1");
} catch (UnsupportedEncodingException e) {
- return (new String("")).getBytes();
+ return "".getBytes();
}
}
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKColorChooserPanel.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKColorChooserPanel.java Wed May 14 07:53:12 2008 -0700
@@ -328,7 +328,7 @@
setHSB(hue, saturation, brightness);
if (update) {
settingColor = true;
- hueSpinner.setValue(new Integer((int)(hue * 360)));
+ hueSpinner.setValue(Integer.valueOf((int)(hue * 360)));
settingColor = false;
}
}
@@ -376,8 +376,8 @@
setHSB(hue, s, b);
if (update) {
settingColor = true;
- saturationSpinner.setValue(new Integer((int)(s * 255)));
- valueSpinner.setValue(new Integer((int)(b * 255)));
+ saturationSpinner.setValue(Integer.valueOf((int)(s * 255)));
+ valueSpinner.setValue(Integer.valueOf((int)(b * 255)));
settingColor = false;
}
}
@@ -391,9 +391,9 @@
setColor(color, false, true, true);
settingColor = true;
- hueSpinner.setValue(new Integer((int)(hue * 360)));
- saturationSpinner.setValue(new Integer((int)(saturation * 255)));
- valueSpinner.setValue(new Integer((int)(brightness * 255)));
+ hueSpinner.setValue(Integer.valueOf((int)(hue * 360)));
+ saturationSpinner.setValue(Integer.valueOf((int)(saturation * 255)));
+ valueSpinner.setValue(Integer.valueOf((int)(brightness * 255)));
settingColor = false;
}
@@ -409,9 +409,9 @@
setColor(color, false, false, true);
settingColor = true;
- redSpinner.setValue(new Integer(color.getRed()));
- greenSpinner.setValue(new Integer(color.getGreen()));
- blueSpinner.setValue(new Integer(color.getBlue()));
+ redSpinner.setValue(Integer.valueOf(color.getRed()));
+ greenSpinner.setValue(Integer.valueOf(color.getGreen()));
+ blueSpinner.setValue(Integer.valueOf(color.getBlue()));
settingColor = false;
}
@@ -454,13 +454,13 @@
colorNameTF.setText("#" + hexString.substring(1));
if (updateSpinners) {
- redSpinner.setValue(new Integer(color.getRed()));
- greenSpinner.setValue(new Integer(color.getGreen()));
- blueSpinner.setValue(new Integer(color.getBlue()));
+ redSpinner.setValue(Integer.valueOf(color.getRed()));
+ greenSpinner.setValue(Integer.valueOf(color.getGreen()));
+ blueSpinner.setValue(Integer.valueOf(color.getBlue()));
- hueSpinner.setValue(new Integer((int)(hue * 360)));
- saturationSpinner.setValue(new Integer((int)(saturation * 255)));
- valueSpinner.setValue(new Integer((int)(brightness * 255)));
+ hueSpinner.setValue(Integer.valueOf((int)(hue * 360)));
+ saturationSpinner.setValue(Integer.valueOf((int)(saturation * 255)));
+ valueSpinner.setValue(Integer.valueOf((int)(brightness * 255)));
}
settingColor = false;
}
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java Wed May 14 07:53:12 2008 -0700
@@ -336,7 +336,7 @@
// populate the table with the values from basic.
super.initComponentDefaults(table);
- Integer zero = new Integer(0);
+ Integer zero = Integer.valueOf(0);
Object zeroBorder = new sun.swing.SwingLazyValue(
"javax.swing.plaf.BorderUIResource$EmptyBorderUIResource",
new Object[] {zero, zero, zero, zero});
@@ -371,7 +371,7 @@
int vProgWidth = 22 - (progXThickness * 2);
int vProgHeight = 80 - (progYThickness * 2);
- Integer caretBlinkRate = new Integer(500);
+ Integer caretBlinkRate = Integer.valueOf(500);
Insets zeroInsets = new InsetsUIResource(0, 0, 0, 0);
Double defaultCaretAspectRatio = new Double(0.025);
@@ -540,7 +540,7 @@
}
Object[] defaults = new Object[] {
- "ArrowButton.size", new Integer(13),
+ "ArrowButton.size", Integer.valueOf(13),
"Button.defaultButtonFollowsFocus", Boolean.FALSE,
@@ -893,8 +893,8 @@
"ScrollBar.squareButtons", Boolean.FALSE,
- "ScrollBar.thumbHeight", new Integer(14),
- "ScrollBar.width", new Integer(16),
+ "ScrollBar.thumbHeight", Integer.valueOf(14),
+ "ScrollBar.width", Integer.valueOf(16),
"ScrollBar.minimumThumbSize", new Dimension(8, 8),
"ScrollBar.maximumThumbSize", new Dimension(4096, 4096),
"ScrollBar.allowsAbsolutePositioning", Boolean.TRUE,
@@ -954,12 +954,12 @@
"Separator.insets", zeroInsets,
- "Separator.thickness", new Integer(2),
+ "Separator.thickness", Integer.valueOf(2),
"Slider.paintValue", Boolean.TRUE,
- "Slider.thumbWidth", new Integer(30),
- "Slider.thumbHeight", new Integer(14),
+ "Slider.thumbWidth", Integer.valueOf(30),
+ "Slider.thumbHeight", Integer.valueOf(14),
"Slider.focusInputMap",
new UIDefaults.LazyInputMap(new Object[] {
"RIGHT", "positiveUnitIncrement",
@@ -1013,9 +1013,9 @@
}),
- "SplitPane.size", new Integer(7),
- "SplitPane.oneTouchOffset", new Integer(2),
- "SplitPane.oneTouchButtonSize", new Integer(5),
+ "SplitPane.size", Integer.valueOf(7),
+ "SplitPane.oneTouchOffset", Integer.valueOf(2),
+ "SplitPane.oneTouchButtonSize", Integer.valueOf(5),
"SplitPane.supportsOneTouchButtons", Boolean.FALSE,
@@ -1223,13 +1223,13 @@
"ToolTip.font", new FontLazyValue(Region.TOOL_TIP),
- "Tree.padding", new Integer(4),
+ "Tree.padding", Integer.valueOf(4),
"Tree.background", tableBg,
"Tree.drawHorizontalLines", Boolean.FALSE,
"Tree.drawVerticalLines", Boolean.FALSE,
- "Tree.rowHeight", new Integer(-1),
+ "Tree.rowHeight", Integer.valueOf(-1),
"Tree.scrollsOnExpand", Boolean.FALSE,
- "Tree.expanderSize", new Integer(10),
+ "Tree.expanderSize", Integer.valueOf(10),
"Tree.repaintWholeRow", Boolean.TRUE,
"Tree.closedIcon", null,
"Tree.leafIcon", null,
@@ -1240,8 +1240,8 @@
"Tree.collapsedIcon", new GTKStyle.GTKLazyValue(
"com.sun.java.swing.plaf.gtk.GTKIconFactory",
"getTreeCollapsedIcon"),
- "Tree.leftChildIndent", new Integer(2),
- "Tree.rightChildIndent", new Integer(12),
+ "Tree.leftChildIndent", Integer.valueOf(2),
+ "Tree.rightChildIndent", Integer.valueOf(12),
"Tree.scrollsHorizontallyAndVertically", Boolean.FALSE,
"Tree.drawsFocusBorder", Boolean.TRUE,
"Tree.focusInputMap",
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java Wed May 14 07:53:12 2008 -0700
@@ -851,7 +851,7 @@
int focusLineWidth = getClassSpecificIntValue(context,
"focus-line-width", 0);
if (value == null && focusLineWidth > 0) {
- value = new Integer(16 + 2 * focusLineWidth);
+ value = Integer.valueOf(16 + 2 * focusLineWidth);
}
}
return value;
@@ -975,12 +975,12 @@
private static void initIconTypeMap() {
ICON_TYPE_MAP = new HashMap<String,Integer>();
- ICON_TYPE_MAP.put("gtk-menu", new Integer(1));
- ICON_TYPE_MAP.put("gtk-small-toolbar", new Integer(2));
- ICON_TYPE_MAP.put("gtk-large-toolbar", new Integer(3));
- ICON_TYPE_MAP.put("gtk-button", new Integer(4));
- ICON_TYPE_MAP.put("gtk-dnd", new Integer(5));
- ICON_TYPE_MAP.put("gtk-dialog", new Integer(6));
+ ICON_TYPE_MAP.put("gtk-menu", Integer.valueOf(1));
+ ICON_TYPE_MAP.put("gtk-small-toolbar", Integer.valueOf(2));
+ ICON_TYPE_MAP.put("gtk-large-toolbar", Integer.valueOf(3));
+ ICON_TYPE_MAP.put("gtk-button", Integer.valueOf(4));
+ ICON_TYPE_MAP.put("gtk-dnd", Integer.valueOf(5));
+ ICON_TYPE_MAP.put("gtk-dialog", Integer.valueOf(6));
}
}
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java Wed May 14 07:53:12 2008 -0700
@@ -178,7 +178,7 @@
name = child.getNodeName();
Object value = null;
if ("distance".equals(name)) {
- value = new Integer(getIntAttr(child, "value", 0));
+ value = Integer.valueOf(getIntAttr(child, "value", 0));
} else if ("border".equals(name)) {
value = new Insets(getIntAttr(child, "top", 0),
getIntAttr(child, "left", 0),
@@ -808,7 +808,7 @@
protected void setFrameGeometry(JComponent titlePane, Map gm) {
this.frameGeometry = gm;
if (getInt("top_height") == 0 && titlePane != null) {
- gm.put("top_height", new Integer(titlePane.getHeight()));
+ gm.put("top_height", Integer.valueOf(titlePane.getHeight()));
}
}
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifLookAndFeel.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifLookAndFeel.java Wed May 14 07:53:12 2008 -0700
@@ -567,7 +567,7 @@
"ProgressBar.selectionBackground", table.get("controlText"),
"ProgressBar.border", loweredBevelBorder,
"ProgressBar.cellLength", new Integer(6),
- "ProgressBar.cellSpacing", new Integer(0),
+ "ProgressBar.cellSpacing", Integer.valueOf(0),
// Buttons
"Button.margin", new InsetsUIResource(2, 4, 2, 4),
@@ -859,7 +859,7 @@
"SplitPane.background", table.get("control"),
"SplitPane.highlight", table.get("controlHighlight"),
"SplitPane.shadow", table.get("controlShadow"),
- "SplitPane.dividerSize", new Integer(20),
+ "SplitPane.dividerSize", Integer.valueOf(20),
"SplitPane.activeThumb", table.get("activeCaptionBorder"),
"SplitPane.ancestorInputMap",
new UIDefaults.LazyInputMap(new Object[] {
@@ -1160,7 +1160,7 @@
}),
"TextField.caretForeground", black,
- "TextField.caretBlinkRate", new Integer(500),
+ "TextField.caretBlinkRate", Integer.valueOf(500),
"TextField.inactiveForeground", table.get("textInactiveText"),
"TextField.selectionBackground", table.get("textHighlight"),
"TextField.selectionForeground", table.get("textHighlightText"),
@@ -1171,7 +1171,7 @@
"TextField.focusInputMap", fieldInputMap,
"PasswordField.caretForeground", black,
- "PasswordField.caretBlinkRate", new Integer(500),
+ "PasswordField.caretBlinkRate", Integer.valueOf(500),
"PasswordField.inactiveForeground", table.get("textInactiveText"),
"PasswordField.selectionBackground", table.get("textHighlight"),
"PasswordField.selectionForeground", table.get("textHighlightText"),
@@ -1182,7 +1182,7 @@
"PasswordField.focusInputMap", passwordInputMap,
"TextArea.caretForeground", black,
- "TextArea.caretBlinkRate", new Integer(500),
+ "TextArea.caretBlinkRate", Integer.valueOf(500),
"TextArea.inactiveForeground", table.get("textInactiveText"),
"TextArea.selectionBackground", table.get("textHighlight"),
"TextArea.selectionForeground", table.get("textHighlightText"),
@@ -1193,7 +1193,7 @@
"TextArea.focusInputMap", multilineInputMap,
"TextPane.caretForeground", black,
- "TextPane.caretBlinkRate", new Integer(500),
+ "TextPane.caretBlinkRate", Integer.valueOf(500),
"TextPane.inactiveForeground", table.get("textInactiveText"),
"TextPane.selectionBackground", lightGray,
"TextPane.selectionForeground", table.get("textHighlightText"),
@@ -1204,7 +1204,7 @@
"TextPane.focusInputMap", multilineInputMap,
"EditorPane.caretForeground", red,
- "EditorPane.caretBlinkRate", new Integer(500),
+ "EditorPane.caretBlinkRate", Integer.valueOf(500),
"EditorPane.inactiveForeground", table.get("textInactiveText"),
"EditorPane.selectionBackground", lightGray,
"EditorPane.selectionForeground", table.get("textHighlightText"),
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java Wed May 14 07:53:12 2008 -0700
@@ -299,9 +299,9 @@
initResourceBundle(table);
// *** Shared Fonts
- Integer twelve = new Integer(12);
- Integer fontPlain = new Integer(Font.PLAIN);
- Integer fontBold = new Integer(Font.BOLD);
+ Integer twelve = Integer.valueOf(12);
+ Integer fontPlain = Integer.valueOf(Font.PLAIN);
+ Integer fontBold = Integer.valueOf(Font.BOLD);
Object dialogPlain12 = new SwingLazyValue(
"javax.swing.plaf.FontUIResource",
@@ -522,19 +522,19 @@
toolkit);
Object WindowBorderWidth = new DesktopProperty(
"win.frame.sizingBorderWidth",
- new Integer(1),
+ Integer.valueOf(1),
toolkit);
Object TitlePaneHeight = new DesktopProperty(
"win.frame.captionHeight",
- new Integer(18),
+ Integer.valueOf(18),
toolkit);
Object TitleButtonWidth = new DesktopProperty(
"win.frame.captionButtonWidth",
- new Integer(16),
+ Integer.valueOf(16),
toolkit);
Object TitleButtonHeight = new DesktopProperty(
"win.frame.captionButtonHeight",
- new Integer(16),
+ Integer.valueOf(16),
toolkit);
Object InactiveTextColor = new DesktopProperty(
"win.text.grayedTextColor",
@@ -567,7 +567,7 @@
Object IconFont = ControlFont;
Object scrollBarWidth = new DesktopProperty("win.scrollbar.width",
- new Integer(16), toolkit);
+ Integer.valueOf(16), toolkit);
Object menuBarHeight = new DesktopProperty("win.menu.height",
null, toolkit);
@@ -673,12 +673,12 @@
"Button.disabledForeground", InactiveTextColor,
"Button.disabledShadow", ControlHighlightColor,
"Button.focus", black,
- "Button.dashedRectGapX", new XPValue(new Integer(3), new Integer(5)),
- "Button.dashedRectGapY", new XPValue(new Integer(3), new Integer(4)),
- "Button.dashedRectGapWidth", new XPValue(new Integer(6), new Integer(10)),
- "Button.dashedRectGapHeight", new XPValue(new Integer(6), new Integer(8)),
- "Button.textShiftOffset", new XPValue(new Integer(0),
- new Integer(1)),
+ "Button.dashedRectGapX", new XPValue(Integer.valueOf(3), Integer.valueOf(5)),
+ "Button.dashedRectGapY", new XPValue(Integer.valueOf(3), Integer.valueOf(4)),
+ "Button.dashedRectGapWidth", new XPValue(Integer.valueOf(6), Integer.valueOf(10)),
+ "Button.dashedRectGapHeight", new XPValue(Integer.valueOf(6), Integer.valueOf(8)),
+ "Button.textShiftOffset", new XPValue(Integer.valueOf(0),
+ Integer.valueOf(1)),
// W2K keyboard navigation hidding.
"Button.showMnemonics", showMnemonics,
"Button.focusInputMap",
@@ -780,7 +780,7 @@
}),
// DesktopIcon
- "DesktopIcon.width", new Integer(160),
+ "DesktopIcon.width", Integer.valueOf(160),
"EditorPane.font", ControlFont,
"EditorPane.background", WindowBackgroundColor,
@@ -814,9 +814,9 @@
"icons/NewFolder.gif"),
"FileChooser.useSystemExtensionHiding", Boolean.TRUE,
- "FileChooser.lookInLabelMnemonic", new Integer(KeyEvent.VK_I),
- "FileChooser.fileNameLabelMnemonic", new Integer(KeyEvent.VK_N),
- "FileChooser.filesOfTypeLabelMnemonic", new Integer(KeyEvent.VK_T),
+ "FileChooser.lookInLabelMnemonic", Integer.valueOf(KeyEvent.VK_I),
+ "FileChooser.fileNameLabelMnemonic", Integer.valueOf(KeyEvent.VK_N),
+ "FileChooser.filesOfTypeLabelMnemonic", Integer.valueOf(KeyEvent.VK_T),
"FileChooser.usesSingleFilePane", Boolean.TRUE,
"FileChooser.noPlacesBar", new DesktopProperty("win.comdlg.noPlacesBar",
Boolean.FALSE, toolkit),
@@ -1021,10 +1021,10 @@
"Menu.selectionBackground", SelectionBackgroundColor,
"Menu.acceleratorForeground", MenuTextColor,
"Menu.acceleratorSelectionForeground", SelectionTextColor,
- "Menu.menuPopupOffsetX", new Integer(0),
- "Menu.menuPopupOffsetY", new Integer(0),
- "Menu.submenuPopupOffsetX", new Integer(-4),
- "Menu.submenuPopupOffsetY", new Integer(-3),
+ "Menu.menuPopupOffsetX", Integer.valueOf(0),
+ "Menu.menuPopupOffsetY", Integer.valueOf(0),
+ "Menu.submenuPopupOffsetX", Integer.valueOf(-4),
+ "Menu.submenuPopupOffsetY", Integer.valueOf(-3),
"Menu.crossMenuMnemonic", Boolean.FALSE,
"Menu.preserveTopLevelSelection", Boolean.TRUE,
@@ -1184,8 +1184,8 @@
"ProgressBar.highlight", ControlHighlightColor,
"ProgressBar.selectionForeground", ControlBackgroundColor,
"ProgressBar.selectionBackground", SelectionBackgroundColor,
- "ProgressBar.cellLength", new Integer(7),
- "ProgressBar.cellSpacing", new Integer(2),
+ "ProgressBar.cellLength", Integer.valueOf(7),
+ "ProgressBar.cellSpacing", Integer.valueOf(2),
"ProgressBar.indeterminateInsets", new Insets(3, 3, 3, 3),
// *** RootPane.
@@ -1292,7 +1292,7 @@
"SplitPane.highlight", ControlHighlightColor,
"SplitPane.shadow", ControlShadowColor,
"SplitPane.darkShadow", ControlDarkShadowColor,
- "SplitPane.dividerSize", new Integer(5),
+ "SplitPane.dividerSize", Integer.valueOf(5),
"SplitPane.ancestorInputMap",
new UIDefaults.LazyInputMap(new Object[] {
"UP", "negativeIncrement",
@@ -1496,7 +1496,7 @@
"ToggleButton.light", ControlLightColor,
"ToggleButton.highlight", ControlHighlightColor,
"ToggleButton.focus", ControlTextColor,
- "ToggleButton.textShiftOffset", new Integer(1),
+ "ToggleButton.textShiftOffset", Integer.valueOf(1),
"ToggleButton.focusInputMap",
new UIDefaults.LazyInputMap(new Object[] {
"SPACE", "pressed",
@@ -1548,8 +1548,8 @@
"Tree.background", WindowBackgroundColor,
"Tree.foreground", WindowTextColor,
"Tree.hash", gray,
- "Tree.leftChildIndent", new Integer(8),
- "Tree.rightChildIndent", new Integer(11),
+ "Tree.leftChildIndent", Integer.valueOf(8),
+ "Tree.rightChildIndent", Integer.valueOf(11),
"Tree.textForeground", WindowTextColor,
"Tree.textBackground", WindowBackgroundColor,
"Tree.selectionForeground", SelectionTextColor,
@@ -2488,18 +2488,18 @@
private int direction;
XPDLUValue(int xpdlu, int classicdlu, int direction) {
- super(new Integer(xpdlu), new Integer(classicdlu));
+ super(Integer.valueOf(xpdlu), Integer.valueOf(classicdlu));
this.direction = direction;
}
public Object getXPValue(UIDefaults table) {
int px = dluToPixels(((Integer)xpValue).intValue(), direction);
- return new Integer(px);
+ return Integer.valueOf(px);
}
public Object getClassicValue(UIDefaults table) {
int px = dluToPixels(((Integer)classicValue).intValue(), direction);
- return new Integer(px);
+ return Integer.valueOf(px);
}
}
--- a/jdk/src/share/classes/java/awt/Button.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/java/awt/Button.java Wed May 14 07:53:12 2008 -0700
@@ -597,7 +597,7 @@
public String getAccessibleActionDescription(int i) {
if (i == 0) {
// [[[PENDING: WDW -- need to provide a localized string]]]
- return new String("click");
+ return "click";
} else {
return null;
}
--- a/jdk/src/share/classes/java/awt/Color.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/java/awt/Color.java Wed May 14 07:53:12 2008 -0700
@@ -51,6 +51,7 @@
* http://www.w3.org/pub/WWW/Graphics/Color/sRGB.html
* </A>.
* <p>
+ * @version 10 Feb 1997
* @author Sami Shaio
* @author Arthur van Hoff
* @see ColorSpace
@@ -1176,23 +1177,32 @@
}
/**
- * Creates and returns a {@link PaintContext} used to generate a solid
- * color pattern. This enables a <code>Color</code> object to be used
- * as an argument to any method requiring an object implementing the
- * {@link Paint} interface.
- * The same <code>PaintContext</code> is returned, regardless of
- * whether or not <code>r</code>, <code>r2d</code>,
- * <code>xform</code>, or <code>hints</code> are <code>null</code>.
- * @param cm the specified <code>ColorModel</code>
- * @param r the specified {@link Rectangle}
- * @param r2d the specified {@link Rectangle2D}
- * @param xform the specified {@link AffineTransform}
- * @param hints the specified {@link RenderingHints}
- * @return a <code>PaintContext</code> that is used to generate a
- * solid color pattern.
+ * Creates and returns a {@link PaintContext} used to
+ * generate a solid color field pattern.
+ * See the {@link Paint#createContext specification} of the
+ * method in the {@link Paint} interface for information
+ * on null parameter handling.
+ *
+ * @param cm the preferred {@link ColorModel} which represents the most convenient
+ * format for the caller to receive the pixel data, or {@code null}
+ * if there is no preference.
+ * @param r the device space bounding box
+ * of the graphics primitive being rendered.
+ * @param r2d the user space bounding box
+ * of the graphics primitive being rendered.
+ * @param xform the {@link AffineTransform} from user
+ * space into device space.
+ * @param hints the set of hints that the context object can use to
+ * choose between rendering alternatives.
+ * @return the {@code PaintContext} for
+ * generating color patterns.
* @see Paint
* @see PaintContext
- * @see Graphics2D#setPaint
+ * @see ColorModel
+ * @see Rectangle
+ * @see Rectangle2D
+ * @see AffineTransform
+ * @see RenderingHints
*/
public synchronized PaintContext createContext(ColorModel cm, Rectangle r,
Rectangle2D r2d,
--- a/jdk/src/share/classes/java/awt/Component.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/java/awt/Component.java Wed May 14 07:53:12 2008 -0700
@@ -635,7 +635,9 @@
*/
private PropertyChangeSupport changeSupport;
- private transient final Object changeSupportLock = new Object();
+ // Note: this field is considered final, though readObject() prohibits
+ // initializing final fields.
+ private transient Object changeSupportLock = new Object();
private Object getChangeSupportLock() {
return changeSupportLock;
}
@@ -1004,7 +1006,7 @@
/**
* Gets this component's locking object (the object that owns the thread
- * sychronization monitor) for AWT component-tree and layout
+ * synchronization monitor) for AWT component-tree and layout
* operations.
* @return this component's locking object
*/
@@ -1327,12 +1329,15 @@
KeyboardFocusManager.clearMostRecentFocusOwner(this);
synchronized (getTreeLock()) {
enabled = false;
- if (isFocusOwner()) {
+ // A disabled lw container is allowed to contain a focus owner.
+ if ((isFocusOwner() || (containsFocus() && !isLightweight())) &&
+ KeyboardFocusManager.isAutoFocusTransferEnabled())
+ {
// Don't clear the global focus owner. If transferFocus
// fails, we want the focus to stay on the disabled
// Component so that keyboard traversal, et. al. still
// makes sense to the user.
- autoTransferFocus(false);
+ transferFocus(false);
}
ComponentPeer peer = this.peer;
if (peer != null) {
@@ -1493,8 +1498,8 @@
synchronized (getTreeLock()) {
visible = false;
mixOnHiding(isLightweight());
- if (containsFocus()) {
- autoTransferFocus(true);
+ if (containsFocus() && KeyboardFocusManager.isAutoFocusTransferEnabled()) {
+ transferFocus(true);
}
ComponentPeer peer = this.peer;
if (peer != null) {
@@ -6581,12 +6586,8 @@
}
synchronized (getTreeLock()) {
- if (isFocusOwner()
- && KeyboardFocusManager.isAutoFocusTransferEnabled()
- && !nextFocusHelper())
- {
- KeyboardFocusManager.getCurrentKeyboardFocusManager().
- clearGlobalFocusOwner();
+ if (isFocusOwner() && KeyboardFocusManager.isAutoFocusTransferEnabledFor(this)) {
+ transferFocus(true);
}
if (getContainer() != null && isAddNotifyComplete) {
@@ -6721,8 +6722,8 @@
firePropertyChange("focusable", oldFocusable, focusable);
if (oldFocusable && !focusable) {
- if (isFocusOwner()) {
- autoTransferFocus(true);
+ if (isFocusOwner() && KeyboardFocusManager.isAutoFocusTransferEnabled()) {
+ transferFocus(true);
}
KeyboardFocusManager.clearMostRecentFocusOwner(this);
}
@@ -7376,69 +7377,6 @@
}
}
- private void autoTransferFocus(boolean clearOnFailure) {
- Component toTest = KeyboardFocusManager.
- getCurrentKeyboardFocusManager().getFocusOwner();
- if (toTest != this) {
- if (toTest != null) {
- toTest.autoTransferFocus(clearOnFailure);
- }
- return;
- }
-
- // Check if there are pending focus requests. We shouldn't do
- // auto-transfer if user has already took care of this
- // component becoming ineligible to hold focus.
- if (!KeyboardFocusManager.isAutoFocusTransferEnabled()) {
- return;
- }
-
- // the following code will execute only if this Component is the focus
- // owner
-
- if (!(isDisplayable() && isVisible() && isEnabled() && isFocusable())) {
- doAutoTransfer(clearOnFailure);
- return;
- }
-
- toTest = getParent();
-
- while (toTest != null && !(toTest instanceof Window)) {
- if (!(toTest.isDisplayable() && toTest.isVisible() &&
- (toTest.isEnabled() || toTest.isLightweight()))) {
- doAutoTransfer(clearOnFailure);
- return;
- }
- toTest = toTest.getParent();
- }
- }
- private void doAutoTransfer(boolean clearOnFailure) {
- if (focusLog.isLoggable(Level.FINER)) {
- focusLog.log(Level.FINER, "this = " + this + ", clearOnFailure = " + clearOnFailure);
- }
- if (clearOnFailure) {
- if (!nextFocusHelper()) {
- if (focusLog.isLoggable(Level.FINER)) {
- focusLog.log(Level.FINER, "clear global focus owner");
- }
- KeyboardFocusManager.getCurrentKeyboardFocusManager().
- clearGlobalFocusOwner();
- }
- } else {
- transferFocus();
- }
- }
-
- /**
- * Transfers the focus to the next component, as though this Component were
- * the focus owner.
- * @see #requestFocus()
- * @since JDK1.1
- */
- public void transferFocus() {
- nextFocus();
- }
-
/**
* Returns the Container which is the focus cycle root of this Component's
* focus traversal cycle. Each focus traversal cycle has only a single
@@ -7478,31 +7416,51 @@
return (rootAncestor == container);
}
+ Container getTraversalRoot() {
+ return getFocusCycleRootAncestor();
+ }
+
+ /**
+ * Transfers the focus to the next component, as though this Component were
+ * the focus owner.
+ * @see #requestFocus()
+ * @since JDK1.1
+ */
+ public void transferFocus() {
+ nextFocus();
+ }
+
/**
* @deprecated As of JDK version 1.1,
* replaced by transferFocus().
*/
@Deprecated
public void nextFocus() {
- nextFocusHelper();
- }
-
- private boolean nextFocusHelper() {
- Component toFocus = preNextFocusHelper();
+ transferFocus(false);
+ }
+
+ boolean transferFocus(boolean clearOnFailure) {
if (focusLog.isLoggable(Level.FINER)) {
- focusLog.log(Level.FINER, "toFocus = " + toFocus);
- }
- if (isFocusOwner() && toFocus == this) {
- return false;
- }
- return postNextFocusHelper(toFocus, CausedFocusEvent.Cause.TRAVERSAL_FORWARD);
- }
-
- Container getTraversalRoot() {
- return getFocusCycleRootAncestor();
- }
-
- final Component preNextFocusHelper() {
+ focusLog.finer("clearOnFailure = " + clearOnFailure);
+ }
+ Component toFocus = getNextFocusCandidate();
+ boolean res = false;
+ if (toFocus != null && !toFocus.isFocusOwner() && toFocus != this) {
+ res = toFocus.requestFocusInWindow(CausedFocusEvent.Cause.TRAVERSAL_FORWARD);
+ }
+ if (clearOnFailure && !res) {
+ if (focusLog.isLoggable(Level.FINER)) {
+ focusLog.finer("clear global focus owner");
+ }
+ KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner();
+ }
+ if (focusLog.isLoggable(Level.FINER)) {
+ focusLog.finer("returning result: " + res);
+ }
+ return res;
+ }
+
+ final Component getNextFocusCandidate() {
Container rootAncestor = getTraversalRoot();
Component comp = this;
while (rootAncestor != null &&
@@ -7514,18 +7472,19 @@
rootAncestor = comp.getFocusCycleRootAncestor();
}
if (focusLog.isLoggable(Level.FINER)) {
- focusLog.log(Level.FINER, "comp = " + comp + ", root = " + rootAncestor);
- }
+ focusLog.finer("comp = " + comp + ", root = " + rootAncestor);
+ }
+ Component candidate = null;
if (rootAncestor != null) {
FocusTraversalPolicy policy = rootAncestor.getFocusTraversalPolicy();
Component toFocus = policy.getComponentAfter(rootAncestor, comp);
if (focusLog.isLoggable(Level.FINER)) {
- focusLog.log(Level.FINER, "component after is " + toFocus);
+ focusLog.finer("component after is " + toFocus);
}
if (toFocus == null) {
toFocus = policy.getDefaultComponent(rootAncestor);
if (focusLog.isLoggable(Level.FINER)) {
- focusLog.log(Level.FINER, "default component is " + toFocus);
+ focusLog.finer("default component is " + toFocus);
}
}
if (toFocus == null) {
@@ -7534,23 +7493,12 @@
toFocus = applet;
}
}
- return toFocus;
- }
- return null;
- }
-
- static boolean postNextFocusHelper(Component toFocus, CausedFocusEvent.Cause cause) {
- if (toFocus != null) {
- if (focusLog.isLoggable(Level.FINER)) {
- focusLog.log(Level.FINER, "Next component " + toFocus);
- }
- boolean res = toFocus.requestFocusInWindow(cause);
- if (focusLog.isLoggable(Level.FINER)) {
- focusLog.log(Level.FINER, "Request focus returned " + res);
- }
- return res;
- }
- return false;
+ candidate = toFocus;
+ }
+ if (focusLog.isLoggable(Level.FINER)) {
+ focusLog.finer("Focus transfer candidate: " + candidate);
+ }
+ return candidate;
}
/**
@@ -7560,6 +7508,10 @@
* @since 1.4
*/
public void transferFocusBackward() {
+ transferFocusBackward(false);
+ }
+
+ boolean transferFocusBackward(boolean clearOnFailure) {
Container rootAncestor = getTraversalRoot();
Component comp = this;
while (rootAncestor != null &&
@@ -7570,6 +7522,7 @@
comp = rootAncestor;
rootAncestor = comp.getFocusCycleRootAncestor();
}
+ boolean res = false;
if (rootAncestor != null) {
FocusTraversalPolicy policy = rootAncestor.getFocusTraversalPolicy();
Component toFocus = policy.getComponentBefore(rootAncestor, comp);
@@ -7577,9 +7530,19 @@
toFocus = policy.getDefaultComponent(rootAncestor);
}
if (toFocus != null) {
- toFocus.requestFocusInWindow(CausedFocusEvent.Cause.TRAVERSAL_BACKWARD);
- }
- }
+ res = toFocus.requestFocusInWindow(CausedFocusEvent.Cause.TRAVERSAL_BACKWARD);
+ }
+ }
+ if (!res) {
+ if (focusLog.isLoggable(Level.FINER)) {
+ focusLog.finer("clear global focus owner");
+ }
+ KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner();
+ }
+ if (focusLog.isLoggable(Level.FINER)) {
+ focusLog.finer("returning result: " + res);
+ }
+ return res;
}
/**
@@ -7654,6 +7617,20 @@
return hasFocus();
}
+ /*
+ * Used to disallow auto-focus-transfer on disposal of the focus owner
+ * in the process of disposing its parent container.
+ */
+ private boolean autoFocusTransferOnDisposal = true;
+
+ void setAutoFocusTransferOnDisposal(boolean value) {
+ autoFocusTransferOnDisposal = value;
+ }
+
+ boolean isAutoFocusTransferOnDisposal() {
+ return autoFocusTransferOnDisposal;
+ }
+
/**
* Adds the specified popup menu to the component.
* @param popup the popup menu to be added to the component.
@@ -8315,6 +8292,8 @@
private void readObject(ObjectInputStream s)
throws ClassNotFoundException, IOException
{
+ changeSupportLock = new Object();
+
s.defaultReadObject();
appContext = AppContext.getAppContext();
--- a/jdk/src/share/classes/java/awt/Container.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/java/awt/Container.java Wed May 14 07:53:12 2008 -0700
@@ -2660,9 +2660,26 @@
synchronized (getTreeLock()) {
int ncomponents = this.ncomponents;
Component component[] = this.component;
- for (int i = ncomponents-1 ; i >= 0 ; i--) {
- if( component[i] != null )
- component[i].removeNotify();
+ for (int i = ncomponents - 1; i >= 0; i--) {
+ if( component[i] != null ) {
+ // Fix for 6607170.
+ // We want to suppress focus change on disposal
+ // of the focused component. But because of focus
+ // is asynchronous, we should suppress focus change
+ // on every component in case it receives native focus
+ // in the process of disposal.
+ component[i].setAutoFocusTransferOnDisposal(false);
+ component[i].removeNotify();
+ component[i].setAutoFocusTransferOnDisposal(true);
+ }
+ }
+ // If some of the children had focus before disposal then it still has.
+ // Auto-transfer focus to the next (or previous) component if auto-transfer
+ // is enabled.
+ if (containsFocus() && KeyboardFocusManager.isAutoFocusTransferEnabledFor(this)) {
+ if (!transferFocus(false)) {
+ transferFocusBackward(true);
+ }
}
if ( dispatcher != null ) {
dispatcher.dispose();
--- a/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java Wed May 14 07:53:12 2008 -0700
@@ -155,12 +155,13 @@
boolean clearOnFailure)
{
if (toFocus != vetoedComponent && toFocus.isShowing() && toFocus.isFocusable() &&
- toFocus.requestFocus(false, CausedFocusEvent.Cause.ROLLBACK)) {
+ toFocus.requestFocus(false, CausedFocusEvent.Cause.ROLLBACK))
+ {
return true;
} else {
- Component nextFocus = toFocus.preNextFocusHelper();
- if (nextFocus != vetoedComponent
- && Component.postNextFocusHelper(nextFocus, CausedFocusEvent.Cause.ROLLBACK))
+ Component nextFocus = toFocus.getNextFocusCandidate();
+ if (nextFocus != null && nextFocus != vetoedComponent &&
+ nextFocus.requestFocusInWindow(CausedFocusEvent.Cause.ROLLBACK))
{
return true;
} else if (clearOnFailure) {
@@ -504,9 +505,16 @@
{
// we should not accept focus on such component, so reject it.
dequeueKeyEvents(-1, newFocusOwner);
- if (KeyboardFocusManager.isAutoFocusTransferEnabled())
- {
- restoreFocus(fe, newFocusedWindow);
+ if (KeyboardFocusManager.isAutoFocusTransferEnabled()) {
+ // If FOCUS_GAINED is for a disposed component (however
+ // it shouldn't happen) its toplevel parent is null. In this
+ // case we have to try to restore focus in the current focused
+ // window (for the details: 6607170).
+ if (newFocusedWindow == null) {
+ restoreFocus(fe, currentFocusedWindow);
+ } else {
+ restoreFocus(fe, newFocusedWindow);
+ }
}
break;
}
@@ -1078,6 +1086,9 @@
focusNextComponent(focusedComponent);
}
return;
+ } else if (e.getID() == KeyEvent.KEY_PRESSED) {
+ // Fix for 6637607: consumeNextKeyTyped should be reset.
+ consumeNextKeyTyped = false;
}
toTest = focusedComponent.getFocusTraversalKeys(
--- a/jdk/src/share/classes/java/awt/GradientPaint.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/java/awt/GradientPaint.java Wed May 14 07:53:12 2008 -0700
@@ -53,6 +53,7 @@
*
* @see Paint
* @see Graphics2D#setPaint
+ * @version 10 Feb 1997
*/
public class GradientPaint implements Paint {
@@ -223,19 +224,32 @@
}
/**
- * Creates and returns a context used to generate the color pattern.
- * @param cm {@link ColorModel} that receives
- * the <code>Paint</code> data. This is used only as a hint.
- * @param deviceBounds the device space bounding box of the
- * graphics primitive being rendered
- * @param userBounds the user space bounding box of the
- * graphics primitive being rendered
+ * Creates and returns a {@link PaintContext} used to
+ * generate a linear color gradient pattern.
+ * See the {@link Paint#createContext specification} of the
+ * method in the {@link Paint} interface for information
+ * on null parameter handling.
+ *
+ * @param cm the preferred {@link ColorModel} which represents the most convenient
+ * format for the caller to receive the pixel data, or {@code null}
+ * if there is no preference.
+ * @param deviceBounds the device space bounding box
+ * of the graphics primitive being rendered.
+ * @param userBounds the user space bounding box
+ * of the graphics primitive being rendered.
* @param xform the {@link AffineTransform} from user
- * space into device space
- * @param hints the hints that the context object uses to choose
- * between rendering alternatives
- * @return the {@link PaintContext} that generates color patterns.
+ * space into device space.
+ * @param hints the set of hints that the context object can use to
+ * choose between rendering alternatives.
+ * @return the {@code PaintContext} for
+ * generating color patterns.
+ * @see Paint
* @see PaintContext
+ * @see ColorModel
+ * @see Rectangle
+ * @see Rectangle2D
+ * @see AffineTransform
+ * @see RenderingHints
*/
public PaintContext createContext(ColorModel cm,
Rectangle deviceBounds,
--- a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java Wed May 14 07:53:12 2008 -0700
@@ -2578,6 +2578,10 @@
}
}
+ static boolean isAutoFocusTransferEnabledFor(Component comp) {
+ return isAutoFocusTransferEnabled() && comp.isAutoFocusTransferOnDisposal();
+ }
+
/*
* Used to process exceptions in dispatching focus event (in focusLost/focusGained callbacks).
* @param ex previously caught exception that may be processed right here, or null
--- a/jdk/src/share/classes/java/awt/LinearGradientPaint.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/java/awt/LinearGradientPaint.java Wed May 14 07:53:12 2008 -0700
@@ -296,7 +296,32 @@
}
/**
- * {@inheritDoc}
+ * Creates and returns a {@link PaintContext} used to
+ * generate a linear color gradient pattern.
+ * See the {@link Paint#createContext specification} of the
+ * method in the {@link Paint} interface for information
+ * on null parameter handling.
+ *
+ * @param cm the preferred {@link ColorModel} which represents the most convenient
+ * format for the caller to receive the pixel data, or {@code null}
+ * if there is no preference.
+ * @param deviceBounds the device space bounding box
+ * of the graphics primitive being rendered.
+ * @param userBounds the user space bounding box
+ * of the graphics primitive being rendered.
+ * @param transform the {@link AffineTransform} from user
+ * space into device space.
+ * @param hints the set of hints that the context object can use to
+ * choose between rendering alternatives.
+ * @return the {@code PaintContext} for
+ * generating color patterns.
+ * @see Paint
+ * @see PaintContext
+ * @see ColorModel
+ * @see Rectangle
+ * @see Rectangle2D
+ * @see AffineTransform
+ * @see RenderingHints
*/
public PaintContext createContext(ColorModel cm,
Rectangle deviceBounds,
--- a/jdk/src/share/classes/java/awt/MenuItem.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/java/awt/MenuItem.java Wed May 14 07:53:12 2008 -0700
@@ -847,7 +847,7 @@
public String getAccessibleActionDescription(int i) {
if (i == 0) {
// [[[PENDING: WDW -- need to provide a localized string]]]
- return new String("click");
+ return "click";
} else {
return null;
}
--- a/jdk/src/share/classes/java/awt/Paint.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/java/awt/Paint.java Wed May 14 07:53:12 2008 -0700
@@ -46,42 +46,58 @@
* @see GradientPaint
* @see TexturePaint
* @see Graphics2D#setPaint
+ * @version 1.36, 06/05/07
*/
public interface Paint extends Transparency {
/**
* Creates and returns a {@link PaintContext} used to
* generate the color pattern.
- * Since the ColorModel argument to createContext is only a
- * hint, implementations of Paint should accept a null argument
- * for ColorModel. Note that if the application does not
- * prefer a specific ColorModel, the null ColorModel argument
- * will give the Paint implementation full leeway in using the
- * most efficient ColorModel it prefers for its raster processing.
- * <p>
- * Since the API documentation was not specific about this in
- * releases before 1.4, there may be implementations of
- * <code>Paint</code> that do not accept a null
- * <code>ColorModel</code> argument.
- * If a developer is writing code which passes a null
- * <code>ColorModel</code> argument to the
- * <code>createContext</code> method of <code>Paint</code>
- * objects from arbitrary sources it would be wise to code defensively
- * by manufacturing a non-null <code>ColorModel</code> for those
- * objects which throw a <code>NullPointerException</code>.
- * @param cm the {@link ColorModel} that receives the
- * <code>Paint</code> data. This is used only as a hint.
+ * The arguments to this method convey additional information
+ * about the rendering operation that may be
+ * used or ignored on various implementations of the {@code Paint} interface.
+ * A caller must pass non-{@code null} values for all of the arguments
+ * except for the {@code ColorModel} argument which may be {@code null} to
+ * indicate that no specific {@code ColorModel} type is preferred.
+ * Implementations of the {@code Paint} interface are allowed to use or ignore
+ * any of the arguments as makes sense for their function, and are
+ * not constrained to use the specified {@code ColorModel} for the returned
+ * {@code PaintContext}, even if it is not {@code null}.
+ * Implementations are allowed to throw {@code NullPointerException} for
+ * any {@code null} argument other than the {@code ColorModel} argument,
+ * but are not required to do so.
+ *
+ * @param cm the preferred {@link ColorModel} which represents the most convenient
+ * format for the caller to receive the pixel data, or {@code null}
+ * if there is no preference.
* @param deviceBounds the device space bounding box
- * of the graphics primitive being rendered
+ * of the graphics primitive being rendered.
+ * Implementations of the {@code Paint} interface
+ * are allowed to throw {@code NullPointerException}
+ * for a {@code null} {@code deviceBounds}.
* @param userBounds the user space bounding box
- * of the graphics primitive being rendered
+ * of the graphics primitive being rendered.
+ * Implementations of the {@code Paint} interface
+ * are allowed to throw {@code NullPointerException}
+ * for a {@code null} {@code userBounds}.
* @param xform the {@link AffineTransform} from user
- * space into device space
- * @param hints the hint that the context object uses to
- * choose between rendering alternatives
- * @return the <code>PaintContext</code> for
- * generating color patterns
+ * space into device space.
+ * Implementations of the {@code Paint} interface
+ * are allowed to throw {@code NullPointerException}
+ * for a {@code null} {@code xform}.
+ * @param hints the set of hints that the context object can use to
+ * choose between rendering alternatives.
+ * Implementations of the {@code Paint} interface
+ * are allowed to throw {@code NullPointerException}
+ * for a {@code null} {@code hints}.
+ * @return the {@code PaintContext} for
+ * generating color patterns.
* @see PaintContext
+ * @see ColorModel
+ * @see Rectangle
+ * @see Rectangle2D
+ * @see AffineTransform
+ * @see RenderingHints
*/
public PaintContext createContext(ColorModel cm,
Rectangle deviceBounds,
--- a/jdk/src/share/classes/java/awt/RadialGradientPaint.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/java/awt/RadialGradientPaint.java Wed May 14 07:53:12 2008 -0700
@@ -543,7 +543,31 @@
}
/**
- * {@inheritDoc}
+ * Creates and returns a {@link PaintContext} used to
+ * generate a circular radial color gradient pattern.
+ * See the description of the {@link Paint#createContext createContext} method
+ * for information on null parameter handling.
+ *
+ * @param cm the preferred {@link ColorModel} which represents the most convenient
+ * format for the caller to receive the pixel data, or {@code null}
+ * if there is no preference.
+ * @param deviceBounds the device space bounding box
+ * of the graphics primitive being rendered.
+ * @param userBounds the user space bounding box
+ * of the graphics primitive being rendered.
+ * @param transform the {@link AffineTransform} from user
+ * space into device space.
+ * @param hints the set of hints that the context object can use to
+ * choose between rendering alternatives.
+ * @return the {@code PaintContext} for
+ * generating color patterns.
+ * @see Paint
+ * @see PaintContext
+ * @see ColorModel
+ * @see Rectangle
+ * @see Rectangle2D
+ * @see AffineTransform
+ * @see RenderingHints
*/
public PaintContext createContext(ColorModel cm,
Rectangle deviceBounds,
--- a/jdk/src/share/classes/java/awt/TexturePaint.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/java/awt/TexturePaint.java Wed May 14 07:53:12 2008 -0700
@@ -45,6 +45,7 @@
* replicated <code>Rectangle2D</code>.
* @see Paint
* @see Graphics2D#setPaint
+ * @version 1.48, 06/05/07
*/
public class TexturePaint implements Paint {
@@ -93,20 +94,32 @@
}
/**
- * Creates and returns a context used to generate the color pattern.
- * @param cm the {@link ColorModel} that receives the
- * <code>Paint</code> data. This is used only as a hint.
- * @param deviceBounds the device space bounding box of the graphics
- * primitive being rendered
- * @param userBounds the user space bounding box of the graphics
- * primitive being rendered
- * @param xform the {@link AffineTransform} from user space
- * into device space
- * @param hints a {@link RenderingHints} object that can be used to
- * specify how the pattern is ultimately rendered
- * @return the {@link PaintContext} used for generating color
- * patterns.
+ * Creates and returns a {@link PaintContext} used to
+ * generate a tiled image pattern.
+ * See the {@link Paint#createContext specification} of the
+ * method in the {@link Paint} interface for information
+ * on null parameter handling.
+ *
+ * @param cm the preferred {@link ColorModel} which represents the most convenient
+ * format for the caller to receive the pixel data, or {@code null}
+ * if there is no preference.
+ * @param deviceBounds the device space bounding box
+ * of the graphics primitive being rendered.
+ * @param userBounds the user space bounding box
+ * of the graphics primitive being rendered.
+ * @param xform the {@link AffineTransform} from user
+ * space into device space.
+ * @param hints the set of hints that the context object can use to
+ * choose between rendering alternatives.
+ * @return the {@code PaintContext} for
+ * generating color patterns.
+ * @see Paint
* @see PaintContext
+ * @see ColorModel
+ * @see Rectangle
+ * @see Rectangle2D
+ * @see AffineTransform
+ * @see RenderingHints
*/
public PaintContext createContext(ColorModel cm,
Rectangle deviceBounds,
--- a/jdk/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java Wed May 14 07:53:12 2008 -0700
@@ -298,7 +298,7 @@
while (continueLine(line)) {
String nextLine = in.readLine();
if (nextLine == null) {
- nextLine = new String("");
+ nextLine = "";
}
String loppedLine =
line.substring(0, line.length() - 1);
@@ -313,7 +313,7 @@
}
nextLine = nextLine.substring(startIndex,
nextLine.length());
- line = new String(loppedLine+nextLine);
+ line = loppedLine+nextLine;
}
// Find start of key
--- a/jdk/src/share/classes/java/awt/dnd/DragGestureEvent.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/java/awt/dnd/DragGestureEvent.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 1998-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1998-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -55,9 +55,19 @@
* platform dependent drag initiating gesture has occurred
* on the <code>Component</code> that it is tracking.
*
+ * The {@code action} field of any {@code DragGestureEvent} instance should take one of the following
+ * values:
+ * <ul>
+ * <li> {@code DnDConstants.ACTION_COPY}
+ * <li> {@code DnDConstants.ACTION_MOVE}
+ * <li> {@code DnDConstants.ACTION_LINK}
+ * </ul>
+ * Assigning the value different from listed above will cause an unspecified behavior.
+ *
* @see java.awt.dnd.DragGestureRecognizer
* @see java.awt.dnd.DragGestureListener
* @see java.awt.dnd.DragSource
+ * @see java.awt.dnd.DnDConstants
*/
public class DragGestureEvent extends EventObject {
@@ -65,19 +75,25 @@
private static final long serialVersionUID = 9080172649166731306L;
/**
- * Constructs a <code>DragGestureEvent</code> given the
- * <code>DragGestureRecognizer</code> firing this event,
- * an <code>int</code> representing
- * the user's preferred action, a <code>Point</code>
- * indicating the origin of the drag, and a <code>List</code>
- * of events that comprise the gesture.
+ * Constructs a <code>DragGestureEvent</code> object given by the
+ * <code>DragGestureRecognizer</code> instance firing this event,
+ * an {@code act} parameter representing
+ * the user's preferred action, an {@code ori} parameter
+ * indicating the origin of the drag, and a {@code List} of
+ * events that comprise the gesture({@code evs} parameter).
* <P>
* @param dgr The <code>DragGestureRecognizer</code> firing this event
- * @param act The the user's preferred action
+ * @param act The user's preferred action.
+ * For information on allowable values, see
+ * the class description for {@link DragGestureEvent}
* @param ori The origin of the drag
* @param evs The <code>List</code> of events that comprise the gesture
* <P>
- * @throws IllegalArgumentException if input parameters are {@code null}
+ * @throws IllegalArgumentException if any parameter equals {@code null}
+ * @throws IllegalArgumentException if the act parameter does not comply with
+ * the values given in the class
+ * description for {@link DragGestureEvent}
+ * @see java.awt.dnd.DnDConstants
*/
public DragGestureEvent(DragGestureRecognizer dgr, int act, Point ori,
--- a/jdk/src/share/classes/java/awt/dnd/DropTargetEvent.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/java/awt/dnd/DropTargetEvent.java Wed May 14 07:53:12 2008 -0700
@@ -45,10 +45,13 @@
private static final long serialVersionUID = 2821229066521922993L;
/**
- * Construct a <code>DropTargetEvent</code> with
- * a specified <code>DropTargetContext</code>.
+ * Construct a <code>DropTargetEvent</code> object with
+ * the specified <code>DropTargetContext</code>.
* <P>
- * @param dtc the <code>DropTargetContext</code>
+ * @param dtc The <code>DropTargetContext</code>
+ * @throws NullPointerException if {@code dtc} equals {@code null}.
+ * @see #getSource()
+ * @see #getDropTargetContext()
*/
public DropTargetEvent(DropTargetContext dtc) {
--- a/jdk/src/share/classes/java/awt/event/ActionEvent.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/java/awt/event/ActionEvent.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -45,6 +45,10 @@
* is therefore spared the details of processing individual mouse movements
* and mouse clicks, and can instead process a "meaningful" (semantic)
* event like "button pressed".
+ * <p>
+ * An unspecified behavior will be caused if the {@code id} parameter
+ * of any particular {@code ActionEvent} instance is not
+ * in the range from {@code ACTION_FIRST} to {@code ACTION_LAST}.
*
* @see ActionListener
* @see <a href="http://java.sun.com/docs/books/tutorial/post1.0/ui/eventmodel.html">Tutorial: Java 1.1 Event Model</a>
@@ -134,18 +138,22 @@
/**
* Constructs an <code>ActionEvent</code> object.
* <p>
- * Note that passing in an invalid <code>id</code> results in
- * unspecified behavior. This method throws an
+ * This method throws an
* <code>IllegalArgumentException</code> if <code>source</code>
* is <code>null</code>.
* A <code>null</code> <code>command</code> string is legal,
* but not recommended.
*
- * @param source the object that originated the event
- * @param id an integer that identifies the event
- * @param command a string that may specify a command (possibly one
+ * @param source The object that originated the event
+ * @param id An integer that identifies the event.
+ * For information on allowable values, see
+ * the class description for {@link ActionEvent}
+ * @param command A string that may specify a command (possibly one
* of several) associated with the event
* @throws IllegalArgumentException if <code>source</code> is null
+ * @see #getSource()
+ * @see #getID()
+ * @see #getActionCommand()
*/
public ActionEvent(Object source, int id, String command) {
this(source, id, command, 0);
@@ -154,19 +162,27 @@
/**
* Constructs an <code>ActionEvent</code> object with modifier keys.
* <p>
- * Note that passing in an invalid <code>id</code> results in
- * unspecified behavior. This method throws an
+ * This method throws an
* <code>IllegalArgumentException</code> if <code>source</code>
* is <code>null</code>.
* A <code>null</code> <code>command</code> string is legal,
* but not recommended.
*
- * @param source the object that originated the event
- * @param id an integer that identifies the event
- * @param command a string that may specify a command (possibly one
- * of several) associated with the event
- * @param modifiers the modifier keys held down during this action
+ * @param source The object that originated the event
+ * @param id An integer that identifies the event.
+ * For information on allowable values, see
+ * the class description for {@link ActionEvent}
+ * @param command A string that may specify a command (possibly one
+ * of several) associated with the event
+ * @param modifiers The modifier keys down during event
+ * (shift, ctrl, alt, meta).
+ * Passing negative parameter is not recommended.
+ * Zero value means that no modifiers were passed
* @throws IllegalArgumentException if <code>source</code> is null
+ * @see #getSource()
+ * @see #getID()
+ * @see #getActionCommand()
+ * @see #getModifiers()
*/
public ActionEvent(Object source, int id, String command, int modifiers) {
this(source, id, command, 0, modifiers);
@@ -176,20 +192,31 @@
* Constructs an <code>ActionEvent</code> object with the specified
* modifier keys and timestamp.
* <p>
- * Note that passing in an invalid <code>id</code> results in
- * unspecified behavior. This method throws an
+ * This method throws an
* <code>IllegalArgumentException</code> if <code>source</code>
* is <code>null</code>.
* A <code>null</code> <code>command</code> string is legal,
* but not recommended.
*
- * @param source the object that originated the event
- * @param id an integer that identifies the event
- * @param command a string that may specify a command (possibly one
- * of several) associated with the event
- * @param when the time the event occurred
- * @param modifiers the modifier keys held down during this action
+ * @param source The object that originated the event
+ * @param id An integer that identifies the event.
+ * For information on allowable values, see
+ * the class description for {@link ActionEvent}
+ * @param command A string that may specify a command (possibly one
+ * of several) associated with the event
+ * @param modifiers The modifier keys down during event
+ * (shift, ctrl, alt, meta).
+ * Passing negative parameter is not recommended.
+ * Zero value means that no modifiers were passed
+ * @param when A long that gives the time the event occurred.
+ * Passing negative or zero value
+ * is not recommended
* @throws IllegalArgumentException if <code>source</code> is null
+ * @see #getSource()
+ * @see #getID()
+ * @see #getActionCommand()
+ * @see #getModifiers()
+ * @see #getWhen()
*
* @since 1.4
*/
--- a/jdk/src/share/classes/java/awt/event/AdjustmentEvent.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/java/awt/event/AdjustmentEvent.java Wed May 14 07:53:12 2008 -0700
@@ -29,7 +29,25 @@
import java.awt.AWTEvent;
/**
- * The adjustment event emitted by Adjustable objects.
+ * The adjustment event emitted by Adjustable objects like
+ * {@link java.awt.Scrollbar} and {@link java.awt.ScrollPane}.
+ * When the user changes the value of the scrolling component,
+ * it receives an instance of {@code AdjustmentEvent}.
+ * <p>
+ * An unspecified behavior will be caused if the {@code id} parameter
+ * of any particular {@code AdjustmentEvent} instance is not
+ * in the range from {@code ADJUSTMENT_FIRST} to {@code ADJUSTMENT_LAST}.
+ * <p>
+ * The {@code type} of any {@code AdjustmentEvent} instance takes one of the following
+ * values:
+ * <ul>
+ * <li> {@code UNIT_INCREMENT}
+ * <li> {@code UNIT_DECREMENT}
+ * <li> {@code BLOCK_INCREMENT}
+ * <li> {@code BLOCK_DECREMENT}
+ * <li> {@code TRACK}
+ * </ul>
+ * Assigning the value different from listed above will cause an unspecified behavior.
* @see java.awt.Adjustable
* @see AdjustmentListener
*
@@ -130,17 +148,24 @@
* Constructs an <code>AdjustmentEvent</code> object with the
* specified <code>Adjustable</code> source, event type,
* adjustment type, and value.
- * <p>Note that passing in an invalid <code>id</code> results in
- * unspecified behavior. This method throws an
+ * <p> This method throws an
* <code>IllegalArgumentException</code> if <code>source</code>
* is <code>null</code>.
*
- * @param source the <code>Adjustable</code> object where the
+ * @param source The <code>Adjustable</code> object where the
* event originated
- * @param id the event type
- * @param type the adjustment type
- * @param value the current value of the adjustment
+ * @param id An integer indicating the type of event.
+ * For information on allowable values, see
+ * the class description for {@link AdjustmentEvent}
+ * @param type An integer indicating the adjustment type.
+ * For information on allowable values, see
+ * the class description for {@link AdjustmentEvent}
+ * @param value The current value of the adjustment
* @throws IllegalArgumentException if <code>source</code> is null
+ * @see #getSource()
+ * @see #getID()
+ * @see #getAdjustmentType()
+ * @see #getValue()
*/
public AdjustmentEvent(Adjustable source, int id, int type, int value) {
this(source, id, type, value, false);
@@ -149,22 +174,29 @@
/**
* Constructs an <code>AdjustmentEvent</code> object with the
* specified Adjustable source, event type, adjustment type, and value.
- * <p>Note that passing in an invalid <code>id</code> results in
- * unspecified behavior. This method throws an
+ * <p> This method throws an
* <code>IllegalArgumentException</code> if <code>source</code>
* is <code>null</code>.
-
*
- * @param source the <code>Adjustable</code> object where the
+ * @param source The <code>Adjustable</code> object where the
* event originated
- * @param id the event type
- * @param type the adjustment type
- * @param value the current value of the adjustment
- * @param isAdjusting <code>true</code> if the event is one
+ * @param id An integer indicating the type of event.
+ * For information on allowable values, see
+ * the class description for {@link AdjustmentEvent}
+ * @param type An integer indicating the adjustment type.
+ * For information on allowable values, see
+ * the class description for {@link AdjustmentEvent}
+ * @param value The current value of the adjustment
+ * @param isAdjusting A boolean that equals <code>true</code> if the event is one
* of a series of multiple adjusting events,
* otherwise <code>false</code>
* @throws IllegalArgumentException if <code>source</code> is null
* @since 1.4
+ * @see #getSource()
+ * @see #getID()
+ * @see #getAdjustmentType()
+ * @see #getValue()
+ * @see #getValueIsAdjusting()
*/
public AdjustmentEvent(Adjustable source, int id, int type, int value, boolean isAdjusting) {
super(source, id);
--- a/jdk/src/share/classes/java/awt/event/ComponentEvent.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/java/awt/event/ComponentEvent.java Wed May 14 07:53:12 2008 -0700
@@ -52,6 +52,10 @@
* (<code>ComponentAdapter</code> objects implement the
* <code>ComponentListener</code> interface.) Each such listener object
* gets this <code>ComponentEvent</code> when the event occurs.
+ * <p>
+ * An unspecified behavior will be caused if the {@code id} parameter
+ * of any particular {@code ComponentEvent} instance is not
+ * in the range from {@code COMPONENT_FIRST} to {@code COMPONENT_LAST}.
*
* @see ComponentAdapter
* @see ComponentListener
@@ -99,14 +103,17 @@
/**
* Constructs a <code>ComponentEvent</code> object.
- * <p>Note that passing in an invalid <code>id</code> results in
- * unspecified behavior. This method throws an
+ * <p> This method throws an
* <code>IllegalArgumentException</code> if <code>source</code>
* is <code>null</code>.
*
- * @param source the <code>Component</code> that originated the event
- * @param id an integer indicating the type of event
+ * @param source The <code>Component</code> that originated the event
+ * @param id An integer indicating the type of event.
+ * For information on allowable values, see
+ * the class description for {@link ComponentEvent}
* @throws IllegalArgumentException if <code>source</code> is null
+ * @see #getComponent()
+ * @see #getID()
*/
public ComponentEvent(Component source, int id) {
super(source, id);
--- a/jdk/src/share/classes/java/awt/event/ContainerEvent.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/java/awt/event/ContainerEvent.java Wed May 14 07:53:12 2008 -0700
@@ -45,6 +45,10 @@
* (<code>ContainerAdapter</code> objects implement the
* <code>ContainerListener</code> interface.) Each such listener object
* gets this <code>ContainerEvent</code> when the event occurs.
+ * <p>
+ * An unspecified behavior will be caused if the {@code id} parameter
+ * of any particular {@code ContainerEvent} instance is not
+ * in the range from {@code CONTAINER_FIRST} to {@code CONTAINER_LAST}.
*
* @see ContainerAdapter
* @see ContainerListener
@@ -92,16 +96,20 @@
/**
* Constructs a <code>ContainerEvent</code> object.
- * <p>Note that passing in an invalid <code>id</code> results in
- * unspecified behavior. This method throws an
+ * <p> This method throws an
* <code>IllegalArgumentException</code> if <code>source</code>
* is <code>null</code>.
*
- * @param source the <code>Component</code> object (container)
+ * @param source The <code>Component</code> object (container)
* that originated the event
- * @param id an integer indicating the type of event
+ * @param id An integer indicating the type of event.
+ * For information on allowable values, see
+ * the class description for {@link ContainerEvent}
* @param child the component that was added or removed
* @throws IllegalArgumentException if <code>source</code> is null
+ * @see #getContainer()
+ * @see #getID()
+ * @see #getChild()
*/
public ContainerEvent(Component source, int id, Component child) {
super(source, id);
--- a/jdk/src/share/classes/java/awt/event/FocusEvent.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/java/awt/event/FocusEvent.java Wed May 14 07:53:12 2008 -0700
@@ -50,6 +50,10 @@
* reactivated. Both permanent and temporary focus events are delivered using
* the FOCUS_GAINED and FOCUS_LOST event ids; the level may be distinguished in
* the event using the isTemporary() method.
+ * <p>
+ * An unspecified behavior will be caused if the {@code id} parameter
+ * of any particular {@code FocusEvent} instance is not
+ * in the range from {@code FOCUS_FIRST} to {@code FOCUS_LAST}.
*
* @see FocusAdapter
* @see FocusListener
@@ -121,18 +125,23 @@
* application, with a Java application in a different VM,
* or with no other <code>Component</code>, then the opposite
* <code>Component</code> is <code>null</code>.
- * <p>Note that passing in an invalid <code>id</code> results in
- * unspecified behavior. This method throws an
+ * <p> This method throws an
* <code>IllegalArgumentException</code> if <code>source</code>
* is <code>null</code>.
*
- * @param source the <code>Component</code> that originated the event
- * @param id <code>FOCUS_GAINED</code> or <code>FOCUS_LOST</code>
- * @param temporary <code>true</code> if the focus change is temporary;
+ * @param source The <code>Component</code> that originated the event
+ * @param id An integer indicating the type of event.
+ * For information on allowable values, see
+ * the class description for {@link FocusEvent}
+ * @param temporary Equals <code>true</code> if the focus change is temporary;
* <code>false</code> otherwise
- * @param opposite the other Component involved in the focus change,
+ * @param opposite The other Component involved in the focus change,
* or <code>null</code>
- * @throws IllegalArgumentException if <code>source</code> is null
+ * @throws IllegalArgumentException if <code>source</code> equals {@code null}
+ * @see #getSource()
+ * @see #getID()
+ * @see #isTemporary()
+ * @see #getOppositeComponent()
* @since 1.4
*/
public FocusEvent(Component source, int id, boolean temporary,
@@ -145,16 +154,20 @@
/**
* Constructs a <code>FocusEvent</code> object and identifies
* whether or not the change is temporary.
- * <p>Note that passing in an invalid <code>id</code> results in
- * unspecified behavior. This method throws an
+ * <p> This method throws an
* <code>IllegalArgumentException</code> if <code>source</code>
* is <code>null</code>.
*
- * @param source the <code>Component</code> that originated the event
- * @param id an integer indicating the type of event
- * @param temporary <code>true</code> if the focus change is temporary;
+ * @param source The <code>Component</code> that originated the event
+ * @param id An integer indicating the type of event.
+ * For information on allowable values, see
+ * the class description for {@link FocusEvent}
+ * @param temporary Equals <code>true</code> if the focus change is temporary;
* <code>false</code> otherwise
- * @throws IllegalArgumentException if <code>source</code> is null
+ * @throws IllegalArgumentException if <code>source</code> equals {@code null}
+ * @see #getSource()
+ * @see #getID()
+ * @see #isTemporary()
*/
public FocusEvent(Component source, int id, boolean temporary) {
this(source, id, temporary, null);
@@ -163,14 +176,17 @@
/**
* Constructs a <code>FocusEvent</code> object and identifies it
* as a permanent change in focus.
- * <p>Note that passing in an invalid <code>id</code> results in
- * unspecified behavior. This method throws an
+ * <p> This method throws an
* <code>IllegalArgumentException</code> if <code>source</code>
* is <code>null</code>.
*
- * @param source the <code>Component</code> that originated the event
- * @param id an integer indicating the type of event
- * @throws IllegalArgumentException if <code>source</code> is null
+ * @param source The <code>Component</code> that originated the event
+ * @param id An integer indicating the type of event.
+ * For information on allowable values, see
+ * the class description for {@link FocusEvent}
+ * @throws IllegalArgumentException if <code>source</code> equals {@code null}
+ * @see #getSource()
+ * @see #getID()
*/
public FocusEvent(Component source, int id) {
this(source, id, false);
--- a/jdk/src/share/classes/java/awt/event/HierarchyEvent.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/java/awt/event/HierarchyEvent.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1999-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@
/**
* An event which indicates a change to the <code>Component</code>
- * hierarchy to which a <code>Component</code> belongs.
+ * hierarchy to which <code>Component</code> belongs.
* <ul>
* <li>Hierarchy Change Events (HierarchyListener)
* <ul>
@@ -58,16 +58,30 @@
* Container is added, removed, moved, or resized, and passed down the
* hierarchy. It is also generated by a Component object when that object's
* <code>addNotify</code>, <code>removeNotify</code>, <code>show</code>, or
- * <code>hide</code> method is called. ANCESTOR_MOVED and ANCESTOR_RESIZED
+ * <code>hide</code> method is called. The {@code ANCESTOR_MOVED} and
+ * {@code ANCESTOR_RESIZED}
* events are dispatched to every <code>HierarchyBoundsListener</code> or
* <code>HierarchyBoundsAdapter</code> object which registered to receive
* such events using the Component's <code>addHierarchyBoundsListener</code>
* method. (<code>HierarchyBoundsAdapter</code> objects implement the <code>
- * HierarchyBoundsListener</code> interface.) HIERARCHY_CHANGED events are
+ * HierarchyBoundsListener</code> interface.) The {@code HIERARCHY_CHANGED} events are
* dispatched to every <code>HierarchyListener</code> object which registered
* to receive such events using the Component's <code>addHierarchyListener
* </code> method. Each such listener object gets this <code>HierarchyEvent
* </code> when the event occurs.
+ * <p>
+ * An unspecified behavior will be caused if the {@code id} parameter
+ * of any particular {@code HierarchyEvent} instance is not
+ * in the range from {@code HIERARCHY_FIRST} to {@code HIERARCHY_LAST}.
+ * <br>
+ * The {@code changeFlags} parameter of any {@code HierarchyEvent} instance takes one of the following
+ * values:
+ * <ul>
+ * <li> {@code HierarchyEvent.PARENT_CHANGED}
+ * <li> {@code HierarchyEvent.DISPLAYABILITY_CHANGED}
+ * <li> {@code HierarchyEvent.SHOWING_CHANGED}
+ * </ul>
+ * Assigning the value different from listed above will cause unspecified behavior.
*
* @author David Mendenhall
* @see HierarchyListener
@@ -108,20 +122,20 @@
public static final int HIERARCHY_LAST = ANCESTOR_RESIZED;
/**
- * Indicates that the <code>HIERARCHY_CHANGED</code> event
+ * A change flag indicates that the <code>HIERARCHY_CHANGED</code> event
* was generated by a reparenting operation.
*/
public static final int PARENT_CHANGED = 0x1;
/**
- * Indicates that the <code>HIERARCHY_CHANGED</code> event
- * was generated due to a change in the displayability
- * of the hierarchy. To discern the
- * current displayability of the hierarchy, call
- * <code>Component.isDisplayable</code>. Displayability changes occur
- * in response to explicit or implicit calls to
+ * A change flag indicates that the <code>HIERARCHY_CHANGED</code> event
+ * was generated due to the changing of the hierarchy displayability.
+ * To discern the
+ * current displayability of the hierarchy, call the
+ * <code>Component.isDisplayable</code> method. Displayability changes occur
+ * in response to explicit or implicit calls of the
* <code>Component.addNotify</code> and
- * <code>Component.removeNotify</code>.
+ * <code>Component.removeNotify</code> methods.
*
* @see java.awt.Component#isDisplayable()
* @see java.awt.Component#addNotify()
@@ -130,15 +144,15 @@
public static final int DISPLAYABILITY_CHANGED = 0x2;
/**
- * Indicates that the <code>HIERARCHY_CHANGED</code> event
- * was generated due to a change in the showing state
- * of the hierarchy. To discern the
- * current showing state of the hierarchy, call
- * <code>Component.isShowing</code>. Showing state changes occur
+ * A change flag indicates that the <code>HIERARCHY_CHANGED</code> event
+ * was generated due to the changing of the hierarchy showing state.
+ * To discern the
+ * current showing state of the hierarchy, call the
+ * <code>Component.isShowing</code> method. Showing state changes occur
* when either the displayability or visibility of the
* hierarchy occurs. Visibility changes occur in response to explicit
- * or implicit calls to <code>Component.show</code> and
- * <code>Component.hide</code>.
+ * or implicit calls of the <code>Component.show</code> and
+ * <code>Component.hide</code> methods.
*
* @see java.awt.Component#isShowing()
* @see java.awt.Component#addNotify()
@@ -155,20 +169,26 @@
/**
* Constructs an <code>HierarchyEvent</code> object to identify a
* change in the <code>Component</code> hierarchy.
- * <p>Note that passing in an invalid <code>id</code> results in
- * unspecified behavior. This method throws an
+ * <p>This method throws an
* <code>IllegalArgumentException</code> if <code>source</code>
* is <code>null</code>.
*
- * @param source the <code>Component</code> object that
+ * @param source The <code>Component</code> object that
* originated the event
- * @param id an integer indicating the type of event
- * @param changed the <code>Component</code> at the top of
+ * @param id An integer indicating the type of event.
+ * For information on allowable values, see
+ * the class description for {@link HierarchyEvent}
+ * @param changed The <code>Component</code> at the top of
* the hierarchy which was changed
- * @param changedParent the parent of <code>changed</code>; this
+ * @param changedParent The parent of the <code>changed</code> component.
+ * This
* may be the parent before or after the
* change, depending on the type of change
- * @throws IllegalArgumentException if <code>source</code> is null
+ * @throws IllegalArgumentException if <code>source</code> is {@code null}
+ * @see #getSource()
+ * @see #getID()
+ * @see #getChanged()
+ * @see #getChangedParent()
*/
public HierarchyEvent(Component source, int id, Component changed,
Container changedParent) {
@@ -180,23 +200,32 @@
/**
* Constructs an <code>HierarchyEvent</code> object to identify
* a change in the <code>Component</code> hierarchy.
- * <p>Note that passing in an invalid <code>id</code> results in
- * unspecified behavior. This method throws an
+ * <p> This method throws an
* <code>IllegalArgumentException</code> if <code>source</code>
* is <code>null</code>.
*
- * @param source the <code>Component</code> object that
+ * @param source The <code>Component</code> object that
* originated the event
- * @param id an integer indicating the type of event
- * @param changed the <code>Component</code> at the top
+ * @param id An integer indicating the type of event.
+ * For information on allowable values, see
+ * the class description for {@link HierarchyEvent}
+ * @param changed The <code>Component</code> at the top
* of the hierarchy which was changed
- * @param changedParent the parent of <code>changed</code>; this
+ * @param changedParent The parent of the <code>changed</code> component.
+ * This
* may be the parent before or after the
* change, depending on the type of change
- * @param changeFlags a bitmask which indicates the type(s) of
- * <code>HIERARCHY_CHANGED</code> events
- * represented in this event object
+ * @param changeFlags A bitmask which indicates the type(s) of
+ * the <code>HIERARCHY_CHANGED</code> events
+ * represented in this event object.
+ * For information on allowable values, see
+ * the class description for {@link HierarchyEvent}
* @throws IllegalArgumentException if <code>source</code> is null
+ * @see #getSource()
+ * @see #getID()
+ * @see #getChanged()
+ * @see #getChangedParent()
+ * @see #getChangeFlags()
*/
public HierarchyEvent(Component source, int id, Component changed,
Container changedParent, long changeFlags) {
--- a/jdk/src/share/classes/java/awt/event/InputEvent.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/java/awt/event/InputEvent.java Wed May 14 07:53:12 2008 -0700
@@ -208,17 +208,32 @@
/**
* Constructs an InputEvent object with the specified source component,
* modifiers, and type.
- * <p>Note that passing in an invalid <code>id</code> results in
- * unspecified behavior. This method throws an
+ * <p> This method throws an
* <code>IllegalArgumentException</code> if <code>source</code>
* is <code>null</code>.
*
* @param source the object where the event originated
- * @param id the event type
- * @param when the time the event occurred
- * @param modifiers represents the modifier keys and mouse buttons down
- * while the event occurred
+ * @param id the integer that identifies the event type.
+ * It is allowed to pass as parameter any value that
+ * allowed for some subclass of {@code InputEvent} class.
+ * Passing in the value different from those values result
+ * in unspecified behavior
+ * @param when a long int that gives the time the event occurred.
+ * Passing negative or zero value
+ * is not recommended
+ * @param modifiers the modifier keys down during event (e.g. shift, ctrl,
+ * alt, meta)
+ * Passing negative parameter is not recommended.
+ * Zero value means no modifiers.
+ * Either extended _DOWN_MASK or old _MASK modifiers
+ * should be used, but both models should not be mixed
+ * in one event. Use of the extended modifiers is
+ * preferred
* @throws IllegalArgumentException if <code>source</code> is null
+ * @see #getSource()
+ * @see #getID()
+ * @see #getWhen()
+ * @see #getModifiers()
*/
InputEvent(Component source, int id, long when, int modifiers) {
super(source, id);
@@ -285,7 +300,8 @@
}
/**
- * Returns the timestamp of when this event occurred.
+ * Returns the difference in milliseconds between the timestamp of when this event occurred and
+ * midnight, January 1, 1970 UTC.
*/
public long getWhen() {
return when;
@@ -358,7 +374,12 @@
* Returns a String describing the extended modifier keys and
* mouse buttons, such as "Shift", "Button1", or "Ctrl+Shift".
* These strings can be localized by changing the
- * awt.properties file.
+ * <code>awt.properties</code> file.
+ * <p>
+ * Note that passing negative parameter is incorrect,
+ * and will cause the returning an unspecified string.
+ * Zero parameter means that no modifiers were passed and will
+ * cause the returning an empty string.
*
* @param modifiers a modifier mask describing the extended
* modifier keys and mouse buttons for the event
--- a/jdk/src/share/classes/java/awt/event/InvocationEvent.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/java/awt/event/InvocationEvent.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 1998-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1998-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -39,6 +39,10 @@
* can use this fact to write replacement functions for <code>invokeLater
* </code> and <code>invokeAndWait</code> without writing special-case code
* in any <code>AWTEventListener</code> objects.
+ * <p>
+ * An unspecified behavior will be caused if the {@code id} parameter
+ * of any particular {@code InvocationEvent} instance is not
+ * in the range from {@code INVOCATION_FIRST} to {@code INVOCATION_LAST}.
*
* @author Fred Ecks
* @author David Mendenhall
@@ -123,12 +127,13 @@
* <p> This method throws an <code>IllegalArgumentException</code>
* if <code>source</code> is <code>null</code>.
*
- * @param source the <code>Object</code> that originated the event
- * @param runnable the <code>Runnable</code> whose <code>run</code>
+ * @param source The <code>Object</code> that originated the event
+ * @param runnable The <code>Runnable</code> whose <code>run</code>
* method will be executed
* @throws IllegalArgumentException if <code>source</code> is null
*
- * @see #InvocationEvent(Object, Runnable, Object, boolean)
+ * @see #getSource()
+ * @see #InvocationEvent(Object, Runnable, Object, boolean)
*/
public InvocationEvent(Object source, Runnable runnable) {
this(source, runnable, null, false);
@@ -147,15 +152,15 @@
* <p>This method throws an <code>IllegalArgumentException</code>
* if <code>source</code> is <code>null</code>.
*
- * @param source the <code>Object</code> that originated
+ * @param source The <code>Object</code> that originated
* the event
- * @param runnable the <code>Runnable</code> whose
+ * @param runnable The <code>Runnable</code> whose
* <code>run</code> method will be
* executed
- * @param notifier the Object whose <code>notifyAll</code>
+ * @param notifier The {@code Object} whose <code>notifyAll</code>
* method will be called after
* <code>Runnable.run</code> has returned
- * @param catchThrowables specifies whether <code>dispatch</code>
+ * @param catchThrowables Specifies whether <code>dispatch</code>
* should catch Throwable when executing
* the <code>Runnable</code>'s <code>run</code>
* method, or should instead propagate those
@@ -163,6 +168,7 @@
* dispatch loop
* @throws IllegalArgumentException if <code>source</code> is null
*
+ * @see #getSource()
* @see #InvocationEvent(Object, int, Runnable, Object, boolean)
*/
public InvocationEvent(Object source, Runnable runnable, Object notifier,
@@ -176,26 +182,29 @@
* method when dispatched. If notifier is non-<code>null</code>,
* <code>notifyAll</code> will be called on it
* immediately after <code>run</code> returns.
- * <p>Note that passing in an invalid <code>id</code> results in
- * unspecified behavior. This method throws an
+ * <p>This method throws an
* <code>IllegalArgumentException</code> if <code>source</code>
* is <code>null</code>.
*
- * @param source the <code>Object</code> that originated
+ * @param source The <code>Object</code> that originated
* the event
- * @param id the ID for the event
- * @param runnable the <code>Runnable</code> whose
+ * @param id An integer indicating the type of event.
+ * For information on allowable values, see
+ * the class description for {@link InvocationEvent}
+ * @param runnable The <code>Runnable</code> whose
* <code>run</code> method will be executed
- * @param notifier the <code>Object</code> whose <code>notifyAll</code>
+ * @param notifier The <code>Object</code> whose <code>notifyAll</code>
* method will be called after
* <code>Runnable.run</code> has returned
- * @param catchThrowables specifies whether <code>dispatch</code>
+ * @param catchThrowables Specifies whether <code>dispatch</code>
* should catch Throwable when executing the
* <code>Runnable</code>'s <code>run</code>
* method, or should instead propagate those
* Throwables to the EventDispatchThread's
* dispatch loop
* @throws IllegalArgumentException if <code>source</code> is null
+ * @see #getSource()
+ * @see #getID()
*/
protected InvocationEvent(Object source, int id, Runnable runnable,
Object notifier, boolean catchThrowables) {
--- a/jdk/src/share/classes/java/awt/event/ItemEvent.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/java/awt/event/ItemEvent.java Wed May 14 07:53:12 2008 -0700
@@ -41,6 +41,18 @@
* spared the details of processing individual mouse movements and mouse
* clicks, and can instead process a "meaningful" (semantic) event like
* "item selected" or "item deselected".
+ * <p>
+ * An unspecified behavior will be caused if the {@code id} parameter
+ * of any particular {@code ItemEvent} instance is not
+ * in the range from {@code ITEM_FIRST} to {@code ITEM_LAST}.
+ * <p>
+ * The {@code stateChange} of any {@code ItemEvent} instance takes one of the following
+ * values:
+ * <ul>
+ * <li> {@code ItemEvent.SELECTED}
+ * <li> {@code ItemEvent.DESELECTED}
+ * </ul>
+ * Assigning the value different from listed above will cause an unspecified behavior.
*
* @author Carl Quinn
*
@@ -101,19 +113,24 @@
/**
* Constructs an <code>ItemEvent</code> object.
- * <p>Note that passing in an invalid <code>id</code> results in
- * unspecified behavior. This method throws an
+ * <p> This method throws an
* <code>IllegalArgumentException</code> if <code>source</code>
* is <code>null</code>.
*
- * @param source the <code>ItemSelectable</code> object
+ * @param source The <code>ItemSelectable</code> object
* that originated the event
- * @param id an integer that identifies the event type
- * @param item an object -- the item affected by the event
- * @param stateChange
- * an integer that indicates whether the item was
- * selected or deselected
+ * @param id The integer that identifies the event type.
+ * For information on allowable values, see
+ * the class description for {@link ItemEvent}
+ * @param item An object -- the item affected by the event
+ * @param stateChange An integer that indicates whether the item was
+ * selected or deselected.
+ * For information on allowable values, see
+ * the class description for {@link ItemEvent}
* @throws IllegalArgumentException if <code>source</code> is null
+ * @see #getItemSelectable()
+ * @see #getID()
+ * @see #getStateChange()
*/
public ItemEvent(ItemSelectable source, int id, Object item, int stateChange) {
super(source, id);
--- a/jdk/src/share/classes/java/awt/event/KeyEvent.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/java/awt/event/KeyEvent.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -128,6 +128,10 @@
* (VK_ENTER, VK_BACK_SPACE, and VK_TAB), do not rely on the values of the VK_
* constants. Sun reserves the right to change these values as needed
* to accomodate a wider range of keyboards in the future.
+ * <p>
+ * An unspecified behavior will be caused if the {@code id} parameter
+ * of any particular {@code KeyEvent} instance is not
+ * in the range from {@code KEY_FIRST} to {@code KEY_LAST}.
*
* @author Carl Quinn
* @author Amy Fowler
@@ -914,27 +918,32 @@
/**
* Constructs a <code>KeyEvent</code> object.
- * <p>Note that passing in an invalid <code>id</code> results in
- * unspecified behavior. This method throws an
+ * <p>This method throws an
* <code>IllegalArgumentException</code> if <code>source</code>
* is <code>null</code>.
*
- * @param source the <code>Component</code> that originated the event
- * @param id an integer identifying the type of event
- * @param when a long integer that specifies the time the event
- * occurred
- * @param modifiers the modifier keys down during event (shift, ctrl,
- * alt, meta)
- * Either extended _DOWN_MASK or old _MASK modifiers
- * should be used, but both models should not be mixed
- * in one event. Use of the extended modifiers is
- * preferred.
- * @param keyCode the integer code for an actual key, or VK_UNDEFINED
+ * @param source The <code>Component</code> that originated the event
+ * @param id An integer indicating the type of event.
+ * For information on allowable values, see
+ * the class description for {@link KeyEvent}
+ * @param when A long integer that specifies the time the event
+ * occurred.
+ * Passing negative or zero value
+ * is not recommended
+ * @param modifiers The modifier keys down during event (shift, ctrl,
+ * alt, meta).
+ * Passing negative value
+ * is not recommended.
+ * Zero value means that no modifiers were passed.
+ * Use either an extended _DOWN_MASK or old _MASK modifiers,
+ * however do not mix models in the one event.
+ * The extended modifiers are preferred for using
+ * @param keyCode The integer code for an actual key, or VK_UNDEFINED
* (for a key-typed event)
- * @param keyChar the Unicode character generated by this event, or
+ * @param keyChar The Unicode character generated by this event, or
* CHAR_UNDEFINED (for key-pressed and key-released
* events which do not map to a valid Unicode character)
- * @param keyLocation identifies the key location. The only legal
+ * @param keyLocation Identifies the key location. The only legal
* values are <code>KEY_LOCATION_UNKNOWN</code>,
* <code>KEY_LOCATION_STANDARD</code>, <code>KEY_LOCATION_LEFT</code>,
* <code>KEY_LOCATION_RIGHT</code>, and <code>KEY_LOCATION_NUMPAD</code>.
@@ -948,6 +957,13 @@
* or if <code>keyLocation</code> is not one of the legal
* values enumerated above.
* @throws IllegalArgumentException if <code>source</code> is null
+ * @see #getSource()
+ * @see #getID()
+ * @see #getWhen()
+ * @see #getModifiers()
+ * @see #getKeyCode()
+ * @see #getKeyChar()
+ * @see #getKeyLocation()
* @since 1.4
*/
public KeyEvent(Component source, int id, long when, int modifiers,
@@ -982,24 +998,29 @@
/**
* Constructs a <code>KeyEvent</code> object.
- * <p>Note that passing in an invalid <code>id</code> results in
- * unspecified behavior. This method throws an
+ * <p> This method throws an
* <code>IllegalArgumentException</code> if <code>source</code>
* is <code>null</code>.
*
- * @param source the <code>Component</code> that originated the event
- * @param id an integer identifying the type of event
- * @param when a long integer that specifies the time the event
- * occurred
- * @param modifiers the modifier keys down during event (shift, ctrl,
- * alt, meta)
- * Either extended _DOWN_MASK or old _MASK modifiers
- * should be used, but both models should not be mixed
- * in one event. Use of the extended modifiers is
- * preferred.
- * @param keyCode the integer code for an actual key, or VK_UNDEFINED
+ * @param source The <code>Component</code> that originated the event
+ * @param id An integer indicating the type of event.
+ * For information on allowable values, see
+ * the class description for {@link KeyEvent}
+ * @param when A long integer that specifies the time the event
+ * occurred.
+ * Passing negative or zero value
+ * is not recommended
+ * @param modifiers The modifier keys down during event (shift, ctrl,
+ * alt, meta).
+ * Passing negative value
+ * is not recommended.
+ * Zero value means that no modifiers were passed.
+ * Use either an extended _DOWN_MASK or old _MASK modifiers,
+ * however do not mix models in the one event.
+ * The extended modifiers are preferred for using
+ * @param keyCode The integer code for an actual key, or VK_UNDEFINED
* (for a key-typed event)
- * @param keyChar the Unicode character generated by this event, or
+ * @param keyChar The Unicode character generated by this event, or
* CHAR_UNDEFINED (for key-pressed and key-released
* events which do not map to a valid Unicode character)
* @throws IllegalArgumentException if <code>id</code> is
@@ -1008,6 +1029,12 @@
* <code>KEY_TYPED</code> and <code>keyCode</code> is not
* <code>VK_UNDEFINED</code>
* @throws IllegalArgumentException if <code>source</code> is null
+ * @see #getSource()
+ * @see #getID()
+ * @see #getWhen()
+ * @see #getModifiers()
+ * @see #getKeyCode()
+ * @see #getKeyChar()
*/
public KeyEvent(Component source, int id, long when, int modifiers,
int keyCode, char keyChar) {
--- a/jdk/src/share/classes/java/awt/event/MouseEvent.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/java/awt/event/MouseEvent.java Wed May 14 07:53:12 2008 -0700
@@ -159,6 +159,11 @@
* The reported coordinates for mouse drag events are clipped to fit within the
* bounds of the virtual device associated with the <code>Component</code>.
* </ul>
+ * <p>
+ * An unspecified behavior will be caused if the {@code id} parameter
+ * of any particular {@code MouseEvent} instance is not
+ * in the range from {@code MOUSE_FIRST} to {@code MOUSE_LAST}-1
+ * ({@code MOUSE_WHEEL} is not acceptable).
*
* @author Carl Quinn
*
@@ -418,8 +423,7 @@
* specified source component,
* type, modifiers, coordinates, and click count.
* <p>
- * Note that passing in an invalid <code>id</code> results in
- * unspecified behavior. Creating an invalid event (such
+ * Creating an invalid event (such
* as by using more than one of the old _MASKs, or modifier/button
* values which don't match) results in unspecified behavior.
* An invocation of the form
@@ -435,28 +439,44 @@
* <code>IllegalArgumentException</code> if <code>source</code>
* is <code>null</code>.
*
- * @param source the <code>Component</code> that originated the event
- * @param id the integer that identifies the event
- * @param when a long int that gives the time the event occurred
- * @param modifiers the modifier keys down during event (e.g. shift, ctrl,
+ * @param source The <code>Component</code> that originated the event
+ * @param id An integer indicating the type of event.
+ * For information on allowable values, see
+ * the class description for {@link MouseEvent}
+ * @param when A long integer that gives the time the event occurred.
+ * Passing negative or zero value
+ * is not recommended
+ * @param modifiers The modifier keys down during event (e.g. shift, ctrl,
* alt, meta)
- * Either extended _DOWN_MASK or old _MASK modifiers
- * should be used, but both models should not be mixed
- * in one event. Use of the extended modifiers is
- * preferred.
- * @param x the horizontal x coordinate for the mouse location
- * @param y the vertical y coordinate for the mouse location
- * @param clickCount the number of mouse clicks associated with event
- * @param popupTrigger a boolean, true if this event is a trigger for a
- * popup menu
- * @param button which of the mouse buttons has changed state.
- * <code>NOBUTTON</code>,
- * <code>BUTTON1</code>,
- * <code>BUTTON2</code> or
- * <code>BUTTON3</code>.
+ * Passing negative parameter
+ * is not recommended.
+ * Zero value means that no modifiers were passed.
+ * Use either an extended _DOWN_MASK or old _MASK modifiers,
+ * however do not mix models in the one event.
+ * The extended modifiers are preferred for using
+ * @param x The horizontal x coordinate for the mouse location.
+ * It is allowed to pass negative values
+ * @param y The vertical y coordinate for the mouse location.
+ * It is allowed to pass negative values
+ * @param clickCount The number of mouse clicks associated with event.
+ * Passing negative value
+ * is not recommended
+ * @param popupTrigger A boolean that equals {@code true} if this event
+ * is a trigger for a popup menu
+ * @param button An integer that indicates, which of the mouse buttons has
+ * changed its state
* @throws IllegalArgumentException if an invalid <code>button</code>
* value is passed in
* @throws IllegalArgumentException if <code>source</code> is null
+ * @see #getSource()
+ * @see #getID()
+ * @see #getWhen()
+ * @see #getModifiers()
+ * @see #getX()
+ * @see #getY()
+ * @see #getClickCount()
+ * @see #isPopupTrigger()
+ * @see #getButton()
* @since 1.4
*/
public MouseEvent(Component source, int id, long when, int modifiers,
@@ -479,8 +499,6 @@
* Constructs a <code>MouseEvent</code> object with the
* specified source component,
* type, modifiers, coordinates, and click count.
- * <p>Note that passing in an invalid <code>id</code> results in
- * unspecified behavior.
* An invocation of the form
* <tt>MouseEvent(source, id, when, modifiers, x, y, clickCount, popupTrigger)</tt>
* behaves in exactly the same way as the invocation
@@ -493,21 +511,39 @@
* This method throws an <code>IllegalArgumentException</code>
* if <code>source</code> is <code>null</code>.
*
- * @param source the <code>Component</code> that originated the event
- * @param id the integer that identifies the event
- * @param when a long int that gives the time the event occurred
- * @param modifiers the modifier keys down during event (e.g. shift, ctrl,
+ * @param source The <code>Component</code> that originated the event
+ * @param id An integer indicating the type of event.
+ * For information on allowable values, see
+ * the class description for {@link MouseEvent}
+ * @param when A long integer that gives the time the event occurred.
+ * Passing negative or zero value
+ * is not recommended
+ * @param modifiers The modifier keys down during event (e.g. shift, ctrl,
* alt, meta)
- * Either extended _DOWN_MASK or old _MASK modifiers
- * should be used, but both models should not be mixed
- * in one event. Use of the extended modifiers is
- * preferred.
- * @param x the horizontal x coordinate for the mouse location
- * @param y the vertical y coordinate for the mouse location
- * @param clickCount the number of mouse clicks associated with event
- * @param popupTrigger a boolean, true if this event is a trigger for a
- * popup menu
+ * Passing negative parameter
+ * is not recommended.
+ * Zero value means that no modifiers were passed.
+ * Use either an extended _DOWN_MASK or old _MASK modifiers,
+ * however do not mix models in the one event.
+ * The extended modifiers are preferred for using
+ * @param x The horizontal x coordinate for the mouse location.
+ * It is allowed to pass negative values
+ * @param y The vertical y coordinate for the mouse location.
+ * It is allowed to pass negative values
+ * @param clickCount The number of mouse clicks associated with event.
+ * Passing negative value
+ * is not recommended
+ * @param popupTrigger A boolean that equals {@code true} if this event
+ * is a trigger for a popup menu
* @throws IllegalArgumentException if <code>source</code> is null
+ * @see #getSource()
+ * @see #getID()
+ * @see #getWhen()
+ * @see #getModifiers()
+ * @see #getX()
+ * @see #getY()
+ * @see #getClickCount()
+ * @see #isPopupTrigger()
*/
public MouseEvent(Component source, int id, long when, int modifiers,
int x, int y, int clickCount, boolean popupTrigger) {
@@ -520,8 +556,7 @@
* specified source component,
* type, modifiers, coordinates, absolute coordinates, and click count.
* <p>
- * Note that passing in an invalid <code>id</code> results in
- * unspecified behavior. Creating an invalid event (such
+ * Creating an invalid event (such
* as by using more than one of the old _MASKs, or modifier/button
* values which don't match) results in unspecified behavior.
* Even if inconsistent values for relative and absolute coordinates are
@@ -531,30 +566,50 @@
* <code>IllegalArgumentException</code> if <code>source</code>
* is <code>null</code>.
*
- * @param source the <code>Component</code> that originated the event
- * @param id the integer that identifies the event
- * @param when a long int that gives the time the event occurred
- * @param modifiers the modifier keys down during event (e.g. shift, ctrl,
+ * @param source The <code>Component</code> that originated the event
+ * @param id An integer indicating the type of event.
+ * For information on allowable values, see
+ * the class description for {@link MouseEvent}
+ * @param when A long integer that gives the time the event occurred.
+ * Passing negative or zero value
+ * is not recommended
+ * @param modifiers The modifier keys down during event (e.g. shift, ctrl,
* alt, meta)
- * Either extended _DOWN_MASK or old _MASK modifiers
- * should be used, but both models should not be mixed
- * in one event. Use of the extended modifiers is
- * preferred.
- * @param x the horizontal x coordinate for the mouse location
- * @param y the vertical y coordinate for the mouse location
- * @param xAbs the absolute horizontal x coordinate for the mouse location
- * @param yAbs the absolute vertical y coordinate for the mouse location
- * @param clickCount the number of mouse clicks associated with event
- * @param popupTrigger a boolean, true if this event is a trigger for a
- * popup menu
- * @param button which of the mouse buttons has changed state.
- * <code>NOBUTTON</code>,
- * <code>BUTTON1</code>,
- * <code>BUTTON2</code> or
- * <code>BUTTON3</code>.
+ * Passing negative parameter
+ * is not recommended.
+ * Zero value means that no modifiers were passed.
+ * Use either an extended _DOWN_MASK or old _MASK modifiers,
+ * however do not mix models in the one event.
+ * The extended modifiers are preferred for using
+ * @param x The horizontal x coordinate for the mouse location.
+ * It is allowed to pass negative values
+ * @param y The vertical y coordinate for the mouse location.
+ * It is allowed to pass negative values
+ * @param xAbs The absolute horizontal x coordinate for the mouse location
+ * It is allowed to pass negative values
+ * @param yAbs The absolute vertical y coordinate for the mouse location
+ * It is allowed to pass negative values
+ * @param clickCount The number of mouse clicks associated with event.
+ * Passing negative value
+ * is not recommended
+ * @param popupTrigger A boolean that equals {@code true} if this event
+ * is a trigger for a popup menu
+ * @param button An integer that indicates, which of the mouse buttons has
+ * changed its state
* @throws IllegalArgumentException if an invalid <code>button</code>
* value is passed in
* @throws IllegalArgumentException if <code>source</code> is null
+ * @see #getSource()
+ * @see #getID()
+ * @see #getWhen()
+ * @see #getModifiers()
+ * @see #getX()
+ * @see #getY()
+ * @see #getXOnScreen()
+ * @see #getYOnScreen()
+ * @see #getClickCount()
+ * @see #isPopupTrigger()
+ * @see #getButton()
* @since 1.6
*/
public MouseEvent(Component source, int id, long when, int modifiers,
@@ -675,21 +730,26 @@
}
/**
- * Returns a <code>String</code> describing the modifier keys and
+ * Returns a <code>String</code> instance describing the modifier keys and
* mouse buttons that were down during the event, such as "Shift",
* or "Ctrl+Shift". These strings can be localized by changing
* the <code>awt.properties</code> file.
* <p>
- * Note that <code>InputEvent.ALT_MASK</code> and
- * <code>InputEvent.BUTTON2_MASK</code> have the same value,
- * so the string "Alt" is returned for both modifiers. Likewise,
- * <code>InputEvent.META_MASK</code> and
- * <code>InputEvent.BUTTON3_MASK</code> have the same value,
- * so the string "Meta" is returned for both modifiers.
+ * Note that the <code>InputEvent.ALT_MASK</code> and
+ * <code>InputEvent.BUTTON2_MASK</code> have equal values,
+ * so the "Alt" string is returned for both modifiers. Likewise,
+ * the <code>InputEvent.META_MASK</code> and
+ * <code>InputEvent.BUTTON3_MASK</code> have equal values,
+ * so the "Meta" string is returned for both modifiers.
+ * <p>
+ * Note that passing negative parameter is incorrect,
+ * and will cause the returning an unspecified string.
+ * Zero parameter means that no modifiers were passed and will
+ * cause the returning an empty string.
*
- * @param modifiers a modifier mask describing the modifier keys and
+ * @param modifiers A modifier mask describing the modifier keys and
* mouse buttons that were down during the event
- * @return string a text description of the combination of modifier
+ * @return string string text description of the combination of modifier
* keys and mouse buttons that were down during the event
* @see InputEvent#getModifiersExText(int)
* @since 1.4
--- a/jdk/src/share/classes/java/awt/event/MouseWheelEvent.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/java/awt/event/MouseWheelEvent.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
--- a/jdk/src/share/classes/java/awt/event/PaintEvent.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/java/awt/event/PaintEvent.java Wed May 14 07:53:12 2008 -0700
@@ -36,6 +36,10 @@
* designed to be used with the Event Listener model; programs
* should continue to override paint/update methods in order
* render themselves properly.
+ * <p>
+ * An unspecified behavior will be caused if the {@code id} parameter
+ * of any particular {@code PaintEvent} instance is not
+ * in the range from {@code PAINT_FIRST} to {@code PAINT_LAST}.
*
* @author Amy Fowler
* @since 1.1
@@ -82,15 +86,19 @@
/**
* Constructs a <code>PaintEvent</code> object with the specified
* source component and type.
- * <p>Note that passing in an invalid <code>id</code> results in
- * unspecified behavior. This method throws an
+ * <p> This method throws an
* <code>IllegalArgumentException</code> if <code>source</code>
* is <code>null</code>.
*
- * @param source the object where the event originated
- * @param id the event type
- * @param updateRect the rectangle area which needs to be repainted
+ * @param source The object where the event originated
+ * @param id The integer that identifies the event type.
+ * For information on allowable values, see
+ * the class description for {@link PaintEvent}
+ * @param updateRect The rectangle area which needs to be repainted
* @throws IllegalArgumentException if <code>source</code> is null
+ * @see #getSource()
+ * @see #getID()
+ * @see #getUpdateRect()
*/
public PaintEvent(Component source, int id, Rectangle updateRect) {
super(source, id);
--- a/jdk/src/share/classes/java/awt/event/TextEvent.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/java/awt/event/TextEvent.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,12 +38,15 @@
* this <code>TextEvent</code> when the event occurs. The listener is
* spared the details of processing individual mouse movements and key strokes
* Instead, it can process a "meaningful" (semantic) event like "text changed".
+ * <p>
+ * An unspecified behavior will be caused if the {@code id} parameter
+ * of any particular {@code TextEvent} instance is not
+ * in the range from {@code TEXT_FIRST} to {@code TEXT_LAST}.
*
* @author Georges Saab
*
* @see java.awt.TextComponent
* @see TextListener
- * @see <a href="http://java.sun.com/docs/books/tutorial/post1.0/ui/textlistener.html">Tutorial: Writing a Text Listener</a>
*
* @since 1.1
*/
@@ -72,15 +75,18 @@
/**
* Constructs a <code>TextEvent</code> object.
- * <p>Note that passing in an invalid <code>id</code> results in
- * unspecified behavior. This method throws an
+ * <p> This method throws an
* <code>IllegalArgumentException</code> if <code>source</code>
* is <code>null</code>.
*
- * @param source the (<code>TextComponent</code>) object that
+ * @param source The (<code>TextComponent</code>) object that
* originated the event
- * @param id an integer that identifies the event type
+ * @param id An integer that identifies the event type.
+ * For information on allowable values, see
+ * the class description for {@link TextEvent}
* @throws IllegalArgumentException if <code>source</code> is null
+ * @see #getSource()
+ * @see #getID()
*/
public TextEvent(Object source, int id) {
super(source, id);
--- a/jdk/src/share/classes/java/awt/event/TextListener.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/java/awt/event/TextListener.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -40,7 +40,6 @@
* @author Georges Saab
*
* @see TextEvent
- * @see <a href="http://java.sun.com/docs/books/tutorial/post1.0/ui/textlistener.html">Tutorial: Writing a Text Listener</a>
*
* @since 1.1
*/
--- a/jdk/src/share/classes/java/awt/event/WindowEvent.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/java/awt/event/WindowEvent.java Wed May 14 07:53:12 2008 -0700
@@ -41,6 +41,10 @@
* (<code>WindowAdapter</code> objects implement the
* <code>WindowListener</code> interface.) Each such listener object
* gets this <code>WindowEvent</code> when the event occurs.
+ * <p>
+ * An unspecified behavior will be caused if the {@code id} parameter
+ * of any particular {@code WindowEvent} instance is not
+ * in the range from {@code WINDOW_FIRST} to {@code WINDOW_LAST}.
*
* @author Carl Quinn
* @author Amy Fowler
@@ -170,20 +174,27 @@
/**
* Constructs a <code>WindowEvent</code> object.
- * <p>Note that passing in an invalid <code>id</code> results in
- * unspecified behavior. This method throws an
+ * <p>This method throws an
* <code>IllegalArgumentException</code> if <code>source</code>
* is <code>null</code>.
*
- * @param source the <code>Window</code> object
+ * @param source The <code>Window</code> object
* that originated the event
- * @param id an integer indicating the type of event.
- * @param opposite the other window involved in the focus or activation
+ * @param id An integer indicating the type of event.
+ * For information on allowable values, see
+ * the class description for {@link WindowEvent}
+ * @param opposite The other window involved in the focus or activation
* change, or <code>null</code>
- * @param oldState previous state of the window for window state
- * change event
- * @param newState new state of the window for window state change event
+ * @param oldState Previous state of the window for window state change event.
+ * See {@code #getOldState()} for allowable values
+ * @param newState New state of the window for window state change event.
+ * See {@code #getNewState()} for allowable values
* @throws IllegalArgumentException if <code>source</code> is null
+ * @see #getWindow()
+ * @see #getID()
+ * @see #getOppositeWindow()
+ * @see #getOldState()
+ * @see #getNewState()
* @since 1.4
*/
public WindowEvent(Window source, int id, Window opposite,
@@ -209,24 +220,28 @@
* If this focus change occurs with a native application, with a
* Java application in a different VM, or with no other
* <code>Window</code>, then the opposite Window is <code>null</code>.
- * <p>Note that passing in an invalid <code>id</code> results in
- * unspecified behavior. This method throws an
+ * <p>This method throws an
* <code>IllegalArgumentException</code> if <code>source</code>
* is <code>null</code>.
*
- * @param source the <code>Window</code> object that
+ * @param source The <code>Window</code> object that
* originated the event
- * @param id <code>WINDOW_ACTIVATED</code>,
- * <code>WINDOW_DEACTIVATED</code>,
- * <code>WINDOW_GAINED_FOCUS</code>,
- * or <code>WINDOW_LOST_FOCUS</code>. It is
- * expected that this constructor will not be used for
- * other <code>WindowEvent</code> types because the
- * opposite <code>Window</code> of such events
- * will always be <code>null</code>
- * @param opposite the other <code>Window</code> involved in the
+ * @param id An integer indicating the type of event.
+ * For information on allowable values, see
+ * the class description for {@link WindowEvent}.
+ * It is expected that this constructor will not
+ * be used for other then
+ * {@code WINDOW_ACTIVATED},{@code WINDOW_DEACTIVATED},
+ * {@code WINDOW_GAINED_FOCUS}, or {@code WINDOW_LOST_FOCUS}.
+ * {@code WindowEvent} types,
+ * because the opposite <code>Window</code> of other event types
+ * will always be {@code null}.
+ * @param opposite The other <code>Window</code> involved in the
* focus or activation change, or <code>null</code>
* @throws IllegalArgumentException if <code>source</code> is null
+ * @see #getWindow()
+ * @see #getID()
+ * @see #getOppositeWindow()
* @since 1.4
*/
public WindowEvent(Window source, int id, Window opposite) {
@@ -236,21 +251,30 @@
/**
* Constructs a <code>WindowEvent</code> object with the specified
* previous and new window states.
- * <p>Note that passing in an invalid <code>id</code> results in
- * unspecified behavior. This method throws an
+ * <p>This method throws an
* <code>IllegalArgumentException</code> if <code>source</code>
* is <code>null</code>.
*
- * @param source the <code>Window</code> object
+ * @param source The <code>Window</code> object
* that originated the event
- * @param id <code>WINDOW_STATE_CHANGED</code> event type.
+ * @param id An integer indicating the type of event.
+ * For information on allowable values, see
+ * the class description for {@link WindowEvent}.
* It is expected that this constructor will not
- * be used for other <code>WindowEvent</code>
+ * be used for other then
+ * {@code WINDOW_STATE_CHANGED}
+ * {@code WindowEvent}
* types, because the previous and new window
* states are meaningless for other event types.
- * @param oldState an integer representing the previous window state
- * @param newState an integer representing the new window state
+ * @param oldState An integer representing the previous window state.
+ * See {@code #getOldState()} for allowable values
+ * @param newState An integer representing the new window state.
+ * See {@code #getNewState()} for allowable values
* @throws IllegalArgumentException if <code>source</code> is null
+ * @see #getWindow()
+ * @see #getID()
+ * @see #getOldState()
+ * @see #getNewState()
* @since 1.4
*/
public WindowEvent(Window source, int id, int oldState, int newState) {
@@ -259,14 +283,17 @@
/**
* Constructs a <code>WindowEvent</code> object.
- * <p>Note that passing in an invalid <code>id</code> results in
- * unspecified behavior. This method throws an
+ * <p>This method throws an
* <code>IllegalArgumentException</code> if <code>source</code>
* is <code>null</code>.
*
- * @param source the <code>Window</code> object that originated the event
- * @param id an integer indicating the type of event
+ * @param source The <code>Window</code> object that originated the event
+ * @param id An integer indicating the type of event.
+ * For information on allowable values, see
+ * the class description for {@link WindowEvent}.
* @throws IllegalArgumentException if <code>source</code> is null
+ * @see #getWindow()
+ * @see #getID()
*/
public WindowEvent(Window source, int id) {
this(source, id, null, 0, 0);
--- a/jdk/src/share/classes/java/awt/image/BufferedImage.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/java/awt/image/BufferedImage.java Wed May 14 07:53:12 2008 -0700
@@ -1210,9 +1210,9 @@
* <code>BufferedImage</code>.
*/
public String toString() {
- return new String("BufferedImage@"+Integer.toHexString(hashCode())
- +": type = "+imageType
- +" "+colorModel+" "+raster);
+ return "BufferedImage@"+Integer.toHexString(hashCode())
+ +": type = "+imageType
+ +" "+colorModel+" "+raster;
}
/**
--- a/jdk/src/share/classes/java/text/DictionaryBasedBreakIterator.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/java/text/DictionaryBasedBreakIterator.java Wed May 14 07:53:12 2008 -0700
@@ -384,7 +384,7 @@
// on the last character of a legal word. Push that position onto
// the possible-break-positions stack
if (dictionary.getNextState(state, 0) == -1) {
- possibleBreakPositions.push(new Integer(text.getIndex()));
+ possibleBreakPositions.push(Integer.valueOf(text.getIndex()));
}
// look up the new state to transition to in the dictionary
@@ -395,7 +395,7 @@
// and we've successfully traversed the whole range. Drop out
// of the loop.
if (state == -1) {
- currentBreakPositions.push(new Integer(text.getIndex()));
+ currentBreakPositions.push(Integer.valueOf(text.getIndex()));
break;
}
@@ -496,7 +496,7 @@
if (!currentBreakPositions.isEmpty()) {
currentBreakPositions.pop();
}
- currentBreakPositions.push(new Integer(endPos));
+ currentBreakPositions.push(Integer.valueOf(endPos));
// create a regular array to hold the break positions and copy
// the break positions from the stack to the array (in addition,
--- a/jdk/src/share/classes/java/text/MessageFormat.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/java/text/MessageFormat.java Wed May 14 07:53:12 2008 -0700
@@ -1286,7 +1286,7 @@
characterIterators.add(
createAttributedCharacterIterator(
subIterator, Field.ARGUMENT,
- new Integer(argumentNumber)));
+ Integer.valueOf(argumentNumber)));
last = result.length();
}
arg = null;
@@ -1296,7 +1296,7 @@
characterIterators.add(
createAttributedCharacterIterator(
arg, Field.ARGUMENT,
- new Integer(argumentNumber)));
+ Integer.valueOf(argumentNumber)));
last = result.length();
}
}
--- a/jdk/src/share/classes/javax/imageio/stream/ImageInputStreamImpl.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/imageio/stream/ImageInputStreamImpl.java Wed May 14 07:53:12 2008 -0700
@@ -778,8 +778,8 @@
*/
public void mark() {
try {
- markByteStack.push(new Long(getStreamPosition()));
- markBitStack.push(new Integer(getBitOffset()));
+ markByteStack.push(Long.valueOf(getStreamPosition()));
+ markBitStack.push(Integer.valueOf(getBitOffset()));
} catch (IOException e) {
}
}
--- a/jdk/src/share/classes/javax/swing/AbstractButton.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/AbstractButton.java Wed May 14 07:53:12 2008 -0700
@@ -2050,14 +2050,14 @@
null, AccessibleState.SELECTED);
accessibleContext.firePropertyChange(
AccessibleContext.ACCESSIBLE_VALUE_PROPERTY,
- new Integer(0), new Integer(1));
+ Integer.valueOf(0), Integer.valueOf(1));
} else {
accessibleContext.firePropertyChange(
AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
AccessibleState.SELECTED, null);
accessibleContext.firePropertyChange(
AccessibleContext.ACCESSIBLE_VALUE_PROPERTY,
- new Integer(1), new Integer(0));
+ Integer.valueOf(1), Integer.valueOf(0));
}
}
}
@@ -2555,9 +2555,9 @@
*/
public Number getCurrentAccessibleValue() {
if (isSelected()) {
- return new Integer(1);
+ return Integer.valueOf(1);
} else {
- return new Integer(0);
+ return Integer.valueOf(0);
}
}
@@ -2586,7 +2586,7 @@
* @return an Integer of 0.
*/
public Number getMinimumAccessibleValue() {
- return new Integer(0);
+ return Integer.valueOf(0);
}
/**
@@ -2595,7 +2595,7 @@
* @return An Integer of 1.
*/
public Number getMaximumAccessibleValue() {
- return new Integer(1);
+ return Integer.valueOf(1);
}
--- a/jdk/src/share/classes/javax/swing/DebugGraphicsInfo.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/DebugGraphicsInfo.java Wed May 14 07:53:12 2008 -0700
@@ -49,7 +49,7 @@
componentToDebug = new Hashtable();
}
if (debug > 0) {
- componentToDebug.put(component, new Integer(debug));
+ componentToDebug.put(component, Integer.valueOf(debug));
} else {
componentToDebug.remove(component);
}
--- a/jdk/src/share/classes/javax/swing/JInternalFrame.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/JInternalFrame.java Wed May 14 07:53:12 2008 -0700
@@ -1285,7 +1285,7 @@
* description: Specifies what desktop layer is used.
*/
public void setLayer(int layer) {
- this.setLayer(new Integer(layer));
+ this.setLayer(Integer.valueOf(layer));
}
/**
@@ -2092,7 +2092,7 @@
* have a value
*/
public Number getCurrentAccessibleValue() {
- return new Integer(getLayer());
+ return Integer.valueOf(getLayer());
}
/**
@@ -2116,7 +2116,7 @@
* have a minimum value
*/
public Number getMinimumAccessibleValue() {
- return new Integer(Integer.MIN_VALUE);
+ return Integer.MIN_VALUE;
}
/**
@@ -2126,7 +2126,7 @@
* have a maximum value
*/
public Number getMaximumAccessibleValue() {
- return new Integer(Integer.MAX_VALUE);
+ return Integer.MAX_VALUE;
}
} // AccessibleJInternalFrame
--- a/jdk/src/share/classes/javax/swing/JOptionPane.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/JOptionPane.java Wed May 14 07:53:12 2008 -0700
@@ -1512,7 +1512,7 @@
iFrame.putClientProperty("JInternalFrame.frameType", "optionDialog");
iFrame.putClientProperty("JInternalFrame.messageType",
- new Integer(getMessageType()));
+ Integer.valueOf(getMessageType()));
iFrame.addInternalFrameListener(new InternalFrameAdapter() {
public void internalFrameClosing(InternalFrameEvent e) {
--- a/jdk/src/share/classes/javax/swing/JProgressBar.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/JProgressBar.java Wed May 14 07:53:12 2008 -0700
@@ -775,9 +775,9 @@
accessibleContext.firePropertyChange(
AccessibleContext.ACCESSIBLE_VALUE_PROPERTY,
(oldModel== null
- ? null : new Integer(oldModel.getValue())),
+ ? null : Integer.valueOf(oldModel.getValue())),
(newModel== null
- ? null : new Integer(newModel.getValue())));
+ ? null : Integer.valueOf(newModel.getValue())));
}
if (model != null) {
@@ -850,8 +850,8 @@
if (accessibleContext != null) {
accessibleContext.firePropertyChange(
AccessibleContext.ACCESSIBLE_VALUE_PROPERTY,
- new Integer(oldValue),
- new Integer(brm.getValue()));
+ Integer.valueOf(oldValue),
+ Integer.valueOf(brm.getValue()));
}
}
@@ -1087,7 +1087,7 @@
* @return the current value of this object
*/
public Number getCurrentAccessibleValue() {
- return new Integer(getValue());
+ return Integer.valueOf(getValue());
}
/**
@@ -1110,7 +1110,7 @@
* @return the minimum value of this object
*/
public Number getMinimumAccessibleValue() {
- return new Integer(getMinimum());
+ return Integer.valueOf(getMinimum());
}
/**
@@ -1120,7 +1120,7 @@
*/
public Number getMaximumAccessibleValue() {
// TIGER - 4422362
- return new Integer(model.getMaximum() - model.getExtent());
+ return Integer.valueOf(model.getMaximum() - model.getExtent());
}
} // AccessibleJProgressBar
--- a/jdk/src/share/classes/javax/swing/JScrollBar.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/JScrollBar.java Wed May 14 07:53:12 2008 -0700
@@ -314,7 +314,7 @@
BoundedRangeModel oldModel = model;
if (model != null) {
model.removeChangeListener(fwdAdjustmentEvents);
- oldValue = new Integer(model.getValue());
+ oldValue = Integer.valueOf(model.getValue());
}
model = newModel;
if (model != null) {
@@ -465,8 +465,8 @@
if (accessibleContext != null) {
accessibleContext.firePropertyChange(
AccessibleContext.ACCESSIBLE_VALUE_PROPERTY,
- new Integer(oldValue),
- new Integer(m.getValue()));
+ Integer.valueOf(oldValue),
+ Integer.valueOf(m.getValue()));
}
}
@@ -611,8 +611,8 @@
if (accessibleContext != null) {
accessibleContext.firePropertyChange(
AccessibleContext.ACCESSIBLE_VALUE_PROPERTY,
- new Integer(oldValue),
- new Integer(m.getValue()));
+ Integer.valueOf(oldValue),
+ Integer.valueOf(m.getValue()));
}
}
@@ -880,7 +880,7 @@
* @return The current value of this object.
*/
public Number getCurrentAccessibleValue() {
- return new Integer(getValue());
+ return Integer.valueOf(getValue());
}
/**
@@ -903,7 +903,7 @@
* @return The minimum value of this object.
*/
public Number getMinimumAccessibleValue() {
- return new Integer(getMinimum());
+ return Integer.valueOf(getMinimum());
}
/**
--- a/jdk/src/share/classes/javax/swing/JSlider.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/JSlider.java Wed May 14 07:53:12 2008 -0700
@@ -485,9 +485,9 @@
accessibleContext.firePropertyChange(
AccessibleContext.ACCESSIBLE_VALUE_PROPERTY,
(oldModel == null
- ? null : new Integer(oldModel.getValue())),
+ ? null : Integer.valueOf(oldModel.getValue())),
(newModel == null
- ? null : new Integer(newModel.getValue())));
+ ? null : Integer.valueOf(newModel.getValue())));
}
}
@@ -538,8 +538,8 @@
if (accessibleContext != null) {
accessibleContext.firePropertyChange(
AccessibleContext.ACCESSIBLE_VALUE_PROPERTY,
- new Integer(oldValue),
- new Integer(m.getValue()));
+ Integer.valueOf(oldValue),
+ Integer.valueOf(m.getValue()));
}
}
@@ -581,7 +581,7 @@
public void setMinimum(int minimum) {
int oldMin = getModel().getMinimum();
getModel().setMinimum(minimum);
- firePropertyChange( "minimum", new Integer( oldMin ), new Integer( minimum ) );
+ firePropertyChange( "minimum", Integer.valueOf( oldMin ), Integer.valueOf( minimum ) );
}
@@ -622,7 +622,7 @@
public void setMaximum(int maximum) {
int oldMax = getModel().getMaximum();
getModel().setMaximum(maximum);
- firePropertyChange( "maximum", new Integer( oldMax ), new Integer( maximum ) );
+ firePropertyChange( "maximum", Integer.valueOf( oldMax ), Integer.valueOf( maximum ) );
}
@@ -989,7 +989,7 @@
void createLabels() {
for ( int labelIndex = start; labelIndex <= getMaximum(); labelIndex += increment ) {
- put( new Integer( labelIndex ), new LabelUIResource( ""+labelIndex, JLabel.CENTER ) );
+ put( Integer.valueOf( labelIndex ), new LabelUIResource( ""+labelIndex, JLabel.CENTER ) );
}
}
}
@@ -1463,7 +1463,7 @@
* @return The current value of this object.
*/
public Number getCurrentAccessibleValue() {
- return new Integer(getValue());
+ return Integer.valueOf(getValue());
}
/**
@@ -1486,7 +1486,7 @@
* @return The minimum value of this object.
*/
public Number getMinimumAccessibleValue() {
- return new Integer(getMinimum());
+ return Integer.valueOf(getMinimum());
}
/**
@@ -1497,7 +1497,7 @@
public Number getMaximumAccessibleValue() {
// TIGER - 4422362
BoundedRangeModel model = JSlider.this.getModel();
- return new Integer(model.getMaximum() - model.getExtent());
+ return Integer.valueOf(model.getMaximum() - model.getExtent());
}
} // AccessibleJSlider
}
--- a/jdk/src/share/classes/javax/swing/JSplitPane.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/JSplitPane.java Wed May 14 07:53:12 2008 -0700
@@ -1195,7 +1195,7 @@
* @return a localized String describing the value of this object
*/
public Number getCurrentAccessibleValue() {
- return new Integer(getDividerLocation());
+ return Integer.valueOf(getDividerLocation());
}
@@ -1220,7 +1220,7 @@
* @return The minimum value of this object.
*/
public Number getMinimumAccessibleValue() {
- return new Integer(getUI().getMinimumDividerLocation(
+ return Integer.valueOf(getUI().getMinimumDividerLocation(
JSplitPane.this));
}
@@ -1231,7 +1231,7 @@
* @return The maximum value of this object.
*/
public Number getMaximumAccessibleValue() {
- return new Integer(getUI().getMaximumDividerLocation(
+ return Integer.valueOf(getUI().getMaximumDividerLocation(
JSplitPane.this));
}
--- a/jdk/src/share/classes/javax/swing/JTabbedPane.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/JTabbedPane.java Wed May 14 07:53:12 2008 -0700
@@ -969,7 +969,7 @@
// currently no IndexPropertyChangeEvent. Once
// IndexPropertyChangeEvents have been added this code should be
// modified to use it.
- putClientProperty("__index_to_remove__", new Integer(index));
+ putClientProperty("__index_to_remove__", Integer.valueOf(index));
/* if the selected tab is after the removal */
if (selected > index) {
--- a/jdk/src/share/classes/javax/swing/JTable.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/JTable.java Wed May 14 07:53:12 2008 -0700
@@ -7680,7 +7680,7 @@
*/
public Accessible getAccessibleRowDescription(int r) {
if (r < 0 || r >= getAccessibleRowCount()) {
- throw new IllegalArgumentException(new Integer(r).toString());
+ throw new IllegalArgumentException(Integer.toString(r));
}
if (rowDescription == null) {
return null;
@@ -7698,7 +7698,7 @@
*/
public void setAccessibleRowDescription(int r, Accessible a) {
if (r < 0 || r >= getAccessibleRowCount()) {
- throw new IllegalArgumentException(new Integer(r).toString());
+ throw new IllegalArgumentException(Integer.toString(r));
}
if (rowDescription == null) {
int numRows = getAccessibleRowCount();
@@ -7716,7 +7716,7 @@
*/
public Accessible getAccessibleColumnDescription(int c) {
if (c < 0 || c >= getAccessibleColumnCount()) {
- throw new IllegalArgumentException(new Integer(c).toString());
+ throw new IllegalArgumentException(Integer.toString(c));
}
if (columnDescription == null) {
return null;
@@ -7734,7 +7734,7 @@
*/
public void setAccessibleColumnDescription(int c, Accessible a) {
if (c < 0 || c >= getAccessibleColumnCount()) {
- throw new IllegalArgumentException(new Integer(c).toString());
+ throw new IllegalArgumentException(Integer.toString(c));
}
if (columnDescription == null) {
int numColumns = getAccessibleColumnCount();
--- a/jdk/src/share/classes/javax/swing/JTextArea.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/JTextArea.java Wed May 14 07:53:12 2008 -0700
@@ -267,7 +267,7 @@
Document doc = getDocument();
if (doc != null) {
int old = getTabSize();
- doc.putProperty(PlainDocument.tabSizeAttribute, new Integer(size));
+ doc.putProperty(PlainDocument.tabSizeAttribute, Integer.valueOf(size));
firePropertyChange("tabSize", old, size);
}
}
--- a/jdk/src/share/classes/javax/swing/SpinnerNumberModel.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/SpinnerNumberModel.java Wed May 14 07:53:12 2008 -0700
@@ -144,7 +144,7 @@
* <code>minimum <= value <= maximum</code>
*/
public SpinnerNumberModel(int value, int minimum, int maximum, int stepSize) {
- this(new Integer(value), new Integer(minimum), new Integer(maximum), new Integer(stepSize));
+ this(Integer.valueOf(value), Integer.valueOf(minimum), Integer.valueOf(maximum), Integer.valueOf(stepSize));
}
@@ -171,7 +171,7 @@
* <code>stepSize</code> equal to one, and an initial value of zero.
*/
public SpinnerNumberModel() {
- this(new Integer(0), null, null, new Integer(1));
+ this(Integer.valueOf(0), null, null, Integer.valueOf(1));
}
@@ -333,16 +333,16 @@
long v = value.longValue() + (stepSize.longValue() * (long)dir);
if (value instanceof Long) {
- newValue = new Long(v);
+ newValue = Long.valueOf(v);
}
else if (value instanceof Integer) {
- newValue = new Integer((int)v);
+ newValue = Integer.valueOf((int)v);
}
else if (value instanceof Short) {
- newValue = new Short((short)v);
+ newValue = Short.valueOf((short)v);
}
else {
- newValue = new Byte((byte)v);
+ newValue = Byte.valueOf((byte)v);
}
}
--- a/jdk/src/share/classes/javax/swing/TablePrintable.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/TablePrintable.java Wed May 14 07:53:12 2008 -0700
@@ -215,7 +215,7 @@
}
// to pass the page number when formatting the header and footer text
- Object[] pageNumber = new Object[]{new Integer(pageIndex + 1)};
+ Object[] pageNumber = new Object[]{Integer.valueOf(pageIndex + 1)};
// fetch the formatted header text, if any
String headerText = null;
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicButtonUI.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicButtonUI.java Wed May 14 07:53:12 2008 -0700
@@ -109,7 +109,7 @@
LookAndFeel.installProperty(b, "rolloverEnabled", rollover);
}
- LookAndFeel.installProperty(b, "iconTextGap", new Integer(4));
+ LookAndFeel.installProperty(b, "iconTextGap", Integer.valueOf(4));
}
protected void installListeners(AbstractButton b) {
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java Wed May 14 07:53:12 2008 -0700
@@ -654,7 +654,7 @@
"javax.swing.plaf.basic.BasicIconFactory",
"getRadioButtonMenuItemIcon");
- Object menuItemAcceleratorDelimiter = new String("+");
+ Object menuItemAcceleratorDelimiter = "+";
// *** OptionPane value objects
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java Wed May 14 07:53:12 2008 -0700
@@ -146,7 +146,7 @@
menuItem.setMargin(UIManager.getInsets(prefix + ".margin"));
}
- LookAndFeel.installProperty(menuItem, "iconTextGap", new Integer(4));
+ LookAndFeel.installProperty(menuItem, "iconTextGap", Integer.valueOf(4));
defaultTextIconGap = menuItem.getIconTextGap();
LookAndFeel.installBorder(menuItem, prefix + ".border");
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java Wed May 14 07:53:12 2008 -0700
@@ -1195,10 +1195,10 @@
if (options == null) {
if (optionType == JOptionPane.OK_CANCEL_OPTION &&
buttonIndex == 1) {
- optionPane.setValue(new Integer(2));
+ optionPane.setValue(Integer.valueOf(2));
} else {
- optionPane.setValue(new Integer(buttonIndex));
+ optionPane.setValue(Integer.valueOf(buttonIndex));
}
} else {
optionPane.setValue(options[buttonIndex]);
@@ -1393,7 +1393,7 @@
if (getName() == CLOSE) {
JOptionPane optionPane = (JOptionPane)e.getSource();
- optionPane.setValue(new Integer(JOptionPane.CLOSED_OPTION));
+ optionPane.setValue(Integer.valueOf(JOptionPane.CLOSED_OPTION));
}
}
}
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java Wed May 14 07:53:12 2008 -0700
@@ -539,7 +539,7 @@
}
mnemonicInputMap.put(KeyStroke.getKeyStroke(mnemonic, Event.ALT_MASK),
"setSelectedIndex");
- mnemonicToIndexMap.put(new Integer(mnemonic), new Integer(index));
+ mnemonicToIndexMap.put(Integer.valueOf(mnemonic), Integer.valueOf(index));
}
/**
@@ -2231,7 +2231,7 @@
mnemonic -= ('a' - 'A');
}
Integer index = (Integer)ui.mnemonicToIndexMap.
- get(new Integer(mnemonic));
+ get(Integer.valueOf(mnemonic));
if (index != null && pane.isEnabledAt(index.intValue())) {
pane.setSelectedIndex(index.intValue());
}
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarUI.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarUI.java Wed May 14 07:53:12 2008 -0700
@@ -178,7 +178,7 @@
dragWindow = null;
dockingSource = null;
- c.putClientProperty( FOCUSED_COMP_INDEX, new Integer( focusedCompIndex ) );
+ c.putClientProperty( FOCUSED_COMP_INDEX, Integer.valueOf( focusedCompIndex ) );
}
protected void installDefaults( )
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java Wed May 14 07:53:12 2008 -0700
@@ -455,7 +455,7 @@
Insets zeroInsets = new InsetsUIResource(0, 0, 0, 0);
- Integer zero = new Integer(0);
+ Integer zero = Integer.valueOf(0);
Object textFieldBorder =
new SwingLazyValue("javax.swing.plaf.metal.MetalBorders",
@@ -904,7 +904,7 @@
"ProgressBar.selectionBackground", primaryControlDarkShadow,
"ProgressBar.border", progressBarBorder,
"ProgressBar.cellSpacing", zero,
- "ProgressBar.cellLength", new Integer(1),
+ "ProgressBar.cellLength", Integer.valueOf(1),
// Combo Box
"ComboBox.background", control,
@@ -971,7 +971,7 @@
"DesktopIcon.font", controlTextValue,
"DesktopIcon.foreground", controlTextColor,
"DesktopIcon.background", control,
- "DesktopIcon.width", new Integer(160),
+ "DesktopIcon.width", Integer.valueOf(160),
"Desktop.ancestorInputMap",
new UIDefaults.LazyInputMap(new Object[] {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthArrowButton.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthArrowButton.java Wed May 14 07:53:12 2008 -0700
@@ -53,7 +53,7 @@
public void setDirection(int dir) {
direction = dir;
- putClientProperty("__arrow_direction__", new Integer(dir));
+ putClientProperty("__arrow_direction__", Integer.valueOf(dir));
repaint();
}
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopPaneUI.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopPaneUI.java Wed May 14 07:53:12 2008 -0700
@@ -96,7 +96,7 @@
}
taskBar.setBackground(desktop.getBackground());
desktop.add(taskBar,
- new Integer(JLayeredPane.PALETTE_LAYER.intValue() + 1));
+ Integer.valueOf(JLayeredPane.PALETTE_LAYER.intValue() + 1));
if (desktop.isShowing()) {
taskBar.adjustSize();
}
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSplitPaneUI.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSplitPaneUI.java Wed May 14 07:53:12 2008 -0700
@@ -127,7 +127,7 @@
if (style != oldStyle) {
Object value = style.get(context, "SplitPane.size");
if (value == null) {
- value = new Integer(6);
+ value = Integer.valueOf(6);
}
LookAndFeel.installProperty(splitPane, "dividerSize", value);
--- a/jdk/src/share/classes/javax/swing/table/TableColumn.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/table/TableColumn.java Wed May 14 07:53:12 2008 -0700
@@ -281,7 +281,7 @@
private void firePropertyChange(String propertyName, int oldValue, int newValue) {
if (oldValue != newValue) {
- firePropertyChange(propertyName, new Integer(oldValue), new Integer(newValue));
+ firePropertyChange(propertyName, Integer.valueOf(oldValue), Integer.valueOf(newValue));
}
}
--- a/jdk/src/share/classes/javax/swing/text/AbstractDocument.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/text/AbstractDocument.java Wed May 14 07:53:12 2008 -0700
@@ -351,7 +351,7 @@
* loaded asynchronously
*/
public void setAsynchronousLoadPriority(int p) {
- Integer loadPriority = (p >= 0) ? new Integer(p) : null;
+ Integer loadPriority = (p >= 0) ? Integer.valueOf(p) : null;
putProperty(AbstractDocument.AsyncLoadPriority, loadPriority);
}
@@ -2675,7 +2675,7 @@
*/
BidiElement(Element parent, int start, int end, int level) {
super(parent, new SimpleAttributeSet(), start, end);
- addAttribute(StyleConstants.BidiLevel, new Integer(level));
+ addAttribute(StyleConstants.BidiLevel, Integer.valueOf(level));
//System.out.println("BidiElement: start = " + start
// + " end = " + end + " level = " + level );
}
--- a/jdk/src/share/classes/javax/swing/text/NumberFormatter.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/text/NumberFormatter.java Wed May 14 07:53:12 2008 -0700
@@ -173,23 +173,24 @@
*/
private Object convertValueToValueClass(Object value, Class valueClass) {
if (valueClass != null && (value instanceof Number)) {
+ Number numberValue = (Number)value;
if (valueClass == Integer.class) {
- return new Integer(((Number)value).intValue());
+ return Integer.valueOf(numberValue.intValue());
}
else if (valueClass == Long.class) {
- return new Long(((Number)value).longValue());
+ return Long.valueOf(numberValue.longValue());
}
else if (valueClass == Float.class) {
- return new Float(((Number)value).floatValue());
+ return Float.valueOf(numberValue.floatValue());
}
else if (valueClass == Double.class) {
- return new Double(((Number)value).doubleValue());
+ return Double.valueOf(numberValue.doubleValue());
}
else if (valueClass == Byte.class) {
- return new Byte(((Number)value).byteValue());
+ return Byte.valueOf(numberValue.byteValue());
}
else if (valueClass == Short.class) {
- return new Short(((Number)value).shortValue());
+ return Short.valueOf(numberValue.shortValue());
}
}
return value;
--- a/jdk/src/share/classes/javax/swing/text/PlainDocument.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/text/PlainDocument.java Wed May 14 07:53:12 2008 -0700
@@ -89,7 +89,7 @@
*/
public PlainDocument(Content c) {
super(c);
- putProperty(tabSizeAttribute, new Integer(8));
+ putProperty(tabSizeAttribute, Integer.valueOf(8));
defaultRoot = createDefaultRoot();
}
--- a/jdk/src/share/classes/javax/swing/text/Segment.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/text/Segment.java Wed May 14 07:53:12 2008 -0700
@@ -118,7 +118,7 @@
if (array != null) {
return new String(array, offset, count);
}
- return new String();
+ return "";
}
// --- CharacterIterator methods -------------------------------------
--- a/jdk/src/share/classes/javax/swing/text/StyleConstants.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/text/StyleConstants.java Wed May 14 07:53:12 2008 -0700
@@ -296,7 +296,7 @@
* @param o the bidi level value
*/
public static void setBidiLevel(MutableAttributeSet a, int o) {
- a.addAttribute(BidiLevel, new Integer(o));
+ a.addAttribute(BidiLevel, Integer.valueOf(o));
}
/**
@@ -386,7 +386,7 @@
* @param s the font size
*/
public static void setFontSize(MutableAttributeSet a, int s) {
- a.addAttribute(FontSize, new Integer(s));
+ a.addAttribute(FontSize, Integer.valueOf(s));
}
/**
@@ -753,7 +753,7 @@
* @param align the alignment value
*/
public static void setAlignment(MutableAttributeSet a, int align) {
- a.addAttribute(Alignment, new Integer(align));
+ a.addAttribute(Alignment, Integer.valueOf(align));
}
/**
--- a/jdk/src/share/classes/javax/swing/text/html/AccessibleHTML.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/text/html/AccessibleHTML.java Wed May 14 07:53:12 2008 -0700
@@ -1970,7 +1970,7 @@
for (int i = 0; i < nRows; i++) {
if (isAccessibleRowSelected(i)) {
- vec.addElement(new Integer(i));
+ vec.addElement(Integer.valueOf(i));
}
}
int retval[] = new int[vec.size()];
@@ -1995,7 +1995,7 @@
for (int i = 0; i < nColumns; i++) {
if (isAccessibleColumnSelected(i)) {
- vec.addElement(new Integer(i));
+ vec.addElement(Integer.valueOf(i));
}
}
int retval[] = new int[vec.size()];
@@ -2139,7 +2139,7 @@
private int columnCount = 0;
public void addHeader(TableCellElementInfo cellInfo, int rowNumber) {
- Integer rowInteger = new Integer(rowNumber);
+ Integer rowInteger = Integer.valueOf(rowNumber);
ArrayList list = (ArrayList)headers.get(rowInteger);
if (list == null) {
list = new ArrayList();
@@ -2201,7 +2201,7 @@
}
private TableCellElementInfo getElementInfoAt(int r, int c) {
- ArrayList list = (ArrayList)headers.get(new Integer(r));
+ ArrayList list = (ArrayList)headers.get(Integer.valueOf(r));
if (list != null) {
return (TableCellElementInfo)list.get(c);
} else {
--- a/jdk/src/share/classes/javax/swing/text/html/CSS.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/text/html/CSS.java Wed May 14 07:53:12 2008 -0700
@@ -1099,7 +1099,7 @@
*/
static String colorToHex(Color color) {
- String colorstr = new String("#");
+ String colorstr = "#";
// Red
String str = Integer.toHexString(color.getRed());
--- a/jdk/src/share/classes/javax/swing/text/html/HTMLEditorKit.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/text/html/HTMLEditorKit.java Wed May 14 07:53:12 2008 -0700
@@ -1899,8 +1899,8 @@
// assistive technologies listening for such events.
comp.getAccessibleContext().firePropertyChange(
AccessibleContext.ACCESSIBLE_HYPERTEXT_OFFSET,
- new Integer(kit.prevHypertextOffset),
- new Integer(e.getDot()));
+ Integer.valueOf(kit.prevHypertextOffset),
+ Integer.valueOf(e.getDot()));
}
}
}
--- a/jdk/src/share/classes/javax/swing/text/html/parser/AttributeList.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/AttributeList.java Wed May 14 07:53:12 2008 -0700
@@ -132,7 +132,7 @@
static Hashtable attributeTypes = new Hashtable();
static void defineAttributeType(String nm, int val) {
- Integer num = new Integer(val);
+ Integer num = Integer.valueOf(val);
attributeTypes.put(nm, num);
attributeTypes.put(num, nm);
}
@@ -154,11 +154,11 @@
defineAttributeType("NUTOKEN", NUTOKEN);
defineAttributeType("NUTOKENS", NUTOKENS);
- attributeTypes.put("fixed", new Integer(FIXED));
- attributeTypes.put("required", new Integer(REQUIRED));
- attributeTypes.put("current", new Integer(CURRENT));
- attributeTypes.put("conref", new Integer(CONREF));
- attributeTypes.put("implied", new Integer(IMPLIED));
+ attributeTypes.put("fixed", Integer.valueOf(FIXED));
+ attributeTypes.put("required", Integer.valueOf(REQUIRED));
+ attributeTypes.put("current", Integer.valueOf(CURRENT));
+ attributeTypes.put("conref", Integer.valueOf(CONREF));
+ attributeTypes.put("implied", Integer.valueOf(IMPLIED));
}
public static int name2type(String nm) {
@@ -167,6 +167,6 @@
}
public static String type2name(int tp) {
- return (String)attributeTypes.get(new Integer(tp));
+ return (String)attributeTypes.get(Integer.valueOf(tp));
}
}
--- a/jdk/src/share/classes/javax/swing/text/html/parser/DTD.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/DTD.java Wed May 14 07:53:12 2008 -0700
@@ -113,7 +113,7 @@
* <code>ch</code> character
*/
public Entity getEntity(int ch) {
- return (Entity)entityHash.get(new Integer(ch));
+ return (Entity)entityHash.get(Integer.valueOf(ch));
}
/**
@@ -178,7 +178,7 @@
switch (type & ~GENERAL) {
case CDATA:
case SDATA:
- entityHash.put(new Integer(data[0]), ent);
+ entityHash.put(Integer.valueOf(data[0]), ent);
break;
}
}
--- a/jdk/src/share/classes/javax/swing/text/html/parser/Element.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/Element.java Wed May 14 07:53:12 2008 -0700
@@ -162,10 +162,10 @@
static Hashtable contentTypes = new Hashtable();
static {
- contentTypes.put("CDATA", new Integer(CDATA));
- contentTypes.put("RCDATA", new Integer(RCDATA));
- contentTypes.put("EMPTY", new Integer(EMPTY));
- contentTypes.put("ANY", new Integer(ANY));
+ contentTypes.put("CDATA", Integer.valueOf(CDATA));
+ contentTypes.put("RCDATA", Integer.valueOf(RCDATA));
+ contentTypes.put("EMPTY", Integer.valueOf(EMPTY));
+ contentTypes.put("ANY", Integer.valueOf(ANY));
}
public static int name2type(String nm) {
--- a/jdk/src/share/classes/javax/swing/text/html/parser/Entity.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/Entity.java Wed May 14 07:53:12 2008 -0700
@@ -110,15 +110,15 @@
static Hashtable entityTypes = new Hashtable();
static {
- entityTypes.put("PUBLIC", new Integer(PUBLIC));
- entityTypes.put("CDATA", new Integer(CDATA));
- entityTypes.put("SDATA", new Integer(SDATA));
- entityTypes.put("PI", new Integer(PI));
- entityTypes.put("STARTTAG", new Integer(STARTTAG));
- entityTypes.put("ENDTAG", new Integer(ENDTAG));
- entityTypes.put("MS", new Integer(MS));
- entityTypes.put("MD", new Integer(MD));
- entityTypes.put("SYSTEM", new Integer(SYSTEM));
+ entityTypes.put("PUBLIC", Integer.valueOf(PUBLIC));
+ entityTypes.put("CDATA", Integer.valueOf(CDATA));
+ entityTypes.put("SDATA", Integer.valueOf(SDATA));
+ entityTypes.put("PI", Integer.valueOf(PI));
+ entityTypes.put("STARTTAG", Integer.valueOf(STARTTAG));
+ entityTypes.put("ENDTAG", Integer.valueOf(ENDTAG));
+ entityTypes.put("MS", Integer.valueOf(MS));
+ entityTypes.put("MD", Integer.valueOf(MD));
+ entityTypes.put("SYSTEM", Integer.valueOf(SYSTEM));
}
/**
--- a/jdk/src/share/classes/javax/swing/text/html/parser/Parser.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/Parser.java Wed May 14 07:53:12 2008 -0700
@@ -1842,7 +1842,7 @@
String elemStr = getString(0);
if (elemStr.equals("image")) {
- elemStr = new String("img");
+ elemStr = "img";
}
/* determine if this element is part of the dtd. */
--- a/jdk/src/share/classes/javax/swing/text/rtf/RTFAttributes.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/text/rtf/RTFAttributes.java Wed May 14 07:53:12 2008 -0700
@@ -281,7 +281,7 @@
public AssertiveAttribute(int d, Object s, String r, int v)
{
super(d, s, r);
- swingValue = new Integer(v);
+ swingValue = Integer.valueOf(v);
}
public boolean set(MutableAttributeSet target)
@@ -343,7 +343,7 @@
public NumericAttribute(int d, Object s,
String r, int ds, int dr)
{
- this(d, s, r, new Integer(ds), dr, 1f);
+ this(d, s, r, Integer.valueOf(ds), dr, 1f);
}
public NumericAttribute(int d, Object s,
@@ -377,7 +377,7 @@
Number swingValue;
if (scale == 1f)
- swingValue = new Integer(parameter);
+ swingValue = Integer.valueOf(parameter);
else
swingValue = new Float(parameter / scale);
target.addAttribute(swingName, swingValue);
--- a/jdk/src/share/classes/javax/swing/text/rtf/RTFGenerator.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/text/rtf/RTFGenerator.java Wed May 14 07:53:12 2008 -0700
@@ -83,11 +83,7 @@
static public final String defaultFontFamily = "Helvetica";
/* constants so we can avoid allocating objects in inner loops */
- /* these should all be final, but javac seems to be a bit buggy */
- static protected Integer One, Zero;
- static protected Boolean False;
- static protected Float ZeroPointZero;
- static private Object MagicToken;
+ final static private Object MagicToken;
/* An array of character-keyword pairs. This could be done
as a dictionary (and lookup would be quicker), but that
@@ -98,11 +94,7 @@
static protected CharacterKeywordPair[] textKeywords;
static {
- One = new Integer(1);
- Zero = new Integer(0);
- False = Boolean.valueOf(false);
MagicToken = new Object();
- ZeroPointZero = new Float(0);
Dictionary textKeywordDictionary = RTFReader.textKeywords;
Enumeration keys = textKeywordDictionary.keys();
@@ -142,7 +134,7 @@
public RTFGenerator(OutputStream to)
{
colorTable = new Hashtable();
- colorTable.put(defaultRTFColor, new Integer(0));
+ colorTable.put(defaultRTFColor, Integer.valueOf(0));
colorCount = 1;
fontTable = new Hashtable();
@@ -693,7 +685,7 @@
{
writeControlWord("pard");
- currentAttributes.addAttribute(StyleConstants.Alignment, Zero);
+ currentAttributes.addAttribute(StyleConstants.Alignment, Integer.valueOf(0));
int wordIndex;
int wordCount = RTFAttributes.attributes.length;
--- a/jdk/src/share/classes/javax/swing/tree/DefaultTreeSelectionModel.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/javax/swing/tree/DefaultTreeSelectionModel.java Wed May 14 07:53:12 2008 -0700
@@ -157,8 +157,8 @@
selectionMode = TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION;
if(oldMode != selectionMode && changeSupport != null)
changeSupport.firePropertyChange(SELECTION_MODE_PROPERTY,
- new Integer(oldMode),
- new Integer(selectionMode));
+ Integer.valueOf(oldMode),
+ Integer.valueOf(selectionMode));
}
/**
--- a/jdk/src/share/classes/sun/applet/AppletPanel.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/sun/applet/AppletPanel.java Wed May 14 07:53:12 2008 -0700
@@ -285,7 +285,7 @@
//System.out.println("SEND0= " + id);
queue = new Queue();
}
- Integer eventId = new Integer(id);
+ Integer eventId = Integer.valueOf(id);
queue.enqueue(eventId);
notifyAll();
}
--- a/jdk/src/share/classes/sun/applet/AppletViewer.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/sun/applet/AppletViewer.java Wed May 14 07:53:12 2008 -0700
@@ -587,9 +587,9 @@
Dimension d = panel.size();
Insets in = panel.insets();
panel.atts.put("width",
- new Integer(d.width - (in.left + in.right)).toString());
+ Integer.toString(d.width - (in.left + in.right)));
panel.atts.put("height",
- new Integer(d.height - (in.top + in.bottom)).toString());
+ Integer.toString(d.height - (in.top + in.bottom)));
}
/**
--- a/jdk/src/share/classes/sun/awt/FontConfiguration.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/sun/awt/FontConfiguration.java Wed May 14 07:53:12 2008 -0700
@@ -1956,7 +1956,7 @@
/*Init these tables to allow componentFontNameID, fontfileNameIDs
to start from "1".
*/
- componentFontNameIDs.put("", new Short((short)0));
+ componentFontNameIDs.put("", Short.valueOf((short)0));
fontfileNameIDs = new HashMap<String, Short>();
filenames = new HashMap<Short, Short>();
--- a/jdk/src/share/classes/sun/awt/im/InputContext.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/sun/awt/im/InputContext.java Wed May 14 07:53:12 2008 -0700
@@ -556,7 +556,7 @@
}
usedInputMethods.put(inputMethodLocator.deriveLocator(null), inputMethod);
perInputMethodState.put(inputMethod,
- new Boolean(clientWindowNotificationEnabled));
+ Boolean.valueOf(clientWindowNotificationEnabled));
enableClientWindowNotification(inputMethod, false);
if (this == inputMethodWindowContext) {
inputMethod.hideWindows();
@@ -921,7 +921,7 @@
if (perInputMethodState == null) {
perInputMethodState = new HashMap(5);
}
- perInputMethodState.put(requester, new Boolean(enable));
+ perInputMethodState.put(requester, Boolean.valueOf(enable));
return;
}
--- a/jdk/src/share/classes/sun/font/FileFontStrike.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/sun/font/FileFontStrike.java Wed May 14 07:53:12 2008 -0700
@@ -657,7 +657,7 @@
* we first obtain this information, then the image, and never
* will access this value again.
*/
- Integer key = new Integer(glyphCode);
+ Integer key = Integer.valueOf(glyphCode);
Point2D.Float value = null;
ConcurrentHashMap<Integer, Point2D.Float> glyphMetricsMap = null;
if (glyphMetricsMapRef != null) {
@@ -724,7 +724,7 @@
boundsMap = new ConcurrentHashMap<Integer, Rectangle2D.Float>();
}
- Integer key = new Integer(glyphCode);
+ Integer key = Integer.valueOf(glyphCode);
Rectangle2D.Float bounds = boundsMap.get(key);
if (bounds == null) {
--- a/jdk/src/share/classes/sun/font/FontManager.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/sun/font/FontManager.java Wed May 14 07:53:12 2008 -0700
@@ -2124,7 +2124,7 @@
private static void addLCIDMapEntry(Map<String, Short> map,
String key, short value) {
- map.put(key, new Short(value));
+ map.put(key, Short.valueOf(value));
}
private static synchronized void createLCIDMap() {
--- a/jdk/src/share/classes/sun/font/FontResolver.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/sun/font/FontResolver.java Wed May 14 07:53:12 2008 -0700
@@ -117,7 +117,7 @@
Font2D font2D = FontManager.getFont2D(font);
if (font2D.hasSupplementaryChars()) {
fonts.add(font);
- indices.add(new Integer(i));
+ indices.add(Integer.valueOf(i));
}
}
--- a/jdk/src/share/classes/sun/font/PhysicalStrike.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/sun/font/PhysicalStrike.java Wed May 14 07:53:12 2008 -0700
@@ -114,7 +114,7 @@
*/
Point2D.Float getGlyphPoint(int glyphCode, int ptNumber) {
Point2D.Float gp = null;
- Integer ptKey = new Integer(glyphCode<<16|ptNumber);
+ Integer ptKey = Integer.valueOf(glyphCode<<16|ptNumber);
if (glyphPointMapCache == null) {
synchronized (this) {
if (glyphPointMapCache == null) {
--- a/jdk/src/share/classes/sun/java2d/SunGraphics2D.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/sun/java2d/SunGraphics2D.java Wed May 14 07:53:12 2008 -0700
@@ -1374,7 +1374,7 @@
SunHints.Value.get(SunHints.INTKEY_FRACTIONALMETRICS,
fractionalMetricsHint));
model.put(SunHints.KEY_TEXT_ANTIALIAS_LCD_CONTRAST,
- new Integer(lcdTextContrast));
+ Integer.valueOf(lcdTextContrast));
Object value;
switch (interpolationHint) {
case SunHints.INTVAL_INTERPOLATION_NEAREST_NEIGHBOR:
--- a/jdk/src/share/classes/sun/java2d/loops/SurfaceType.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/sun/java2d/loops/SurfaceType.java Wed May 14 07:53:12 2008 -0700
@@ -408,7 +408,7 @@
if (unusedUID > 255) {
throw new InternalError("surface type id overflow");
}
- i = new Integer(unusedUID++);
+ i = Integer.valueOf(unusedUID++);
surfaceUIDMap.put(desc, i);
}
return i.intValue();
--- a/jdk/src/share/classes/sun/print/PSPrinterJob.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/sun/print/PSPrinterJob.java Wed May 14 07:53:12 2008 -0700
@@ -1536,16 +1536,16 @@
execCmd = new String[ncomps];
execCmd[n++] = "/usr/bin/lpr";
if ((pFlags & PRINTER) != 0) {
- execCmd[n++] = new String("-P" + printer);
+ execCmd[n++] = "-P" + printer;
}
if ((pFlags & BANNER) != 0) {
- execCmd[n++] = new String("-J" + banner);
+ execCmd[n++] = "-J" + banner;
}
if ((pFlags & COPIES) != 0) {
- execCmd[n++] = new String("-#" + new Integer(copies).toString());
+ execCmd[n++] = "-#" + copies;
}
if ((pFlags & NOSHEET) != 0) {
- execCmd[n++] = new String("-h");
+ execCmd[n++] = "-h";
}
if ((pFlags & OPTIONS) != 0) {
execCmd[n++] = new String(options);
@@ -1556,19 +1556,19 @@
execCmd[n++] = "/usr/bin/lp";
execCmd[n++] = "-c"; // make a copy of the spool file
if ((pFlags & PRINTER) != 0) {
- execCmd[n++] = new String("-d" + printer);
+ execCmd[n++] = "-d" + printer;
}
if ((pFlags & BANNER) != 0) {
- execCmd[n++] = new String("-t" + banner);
+ execCmd[n++] = "-t" + banner;
}
if ((pFlags & COPIES) != 0) {
- execCmd[n++] = new String("-n" + new Integer(copies).toString());
+ execCmd[n++] = "-n" + copies;
}
if ((pFlags & NOSHEET) != 0) {
- execCmd[n++] = new String("-o nobanner");
+ execCmd[n++] = "-o nobanner";
}
if ((pFlags & OPTIONS) != 0) {
- execCmd[n++] = new String("-o" + options);
+ execCmd[n++] = "-o" + options;
}
}
execCmd[n++] = spoolFile;
--- a/jdk/src/share/classes/sun/print/RasterPrinterJob.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/sun/print/RasterPrinterJob.java Wed May 14 07:53:12 2008 -0700
@@ -245,7 +245,7 @@
/**
* The name of the job being printed.
*/
- private String mDocName = new String("Java Printing");
+ private String mDocName = "Java Printing";
/**
--- a/jdk/src/share/classes/sun/text/normalizer/VersionInfo.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/share/classes/sun/text/normalizer/VersionInfo.java Wed May 14 07:53:12 2008 -0700
@@ -116,7 +116,7 @@
throw new IllegalArgumentException(INVALID_VERSION_NUMBER_);
}
int version = getInt(major, minor, milli, micro);
- Integer key = new Integer(version);
+ Integer key = Integer.valueOf(version);
Object result = MAP_.get(key);
if (result == null) {
result = new VersionInfo(version);
--- a/jdk/src/solaris/classes/sun/awt/X11/MWMConstants.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/MWMConstants.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,9 @@
package sun.awt.X11;
-public interface MWMConstants {
+final public class MWMConstants {
+
+ private MWMConstants(){}
/* bit definitions for MwmHints.flags */
static final int MWM_HINTS_FUNCTIONS= (1 << 0);
--- a/jdk/src/solaris/classes/sun/awt/X11/MotifDnDConstants.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/MotifDnDConstants.java Wed May 14 07:53:12 2008 -0700
@@ -118,11 +118,11 @@
XA_MOTIF_DRAG_WINDOW,
0, 1,
false,
- XlibWrapper.AnyPropertyType);
+ XConstants.AnyPropertyType);
try {
int status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
- if (status == XlibWrapper.Success &&
+ if (status == XConstants.Success &&
wpg.getData() != 0 &&
wpg.getActualType() == XAtom.XA_WINDOW &&
wpg.getActualFormat() == 32 &&
@@ -163,20 +163,20 @@
XlibWrapper.XGrabServer(newDisplay);
try {
- XlibWrapper.XSetCloseDownMode(newDisplay, (int)XlibWrapper.RetainPermanent);
+ XlibWrapper.XSetCloseDownMode(newDisplay, (int)XConstants.RetainPermanent);
XSetWindowAttributes xwa = new XSetWindowAttributes();
try {
xwa.set_override_redirect(true);
- xwa.set_event_mask(XlibWrapper.PropertyChangeMask);
+ xwa.set_event_mask(XConstants.PropertyChangeMask);
motifWindow = XlibWrapper.XCreateWindow(newDisplay, defaultRootWindow,
-10, -10, 1, 1, 0, 0,
- XlibWrapper.InputOnly,
- XlibWrapper.CopyFromParent,
- (XlibWrapper.CWOverrideRedirect |
- XlibWrapper.CWEventMask),
+ XConstants.InputOnly,
+ XConstants.CopyFromParent,
+ (XConstants.CWOverrideRedirect |
+ XConstants.CWEventMask),
xwa.pData);
if (motifWindow == 0) {
@@ -195,13 +195,13 @@
defaultRootWindow,
XA_MOTIF_DRAG_WINDOW.getAtom(),
XAtom.XA_WINDOW, 32,
- XlibWrapper.PropModeReplace,
+ XConstants.PropModeReplace,
data, 1);
XToolkit.RESTORE_XERROR_HANDLER();
if (XToolkit.saved_error != null &&
- XToolkit.saved_error.get_error_code() != XlibWrapper.Success) {
+ XToolkit.saved_error.get_error_code() != XConstants.Success) {
throw new XException("Cannot write motif drag window handle.");
}
@@ -282,7 +282,7 @@
try {
int status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
- if (status != XlibWrapper.Success
+ if (status != XConstants.Success
|| wpg.getActualType() != XA_MOTIF_DRAG_TARGETS.getAtom()
|| wpg.getData() == 0) {
@@ -399,13 +399,13 @@
motifWindow,
XA_MOTIF_DRAG_TARGETS.getAtom(),
XA_MOTIF_DRAG_TARGETS.getAtom(), 8,
- XlibWrapper.PropModeReplace,
+ XConstants.PropModeReplace,
data, tableSize);
XToolkit.RESTORE_XERROR_HANDLER();
if (XToolkit.saved_error != null &&
- XToolkit.saved_error.get_error_code() != XlibWrapper.Success) {
+ XToolkit.saved_error.get_error_code() != XConstants.Success) {
// Create a new motif window and retry.
motifWindow = createMotifWindow();
@@ -415,13 +415,13 @@
motifWindow,
XA_MOTIF_DRAG_TARGETS.getAtom(),
XA_MOTIF_DRAG_TARGETS.getAtom(), 8,
- XlibWrapper.PropModeReplace,
+ XConstants.PropModeReplace,
data, tableSize);
XToolkit.RESTORE_XERROR_HANDLER();
if (XToolkit.saved_error != null &&
- XToolkit.saved_error.get_error_code() != XlibWrapper.Success) {
+ XToolkit.saved_error.get_error_code() != XConstants.Success) {
throw new XException("Cannot write motif drag targets property.");
}
}
@@ -538,12 +538,12 @@
XlibWrapper.XChangeProperty(XToolkit.getDisplay(), window,
XA_MOTIF_ATOM_0.getAtom(),
XA_MOTIF_DRAG_INITIATOR_INFO.getAtom(),
- 8, XlibWrapper.PropModeReplace,
+ 8, XConstants.PropModeReplace,
structData, MOTIF_INITIATOR_INFO_SIZE);
XToolkit.RESTORE_XERROR_HANDLER();
if (XToolkit.saved_error != null &&
- XToolkit.saved_error.get_error_code() != XlibWrapper.Success) {
+ XToolkit.saved_error.get_error_code() != XConstants.Success) {
throw new XException("Cannot write drag initiator info");
}
} finally {
@@ -571,12 +571,12 @@
XlibWrapper.XChangeProperty(XToolkit.getDisplay(), window,
XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
- 8, XlibWrapper.PropModeReplace,
+ 8, XConstants.PropModeReplace,
data, dataSize);
XToolkit.RESTORE_XERROR_HANDLER();
if (XToolkit.saved_error != null &&
- XToolkit.saved_error.get_error_code() != XlibWrapper.Success) {
+ XToolkit.saved_error.get_error_code() != XConstants.Success) {
throw new XException("Cannot write Motif receiver info property");
}
} finally {
--- a/jdk/src/solaris/classes/sun/awt/X11/MotifDnDDragSourceProtocol.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/MotifDnDDragSourceProtocol.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -44,7 +44,7 @@
private static final Unsafe unsafe = XlibWrapper.unsafe;
- private long targetEnterServerTime = XlibWrapper.CurrentTime;
+ private long targetEnterServerTime = XConstants.CurrentTime;
protected MotifDnDDragSourceProtocol(XDragSourceProtocolListener listener) {
super(listener);
@@ -86,7 +86,7 @@
if (!MotifDnDConstants.MotifDnDSelection.setOwner(contents, formatMap,
formats,
- XlibWrapper.CurrentTime)) {
+ XConstants.CurrentTime)) {
cleanup();
throw new InvalidDnDOperationException("Cannot acquire selection ownership");
}
@@ -137,7 +137,7 @@
long time = t;
/* Discard events from the previous receiver. */
- if (targetEnterServerTime == XlibWrapper.CurrentTime ||
+ if (targetEnterServerTime == XConstants.CurrentTime ||
time < targetEnterServerTime) {
return true;
}
@@ -181,7 +181,7 @@
new WindowPropertyGetter(window,
MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO,
0, 0xFFFF, false,
- XlibWrapper.AnyPropertyType);
+ XConstants.AnyPropertyType);
try {
int status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
@@ -200,7 +200,7 @@
* CARD32 heap_offset B32;
* } xmDragReceiverInfoStruct;
*/
- if (status == (int)XlibWrapper.Success && wpg.getData() != 0 &&
+ if (status == (int)XConstants.Success && wpg.getData() != 0 &&
wpg.getActualType() != 0 && wpg.getActualFormat() == 8 &&
wpg.getNumberOfItems() >=
MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE) {
@@ -243,7 +243,7 @@
XClientMessageEvent msg = new XClientMessageEvent();
try {
- msg.set_type(XlibWrapper.ClientMessage);
+ msg.set_type(XConstants.ClientMessage);
msg.set_window(getTargetWindow());
msg.set_format(8);
msg.set_message_type(MotifDnDConstants.XA_MOTIF_DRAG_AND_DROP_MESSAGE.getAtom());
@@ -267,7 +267,7 @@
XlibWrapper.XSendEvent(XToolkit.getDisplay(),
getTargetProxyWindow(),
- false, XlibWrapper.NoEventMask,
+ false, XConstants.NoEventMask,
msg.pData);
} finally {
msg.dispose();
@@ -281,7 +281,7 @@
XClientMessageEvent msg = new XClientMessageEvent();
try {
- msg.set_type(XlibWrapper.ClientMessage);
+ msg.set_type(XConstants.ClientMessage);
msg.set_window(getTargetWindow());
msg.set_format(8);
msg.set_message_type(MotifDnDConstants.XA_MOTIF_DRAG_AND_DROP_MESSAGE.getAtom());
@@ -305,7 +305,7 @@
XlibWrapper.XSendEvent(XToolkit.getDisplay(),
getTargetProxyWindow(),
- false, XlibWrapper.NoEventMask,
+ false, XConstants.NoEventMask,
msg.pData);
} finally {
msg.dispose();
@@ -318,7 +318,7 @@
XClientMessageEvent msg = new XClientMessageEvent();
try {
- msg.set_type(XlibWrapper.ClientMessage);
+ msg.set_type(XConstants.ClientMessage);
msg.set_window(getTargetWindow());
msg.set_format(8);
msg.set_message_type(MotifDnDConstants.XA_MOTIF_DRAG_AND_DROP_MESSAGE.getAtom());
@@ -336,7 +336,7 @@
XlibWrapper.XSendEvent(XToolkit.getDisplay(),
getTargetProxyWindow(),
- false, XlibWrapper.NoEventMask,
+ false, XConstants.NoEventMask,
msg.pData);
} finally {
msg.dispose();
@@ -356,7 +356,7 @@
XClientMessageEvent msg = new XClientMessageEvent();
try {
- msg.set_type(XlibWrapper.ClientMessage);
+ msg.set_type(XConstants.ClientMessage);
msg.set_window(getTargetWindow());
msg.set_format(8);
msg.set_message_type(MotifDnDConstants.XA_MOTIF_DRAG_AND_DROP_MESSAGE.getAtom());
@@ -382,7 +382,7 @@
XlibWrapper.XSendEvent(XToolkit.getDisplay(),
getTargetProxyWindow(),
- false, XlibWrapper.NoEventMask,
+ false, XConstants.NoEventMask,
msg.pData);
} finally {
msg.dispose();
@@ -397,12 +397,12 @@
public void cleanupTargetInfo() {
super.cleanupTargetInfo();
- targetEnterServerTime = XlibWrapper.CurrentTime;
+ targetEnterServerTime = XConstants.CurrentTime;
}
public void dispatchEvent(XEvent ev) {
switch (ev.get_type()) {
- case XlibWrapper.SelectionRequest:
+ case XConstants.SelectionRequest:
XSelectionRequestEvent xsre = ev.get_xselectionrequest();
long atom = xsre.get_selection();
--- a/jdk/src/solaris/classes/sun/awt/X11/MotifDnDDropTargetProtocol.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/MotifDnDDropTargetProtocol.java Wed May 14 07:53:12 2008 -0700
@@ -99,7 +99,7 @@
new WindowPropertyGetter(embedder,
MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO,
0, 0xFFFF, false,
- XlibWrapper.AnyPropertyType);
+ XConstants.AnyPropertyType);
try {
status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
@@ -118,7 +118,7 @@
* CARD32 heap_offset B32;
* } xmDragReceiverInfoStruct;
*/
- if (status == (int)XlibWrapper.Success && wpg.getData() != 0 &&
+ if (status == (int)XConstants.Success && wpg.getData() != 0 &&
wpg.getActualType() != 0 && wpg.getActualFormat() == 8 &&
wpg.getNumberOfItems() >=
MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE) {
@@ -166,12 +166,12 @@
XlibWrapper.XChangeProperty(XToolkit.getDisplay(), embedder,
MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
- 8, XlibWrapper.PropModeReplace,
+ 8, XConstants.PropModeReplace,
data, dataSize);
XToolkit.RESTORE_XERROR_HANDLER();
if (XToolkit.saved_error != null &&
- XToolkit.saved_error.get_error_code() != XlibWrapper.Success) {
+ XToolkit.saved_error.get_error_code() != XConstants.Success) {
throw new XException("Cannot write Motif receiver info property");
}
} finally {
@@ -201,7 +201,7 @@
new WindowPropertyGetter(embedder,
MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO,
0, 0xFFFF, false,
- XlibWrapper.AnyPropertyType);
+ XConstants.AnyPropertyType);
try {
status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
@@ -220,7 +220,7 @@
* CARD32 heap_offset B32;
* } xmDragReceiverInfoStruct;
*/
- if (status == (int)XlibWrapper.Success && wpg.getData() != 0 &&
+ if (status == (int)XConstants.Success && wpg.getData() != 0 &&
wpg.getActualType() != 0 && wpg.getActualFormat() == 8 &&
wpg.getNumberOfItems() >=
MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE) {
@@ -240,12 +240,12 @@
XlibWrapper.XChangeProperty(XToolkit.getDisplay(), embedder,
MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
- 8, XlibWrapper.PropModeReplace,
+ 8, XConstants.PropModeReplace,
data, dataSize);
XToolkit.RESTORE_XERROR_HANDLER();
if (XToolkit.saved_error != null &&
- XToolkit.saved_error.get_error_code() != XlibWrapper.Success) {
+ XToolkit.saved_error.get_error_code() != XConstants.Success) {
throw new XException("Cannot write Motif receiver info property");
}
}
@@ -273,7 +273,7 @@
new WindowPropertyGetter(embedded,
MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO,
0, 0xFFFF, false,
- XlibWrapper.AnyPropertyType);
+ XConstants.AnyPropertyType);
try {
status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
@@ -292,7 +292,7 @@
* CARD32 heap_offset B32;
* } xmDragReceiverInfoStruct;
*/
- if (status == (int)XlibWrapper.Success && wpg.getData() != 0 &&
+ if (status == (int)XConstants.Success && wpg.getData() != 0 &&
wpg.getActualType() != 0 && wpg.getActualFormat() == 8 &&
wpg.getNumberOfItems() >=
MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE) {
@@ -322,12 +322,12 @@
new WindowPropertyGetter(window,
MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO,
0, 0xFFFF, false,
- XlibWrapper.AnyPropertyType);
+ XConstants.AnyPropertyType);
try {
int status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
- if (status == (int)XlibWrapper.Success && wpg.getData() != 0 &&
+ if (status == (int)XConstants.Success && wpg.getData() != 0 &&
wpg.getActualType() != 0 && wpg.getActualFormat() == 8 &&
wpg.getNumberOfItems() >=
MotifDnDConstants.MOTIF_RECEIVER_INFO_SIZE) {
@@ -377,7 +377,7 @@
try {
int status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
- if (status == XlibWrapper.Success && wpg.getData() != 0 &&
+ if (status == XConstants.Success && wpg.getData() != 0 &&
wpg.getActualType() ==
MotifDnDConstants.XA_MOTIF_DRAG_INITIATOR_INFO.getAtom() &&
wpg.getActualFormat() == 8 &&
@@ -420,7 +420,7 @@
if (status == 0 ||
(XToolkit.saved_error != null &&
- XToolkit.saved_error.get_error_code() != XlibWrapper.Success)) {
+ XToolkit.saved_error.get_error_code() != XConstants.Success)) {
throw new XException("XGetWindowAttributes failed");
}
@@ -432,12 +432,12 @@
XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
XlibWrapper.XSelectInput(XToolkit.getDisplay(), source_win,
source_win_mask |
- XlibWrapper.StructureNotifyMask);
+ XConstants.StructureNotifyMask);
XToolkit.RESTORE_XERROR_HANDLER();
if (XToolkit.saved_error != null &&
- XToolkit.saved_error.get_error_code() != XlibWrapper.Success) {
+ XToolkit.saved_error.get_error_code() != XConstants.Success) {
throw new XException("XSelectInput failed");
}
@@ -590,7 +590,7 @@
XClientMessageEvent dummy = new XClientMessageEvent();
try {
- dummy.set_type(XlibWrapper.ClientMessage);
+ dummy.set_type(XConstants.ClientMessage);
dummy.set_window(xclient.get_window());
dummy.set_format(32);
dummy.set_message_type(0);
@@ -600,7 +600,7 @@
dummy.set_data(3, 0);
dummy.set_data(4, 0);
XlibWrapper.XSendEvent(XToolkit.getDisplay(),
- proxy, false, XlibWrapper.NoEventMask,
+ proxy, false, XConstants.NoEventMask,
dummy.pData);
} finally {
dummy.dispose();
@@ -821,7 +821,7 @@
XClientMessageEvent msg = new XClientMessageEvent();
try {
- msg.set_type(XlibWrapper.ClientMessage);
+ msg.set_type(XConstants.ClientMessage);
msg.set_window(MotifDnDConstants.Swapper.getInt(data + 12, eventByteOrder));
msg.set_format(8);
msg.set_message_type(MotifDnDConstants.XA_MOTIF_DRAG_AND_DROP_MESSAGE.getAtom());
@@ -878,7 +878,7 @@
try {
XlibWrapper.XSendEvent(XToolkit.getDisplay(),
msg.get_window(),
- false, XlibWrapper.NoEventMask,
+ false, XConstants.NoEventMask,
msg.pData);
} finally {
XToolkit.awtUnlock();
--- a/jdk/src/solaris/classes/sun/awt/X11/WindowPropertyGetter.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/WindowPropertyGetter.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -89,7 +89,7 @@
if (isCachingSupported() && isCached()) {
readFromCache();
- return XlibWrapper.Success;
+ return XConstants.Success;
}
// Fix for performance problem - IgnodeBadWindowHandler is
@@ -106,7 +106,7 @@
offset, length, (auto_delete?1:0), type,
actual_type, actual_format, nitems_ptr,
bytes_after, data);
- if (isCachingSupported() && status == XlibWrapper.Success && getData() != 0 && isCacheableProperty(property)) {
+ if (isCachingSupported() && status == XConstants.Success && getData() != 0 && isCacheableProperty(property)) {
// Property has some data, we cache them
cacheProperty();
}
--- a/jdk/src/solaris/classes/sun/awt/X11/XAWTXSettings.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XAWTXSettings.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -128,7 +128,7 @@
try {
int status = getter.execute(XToolkit.IgnoreBadWindowHandler);
- if (status != XlibWrapper.Success || getter.getData() == 0) {
+ if (status != XConstants.Success || getter.getData() == 0) {
if (log.isLoggable(Level.FINE)) log.fine("OH OH : getter failed status = " + status );
settings = null;
}
--- a/jdk/src/solaris/classes/sun/awt/X11/XAtom.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XAtom.java Wed May 14 07:53:12 2008 -0700
@@ -370,7 +370,7 @@
false, property_type);
try {
int status = getter.execute();
- if (status != XlibWrapper.Success || getter.getData() == 0) {
+ if (status != XConstants.Success || getter.getData() == 0) {
return 0;
}
if (getter.getActualType() != property_type || getter.getActualFormat() != 32) {
@@ -401,7 +401,7 @@
try {
Native.putCard32(XlibWrapper.larg1, value);
XlibWrapper.XChangeProperty(XToolkit.getDisplay(), window,
- atom, XA_CARDINAL, 32, XlibWrapper.PropModeReplace,
+ atom, XA_CARDINAL, 32, XConstants.PropModeReplace,
XlibWrapper.larg1, 1);
} finally {
XToolkit.awtUnlock();
@@ -432,7 +432,7 @@
false, this);
try {
int status = getter.execute();
- if (status != XlibWrapper.Success || getter.getData() == 0) {
+ if (status != XConstants.Success || getter.getData() == 0) {
return false;
}
if (getter.getActualType() != atom
@@ -466,7 +466,7 @@
false, type);
try {
int status = getter.execute();
- if (status != XlibWrapper.Success || getter.getData() == 0) {
+ if (status != XConstants.Success || getter.getData() == 0) {
return false;
}
if (getter.getActualType() != type
@@ -497,7 +497,7 @@
XToolkit.awtLock();
try {
XlibWrapper.XChangeProperty(XToolkit.getDisplay(), window,
- atom, atom, 32, XlibWrapper.PropModeReplace,
+ atom, atom, 32, XConstants.PropModeReplace,
data_ptr, length);
} finally {
XToolkit.awtUnlock();
@@ -518,7 +518,7 @@
XToolkit.awtLock();
try {
XlibWrapper.XChangeProperty(XToolkit.getDisplay(), window,
- atom, type, 32, XlibWrapper.PropModeReplace,
+ atom, type, 32, XConstants.PropModeReplace,
data_ptr, length);
} finally {
XToolkit.awtUnlock();
@@ -539,7 +539,7 @@
XToolkit.awtLock();
try {
XlibWrapper.XChangeProperty(XToolkit.getDisplay(), window,
- atom, type, 8, XlibWrapper.PropModeReplace,
+ atom, type, 8, XConstants.PropModeReplace,
data_ptr, length);
} finally {
XToolkit.awtUnlock();
@@ -602,7 +602,7 @@
false, property_type);
try {
int status = getter.execute();
- if (status != XlibWrapper.Success || getter.getData() == 0) {
+ if (status != XConstants.Success || getter.getData() == 0) {
return null;
}
if (getter.getActualType() != property_type || getter.getActualFormat() != 8) {
@@ -674,7 +674,7 @@
false, XA_ATOM);
try {
int status = getter.execute();
- if (status != XlibWrapper.Success || getter.getData() == 0) {
+ if (status != XConstants.Success || getter.getData() == 0) {
return emptyList;
}
if (getter.getActualType() != XA_ATOM || getter.getActualFormat() != 32) {
@@ -797,7 +797,7 @@
try {
Native.putWindow(XlibWrapper.larg1, window_value);
XlibWrapper.XChangeProperty(XToolkit.getDisplay(), window,
- atom, XA_WINDOW, 32, XlibWrapper.PropModeReplace,
+ atom, XA_WINDOW, 32, XConstants.PropModeReplace,
XlibWrapper.larg1, 1);
} finally {
XToolkit.awtUnlock();
@@ -821,7 +821,7 @@
false, XA_WINDOW);
try {
int status = getter.execute();
- if (status != XlibWrapper.Success || getter.getData() == 0) {
+ if (status != XConstants.Success || getter.getData() == 0) {
return 0;
}
if (getter.getActualType() != XA_WINDOW || getter.getActualFormat() != 32) {
--- a/jdk/src/solaris/classes/sun/awt/X11/XBaseMenuWindow.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XBaseMenuWindow.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2005-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -885,14 +885,14 @@
*/
protected boolean isEventDisabled(XEvent e) {
switch (e.get_type()) {
- case XlibWrapper.Expose :
- case XlibWrapper.GraphicsExpose :
- case XlibWrapper.ButtonPress:
- case XlibWrapper.ButtonRelease:
- case XlibWrapper.MotionNotify:
- case XlibWrapper.KeyPress:
- case XlibWrapper.KeyRelease:
- case XlibWrapper.DestroyNotify:
+ case XConstants.Expose :
+ case XConstants.GraphicsExpose :
+ case XConstants.ButtonPress:
+ case XConstants.ButtonRelease:
+ case XConstants.MotionNotify:
+ case XConstants.KeyPress:
+ case XConstants.KeyRelease:
+ case XConstants.DestroyNotify:
return super.isEventDisabled(e);
default:
return true;
--- a/jdk/src/solaris/classes/sun/awt/X11/XBaseWindow.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XBaseWindow.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,7 @@
import java.util.logging.*;
import java.util.*;
-public class XBaseWindow implements XConstants, XUtilConstants {
+public class XBaseWindow {
private static final Logger log = Logger.getLogger("sun.awt.X11.XBaseWindow");
private static final Logger insLog = Logger.getLogger("sun.awt.X11.insets.XBaseWindow");
private static final Logger eventLog = Logger.getLogger("sun.awt.X11.event.XBaseWindow");
@@ -148,7 +148,7 @@
Long eventMask = (Long)params.get(EVENT_MASK);
if (eventMask != null) {
long mask = eventMask.longValue();
- mask |= SubstructureNotifyMask;
+ mask |= XConstants.SubstructureNotifyMask;
params.put(EVENT_MASK, mask);
}
@@ -281,10 +281,10 @@
}
params.putIfNull(PARENT_WINDOW, Long.valueOf(XToolkit.getDefaultRootWindow()));
params.putIfNull(BOUNDS, new Rectangle(DEF_LOCATION, DEF_LOCATION, MIN_SIZE, MIN_SIZE));
- params.putIfNull(DEPTH, Integer.valueOf((int)XlibWrapper.CopyFromParent));
- params.putIfNull(VISUAL, Long.valueOf(XlibWrapper.CopyFromParent));
- params.putIfNull(VISUAL_CLASS, Integer.valueOf((int)XlibWrapper.InputOnly));
- params.putIfNull(VALUE_MASK, Long.valueOf(XlibWrapper.CWEventMask));
+ params.putIfNull(DEPTH, Integer.valueOf((int)XConstants.CopyFromParent));
+ params.putIfNull(VISUAL, Long.valueOf(XConstants.CopyFromParent));
+ params.putIfNull(VISUAL_CLASS, Integer.valueOf((int)XConstants.InputOnly));
+ params.putIfNull(VALUE_MASK, Long.valueOf(XConstants.CWEventMask));
Rectangle bounds = (Rectangle)params.get(BOUNDS);
bounds.width = Math.max(MIN_SIZE, bounds.width);
bounds.height = Math.max(MIN_SIZE, bounds.height);
@@ -293,7 +293,7 @@
long eventMask = eventMaskObj != null ? eventMaskObj.longValue() : 0;
// We use our own synthetic grab see XAwtState.getGrabWindow()
// (see X vol. 1, 8.3.3.2)
- eventMask |= PropertyChangeMask | OwnerGrabButtonMask;
+ eventMask |= XConstants.PropertyChangeMask | XConstants.OwnerGrabButtonMask;
params.put(EVENT_MASK, Long.valueOf(eventMask));
}
@@ -312,23 +312,23 @@
Long eventMask = (Long)params.get(EVENT_MASK);
xattr.set_event_mask(eventMask.longValue());
- value_mask |= XlibWrapper.CWEventMask;
+ value_mask |= XConstants.CWEventMask;
Long border_pixel = (Long)params.get(BORDER_PIXEL);
if (border_pixel != null) {
xattr.set_border_pixel(border_pixel.longValue());
- value_mask |= XlibWrapper.CWBorderPixel;
+ value_mask |= XConstants.CWBorderPixel;
}
Long colormap = (Long)params.get(COLORMAP);
if (colormap != null) {
xattr.set_colormap(colormap.longValue());
- value_mask |= XlibWrapper.CWColormap;
+ value_mask |= XConstants.CWColormap;
}
Long background_pixmap = (Long)params.get(BACKGROUND_PIXMAP);
if (background_pixmap != null) {
xattr.set_background_pixmap(background_pixmap.longValue());
- value_mask |= XlibWrapper.CWBackPixmap;
+ value_mask |= XConstants.CWBackPixmap;
}
Long parentWindow = (Long)params.get(PARENT_WINDOW);
@@ -339,25 +339,25 @@
Boolean overrideRedirect = (Boolean)params.get(OVERRIDE_REDIRECT);
if (overrideRedirect != null) {
xattr.set_override_redirect(overrideRedirect.booleanValue());
- value_mask |= XlibWrapper.CWOverrideRedirect;
+ value_mask |= XConstants.CWOverrideRedirect;
}
Boolean saveUnder = (Boolean)params.get(SAVE_UNDER);
if (saveUnder != null) {
xattr.set_save_under(saveUnder.booleanValue());
- value_mask |= XlibWrapper.CWSaveUnder;
+ value_mask |= XConstants.CWSaveUnder;
}
Integer backingStore = (Integer)params.get(BACKING_STORE);
if (backingStore != null) {
xattr.set_backing_store(backingStore.intValue());
- value_mask |= XlibWrapper.CWBackingStore;
+ value_mask |= XConstants.CWBackingStore;
}
Integer bitGravity = (Integer)params.get(BIT_GRAVITY);
if (bitGravity != null) {
xattr.set_bit_gravity(bitGravity.intValue());
- value_mask |= XlibWrapper.CWBitGravity;
+ value_mask |= XConstants.CWBitGravity;
}
if (log.isLoggable(Level.FINE)) {
@@ -487,25 +487,25 @@
// Note: if PPosition is not set in flags this means that
// we want to reset PPosition in hints. This is necessary
// for locationByPlatform functionality
- if ((flags & XlibWrapper.PPosition) != 0) {
+ if ((flags & XUtilConstants.PPosition) != 0) {
hints.set_x(x);
hints.set_y(y);
}
- if ((flags & XlibWrapper.PSize) != 0) {
+ if ((flags & XUtilConstants.PSize) != 0) {
hints.set_width(width);
hints.set_height(height);
- } else if ((hints.get_flags() & XlibWrapper.PSize) != 0) {
- flags |= XlibWrapper.PSize;
+ } else if ((hints.get_flags() & XUtilConstants.PSize) != 0) {
+ flags |= XUtilConstants.PSize;
}
- if ((flags & XlibWrapper.PMinSize) != 0) {
+ if ((flags & XUtilConstants.PMinSize) != 0) {
hints.set_min_width(width);
hints.set_min_height(height);
- } else if ((hints.get_flags() & XlibWrapper.PMinSize) != 0) {
- flags |= XlibWrapper.PMinSize;
+ } else if ((hints.get_flags() & XUtilConstants.PMinSize) != 0) {
+ flags |= XUtilConstants.PMinSize;
//Fix for 4320050: Minimum size for java.awt.Frame is not being enforced.
//We don't need to reset minimum size if it's already set
}
- if ((flags & XlibWrapper.PMaxSize) != 0) {
+ if ((flags & XUtilConstants.PMaxSize) != 0) {
if (maxBounds != null) {
if (maxBounds.width != Integer.MAX_VALUE) {
hints.set_max_width(maxBounds.width);
@@ -521,8 +521,8 @@
hints.set_max_width(width);
hints.set_max_height(height);
}
- } else if ((hints.get_flags() & XlibWrapper.PMaxSize) != 0) {
- flags |= XlibWrapper.PMaxSize;
+ } else if ((hints.get_flags() & XUtilConstants.PMaxSize) != 0) {
+ flags |= XUtilConstants.PMaxSize;
if (maxBounds != null) {
if (maxBounds.width != Integer.MAX_VALUE) {
hints.set_max_width(maxBounds.width);
@@ -538,9 +538,9 @@
// Leave intact
}
}
- flags |= XlibWrapper.PWinGravity;
+ flags |= XUtilConstants.PWinGravity;
hints.set_flags(flags);
- hints.set_win_gravity((int)XlibWrapper.NorthWestGravity);
+ hints.set_win_gravity((int)XConstants.NorthWestGravity);
if (insLog.isLoggable(Level.FINER)) insLog.finer("Setting hints, resulted flags " + XlibWrapper.hintsToString(flags) +
", values " + hints);
XlibWrapper.XSetWMNormalHints(XToolkit.getDisplay(), getWindow(), hints.pData);
@@ -552,7 +552,7 @@
public boolean isMinSizeSet() {
XSizeHints hints = getHints();
long flags = hints.get_flags();
- return ((flags & XlibWrapper.PMinSize) == XlibWrapper.PMinSize);
+ return ((flags & XUtilConstants.PMinSize) == XUtilConstants.PMinSize);
}
/**
@@ -837,29 +837,29 @@
//6273031: PIT. Choice drop down does not close once it is right clicked to show a popup menu
//remember previous window having grab and if it's not null ungrab it.
XBaseWindow prevGrabWindow = XAwtState.getGrabWindow();
- final int eventMask = (int) (ButtonPressMask | ButtonReleaseMask
- | EnterWindowMask | LeaveWindowMask | PointerMotionMask
- | ButtonMotionMask);
+ final int eventMask = (int) (XConstants.ButtonPressMask | XConstants.ButtonReleaseMask
+ | XConstants.EnterWindowMask | XConstants.LeaveWindowMask | XConstants.PointerMotionMask
+ | XConstants.ButtonMotionMask);
final int ownerEvents = 1;
int ptrGrab = XlibWrapper.XGrabPointer(XToolkit.getDisplay(),
- getContentWindow(), ownerEvents, eventMask, GrabModeAsync,
- GrabModeAsync, None, (XWM.isMotif() ? XToolkit.arrowCursor : None),
- CurrentTime);
+ getContentWindow(), ownerEvents, eventMask, XConstants.GrabModeAsync,
+ XConstants.GrabModeAsync, XConstants.None, (XWM.isMotif() ? XToolkit.arrowCursor : XConstants.None),
+ XConstants.CurrentTime);
// Check grab results to be consistent with X server grab
- if (ptrGrab != GrabSuccess) {
- XlibWrapper.XUngrabPointer(XToolkit.getDisplay(), CurrentTime);
+ if (ptrGrab != XConstants.GrabSuccess) {
+ XlibWrapper.XUngrabPointer(XToolkit.getDisplay(), XConstants.CurrentTime);
XAwtState.setGrabWindow(null);
grabLog.fine(" Grab Failure - mouse");
return false;
}
int keyGrab = XlibWrapper.XGrabKeyboard(XToolkit.getDisplay(),
- getContentWindow(), ownerEvents, GrabModeAsync, GrabModeAsync,
- CurrentTime);
- if (keyGrab != GrabSuccess) {
- XlibWrapper.XUngrabPointer(XToolkit.getDisplay(), CurrentTime);
- XlibWrapper.XUngrabKeyboard(XToolkit.getDisplay(), CurrentTime);
+ getContentWindow(), ownerEvents, XConstants.GrabModeAsync, XConstants.GrabModeAsync,
+ XConstants.CurrentTime);
+ if (keyGrab != XConstants.GrabSuccess) {
+ XlibWrapper.XUngrabPointer(XToolkit.getDisplay(), XConstants.CurrentTime);
+ XlibWrapper.XUngrabKeyboard(XToolkit.getDisplay(), XConstants.CurrentTime);
XAwtState.setGrabWindow(null);
grabLog.fine(" Grab Failure - keyboard");
return false;
@@ -882,8 +882,8 @@
grabLog.log(Level.FINE, "UnGrab input on {0}", new Object[] {grabWindow});
if (grabWindow != null) {
grabWindow.ungrabInputImpl();
- XlibWrapper.XUngrabPointer(XToolkit.getDisplay(), CurrentTime);
- XlibWrapper.XUngrabKeyboard(XToolkit.getDisplay(), CurrentTime);
+ XlibWrapper.XUngrabPointer(XToolkit.getDisplay(), XConstants.CurrentTime);
+ XlibWrapper.XUngrabKeyboard(XToolkit.getDisplay(), XConstants.CurrentTime);
XAwtState.setGrabWindow(null);
// we need to call XFlush() here to force ungrab
// see 6384219 for details
@@ -979,15 +979,15 @@
*/
public void handleButtonPressRelease(XEvent xev) {
XButtonEvent xbe = xev.get_xbutton();
- final int buttonState = xbe.get_state() & (Button1Mask | Button2Mask
- | Button3Mask | Button4Mask | Button5Mask);
+ final int buttonState = xbe.get_state() & (XConstants.Button1Mask | XConstants.Button2Mask
+ | XConstants.Button3Mask | XConstants.Button4Mask | XConstants.Button5Mask);
switch (xev.get_type()) {
- case ButtonPress:
+ case XConstants.ButtonPress:
if (buttonState == 0) {
XAwtState.setAutoGrabWindow(this);
}
break;
- case ButtonRelease:
+ case XConstants.ButtonRelease:
if (isFullRelease(buttonState, xbe.get_button())) {
XAwtState.setAutoGrabWindow(null);
}
@@ -1012,30 +1012,30 @@
*/
static boolean isFullRelease(int buttonState, int button) {
switch (button) {
- case Button1:
- return buttonState == Button1Mask;
- case Button2:
- return buttonState == Button2Mask;
- case Button3:
- return buttonState == Button3Mask;
- case Button4:
- return buttonState == Button4Mask;
- case Button5:
- return buttonState == Button5Mask;
+ case XConstants.Button1:
+ return buttonState == XConstants.Button1Mask;
+ case XConstants.Button2:
+ return buttonState == XConstants.Button2Mask;
+ case XConstants.Button3:
+ return buttonState == XConstants.Button3Mask;
+ case XConstants.Button4:
+ return buttonState == XConstants.Button4Mask;
+ case XConstants.Button5:
+ return buttonState == XConstants.Button5Mask;
}
return buttonState == 0;
}
static boolean isGrabbedEvent(XEvent ev, XBaseWindow target) {
switch (ev.get_type()) {
- case ButtonPress:
- case ButtonRelease:
- case MotionNotify:
- case KeyPress:
- case KeyRelease:
+ case XConstants.ButtonPress:
+ case XConstants.ButtonRelease:
+ case XConstants.MotionNotify:
+ case XConstants.KeyPress:
+ case XConstants.KeyRelease:
return true;
- case LeaveNotify:
- case EnterNotify:
+ case XConstants.LeaveNotify:
+ case XConstants.EnterNotify:
// We shouldn't dispatch this events to the grabbed components (see 6317481)
// But this logic is important if the grabbed component is top-level (see realSync)
return (target instanceof XWindowPeer);
@@ -1067,53 +1067,53 @@
switch (type)
{
- case VisibilityNotify:
+ case XConstants.VisibilityNotify:
handleVisibilityEvent(xev);
break;
- case ClientMessage:
+ case XConstants.ClientMessage:
handleClientMessage(xev);
break;
- case Expose :
- case GraphicsExpose :
+ case XConstants.Expose :
+ case XConstants.GraphicsExpose :
handleExposeEvent(xev);
break;
- case ButtonPress:
- case ButtonRelease:
+ case XConstants.ButtonPress:
+ case XConstants.ButtonRelease:
handleButtonPressRelease(xev);
break;
- case MotionNotify:
+ case XConstants.MotionNotify:
handleMotionNotify(xev);
break;
- case KeyPress:
+ case XConstants.KeyPress:
handleKeyPress(xev);
break;
- case KeyRelease:
+ case XConstants.KeyRelease:
handleKeyRelease(xev);
break;
- case EnterNotify:
- case LeaveNotify:
+ case XConstants.EnterNotify:
+ case XConstants.LeaveNotify:
handleXCrossingEvent(xev);
break;
- case ConfigureNotify:
+ case XConstants.ConfigureNotify:
handleConfigureNotifyEvent(xev);
break;
- case MapNotify:
+ case XConstants.MapNotify:
handleMapNotifyEvent(xev);
break;
- case UnmapNotify:
+ case XConstants.UnmapNotify:
handleUnmapNotifyEvent(xev);
break;
- case ReparentNotify:
+ case XConstants.ReparentNotify:
handleReparentNotifyEvent(xev);
break;
- case PropertyNotify:
+ case XConstants.PropertyNotify:
handlePropertyNotify(xev);
break;
- case DestroyNotify:
+ case XConstants.DestroyNotify:
handleDestroyNotify(xev);
break;
- case CreateNotify:
+ case XConstants.CreateNotify:
handleCreateNotify(xev);
break;
}
--- a/jdk/src/solaris/classes/sun/awt/X11/XClipboard.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XClipboard.java Wed May 14 07:53:12 2008 -0700
@@ -185,7 +185,7 @@
private static class SelectionNotifyHandler implements XEventDispatcher {
public void dispatchEvent(XEvent ev) {
- if (ev.get_type() == XlibWrapper.SelectionNotify) {
+ if (ev.get_type() == XConstants.SelectionNotify) {
final XSelectionEvent xse = ev.get_xselection();
XClipboard clipboard = null;
synchronized (XClipboard.classLock) {
@@ -223,7 +223,7 @@
XDataTransferer.TARGETS_ATOM.getAtom(),
getTargetsPropertyAtom().getAtom(),
XWindow.getXAWTRootWindow().getWindow(),
- XlibWrapper.CurrentTime);
+ XConstants.CurrentTime);
isSelectionNotifyProcessed = false;
}
} finally {
@@ -260,7 +260,7 @@
long[] formats = null;
- if (propertyAtom == XlibWrapper.None) {
+ if (propertyAtom == XConstants.None) {
// We treat None property atom as "empty selection".
formats = new long[0];
} else {
@@ -268,7 +268,7 @@
new WindowPropertyGetter(XWindow.getXAWTRootWindow().getWindow(),
XAtom.get(propertyAtom), 0,
XSelection.MAX_LENGTH, true,
- XlibWrapper.AnyPropertyType);
+ XConstants.AnyPropertyType);
try {
targetsGetter.execute();
formats = XSelection.getFormats(targetsGetter);
--- a/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java Wed May 14 07:53:12 2008 -0700
@@ -72,7 +72,7 @@
import sun.awt.image.ToolkitImage;
import sun.java2d.pipe.Region;
-public class XComponentPeer extends XWindow implements ComponentPeer, DropTargetPeer, XConstants {
+public class XComponentPeer extends XWindow implements ComponentPeer, DropTargetPeer {
/* FIX ME: these constants copied from java.awt.KeyboardFocusManager */
static final int SNFH_FAILURE = 0;
static final int SNFH_SUCCESS_HANDLED = 1;
@@ -420,40 +420,36 @@
case SNFH_SUCCESS_PROCEED:
// Currently we just generate focus events like we deal with lightweight instead of calling
// XSetInputFocus on native window
- if (focusLog.isLoggable(Level.FINER)) focusLog.finer("Proceeding with request to " + lightweightChild + " in " + target);
+ if (focusLog.isLoggable(Level.FINER)) focusLog.finer("Proceeding with request to " +
+ lightweightChild + " in " + target);
/**
* The problems with requests in non-focused window arise because shouldNativelyFocusHeavyweight
* checks that native window is focused while appropriate WINDOW_GAINED_FOCUS has not yet
* been processed - it is in EventQueue. Thus, SNFH allows native request and stores request record
- * in requests list - and it breaks our requests sequence as first record on WGF should be the last focus
- * owner which had focus before WLF. So, we should not add request record for such requests
+ * in requests list - and it breaks our requests sequence as first record on WGF should be the last
+ * focus owner which had focus before WLF. So, we should not add request record for such requests
* but store this component in mostRecent - and return true as before for compatibility.
*/
Window parentWindow = getContainingWindow(target);
- if (parentWindow != null) {
- // and check that it is focused
- if (!parentWindow.isFocused()) {
- XWindowPeer wpeer = (XWindowPeer)parentWindow.getPeer();
- /*
- * Fix for 6314575.
- * Shouldn't restore focus on 'actualFocusedWindow'
- * when a component inside a Frame is requesting it.
- */
- wpeer.setActualFocusedWindow(null);
+ if (parentWindow == null) {
+ return rejectFocusRequestHelper("WARNING: Parent window is null");
+ }
+ XWindowPeer wpeer = (XWindowPeer)parentWindow.getPeer();
+ if (wpeer == null) {
+ return rejectFocusRequestHelper("WARNING: Parent window's peer is null");
+ }
+ /*
+ * Passing null 'actualFocusedWindow' as we don't want to restore focus on it
+ * when a component inside a Frame is requesting focus.
+ * See 6314575 for details.
+ */
+ boolean res = wpeer.requestWindowFocus(null);
- boolean res = wpeer.requestWindowFocus();
- if (focusLog.isLoggable(Level.FINER)) focusLog.finer("Requested window focus: " + res);
- // If parent window can be made focused and has been made focused(synchronously)
- // then we can proceed with children, otherwise we retreat.
- if (!(res && parentWindow.isFocused())) {
- focusLog.finer("Waiting for asynchronous processing of window focus request");
- KeyboardFocusManagerPeerImpl.removeLastFocusRequest(target);
- return false;
- }
- }
- } else {
- if (focusLog.isLoggable(Level.FINER)) focusLog.finer("WARNING: Parent window is null");
- return false;
+ if (focusLog.isLoggable(Level.FINER)) focusLog.finer("Requested window focus: " + res);
+ // If parent window can be made focused and has been made focused(synchronously)
+ // then we can proceed with children, otherwise we retreat.
+ if (!(res && parentWindow.isFocused())) {
+ return rejectFocusRequestHelper("Waiting for asynchronous processing of the request");
}
// NOTE: We simulate heavyweight behavior of Motif - component receives focus right
@@ -469,6 +465,12 @@
return false;
}
+ private boolean rejectFocusRequestHelper(String logMsg) {
+ if (focusLog.isLoggable(Level.FINER)) focusLog.finer(logMsg);
+ KeyboardFocusManagerPeerImpl.removeLastFocusRequest(target);
+ return false;
+ }
+
void handleJavaFocusEvent(AWTEvent e) {
if (focusLog.isLoggable(Level.FINER)) focusLog.finer(e.toString());
if (e.getID() == FocusEvent.FOCUS_GAINED) {
@@ -718,7 +720,7 @@
* handleJavaMouseEvent() would be more suitable place to do this
* but we want Swing to have this functionality also.
*/
- if (xev.get_type() == ButtonPress) {
+ if (xev.get_type() == XConstants.ButtonPress) {
final XWindowPeer parentXWindow = getParentTopLevel();
Window parentWindow = (Window)parentXWindow.getTarget();
if (parentXWindow.isFocusableWindow() && parentXWindow.isSimpleWindow() &&
@@ -841,7 +843,7 @@
XSetWindowAttributes xwa = new XSetWindowAttributes();
xwa.set_cursor(xcursor);
- long valuemask = XlibWrapper.CWCursor;
+ long valuemask = XConstants.CWCursor;
XlibWrapper.XChangeWindowAttributes(XToolkit.getDisplay(),getWindow(),valuemask,xwa.pData);
XlibWrapper.XFlush(XToolkit.getDisplay());
@@ -1342,20 +1344,20 @@
enableLog.log(Level.FINEST, "Component is {1}, checking for disabled event {0}", new Object[] {e, (isEnabled()?"enabled":"disable")});
if (!isEnabled()) {
switch (e.get_type()) {
- case ButtonPress:
- case ButtonRelease:
- case KeyPress:
- case KeyRelease:
- case EnterNotify:
- case LeaveNotify:
- case MotionNotify:
+ case XConstants.ButtonPress:
+ case XConstants.ButtonRelease:
+ case XConstants.KeyPress:
+ case XConstants.KeyRelease:
+ case XConstants.EnterNotify:
+ case XConstants.LeaveNotify:
+ case XConstants.MotionNotify:
enableLog.log(Level.FINER, "Event {0} is disable", new Object[] {e});
return true;
}
}
switch(e.get_type()) {
- case MapNotify:
- case UnmapNotify:
+ case XConstants.MapNotify:
+ case XConstants.UnmapNotify:
return true;
}
return super.isEventDisabled(e);
--- a/jdk/src/solaris/classes/sun/awt/X11/XConstants.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XConstants.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,10 @@
package sun.awt.X11;
-public interface XConstants {
+final public class XConstants {
+
+ private XConstants(){}
+
public static final int X_PROTOCOL = 11 ; /* current protocol version */
public static final int X_PROTOCOL_REVISION = 0 ; /* current minor version */
@@ -292,9 +295,9 @@
public static final int RevertToParent = 2 ;
/* Used in XEventsQueued */
- int QueuedAlready = 0;
- int QueuedAfterReading = 1;
- int QueuedAfterFlush = 2;
+ public static final int QueuedAlready = 0;
+ public static final int QueuedAfterReading = 1;
+ public static final int QueuedAfterFlush = 2;
/*****************************************************************
--- a/jdk/src/solaris/classes/sun/awt/X11/XContentWindow.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XContentWindow.java Wed May 14 07:53:12 2008 -0700
@@ -43,7 +43,7 @@
* It should always be located at (- left inset, - top inset) in the associated
* decorated window. So coordinates in it would be the same as java coordinates.
*/
-public final class XContentWindow extends XWindow implements XConstants {
+public final class XContentWindow extends XWindow {
private static Logger insLog = Logger.getLogger("sun.awt.X11.insets.XContentWindow");
static XContentWindow createContent(XDecoratedPeer parentFrame) {
@@ -76,10 +76,10 @@
void preInit(XCreateWindowParams params) {
super.preInit(params);
- params.putIfNull(BIT_GRAVITY, Integer.valueOf(NorthWestGravity));
+ params.putIfNull(BIT_GRAVITY, Integer.valueOf(XConstants.NorthWestGravity));
Long eventMask = (Long)params.get(EVENT_MASK);
if (eventMask != null) {
- eventMask = eventMask & ~(StructureNotifyMask);
+ eventMask = eventMask & ~(XConstants.StructureNotifyMask);
params.put(EVENT_MASK, eventMask);
}
}
@@ -90,15 +90,15 @@
protected boolean isEventDisabled(XEvent e) {
switch (e.get_type()) {
// Override parentFrame to receive MouseEnter/Exit
- case EnterNotify:
- case LeaveNotify:
+ case XConstants.EnterNotify:
+ case XConstants.LeaveNotify:
return false;
// We handle ConfigureNotify specifically in XDecoratedPeer
- case ConfigureNotify:
+ case XConstants.ConfigureNotify:
return true;
// We don't want SHOWN/HIDDEN on content window since it will duplicate XDecoratedPeer
- case MapNotify:
- case UnmapNotify:
+ case XConstants.MapNotify:
+ case XConstants.UnmapNotify:
return true;
default:
return super.isEventDisabled(e) || parentFrame.isEventDisabled(e);
--- a/jdk/src/solaris/classes/sun/awt/X11/XCursorFontConstants.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XCursorFontConstants.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,10 @@
package sun.awt.X11;
-public interface XCursorFontConstants {
+final public class XCursorFontConstants {
+
+ private XCursorFontConstants(){}
+
/* cursorfont defines */
static final int XC_num_glyphs=154;
static final int XC_X_cursor=0;
--- a/jdk/src/solaris/classes/sun/awt/X11/XCustomCursor.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XCustomCursor.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -83,7 +83,7 @@
long colormap = XToolkit.getDefaultXColormap();
XColor fore_color = new XColor();
- fore_color.set_flags((byte) (XlibWrapper.DoRed | XlibWrapper.DoGreen | XlibWrapper.DoBlue));
+ fore_color.set_flags((byte) (XConstants.DoRed | XConstants.DoGreen | XConstants.DoBlue));
fore_color.set_red((short)(((fcolor >> 16) & 0x000000ff) << 8));
fore_color.set_green((short) (((fcolor >> 8) & 0x000000ff) << 8));
fore_color.set_blue((short)(((fcolor >> 0) & 0x000000ff) << 8));
@@ -92,7 +92,7 @@
XColor back_color = new XColor();
- back_color.set_flags((byte) (XlibWrapper.DoRed | XlibWrapper.DoGreen | XlibWrapper.DoBlue));
+ back_color.set_flags((byte) (XConstants.DoRed | XConstants.DoGreen | XConstants.DoBlue));
back_color.set_red((short) (((bcolor >> 16) & 0x000000ff) << 8));
back_color.set_green((short) (((bcolor >> 8) & 0x000000ff) << 8));
--- a/jdk/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2002-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -40,9 +40,7 @@
private static final Logger log = Logger.getLogger("sun.awt.X11.XDecoratedPeer");
private static final Logger insLog = Logger.getLogger("sun.awt.X11.insets.XDecoratedPeer");
private static final Logger focusLog = Logger.getLogger("sun.awt.X11.focus.XDecoratedPeer");
- private final static Logger iconLog = Logger.getLogger("sun.awt.X11.icon.XDecoratedPeer");
-
- private static XAtom resize_request = new XAtom("_SUN_AWT_RESIZE_REQUEST", false);
+ private static final Logger iconLog = Logger.getLogger("sun.awt.X11.icon.XDecoratedPeer");
// Set to true when we get the first ConfigureNotify after being
// reparented - indicates that WM has adopted the top-level.
@@ -73,14 +71,11 @@
void preInit(XCreateWindowParams params) {
super.preInit(params);
- if (!resize_request.isInterned()) {
- resize_request.intern(false);
- }
winAttr.initialFocus = true;
- currentInsets = new Insets(0,0,0,0); // replacemenet for wdata->top, left, bottom, right
+ currentInsets = new Insets(0,0,0,0);
+ applyGuessedInsets();
- applyGuessedInsets();
Rectangle bounds = (Rectangle)params.get(BOUNDS);
dimensions = new WindowDimensions(bounds, getRealInsets(), false);
params.put(BOUNDS, dimensions.getClientRect());
@@ -89,7 +84,7 @@
// Deny default processing of these events on the shell - proxy will take care of
// them instead
Long eventMask = (Long)params.get(EVENT_MASK);
- params.add(EVENT_MASK, Long.valueOf(eventMask.longValue() & ~(FocusChangeMask | KeyPressMask | KeyReleaseMask)));
+ params.add(EVENT_MASK, Long.valueOf(eventMask.longValue() & ~(XConstants.FocusChangeMask | XConstants.KeyPressMask | XConstants.KeyReleaseMask)));
}
void postInit(XCreateWindowParams params) {
@@ -98,7 +93,10 @@
// happen after the X window is created.
initResizability();
updateSizeHints(dimensions);
+ XWM.requestWMExtents(getWindow());
+
content = XContentWindow.createContent(this);
+
if (warningWindow != null) {
warningWindow.toFront();
}
@@ -121,7 +119,6 @@
updateMinSizeHints();
}
-
private void updateMinSizeHints() {
if (isResizable()) {
Dimension minimumSize = getTargetMinimumSize();
@@ -131,7 +128,7 @@
int minHeight = minimumSize.height - insets.top - insets.bottom;
if (minWidth < 0) minWidth = 0;
if (minHeight < 0) minHeight = 0;
- setSizeHints(XlibWrapper.PMinSize | (isLocationByPlatform()?0:(XlibWrapper.PPosition | XlibWrapper.USPosition)),
+ setSizeHints(XUtilConstants.PMinSize | (isLocationByPlatform()?0:(XUtilConstants.PPosition | XUtilConstants.USPosition)),
getX(), getY(), minWidth, minHeight);
if (isVisible()) {
Rectangle bounds = getShellBounds();
@@ -143,7 +140,7 @@
}
} else {
boolean isMinSizeSet = isMinSizeSet();
- XWM.removeSizeHints(this, XlibWrapper.PMinSize);
+ XWM.removeSizeHints(this, XUtilConstants.PMinSize);
/* Some WMs need remap to redecorate the window */
if (isMinSizeSet && isShowing() && XWM.needRemap(this)) {
/*
@@ -238,23 +235,59 @@
return false;
}
- Insets difference(Insets i1, Insets i2) {
+ private static Insets difference(Insets i1, Insets i2) {
return new Insets(i1.top-i2.top, i1.left - i2.left, i1.bottom-i2.bottom, i1.right-i2.right);
}
- void add(Insets i1, Insets i2) {
- i1.left += i2.left;
- i1.top += i2.top;
- i1.right += i2.right;
- i1.bottom += i2.bottom;
- }
- boolean isNull(Insets i) {
+ private static boolean isNull(Insets i) {
return (i == null) || ((i.left | i.top | i.right | i.bottom) == 0);
}
- Insets copy(Insets i) {
+
+ private static Insets copy(Insets i) {
return new Insets(i.top, i.left, i.bottom, i.right);
}
+ // insets which we get from WM (e.g from _NET_FRAME_EXTENTS)
+ private Insets wm_set_insets;
+
+ private Insets getWMSetInsets(XAtom changedAtom) {
+ if (isEmbedded()) {
+ return null;
+ }
+
+ if (wm_set_insets != null) {
+ return wm_set_insets;
+ }
+
+ if (changedAtom == null) {
+ wm_set_insets = XWM.getInsetsFromExtents(getWindow());
+ } else {
+ wm_set_insets = XWM.getInsetsFromProp(getWindow(), changedAtom);
+ }
+
+ insLog.log(Level.FINER, "FRAME_EXTENTS: {0}", new Object[]{wm_set_insets});
+
+ if (wm_set_insets != null) {
+ wm_set_insets = copy(wm_set_insets);
+ }
+ return wm_set_insets;
+ }
+
+ private void resetWMSetInsets() {
+ wm_set_insets = null;
+ }
+
+ public void handlePropertyNotify(XEvent xev) {
+ super.handlePropertyNotify(xev);
+
+ XPropertyEvent ev = xev.get_xproperty();
+ if (ev.get_atom() == XWM.XA_KDE_NET_WM_FRAME_STRUT.getAtom()
+ || ev.get_atom() == XWM.XA_NET_FRAME_EXTENTS.getAtom())
+ {
+ getWMSetInsets(XAtom.get(ev.get_atom()));
+ }
+ }
+
long reparent_serial = 0;
public void handleReparentNotifyEvent(XEvent xev) {
@@ -337,35 +370,30 @@
Insets correction = difference(correctWM, currentInsets);
insLog.log(Level.FINEST, "Corrention {0}", new Object[] {correction});
if (!isNull(correction)) {
- /*
- * Actual insets account for menubar/warning label,
- * so we can't assign directly but must adjust them.
- */
- add(currentInsets, correction);
+ currentInsets = copy(correctWM);
applyGuessedInsets();
//Fix for 6318109: PIT: Min Size is not honored properly when a
//smaller size is specified in setSize(), XToolkit
//update minimum size hints
updateMinSizeHints();
-
- /*
- * If this window has been sized by a pack() we need
- * to keep the interior geometry intact. Since pack()
- * computed width and height with wrong insets, we
- * must adjust the target dimensions appropriately.
- */
}
if (insLog.isLoggable(Level.FINER)) insLog.finer("Dimensions before reparent: " + dimensions);
dimensions.setInsets(getRealInsets());
insets_corrected = true;
- if (isMaximized()) {
+ if (isMaximized() || isNull(correction)) {
return;
}
- if ((getHints().get_flags() & (USPosition | PPosition)) != 0) {
+ /*
+ * If this window has been sized by a pack() we need
+ * to keep the interior geometry intact. Since pack()
+ * computed width and height with wrong insets, we
+ * must adjust the target dimensions appropriately.
+ */
+ if ((getHints().get_flags() & (XUtilConstants.USPosition | XUtilConstants.PPosition)) != 0) {
reshape(dimensions, SET_BOUNDS, false);
} else {
reshape(dimensions, SET_SIZE, false);
@@ -384,10 +412,10 @@
protected Insets guessInsets() {
- if (isEmbedded()) {
+ if (isEmbedded() || isTargetUndecorated()) {
return new Insets(0, 0, 0, 0);
} else {
- if (currentInsets.top > 0) {
+ if (!isNull(currentInsets)) {
/* insets were set on wdata by System Properties */
return copy(currentInsets);
} else {
@@ -403,7 +431,6 @@
private void applyGuessedInsets() {
Insets guessed = guessInsets();
currentInsets = copy(guessed);
- insets = copy(currentInsets);
}
public void revalidate() {
@@ -416,16 +443,18 @@
}
Insets getRealInsets() {
- if (isNull(insets)) {
+ if (isNull(currentInsets)) {
applyGuessedInsets();
}
- return insets;
+ return currentInsets;
}
public Insets getInsets() {
Insets in = copy(getRealInsets());
in.top += getMenuBarHeight() + getWarningWindowHeight();
- if (insLog.isLoggable(Level.FINEST)) insLog.log(Level.FINEST, "Get insets returns {0}", new Object[] {in});
+ if (insLog.isLoggable(Level.FINEST)) {
+ insLog.log(Level.FINEST, "Get insets returns {0}", new Object[] {in});
+ }
return in;
}
@@ -835,30 +864,30 @@
public void setResizable(boolean resizable) {
int fs = winAttr.functions;
if (!isResizable() && resizable) {
- insets = currentInsets = new Insets(0, 0, 0, 0);
+ currentInsets = new Insets(0, 0, 0, 0);
resetWMSetInsets();
if (!isEmbedded()) {
setReparented(false);
}
winAttr.isResizable = resizable;
- if ((fs & MWM_FUNC_ALL) != 0) {
- fs &= ~(MWM_FUNC_RESIZE | MWM_FUNC_MAXIMIZE);
+ if ((fs & MWMConstants.MWM_FUNC_ALL) != 0) {
+ fs &= ~(MWMConstants.MWM_FUNC_RESIZE | MWMConstants.MWM_FUNC_MAXIMIZE);
} else {
- fs |= (MWM_FUNC_RESIZE | MWM_FUNC_MAXIMIZE);
+ fs |= (MWMConstants.MWM_FUNC_RESIZE | MWMConstants.MWM_FUNC_MAXIMIZE);
}
winAttr.functions = fs;
XWM.setShellResizable(this);
} else if (isResizable() && !resizable) {
- insets = currentInsets = new Insets(0, 0, 0, 0);
+ currentInsets = new Insets(0, 0, 0, 0);
resetWMSetInsets();
if (!isEmbedded()) {
setReparented(false);
}
winAttr.isResizable = resizable;
- if ((fs & MWM_FUNC_ALL) != 0) {
- fs |= (MWM_FUNC_RESIZE | MWM_FUNC_MAXIMIZE);
+ if ((fs & MWMConstants.MWM_FUNC_ALL) != 0) {
+ fs |= (MWMConstants.MWM_FUNC_RESIZE | MWMConstants.MWM_FUNC_MAXIMIZE);
} else {
- fs &= ~(MWM_FUNC_RESIZE | MWM_FUNC_MAXIMIZE);
+ fs &= ~(MWMConstants.MWM_FUNC_RESIZE | MWMConstants.MWM_FUNC_MAXIMIZE);
}
winAttr.functions = fs;
XWM.setShellNotResizable(this, dimensions, dimensions.getBounds(), false);
@@ -936,10 +965,10 @@
protected boolean isEventDisabled(XEvent e) {
switch (e.get_type()) {
// Do not generate MOVED/RESIZED events since we generate them by ourselves
- case ConfigureNotify:
+ case XConstants.ConfigureNotify:
return true;
- case EnterNotify:
- case LeaveNotify:
+ case XConstants.EnterNotify:
+ case XConstants.LeaveNotify:
// Disable crossing event on outer borders of Frame so
// we receive only one set of cross notifications(first set is from content window)
return true;
@@ -964,7 +993,7 @@
if (winAttr.isResizable) {
//Fix for 4320050: Minimum size for java.awt.Frame is not being enforced.
//We need to update frame's minimum size, not to reset it
- XWM.removeSizeHints(this, XlibWrapper.PMaxSize);
+ XWM.removeSizeHints(this, XUtilConstants.PMaxSize);
updateMinimumSize();
}
} else {
@@ -1004,10 +1033,6 @@
} else if (cl.get_data(0) == wm_take_focus.getAtom()) {
handleWmTakeFocus(cl);
}
- } else if (cl.get_message_type() == resize_request.getAtom()) {
- reshape((int)cl.get_data(0), (int)cl.get_data(1),
- (int)cl.get_data(2), (int)cl.get_data(3),
- (int)cl.get_data(4), true);
}
}
@@ -1114,53 +1139,51 @@
focusLog.fine("Request for decorated window focus");
// If this is Frame or Dialog we can't assure focus request success - but we still can try
// If this is Window and its owner Frame is active we can be sure request succedded.
- Window win = (Window)target;
Window focusedWindow = XKeyboardFocusManagerPeer.getCurrentNativeFocusedWindow();
Window activeWindow = XWindowPeer.getDecoratedOwner(focusedWindow);
focusLog.log(Level.FINER, "Current window is: active={0}, focused={1}",
- new Object[]{ Boolean.valueOf(win == activeWindow),
- Boolean.valueOf(win == focusedWindow)});
+ new Object[]{ Boolean.valueOf(target == activeWindow),
+ Boolean.valueOf(target == focusedWindow)});
XWindowPeer toFocus = this;
while (toFocus.nextTransientFor != null) {
toFocus = toFocus.nextTransientFor;
}
-
- if (this == toFocus) {
- if (focusAllowedFor()) {
- if (win == activeWindow && win != focusedWindow) {
- // Happens when focus is on window child
- focusLog.fine("Focus is on child window - transfering it back");
- handleWindowFocusInSync(-1);
- } else {
- focusLog.fine("Requesting focus to this window");
- if (timeProvided) {
- requestXFocus(time);
- } else {
- requestXFocus();
- }
- }
- return true;
- } else {
- return false;
- }
- }
- else if (toFocus.focusAllowedFor()) {
- focusLog.fine("Requesting focus to " + toFocus);
- if (timeProvided) {
- toFocus.requestXFocus(time);
- } else {
- toFocus.requestXFocus();
- }
- return false;
- }
- else
- {
+ if (toFocus == null || !toFocus.focusAllowedFor()) {
// This might change when WM will have property to determine focus policy.
// Right now, because policy is unknown we can't be sure we succedded
return false;
}
+ if (this == toFocus) {
+ if (isWMStateNetHidden()) {
+ focusLog.fine("The window is unmapped, so rejecting the request");
+ return false;
+ }
+ if (target == activeWindow && target != focusedWindow) {
+ // Happens when an owned window is currently focused
+ focusLog.fine("Focus is on child window - transfering it back to the owner");
+ handleWindowFocusInSync(-1);
+ return true;
+ }
+ Window realNativeFocusedWindow = XWindowPeer.getNativeFocusedWindow();
+ focusLog.finest("Real native focused window: " + realNativeFocusedWindow +
+ "\nKFM's focused window: " + focusedWindow);
+
+ // See 6522725, 6613426.
+ if (target == realNativeFocusedWindow) {
+ focusLog.fine("The window is already natively focused.");
+ return true;
+ }
+ }
+ focusLog.fine("Requesting focus to " + (this == toFocus ? "this window" : toFocus));
+
+ if (timeProvided) {
+ toFocus.requestXFocus(time);
+ } else {
+ toFocus.requestXFocus();
+ }
+ return (this == toFocus);
}
XWindowPeer actualFocusedWindow = null;
--- a/jdk/src/solaris/classes/sun/awt/X11/XDialogPeer.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDialogPeer.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2002-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -51,7 +51,7 @@
} else {
winAttr.decorations = winAttr.AWT_DECOR_NONE;
}
- winAttr.functions = MWM_FUNC_ALL;
+ winAttr.functions = MWMConstants.MWM_FUNC_ALL;
winAttr.isResizable = true; //target.isResizable();
winAttr.initialResizability = target.isResizable();
winAttr.title = target.getTitle();
@@ -80,14 +80,6 @@
super.setVisible(vis);
}
- protected Insets guessInsets() {
- if (isTargetUndecorated()) {
- return new Insets(0, 0, 0, 0);
- } else {
- return super.guessInsets();
- }
- }
-
@Override
boolean isTargetUndecorated() {
if (undecorated != null) {
@@ -100,10 +92,10 @@
int getDecorations() {
int d = super.getDecorations();
// remove minimize and maximize buttons for dialogs
- if ((d & MWM_DECOR_ALL) != 0) {
- d |= (MWM_DECOR_MINIMIZE | MWM_DECOR_MAXIMIZE);
+ if ((d & MWMConstants.MWM_DECOR_ALL) != 0) {
+ d |= (MWMConstants.MWM_DECOR_MINIMIZE | MWMConstants.MWM_DECOR_MAXIMIZE);
} else {
- d &= ~(MWM_DECOR_MINIMIZE | MWM_DECOR_MAXIMIZE);
+ d &= ~(MWMConstants.MWM_DECOR_MINIMIZE | MWMConstants.MWM_DECOR_MAXIMIZE);
}
return d;
}
@@ -111,10 +103,10 @@
int getFunctions() {
int f = super.getFunctions();
// remove minimize and maximize functions for dialogs
- if ((f & MWM_FUNC_ALL) != 0) {
- f |= (MWM_FUNC_MINIMIZE | MWM_FUNC_MAXIMIZE);
+ if ((f & MWMConstants.MWM_FUNC_ALL) != 0) {
+ f |= (MWMConstants.MWM_FUNC_MINIMIZE | MWMConstants.MWM_FUNC_MAXIMIZE);
} else {
- f &= ~(MWM_FUNC_MINIMIZE | MWM_FUNC_MAXIMIZE);
+ f &= ~(MWMConstants.MWM_FUNC_MINIMIZE | MWMConstants.MWM_FUNC_MAXIMIZE);
}
return f;
}
--- a/jdk/src/solaris/classes/sun/awt/X11/XDnDDragSourceProtocol.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDnDDragSourceProtocol.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -103,7 +103,7 @@
XToolkit.RESTORE_XERROR_HANDLER();
if (XToolkit.saved_error != null &&
- XToolkit.saved_error.get_error_code() != XlibWrapper.Success) {
+ XToolkit.saved_error.get_error_code() != XConstants.Success) {
cleanup();
throw new XException("Cannot write XdndActionList property");
}
@@ -124,7 +124,7 @@
XToolkit.RESTORE_XERROR_HANDLER();
if (XToolkit.saved_error != null &&
- XToolkit.saved_error.get_error_code() != XlibWrapper.Success) {
+ XToolkit.saved_error.get_error_code() != XConstants.Success) {
cleanup();
throw new XException("Cannot write XdndActionList property");
}
@@ -134,7 +134,7 @@
}
if (!XDnDConstants.XDnDSelection.setOwner(contents, formatMap, formats,
- XlibWrapper.CurrentTime)) {
+ XConstants.CurrentTime)) {
cleanup();
throw new InvalidDnDOperationException("Cannot acquire selection ownership");
}
@@ -193,11 +193,11 @@
WindowPropertyGetter wpg1 =
new WindowPropertyGetter(window, XDnDConstants.XA_XdndAware, 0, 1,
- false, XlibWrapper.AnyPropertyType);
+ false, XConstants.AnyPropertyType);
int status = wpg1.execute(XToolkit.IgnoreBadWindowHandler);
- if (status == XlibWrapper.Success &&
+ if (status == XConstants.Success &&
wpg1.getData() != 0 && wpg1.getActualType() == XAtom.XA_ATOM) {
int targetVersion = (int)Native.getLong(wpg1.getData());
@@ -217,7 +217,7 @@
try {
status = wpg2.execute(XToolkit.IgnoreBadWindowHandler);
- if (status == XlibWrapper.Success &&
+ if (status == XConstants.Success &&
wpg2.getData() != 0 &&
wpg2.getActualType() == XAtom.XA_WINDOW) {
@@ -235,7 +235,7 @@
try {
status = wpg3.execute(XToolkit.IgnoreBadWindowHandler);
- if (status != XlibWrapper.Success ||
+ if (status != XConstants.Success ||
wpg3.getData() == 0 ||
wpg3.getActualType() != XAtom.XA_WINDOW ||
Native.getLong(wpg3.getData()) != proxy) {
@@ -246,12 +246,12 @@
new WindowPropertyGetter(proxy,
XDnDConstants.XA_XdndAware,
0, 1, false,
- XlibWrapper.AnyPropertyType);
+ XConstants.AnyPropertyType);
try {
status = wpg4.execute(XToolkit.IgnoreBadWindowHandler);
- if (status != XlibWrapper.Success ||
+ if (status != XConstants.Success ||
wpg4.getData() == 0 ||
wpg4.getActualType() != XAtom.XA_ATOM) {
@@ -283,7 +283,7 @@
XClientMessageEvent msg = new XClientMessageEvent();
try {
- msg.set_type((int)XlibWrapper.ClientMessage);
+ msg.set_type((int)XConstants.ClientMessage);
msg.set_window(getTargetWindow());
msg.set_format(32);
msg.set_message_type(XDnDConstants.XA_XdndEnter.getAtom());
@@ -297,7 +297,7 @@
msg.set_data(4, formats.length > 2 ? formats[2] : 0);
XlibWrapper.XSendEvent(XToolkit.getDisplay(),
getTargetProxyWindow(),
- false, XlibWrapper.NoEventMask,
+ false, XConstants.NoEventMask,
msg.pData);
} finally {
msg.dispose();
@@ -311,7 +311,7 @@
XClientMessageEvent msg = new XClientMessageEvent();
try {
- msg.set_type((int)XlibWrapper.ClientMessage);
+ msg.set_type((int)XConstants.ClientMessage);
msg.set_window(getTargetWindow());
msg.set_format(32);
msg.set_message_type(XDnDConstants.XA_XdndPosition.getAtom());
@@ -322,7 +322,7 @@
msg.set_data(4, XDnDConstants.getXDnDActionForJavaAction(sourceAction));
XlibWrapper.XSendEvent(XToolkit.getDisplay(),
getTargetProxyWindow(),
- false, XlibWrapper.NoEventMask,
+ false, XConstants.NoEventMask,
msg.pData);
} finally {
msg.dispose();
@@ -335,7 +335,7 @@
XClientMessageEvent msg = new XClientMessageEvent();
try {
- msg.set_type((int)XlibWrapper.ClientMessage);
+ msg.set_type((int)XConstants.ClientMessage);
msg.set_window(getTargetWindow());
msg.set_format(32);
msg.set_message_type(XDnDConstants.XA_XdndLeave.getAtom());
@@ -346,7 +346,7 @@
msg.set_data(4, 0);
XlibWrapper.XSendEvent(XToolkit.getDisplay(),
getTargetProxyWindow(),
- false, XlibWrapper.NoEventMask,
+ false, XConstants.NoEventMask,
msg.pData);
} finally {
msg.dispose();
@@ -361,7 +361,7 @@
XClientMessageEvent msg = new XClientMessageEvent();
try {
- msg.set_type((int)XlibWrapper.ClientMessage);
+ msg.set_type((int)XConstants.ClientMessage);
msg.set_window(getTargetWindow());
msg.set_format(32);
msg.set_message_type(XDnDConstants.XA_XdndDrop.getAtom());
@@ -372,7 +372,7 @@
msg.set_data(4, 0);
XlibWrapper.XSendEvent(XToolkit.getDisplay(),
getTargetProxyWindow(),
- false, XlibWrapper.NoEventMask,
+ false, XConstants.NoEventMask,
msg.pData);
} finally {
msg.dispose();
@@ -406,7 +406,7 @@
assert XToolkit.isAWTLockHeldByCurrentThread();
XlibWrapper.XSendEvent(XToolkit.getDisplay(), sourceWindow,
- false, XlibWrapper.NoEventMask,
+ false, XConstants.NoEventMask,
xclient.pData);
return true;
--- a/jdk/src/solaris/classes/sun/awt/X11/XDnDDropTargetProtocol.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDnDDropTargetProtocol.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -93,7 +93,7 @@
XToolkit.RESTORE_XERROR_HANDLER();
if (XToolkit.saved_error != null &&
- XToolkit.saved_error.get_error_code() != XlibWrapper.Success) {
+ XToolkit.saved_error.get_error_code() != XConstants.Success) {
throw new XException("Cannot write XdndAware property");
}
} finally {
@@ -119,12 +119,12 @@
WindowPropertyGetter wpg1 =
new WindowPropertyGetter(embedder, XDnDConstants.XA_XdndAware, 0, 1,
- false, XlibWrapper.AnyPropertyType);
+ false, XConstants.AnyPropertyType);
try {
status = wpg1.execute(XToolkit.IgnoreBadWindowHandler);
- if (status == XlibWrapper.Success &&
+ if (status == XConstants.Success &&
wpg1.getData() != 0 && wpg1.getActualType() == XAtom.XA_ATOM) {
overriden = true;
@@ -143,7 +143,7 @@
try {
status = wpg2.execute(XToolkit.IgnoreBadWindowHandler);
- if (status == XlibWrapper.Success &&
+ if (status == XConstants.Success &&
wpg2.getData() != 0 &&
wpg2.getActualType() == XAtom.XA_WINDOW) {
@@ -161,7 +161,7 @@
try {
status = wpg3.execute(XToolkit.IgnoreBadWindowHandler);
- if (status != XlibWrapper.Success ||
+ if (status != XConstants.Success ||
wpg3.getData() == 0 ||
wpg3.getActualType() != XAtom.XA_WINDOW ||
Native.getLong(wpg3.getData()) != proxy) {
@@ -172,12 +172,12 @@
new WindowPropertyGetter(proxy,
XDnDConstants.XA_XdndAware,
0, 1, false,
- XlibWrapper.AnyPropertyType);
+ XConstants.AnyPropertyType);
try {
status = wpg4.execute(XToolkit.IgnoreBadWindowHandler);
- if (status != XlibWrapper.Success ||
+ if (status != XConstants.Success ||
wpg4.getData() == 0 ||
wpg4.getActualType() != XAtom.XA_ATOM) {
@@ -212,7 +212,7 @@
if (XToolkit.saved_error != null &&
XToolkit.saved_error.get_error_code() !=
- XlibWrapper.Success) {
+ XConstants.Success) {
throw new XException("Cannot write XdndAware property");
}
@@ -226,7 +226,7 @@
if (XToolkit.saved_error != null &&
XToolkit.saved_error.get_error_code() !=
- XlibWrapper.Success) {
+ XConstants.Success) {
throw new XException("Cannot write XdndProxy property");
}
@@ -239,7 +239,7 @@
if (XToolkit.saved_error != null &&
XToolkit.saved_error.get_error_code() !=
- XlibWrapper.Success) {
+ XConstants.Success) {
throw new XException("Cannot write XdndAware property");
}
@@ -252,7 +252,7 @@
if (XToolkit.saved_error != null &&
XToolkit.saved_error.get_error_code() !=
- XlibWrapper.Success) {
+ XConstants.Success) {
throw new XException("Cannot write XdndProxy property");
}
} finally {
@@ -285,7 +285,7 @@
if (XToolkit.saved_error != null &&
XToolkit.saved_error.get_error_code() !=
- XlibWrapper.Success) {
+ XConstants.Success) {
throw new XException("Cannot write XdndAware property");
}
@@ -298,7 +298,7 @@
if (XToolkit.saved_error != null &&
XToolkit.saved_error.get_error_code() !=
- XlibWrapper.Success) {
+ XConstants.Success) {
throw new XException("Cannot write XdndProxy property");
}
} finally {
@@ -326,12 +326,12 @@
WindowPropertyGetter wpg1 =
new WindowPropertyGetter(embedded, XDnDConstants.XA_XdndAware, 0, 1,
- false, XlibWrapper.AnyPropertyType);
+ false, XConstants.AnyPropertyType);
try {
status = wpg1.execute(XToolkit.IgnoreBadWindowHandler);
- if (status == XlibWrapper.Success &&
+ if (status == XConstants.Success &&
wpg1.getData() != 0 && wpg1.getActualType() == XAtom.XA_ATOM) {
overriden = true;
@@ -350,7 +350,7 @@
try {
status = wpg2.execute(XToolkit.IgnoreBadWindowHandler);
- if (status == XlibWrapper.Success &&
+ if (status == XConstants.Success &&
wpg2.getData() != 0 &&
wpg2.getActualType() == XAtom.XA_WINDOW) {
@@ -368,7 +368,7 @@
try {
status = wpg3.execute(XToolkit.IgnoreBadWindowHandler);
- if (status != XlibWrapper.Success ||
+ if (status != XConstants.Success ||
wpg3.getData() == 0 ||
wpg3.getActualType() != XAtom.XA_WINDOW ||
Native.getLong(wpg3.getData()) != proxy) {
@@ -379,12 +379,12 @@
new WindowPropertyGetter(proxy,
XDnDConstants.XA_XdndAware,
0, 1, false,
- XlibWrapper.AnyPropertyType);
+ XConstants.AnyPropertyType);
try {
status = wpg4.execute(XToolkit.IgnoreBadWindowHandler);
- if (status != XlibWrapper.Success ||
+ if (status != XConstants.Success ||
wpg4.getData() == 0 ||
wpg4.getActualType() != XAtom.XA_ATOM) {
@@ -408,12 +408,12 @@
WindowPropertyGetter wpg1 =
new WindowPropertyGetter(window, XDnDConstants.XA_XdndAware, 0, 1,
- false, XlibWrapper.AnyPropertyType);
+ false, XConstants.AnyPropertyType);
try {
int status = wpg1.execute(XToolkit.IgnoreBadWindowHandler);
- if (status == XlibWrapper.Success &&
+ if (status == XConstants.Success &&
wpg1.getData() != 0 && wpg1.getActualType() == XAtom.XA_ATOM) {
return true;
@@ -523,7 +523,7 @@
for (int i = 0; i < 3; i++) {
long j;
- if ((j = xclient.get_data(2 + i)) != XlibWrapper.None) {
+ if ((j = xclient.get_data(2 + i)) != XConstants.None) {
formats3[countFormats++] = j;
}
}
@@ -549,7 +549,7 @@
if (status == 0 ||
(XToolkit.saved_error != null &&
- XToolkit.saved_error.get_error_code() != XlibWrapper.Success)) {
+ XToolkit.saved_error.get_error_code() != XConstants.Success)) {
throw new XException("XGetWindowAttributes failed");
}
@@ -561,12 +561,12 @@
XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
XlibWrapper.XSelectInput(XToolkit.getDisplay(), source_win,
source_win_mask |
- XlibWrapper.StructureNotifyMask);
+ XConstants.StructureNotifyMask);
XToolkit.RESTORE_XERROR_HANDLER();
if (XToolkit.saved_error != null &&
- XToolkit.saved_error.get_error_code() != XlibWrapper.Success) {
+ XToolkit.saved_error.get_error_code() != XConstants.Success) {
throw new XException("XSelectInput failed");
}
@@ -581,7 +581,7 @@
}
private boolean processXdndPosition(XClientMessageEvent xclient) {
- long time_stamp = (int)XlibWrapper.CurrentTime;
+ long time_stamp = (int)XConstants.CurrentTime;
long xdnd_action = 0;
int java_action = DnDConstants.ACTION_NONE;
int x = 0;
@@ -748,7 +748,7 @@
long data3, long data4) {
XClientMessageEvent enter = new XClientMessageEvent();
try {
- enter.set_type((int)XlibWrapper.ClientMessage);
+ enter.set_type((int)XConstants.ClientMessage);
enter.set_window(toplevel);
enter.set_format(32);
enter.set_message_type(XDnDConstants.XA_XdndEnter.getAtom());
@@ -774,7 +774,7 @@
long sourceWindow) {
XClientMessageEvent leave = new XClientMessageEvent();
try {
- leave.set_type((int)XlibWrapper.ClientMessage);
+ leave.set_type((int)XConstants.ClientMessage);
leave.set_window(toplevel);
leave.set_format(32);
leave.set_message_type(XDnDConstants.XA_XdndLeave.getAtom());
@@ -804,7 +804,7 @@
XClientMessageEvent msg = new XClientMessageEvent();
try {
- msg.set_type((int)XlibWrapper.ClientMessage);
+ msg.set_type((int)XConstants.ClientMessage);
msg.set_window(xclient.get_data(0));
msg.set_format(32);
msg.set_message_type(XDnDConstants.XA_XdndStatus.getAtom());
@@ -826,7 +826,7 @@
try {
XlibWrapper.XSendEvent(XToolkit.getDisplay(),
xclient.get_data(0),
- false, XlibWrapper.NoEventMask,
+ false, XConstants.NoEventMask,
msg.pData);
} finally {
XToolkit.awtUnlock();
@@ -842,7 +842,7 @@
throws IllegalArgumentException, IOException {
XClientMessageEvent xclient = new XClientMessageEvent(ctxt);
long message_type = xclient.get_message_type();
- long time_stamp = XlibWrapper.CurrentTime;
+ long time_stamp = XConstants.CurrentTime;
// NOTE: we assume that the source supports at least version 1, so we
// can use the time stamp
@@ -892,7 +892,7 @@
XClientMessageEvent msg = new XClientMessageEvent();
try {
- msg.set_type((int)XlibWrapper.ClientMessage);
+ msg.set_type((int)XConstants.ClientMessage);
msg.set_window(xclient.get_data(0));
msg.set_format(32);
msg.set_message_type(XDnDConstants.XA_XdndFinished.getAtom());
@@ -914,7 +914,7 @@
try {
XlibWrapper.XSendEvent(XToolkit.getDisplay(),
xclient.get_data(0),
- false, XlibWrapper.NoEventMask,
+ false, XConstants.NoEventMask,
msg.pData);
} finally {
XToolkit.awtUnlock();
@@ -1119,7 +1119,7 @@
XToolkit.RESTORE_XERROR_HANDLER();
if (XToolkit.saved_error != null &&
- XToolkit.saved_error.get_error_code() != XlibWrapper.Success) {
+ XToolkit.saved_error.get_error_code() != XConstants.Success) {
if (logger.isLoggable(Level.WARNING)) {
logger.warning("Cannot set XdndTypeList on the proxy window");
}
--- a/jdk/src/solaris/classes/sun/awt/X11/XDragSourceContextPeer.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDragSourceContextPeer.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -55,11 +55,11 @@
Logger.getLogger("sun.awt.X11.xembed.xdnd.XDragSourceContextPeer");
/* The events selected on the root window when the drag begins. */
- private static final int ROOT_EVENT_MASK = (int)XlibWrapper.ButtonMotionMask |
- (int)XlibWrapper.KeyPressMask | (int)XlibWrapper.KeyReleaseMask;
+ private static final int ROOT_EVENT_MASK = (int)XConstants.ButtonMotionMask |
+ (int)XConstants.KeyPressMask | (int)XConstants.KeyReleaseMask;
/* The events to be delivered during grab. */
- private static final int GRAB_EVENT_MASK = (int)XlibWrapper.ButtonPressMask |
- (int)XlibWrapper.ButtonMotionMask | (int)XlibWrapper.ButtonReleaseMask;
+ private static final int GRAB_EVENT_MASK = (int)XConstants.ButtonPressMask |
+ (int)XConstants.ButtonMotionMask | (int)XConstants.ButtonReleaseMask;
/* The event mask of the root window before the drag operation starts. */
private long rootEventMask = 0;
@@ -196,11 +196,11 @@
status = XlibWrapper.XGrabPointer(XToolkit.getDisplay(), rootWindow,
0, GRAB_EVENT_MASK,
- XlibWrapper.GrabModeAsync,
- XlibWrapper.GrabModeAsync,
- XlibWrapper.None, xcursor, timeStamp);
+ XConstants.GrabModeAsync,
+ XConstants.GrabModeAsync,
+ XConstants.None, xcursor, timeStamp);
- if (status != XlibWrapper.GrabSuccess) {
+ if (status != XConstants.GrabSuccess) {
cleanup(timeStamp);
throwGrabFailureException("Cannot grab pointer", status);
return;
@@ -208,11 +208,11 @@
status = XlibWrapper.XGrabKeyboard(XToolkit.getDisplay(), rootWindow,
0,
- XlibWrapper.GrabModeAsync,
- XlibWrapper.GrabModeAsync,
+ XConstants.GrabModeAsync,
+ XConstants.GrabModeAsync,
timeStamp);
- if (status != XlibWrapper.GrabSuccess) {
+ if (status != XConstants.GrabSuccess) {
cleanup(timeStamp);
throwGrabFailureException("Cannot grab keyboard", status);
return;
@@ -276,7 +276,7 @@
XlibWrapper.XChangeActivePointerGrab(XToolkit.getDisplay(),
GRAB_EVENT_MASK,
xcursor,
- XlibWrapper.CurrentTime);
+ XConstants.CurrentTime);
}
protected boolean needsBogusExitBeforeDrop() {
@@ -287,10 +287,10 @@
throws InvalidDnDOperationException {
String msgCause = "";
switch (grabStatus) {
- case XlibWrapper.GrabNotViewable: msgCause = "not viewable"; break;
- case XlibWrapper.AlreadyGrabbed: msgCause = "already grabbed"; break;
- case XlibWrapper.GrabInvalidTime: msgCause = "invalid time"; break;
- case XlibWrapper.GrabFrozen: msgCause = "grab frozen"; break;
+ case XConstants.GrabNotViewable: msgCause = "not viewable"; break;
+ case XConstants.AlreadyGrabbed: msgCause = "already grabbed"; break;
+ case XConstants.GrabInvalidTime: msgCause = "invalid time"; break;
+ case XConstants.GrabFrozen: msgCause = "grab frozen"; break;
default: msgCause = "unknown failure"; break;
}
throw new InvalidDnDOperationException(msg + ": " + msgCause);
@@ -537,7 +537,7 @@
return false;
}
- if (ev.get_type() != (int)XlibWrapper.ClientMessage) {
+ if (ev.get_type() != (int)XConstants.ClientMessage) {
return false;
}
@@ -579,18 +579,18 @@
}
switch (ev.get_type()) {
- case XlibWrapper.ClientMessage: {
+ case XConstants.ClientMessage: {
XClientMessageEvent xclient = ev.get_xclient();
return processClientMessage(xclient);
}
- case XlibWrapper.DestroyNotify: {
+ case XConstants.DestroyNotify: {
XDestroyWindowEvent xde = ev.get_xdestroywindow();
/* Target crashed during drop processing - cleanup. */
if (!dragInProgress &&
dragProtocol != null &&
xde.get_window() == dragProtocol.getTargetWindow()) {
- cleanup(XlibWrapper.CurrentTime);
+ cleanup(XConstants.CurrentTime);
return true;
}
/* Pass along */
@@ -604,14 +604,14 @@
/* Process drag-only messages. */
switch (ev.get_type()) {
- case XlibWrapper.KeyRelease:
- case XlibWrapper.KeyPress: {
+ case XConstants.KeyRelease:
+ case XConstants.KeyPress: {
XKeyEvent xkey = ev.get_xkey();
long keysym = XlibWrapper.XKeycodeToKeysym(XToolkit.getDisplay(),
xkey.get_keycode(), 0);
switch ((int)keysym) {
case (int)XKeySymConstants.XK_Escape: {
- if (ev.get_type() == (int)XlibWrapper.KeyRelease) {
+ if (ev.get_type() == (int)XConstants.KeyRelease) {
cleanup(xkey.get_time());
}
break;
@@ -631,7 +631,7 @@
XlibWrapper.larg7); // modifiers
XMotionEvent xmotion = new XMotionEvent();
try {
- xmotion.set_type(XlibWrapper.MotionNotify);
+ xmotion.set_type(XConstants.MotionNotify);
xmotion.set_serial(xkey.get_serial());
xmotion.set_send_event(xkey.get_send_event());
xmotion.set_display(xkey.get_display());
@@ -658,12 +658,12 @@
}
return true;
}
- case XlibWrapper.ButtonPress:
+ case XConstants.ButtonPress:
return true;
- case XlibWrapper.MotionNotify:
+ case XConstants.MotionNotify:
processMouseMove(ev.get_xmotion());
return true;
- case XlibWrapper.ButtonRelease: {
+ case XConstants.ButtonRelease: {
XButtonEvent xbutton = ev.get_xbutton();
/*
* On some X servers it could happen that ButtonRelease coordinates
@@ -672,7 +672,7 @@
*/
XMotionEvent xmotion = new XMotionEvent();
try {
- xmotion.set_type(XlibWrapper.MotionNotify);
+ xmotion.set_type(XConstants.MotionNotify);
xmotion.set_serial(xbutton.get_serial());
xmotion.set_send_event(xbutton.get_send_event());
xmotion.set_display(xbutton.get_display());
@@ -694,8 +694,8 @@
} finally {
xmotion.dispose();
}
- if (xbutton.get_button() == XlibWrapper.Button1
- || xbutton.get_button() == XlibWrapper.Button2) {
+ if (xbutton.get_button() == XConstants.Button1
+ || xbutton.get_button() == XConstants.Button2) {
// drag is initiated with Button1 or Button2 pressed and
// ended on release of either of these buttons (as the same
// behavior was with our old Motif DnD-based implementation)
@@ -789,6 +789,6 @@
dragDropFinished(success, action, x, y);
dndInProgress = false;
- cleanup(XlibWrapper.CurrentTime);
+ cleanup(XConstants.CurrentTime);
}
}
--- a/jdk/src/solaris/classes/sun/awt/X11/XDragSourceProtocol.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDragSourceProtocol.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -189,7 +189,7 @@
if (status == 0 ||
(XToolkit.saved_error != null &&
- XToolkit.saved_error.get_error_code() != XlibWrapper.Success)) {
+ XToolkit.saved_error.get_error_code() != XConstants.Success)) {
throw new XException("XGetWindowAttributes failed");
}
@@ -201,12 +201,12 @@
XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
XlibWrapper.XSelectInput(XToolkit.getDisplay(), targetWindow,
targetWindowMask |
- XlibWrapper.StructureNotifyMask);
+ XConstants.StructureNotifyMask);
XToolkit.RESTORE_XERROR_HANDLER();
if (XToolkit.saved_error != null &&
- XToolkit.saved_error.get_error_code() != XlibWrapper.Success) {
+ XToolkit.saved_error.get_error_code() != XConstants.Success) {
throw new XException("XSelectInput failed");
}
--- a/jdk/src/solaris/classes/sun/awt/X11/XDropTargetEventProcessor.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDropTargetEventProcessor.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -43,7 +43,7 @@
private XDropTargetEventProcessor() {}
private boolean doProcessEvent(XEvent ev) {
- if (ev.get_type() == (int)XlibWrapper.DestroyNotify &&
+ if (ev.get_type() == (int)XConstants.DestroyNotify &&
protocol != null &&
ev.get_xany().get_window() == protocol.getSourceWindow()) {
protocol.cleanup();
@@ -51,7 +51,7 @@
return false;
}
- if (ev.get_type() == (int)XlibWrapper.PropertyNotify) {
+ if (ev.get_type() == (int)XConstants.PropertyNotify) {
XPropertyEvent xproperty = ev.get_xproperty();
if (xproperty.get_atom() ==
MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom()) {
@@ -60,7 +60,7 @@
}
}
- if (ev.get_type() != (int)XlibWrapper.ClientMessage) {
+ if (ev.get_type() != (int)XConstants.ClientMessage) {
return false;
}
--- a/jdk/src/solaris/classes/sun/awt/X11/XDropTargetProtocol.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDropTargetProtocol.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -149,7 +149,7 @@
XToolkit.awtLock();
try {
XlibWrapper.XSendEvent(XToolkit.getDisplay(), proxy, false,
- XlibWrapper.NoEventMask, xclient.pData);
+ XConstants.NoEventMask, xclient.pData);
} finally {
XToolkit.awtUnlock();
}
@@ -317,7 +317,7 @@
protected final void removeEmbedderRegistryEntry(long embedder) {
synchronized (this) {
- embedderRegistry.remove(new Long(embedder));
+ embedderRegistry.remove(Long.valueOf(embedder));
}
}
}
--- a/jdk/src/solaris/classes/sun/awt/X11/XDropTargetRegistry.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDropTargetRegistry.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,18 +27,14 @@
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.logging.*;
import java.awt.Point;
-import sun.awt.dnd.SunDropTargetContextPeer;
-import sun.awt.dnd.SunDropTargetEvent;
/**
* The class responsible for registration/deregistration of drop sites.
@@ -179,11 +175,11 @@
if (status == 0 ||
(XToolkit.saved_error != null &&
- XToolkit.saved_error.get_error_code() != XlibWrapper.Success)) {
+ XToolkit.saved_error.get_error_code() != XConstants.Success)) {
continue;
}
- if (wattr.get_map_state() != XlibWrapper.IsUnmapped
+ if (wattr.get_map_state() != XConstants.IsUnmapped
&& dest_x < wattr.get_width()
&& dest_y < wattr.get_height()) {
return window;
@@ -233,7 +229,7 @@
if (status == 0 ||
(XToolkit.saved_error != null &&
- XToolkit.saved_error.get_error_code() != XlibWrapper.Success)) {
+ XToolkit.saved_error.get_error_code() != XConstants.Success)) {
throw new XException("XGetWindowAttributes failed");
}
@@ -243,14 +239,14 @@
wattr.dispose();
}
- if ((event_mask & XlibWrapper.PropertyChangeMask) == 0) {
+ if ((event_mask & XConstants.PropertyChangeMask) == 0) {
XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
XlibWrapper.XSelectInput(XToolkit.getDisplay(), embedder,
- event_mask | XlibWrapper.PropertyChangeMask);
+ event_mask | XConstants.PropertyChangeMask);
XToolkit.RESTORE_XERROR_HANDLER();
if (XToolkit.saved_error != null &&
- XToolkit.saved_error.get_error_code() != XlibWrapper.Success) {
+ XToolkit.saved_error.get_error_code() != XConstants.Success) {
throw new XException("XSelectInput failed");
}
}
@@ -329,7 +325,7 @@
embedderProtocols = Collections.unmodifiableList(embedderProtocols);
- Long lToplevel = new Long(embedder);
+ Long lToplevel = Long.valueOf(embedder);
boolean isXEmbedServer = false;
synchronized (this) {
EmbeddedDropSiteEntry entry =
@@ -397,14 +393,14 @@
long event_mask = entry.getEventMask();
/* Restore the original event mask for the embedder. */
- if ((event_mask & XlibWrapper.PropertyChangeMask) == 0) {
+ if ((event_mask & XConstants.PropertyChangeMask) == 0) {
XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
XlibWrapper.XSelectInput(XToolkit.getDisplay(), embedder,
event_mask);
XToolkit.RESTORE_XERROR_HANDLER();
if (XToolkit.saved_error != null &&
- XToolkit.saved_error.get_error_code() != XlibWrapper.Success) {
+ XToolkit.saved_error.get_error_code() != XConstants.Success) {
throw new XException("XSelectInput failed");
}
}
--- a/jdk/src/solaris/classes/sun/awt/X11/XEmbedCanvasPeer.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XEmbedCanvasPeer.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -81,10 +81,10 @@
super.preInit(params);
params.put(EVENT_MASK,
- KeyPressMask | KeyReleaseMask
- | FocusChangeMask | ButtonPressMask | ButtonReleaseMask
- | EnterWindowMask | LeaveWindowMask | PointerMotionMask
- | ButtonMotionMask | ExposureMask | StructureNotifyMask | SubstructureNotifyMask);
+ XConstants.KeyPressMask | XConstants.KeyReleaseMask
+ | XConstants.FocusChangeMask | XConstants.ButtonPressMask | XConstants.ButtonReleaseMask
+ | XConstants.EnterWindowMask | XConstants.LeaveWindowMask | XConstants.PointerMotionMask
+ | XConstants.ButtonMotionMask | XConstants.ExposureMask | XConstants.StructureNotifyMask | XConstants.SubstructureNotifyMask);
}
@@ -134,7 +134,7 @@
try {
XToolkit.addEventDispatcher(xembed.handle, xembed);
XlibWrapper.XSelectInput(XToolkit.getDisplay(), xembed.handle,
- XlibWrapper.StructureNotifyMask | XlibWrapper.PropertyChangeMask);
+ XConstants.StructureNotifyMask | XConstants.PropertyChangeMask);
XDropTargetRegistry.getRegistry().registerXEmbedClient(getWindow(), xembed.handle);
} finally {
@@ -194,7 +194,7 @@
public void dispatchEvent(XEvent ev) {
super.dispatchEvent(ev);
switch (ev.get_type()) {
- case CreateNotify:
+ case XConstants.CreateNotify:
XCreateWindowEvent cr = ev.get_xcreatewindow();
if (xembedLog.isLoggable(Level.FINEST)) {
xembedLog.finest("Message on embedder: " + cr);
@@ -205,7 +205,7 @@
}
embedChild(cr.get_window());
break;
- case DestroyNotify:
+ case XConstants.DestroyNotify:
XDestroyWindowEvent dn = ev.get_xdestroywindow();
if (xembedLog.isLoggable(Level.FINEST)) {
xembedLog.finest("Message on embedder: " + dn);
@@ -215,7 +215,7 @@
}
childDestroyed();
break;
- case ReparentNotify:
+ case XConstants.ReparentNotify:
XReparentEvent rep = ev.get_xreparent();
if (xembedLog.isLoggable(Level.FINEST)) {
xembedLog.finest("Message on embedder: " + rep);
@@ -309,7 +309,7 @@
if (status == 0 ||
(XToolkit.saved_error != null &&
- XToolkit.saved_error.get_error_code() != XlibWrapper.Success)) {
+ XToolkit.saved_error.get_error_code() != XConstants.Success)) {
return null;
}
@@ -480,7 +480,7 @@
if (xembedLog.isLoggable(Level.FINE)) xembedLog.fine("Forwarding native key event: " + ke);
XToolkit.awtLock();
try {
- XlibWrapper.XSendEvent(XToolkit.getDisplay(), xembed.handle, false, XlibWrapper.NoEventMask, data);
+ XlibWrapper.XSendEvent(XToolkit.getDisplay(), xembed.handle, false, XConstants.NoEventMask, data);
} finally {
XToolkit.awtUnlock();
}
@@ -742,7 +742,7 @@
version = Native.getCard32(xembed_info_data, 0);
flags = Native.getCard32(xembed_info_data, 1);
boolean new_mapped = (flags & XEMBED_MAPPED) != 0;
- boolean currently_mapped = XlibUtil.getWindowMapState(handle) != XlibWrapper.IsUnmapped;
+ boolean currently_mapped = XlibUtil.getWindowMapState(handle) != XConstants.IsUnmapped;
if (new_mapped != currently_mapped) {
if (xembedLog.isLoggable(Level.FINER))
xembedLog.fine("Mapping state of the client has changed, old state: " + currently_mapped + ", new state: " + new_mapped);
@@ -803,13 +803,13 @@
public void dispatchEvent(XEvent xev) {
int type = xev.get_type();
switch (type) {
- case PropertyNotify:
+ case XConstants.PropertyNotify:
handlePropertyNotify(xev);
break;
- case ConfigureNotify:
+ case XConstants.ConfigureNotify:
handleConfigureNotify(xev);
break;
- case ClientMessage:
+ case XConstants.ClientMessage:
handleClientMessage(xev);
break;
}
@@ -844,7 +844,7 @@
XKeyEvent ke = new XKeyEvent(data);
// We recognize only these masks
- modifiers = ke.get_state() & (ShiftMask | ControlMask | LockMask);
+ modifiers = ke.get_state() & (XConstants.ShiftMask | XConstants.ControlMask | XConstants.LockMask);
if (xembedLog.isLoggable(Level.FINEST)) xembedLog.finest("Mapped " + e + " to " + this);
} finally {
XlibWrapper.unsafe.freeMemory(data);
--- a/jdk/src/solaris/classes/sun/awt/X11/XEmbedChildProxyPeer.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XEmbedChildProxyPeer.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -53,7 +53,7 @@
try {
XToolkit.addEventDispatcher(handle, this);
XlibWrapper.XSelectInput(XToolkit.getDisplay(), handle,
- XlibWrapper.StructureNotifyMask | XlibWrapper.PropertyChangeMask);
+ XConstants.StructureNotifyMask | XConstants.PropertyChangeMask);
}
finally {
XToolkit.awtUnlock();
@@ -341,10 +341,10 @@
public void dispatchEvent(XEvent xev) {
int type = xev.get_type();
switch (type) {
- case XlibWrapper.PropertyNotify:
+ case XConstants.PropertyNotify:
handlePropertyNotify(xev);
break;
- case XlibWrapper.ConfigureNotify:
+ case XConstants.ConfigureNotify:
handleConfigureNotify(xev);
break;
}
--- a/jdk/src/solaris/classes/sun/awt/X11/XEmbedClientHelper.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XEmbedClientHelper.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -145,10 +145,10 @@
public void dispatchEvent(XEvent xev) {
switch(xev.get_type()) {
- case XlibWrapper.ClientMessage:
+ case XConstants.ClientMessage:
handleClientMessage(xev);
break;
- case XlibWrapper.ReparentNotify:
+ case XConstants.ReparentNotify:
handleReparentNotify(xev);
break;
}
--- a/jdk/src/solaris/classes/sun/awt/X11/XEmbedHelper.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XEmbedHelper.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -94,7 +94,7 @@
}
void sendMessage(long window, int message, long detail, long data1, long data2) {
XClientMessageEvent msg = new XClientMessageEvent();
- msg.set_type((int)XlibWrapper.ClientMessage);
+ msg.set_type((int)XConstants.ClientMessage);
msg.set_window(window);
msg.set_message_type(XEmbed.getAtom());
msg.set_format(32);
@@ -106,7 +106,7 @@
XToolkit.awtLock();
try {
if (xembedLog.isLoggable(Level.FINE)) xembedLog.fine("Sending " + XEmbedMessageToString(msg));
- XlibWrapper.XSendEvent(XToolkit.getDisplay(), window, false, XlibWrapper.NoEventMask, msg.pData);
+ XlibWrapper.XSendEvent(XToolkit.getDisplay(), window, false, XConstants.NoEventMask, msg.pData);
}
finally {
XToolkit.awtUnlock();
--- a/jdk/src/solaris/classes/sun/awt/X11/XEmbedServerTester.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XEmbedServerTester.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -260,7 +260,7 @@
mapped = 0;
embedCompletely();
sleep(1000);
- if (XlibUtil.getWindowMapState(window.getWindow()) != XlibWrapper.IsUnmapped) {
+ if (XlibUtil.getWindowMapState(window.getWindow()) != IsUnmapped) {
throw new RuntimeException("Client has been mapped");
}
}
@@ -383,11 +383,11 @@
try {
XCreateWindowParams params =
new XCreateWindowParams(new Object[] {
- XBaseWindow.PARENT_WINDOW, new Long(reparent?XToolkit.getDefaultRootWindow():parent),
+ XBaseWindow.PARENT_WINDOW, Long.valueOf(reparent?XToolkit.getDefaultRootWindow():parent),
XBaseWindow.BOUNDS, initialBounds,
XBaseWindow.EMBEDDED, Boolean.TRUE,
XBaseWindow.VISIBLE, Boolean.valueOf(mapped == XEmbedHelper.XEMBED_MAPPED),
- XBaseWindow.EVENT_MASK, new Long(VisibilityChangeMask | StructureNotifyMask |
+ XBaseWindow.EVENT_MASK, Long.valueOf(VisibilityChangeMask | StructureNotifyMask |
SubstructureNotifyMask | KeyPressMask)});
window = new XBaseWindow(params);
@@ -613,12 +613,12 @@
}
}
private void checkMapped() {
- if (XlibUtil.getWindowMapState(window.getWindow()) == XlibWrapper.IsUnmapped) {
+ if (XlibUtil.getWindowMapState(window.getWindow()) == IsUnmapped) {
throw new RuntimeException("Client is not mapped");
}
}
private void checkNotMapped() {
- if (XlibUtil.getWindowMapState(window.getWindow()) != XlibWrapper.IsUnmapped) {
+ if (XlibUtil.getWindowMapState(window.getWindow()) != IsUnmapped) {
throw new RuntimeException("Client is mapped");
}
}
--- a/jdk/src/solaris/classes/sun/awt/X11/XEmbeddedFramePeer.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XEmbeddedFramePeer.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2002-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -114,8 +114,8 @@
protected boolean isEventDisabled(XEvent e) {
if (embedder != null && embedder.isActive()) {
switch (e.get_type()) {
- case FocusIn:
- case FocusOut:
+ case XConstants.FocusIn:
+ case XConstants.FocusOut:
return true;
}
}
--- a/jdk/src/solaris/classes/sun/awt/X11/XEmbeddingContainer.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XEmbeddingContainer.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -121,7 +121,7 @@
}
public void dispatchEvent(XEvent xev) {
switch(xev.get_type()) {
- case XlibWrapper.ClientMessage:
+ case XConstants.ClientMessage:
handleClientMessage(xev);
break;
}
@@ -149,7 +149,7 @@
ke.set_window(child);
XToolkit.awtLock();
try {
- XlibWrapper.XSendEvent(XToolkit.getDisplay(), child, false, XlibWrapper.NoEventMask, data);
+ XlibWrapper.XSendEvent(XToolkit.getDisplay(), child, false, XConstants.NoEventMask, data);
}
finally {
XToolkit.awtUnlock();
--- a/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java Wed May 14 07:53:12 2008 -0700
@@ -908,7 +908,7 @@
* Converts the filter into the form which is acceptable by Java's regexps
*/
private String convert(String filter) {
- String regex = new String("^" + filter + "$");
+ String regex = "^" + filter + "$";
regex = regex.replaceAll("\\.", "\\\\.");
regex = regex.replaceAll("\\?", ".");
regex = regex.replaceAll("\\*", ".*");
--- a/jdk/src/solaris/classes/sun/awt/X11/XFocusProxyWindow.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XFocusProxyWindow.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -41,7 +41,7 @@
super(new XCreateWindowParams(new Object[] {
BOUNDS, new Rectangle(-1, -1, 1, 1),
PARENT_WINDOW, new Long(owner.getWindow()),
- EVENT_MASK, new Long(FocusChangeMask | KeyPressMask | KeyReleaseMask)
+ EVENT_MASK, new Long(XConstants.FocusChangeMask | XConstants.KeyPressMask | XConstants.KeyReleaseMask)
}));
this.owner = owner;
}
@@ -67,8 +67,8 @@
int type = ev.get_type();
switch (type)
{
- case XlibWrapper.FocusIn:
- case XlibWrapper.FocusOut:
+ case XConstants.FocusIn:
+ case XConstants.FocusOut:
handleFocusEvent(ev);
break;
}
--- a/jdk/src/solaris/classes/sun/awt/X11/XFramePeer.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XFramePeer.java Wed May 14 07:53:12 2008 -0700
@@ -37,7 +37,7 @@
import java.util.logging.Level;
import java.util.logging.Logger;
-class XFramePeer extends XDecoratedPeer implements FramePeer, XConstants {
+class XFramePeer extends XDecoratedPeer implements FramePeer {
private static Logger log = Logger.getLogger("sun.awt.X11.XFramePeer");
private static Logger stateLog = Logger.getLogger("sun.awt.X11.states");
private static Logger insLog = Logger.getLogger("sun.awt.X11.insets.XFramePeer");
@@ -71,7 +71,7 @@
} else {
winAttr.decorations = winAttr.AWT_DECOR_NONE;
}
- winAttr.functions = MWM_FUNC_ALL;
+ winAttr.functions = MWMConstants.MWM_FUNC_ALL;
winAttr.isResizable = true; // target.isResizable();
winAttr.title = target.getTitle();
winAttr.initialResizability = target.isResizable();
@@ -87,14 +87,6 @@
setupState(true);
}
- protected Insets guessInsets() {
- if (isTargetUndecorated()) {
- return new Insets(0, 0, 0, 0);
- } else {
- return super.guessInsets();
- }
- }
-
@Override
boolean isTargetUndecorated() {
if (undecorated != null) {
@@ -109,9 +101,9 @@
state = winAttr.initialState;
}
if ((state & Frame.ICONIFIED) != 0) {
- setInitialState(IconicState);
+ setInitialState(XUtilConstants.IconicState);
} else {
- setInitialState(NormalState);
+ setInitialState(XUtilConstants.NormalState);
}
setExtendedState(state);
}
@@ -221,7 +213,7 @@
XToolkit.awtLock();
try {
XSizeHints hints = getHints();
- hints.set_flags(hints.get_flags() | (int)XlibWrapper.PMaxSize);
+ hints.set_flags(hints.get_flags() | (int)XUtilConstants.PMaxSize);
if (b.width != Integer.MAX_VALUE) {
hints.set_max_width(b.width);
} else {
@@ -344,7 +336,7 @@
XToolkit.awtLock();
try {
XWMHints hints = getWMHints();
- hints.set_flags((int)XlibWrapper.StateHint | hints.get_flags());
+ hints.set_flags((int)XUtilConstants.StateHint | hints.get_flags());
hints.set_initial_state(wm_state);
if (stateLog.isLoggable(Level.FINE)) stateLog.fine("Setting initial WM state on " + this + " to " + wm_state);
XlibWrapper.XSetWMHints(XToolkit.getDisplay(), getWindow(), hints.pData);
--- a/jdk/src/solaris/classes/sun/awt/X11/XGlobalCursorManager.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XGlobalCursorManager.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -229,46 +229,46 @@
int cursorType = 0;
switch (type) {
case Cursor.DEFAULT_CURSOR:
- cursorType = XlibWrapper.XC_left_ptr;
+ cursorType = XCursorFontConstants.XC_left_ptr;
break;
case Cursor.CROSSHAIR_CURSOR:
- cursorType = XlibWrapper.XC_crosshair;
+ cursorType = XCursorFontConstants.XC_crosshair;
break;
case Cursor.TEXT_CURSOR:
- cursorType = XlibWrapper.XC_xterm;
+ cursorType = XCursorFontConstants.XC_xterm;
break;
case Cursor.WAIT_CURSOR:
- cursorType = XlibWrapper.XC_watch;
+ cursorType = XCursorFontConstants.XC_watch;
break;
case Cursor.SW_RESIZE_CURSOR:
- cursorType = XlibWrapper.XC_bottom_left_corner;
+ cursorType = XCursorFontConstants.XC_bottom_left_corner;
break;
case Cursor.NW_RESIZE_CURSOR:
- cursorType = XlibWrapper.XC_top_left_corner;
+ cursorType = XCursorFontConstants.XC_top_left_corner;
break;
case Cursor.SE_RESIZE_CURSOR:
- cursorType = XlibWrapper.XC_bottom_right_corner;
+ cursorType = XCursorFontConstants.XC_bottom_right_corner;
break;
case Cursor.NE_RESIZE_CURSOR:
- cursorType = XlibWrapper.XC_top_right_corner;
+ cursorType = XCursorFontConstants.XC_top_right_corner;
break;
case Cursor.S_RESIZE_CURSOR:
- cursorType = XlibWrapper.XC_bottom_side;
+ cursorType = XCursorFontConstants.XC_bottom_side;
break;
case Cursor.N_RESIZE_CURSOR:
- cursorType = XlibWrapper.XC_top_side;
+ cursorType = XCursorFontConstants.XC_top_side;
break;
case Cursor.W_RESIZE_CURSOR:
- cursorType = XlibWrapper.XC_left_side;
+ cursorType = XCursorFontConstants.XC_left_side;
break;
case Cursor.E_RESIZE_CURSOR:
- cursorType = XlibWrapper.XC_right_side;
+ cursorType = XCursorFontConstants.XC_right_side;
break;
case Cursor.HAND_CURSOR:
- cursorType = XlibWrapper.XC_hand2;
+ cursorType = XCursorFontConstants.XC_hand2;
break;
case Cursor.MOVE_CURSOR:
- cursorType = XlibWrapper.XC_fleur;
+ cursorType = XCursorFontConstants.XC_fleur;
break;
}
--- a/jdk/src/solaris/classes/sun/awt/X11/XIconWindow.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XIconWindow.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -293,7 +293,7 @@
long dst = XlibWrapper.XCreateImage(XToolkit.getDisplay(),
visInfo.get_visual(),
(int)awtImage.get_Depth(),
- (int)XlibWrapper.ZPixmap,
+ (int)XConstants.ZPixmap,
0,
bytes,
iconWidth,
@@ -470,9 +470,9 @@
params.add(BACKGROUND_PIXMAP, iconPixmap);
params.add(COLORMAP, adata.get_awt_cmap());
params.add(DEPTH, awtImage.get_Depth());
- params.add(VISUAL_CLASS, (int)XlibWrapper.InputOutput);
+ params.add(VISUAL_CLASS, (int)XConstants.InputOutput);
params.add(VISUAL, visInfo.get_visual());
- params.add(VALUE_MASK, XlibWrapper.CWBorderPixel | XlibWrapper.CWColormap | XlibWrapper.CWBackPixmap);
+ params.add(VALUE_MASK, XConstants.CWBorderPixel | XConstants.CWColormap | XConstants.CWBackPixmap);
params.add(PARENT_WINDOW, XlibWrapper.RootWindow(XToolkit.getDisplay(), visInfo.get_screen()));
params.add(BOUNDS, new Rectangle(0, 0, iconWidth, iconHeight));
params.remove(DELAYED);
@@ -488,9 +488,9 @@
XlibWrapper.XClearWindow(XToolkit.getDisplay(), getWindow());
}
// Provide both pixmap and window, WM or Taskbar will use the one they find more appropriate
- long newFlags = hints.get_flags() | XlibWrapper.IconPixmapHint | XlibWrapper.IconMaskHint;
+ long newFlags = hints.get_flags() | XUtilConstants.IconPixmapHint | XUtilConstants.IconMaskHint;
if (getWindow() != 0) {
- newFlags |= XlibWrapper.IconWindowHint;
+ newFlags |= XUtilConstants.IconWindowHint;
}
hints.set_flags(newFlags);
hints.set_icon_pixmap(iconPixmap);
--- a/jdk/src/solaris/classes/sun/awt/X11/XKeyboardFocusManagerPeer.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XKeyboardFocusManagerPeer.java Wed May 14 07:53:12 2008 -0700
@@ -96,12 +96,12 @@
Component focusOwner = activeWindow.getFocusOwner();
if (focusLog.isLoggable(Level.FINE)) focusLog.fine("Clearing global focus owner " + focusOwner);
if (focusOwner != null) {
- XComponentPeer nativePeer = XComponentPeer.getNativeContainer(focusOwner);
- if (nativePeer != null) {
+// XComponentPeer nativePeer = XComponentPeer.getNativeContainer(focusOwner);
+// if (nativePeer != null) {
FocusEvent fl = new CausedFocusEvent(focusOwner, FocusEvent.FOCUS_LOST, false, null,
CausedFocusEvent.Cause.CLEAR_GLOBAL_FOCUS_OWNER);
XWindow.sendEvent(fl);
- }
+// }
}
}
}
--- a/jdk/src/solaris/classes/sun/awt/X11/XKeysym.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XKeysym.java Wed May 14 07:53:12 2008 -0700
@@ -1,7 +1,7 @@
// This is a generated file: do not edit! Edit keysym2ucs.h if necessary.
/*
- * Copyright 2005-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1495,6 +1495,7 @@
keysym2JavaKeycodeHash.put( Long.valueOf(XKeySymConstants.XK_Multi_key), new Keysym2JavaKeycode(java.awt.event.KeyEvent.VK_COMPOSE, java.awt.event.KeyEvent.KEY_LOCATION_STANDARD));
keysym2JavaKeycodeHash.put( Long.valueOf(XKeySymConstants.XK_Mode_switch), new Keysym2JavaKeycode(java.awt.event.KeyEvent.VK_ALT_GRAPH, java.awt.event.KeyEvent.KEY_LOCATION_STANDARD));
+ keysym2JavaKeycodeHash.put( Long.valueOf(XKeySymConstants.XK_ISO_Level3_Shift), new Keysym2JavaKeycode(java.awt.event.KeyEvent.VK_ALT_GRAPH, java.awt.event.KeyEvent.KEY_LOCATION_STANDARD));
/* Editing block */
keysym2JavaKeycodeHash.put( Long.valueOf(XKeySymConstants.XK_Redo), new Keysym2JavaKeycode(java.awt.event.KeyEvent.VK_AGAIN, java.awt.event.KeyEvent.KEY_LOCATION_STANDARD));
--- a/jdk/src/solaris/classes/sun/awt/X11/XListPeer.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XListPeer.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -55,14 +55,15 @@
public final static int DEFAULT_VISIBLE_ROWS = 4; // From java.awt.List,
public final static int HORIZ_SCROLL_AMT = 10;
- final static int
- PAINT_VSCROLL = 2,
- PAINT_HSCROLL = 4,
- PAINT_ITEMS = 8,
- PAINT_FOCUS = 16,
- PAINT_BACKGROUND = 32,
- PAINT_HIDEFOCUS = 64,
- PAINT_ALL = PAINT_VSCROLL | PAINT_HSCROLL | PAINT_ITEMS | PAINT_FOCUS | PAINT_BACKGROUND;
+ private final static int PAINT_VSCROLL = 2;
+ private final static int PAINT_HSCROLL = 4;
+ private final static int PAINT_ITEMS = 8;
+ private final static int PAINT_FOCUS = 16;
+ private final static int PAINT_BACKGROUND = 32;
+ private final static int PAINT_HIDEFOCUS = 64;
+ private final static int PAINT_ALL =
+ PAINT_VSCROLL | PAINT_HSCROLL | PAINT_ITEMS | PAINT_FOCUS | PAINT_BACKGROUND;
+ private final static int COPY_AREA = 128;
XVerticalScrollbar vsb;
XHorizontalScrollbar hsb;
@@ -363,35 +364,6 @@
}
}
- Area getItemsArea(int firstItem, int lastItem) {
- firstItem = Math.max(getFirstVisibleItem(), firstItem);
- lastItem = Math.min(lastItem, getLastVisibleItem());
- if (lastItem < getFirstVisibleItem()) {
- return new Area();
- }
- if (firstItem <= lastItem) {
- int startY = getItemY(firstItem);
- int endY = getItemY(lastItem) + getItemHeight();
- // Account for focus rectangle, instead should be called twice - before change
- // of focusIndex and after
- startY -= 2;
- endY += 2;
- // x is 0 since we need to account for focus rectangle,
- // the same with width
- return new Area(new Rectangle(0, startY, getItemWidth() + 3, endY-startY+1));
- } else {
- return new Area();
- }
- }
-
- Rectangle getItemRect(int item) {
- return new Rectangle(MARGIN, getItemY(item), getItemWidth(), getItemHeight());
- }
-
- Area getItemArea(int item) {
- return new Area(getItemRect(item));
- }
-
public void repaintScrollbarRequest(XScrollbar scrollbar) {
Graphics g = getGraphics();
if (scrollbar == hsb) {
@@ -411,14 +383,36 @@
repaint(getFirstVisibleItem(), getLastVisibleItem(), PAINT_ALL);
}
- public void repaint(int options) {
+ private void repaint(int options) {
repaint(getFirstVisibleItem(), getLastVisibleItem(), options);
}
- public void repaint(int firstItem, int lastItem, int options) {
+ private void repaint(int firstItem, int lastItem, int options) {
+ repaint(firstItem, lastItem, options, null, null);
+ }
+
+ /**
+ * In most cases the entire area of the component doesn't have
+ * to be repainted. The method repaints the particular areas of
+ * the component. The areas to repaint is specified by the option
+ * parameter. The possible values of the option parameter are:
+ * PAINT_VSCROLL, PAINT_HSCROLL, PAINT_ITEMS, PAINT_FOCUS,
+ * PAINT_HIDEFOCUS, PAINT_BACKGROUND, PAINT_ALL, COPY_AREA.
+ *
+ * Note that the COPY_AREA value initiates copy of a source area
+ * of the component by a distance by means of the copyArea method
+ * of the Graphics class.
+ *
+ * @param firstItem the position of the first item of the range to repaint
+ * @param lastItem the position of the last item of the range to repaint
+ * @param options specifies the particular area of the component to repaint
+ * @param source the area of the component to copy
+ * @param distance the distance to copy the source area
+ */
+ private void repaint(int firstItem, int lastItem, int options, Rectangle source, Point distance) {
Graphics g = getGraphics();
try {
- painter.paint(g, firstItem, lastItem, options);
+ painter.paint(g, firstItem, lastItem, options, source, distance);
} finally {
g.dispose();
}
@@ -1449,35 +1443,29 @@
}
vsb.setValue(vsb.getValue() + y);
+ Rectangle source = null;
+ Point distance = null;
+ int firstItem = 0, lastItem = 0;
+ int options = PAINT_HIDEFOCUS | PAINT_ITEMS | PAINT_VSCROLL | PAINT_FOCUS;
if (y > 0) {
- // Fixed 6308295: XAWTduplicate list item is displayed
- // Window resizing leads to the buffer flushing
- // That's why the repainting with the PAINT_HIDEFOCUS option is the repainting with PAINT_ALL option
- // So we should do only the repainting instead of the copy area
- if (y < itemsInWin && painter.isBuffer()) {
- if (log.isLoggable(Level.FINEST)) {
- log.finest("Copying " + "" + MARGIN + "," + ( MARGIN + pixelsToScroll)
- + "," + (width - SCROLLBAR_AREA) + "," + (h * (itemsInWin - y)-1) +
- "," + 0 + "," + (-pixelsToScroll));
- }
- // Unpaint focus before copying
- repaint(PAINT_HIDEFOCUS);
- painter.copyArea(MARGIN, MARGIN + pixelsToScroll, width - SCROLLBAR_AREA, h * (itemsInWin - y - 1)-1, 0, -pixelsToScroll);
+ if (y < itemsInWin) {
+ source = new Rectangle(MARGIN, MARGIN + pixelsToScroll, width - SCROLLBAR_AREA, h * (itemsInWin - y - 1)-1);
+ distance = new Point(0, -pixelsToScroll);
+ options |= COPY_AREA;
}
- repaint(vsb.getValue() + (itemsInWin - y)-1, (vsb.getValue() + itemsInWin) - 1, PAINT_ITEMS | PAINT_VSCROLL | PAINT_FOCUS);
- } else if (y < 0 && painter.isBuffer()) {
+ firstItem = vsb.getValue() + itemsInWin - y - 1;
+ lastItem = vsb.getValue() + itemsInWin - 1;
+
+ } else if (y < 0) {
if (y + itemsInWindow() > 0) {
- if (log.isLoggable(Level.FINEST)) {
- log.finest("Copying " + MARGIN + "," + MARGIN +"," +
- (width - SCROLLBAR_AREA) + "," +
- (h * (itemsInWin + y)) + "," + "0" +"," +(-pixelsToScroll));
- }
- repaint(PAINT_HIDEFOCUS);
- painter.copyArea(MARGIN, MARGIN, width - SCROLLBAR_AREA, h * (itemsInWin + y), 0, -pixelsToScroll);
+ source = new Rectangle(MARGIN, MARGIN, width - SCROLLBAR_AREA, h * (itemsInWin + y));
+ distance = new Point(0, -pixelsToScroll);
+ options |= COPY_AREA;
}
- int e = Math.min(getLastVisibleItem(), vsb.getValue() + -y);
- repaint(vsb.getValue(), e, PAINT_ITEMS | PAINT_VSCROLL | PAINT_FOCUS);
+ firstItem = vsb.getValue();
+ lastItem = Math.min(getLastVisibleItem(), vsb.getValue() + -y);
}
+ repaint(firstItem, lastItem, options, source, distance);
}
/**
@@ -1491,12 +1479,17 @@
int h = height - (SCROLLBAR_AREA + (2 * MARGIN));
hsb.setValue(hsb.getValue() + x);
- if (x < 0 && painter.isBuffer()) {
- painter.copyArea(MARGIN + SPACE, MARGIN, w + x, h, -x, 0);
- } else if (x > 0 && painter.isBuffer()) {
- painter.copyArea(MARGIN + SPACE + x, MARGIN, w - x, h, -x, 0);
+ Rectangle source = null;
+ Point distance = null;
+ if (x < 0) {
+ source = new Rectangle(MARGIN + SPACE, MARGIN, w + x, h);
+ distance = new Point(-x, 0);
+ } else if (x > 0) {
+ source = new Rectangle(MARGIN + SPACE + x, MARGIN, w - x, h);
+ distance = new Point(-x, 0);
}
- repaint(vsb.getValue(), lastItemDisplayed(), PAINT_ITEMS | PAINT_HSCROLL);
+ int options = COPY_AREA | PAINT_ITEMS | PAINT_HSCROLL;
+ repaint(vsb.getValue(), lastItemDisplayed(), options, source, distance);
}
/**
@@ -1677,7 +1670,6 @@
* Since we can't guarantee the sequence, use awtLock.
*/
class ListPainter {
- // TODO: use VolatileImage
VolatileImage buffer;
Color[] colors;
@@ -1746,6 +1738,11 @@
}
private void paint(Graphics listG, int firstItem, int lastItem, int options) {
+ paint(listG, firstItem, lastItem, options, null, null);
+ }
+
+ private void paint(Graphics listG, int firstItem, int lastItem, int options,
+ Rectangle source, Point distance) {
if (log.isLoggable(Level.FINER)) log.finer("Repaint from " + firstItem + " to " + lastItem + " options " + options);
if (firstItem > lastItem) {
int t = lastItem;
@@ -1773,17 +1770,34 @@
invalidate();
options = PAINT_ALL;
continue;
+ case VolatileImage.IMAGE_RESTORED:
+ options = PAINT_ALL;
}
Graphics g = localBuffer.createGraphics();
+ // Note that the order of the following painting operations
+ // should not be modified
try {
g.setFont(getFont());
+
+ // hiding the focus rectangle must be done prior to copying
+ // area and so this is the first action to be performed
+ if ((options & (PAINT_HIDEFOCUS)) != 0) {
+ paintFocus(g, PAINT_HIDEFOCUS);
+ }
+ /*
+ * The shift of the component contents occurs while someone
+ * scrolls the component, the only purpose of the shift is to
+ * increase the painting performance. The shift should be done
+ * prior to painting any area (except hiding focus) and actually
+ * it should never be done jointly with erase background.
+ */
+ if ((options & COPY_AREA) != 0) {
+ g.copyArea(source.x, source.y, source.width, source.height,
+ distance.x, distance.y);
+ }
if ((options & PAINT_BACKGROUND) != 0) {
- g.setColor(SystemColor.window);
- g.fillRect(0, 0, width, height);
- g.setColor(getListBackground());
- g.fillRect(0, 0, listWidth, listHeight);
- draw3DRect(g, getSystemColors(), 0, 0, listWidth - 1, listHeight - 1, false);
+ paintBackground(g);
// Since we made full erase update items
firstItem = getFirstVisibleItem();
lastItem = getLastVisibleItem();
@@ -1799,8 +1813,8 @@
g.setClip(getHScrollBarRec());
paintHorScrollbar(g, true);
}
- if ((options & (PAINT_FOCUS|PAINT_HIDEFOCUS)) != 0) {
- paintFocus(g, options);
+ if ((options & (PAINT_FOCUS)) != 0) {
+ paintFocus(g, PAINT_FOCUS);
}
} finally {
g.dispose();
@@ -1809,6 +1823,14 @@
listG.drawImage(localBuffer, 0, 0, null);
}
+ private void paintBackground(Graphics g) {
+ g.setColor(SystemColor.window);
+ g.fillRect(0, 0, width, height);
+ g.setColor(getListBackground());
+ g.fillRect(0, 0, listWidth, listHeight);
+ draw3DRect(g, getSystemColors(), 0, 0, listWidth - 1, listHeight - 1, false);
+ }
+
private void paintItems(Graphics g, int firstItem, int lastItem, int options) {
if (log.isLoggable(Level.FINER)) log.finer("Painting items from " + firstItem + " to " + lastItem + ", focused " + focusIndex + ", first " + getFirstVisibleItem() + ", last " + getLastVisibleItem());
@@ -1932,53 +1954,5 @@
}
g.setClip(clip);
}
-
- public void copyArea(int x, int y, int width, int height, int dx, int dy) {
- if (log.isLoggable(Level.FINER)) log.finer("Copying area " + x + ", " + y + " " + width +
- "x" + height + ", (" + dx + "," + dy + ")");
- VolatileImage localBuffer = null;
- do {
- XToolkit.awtLock();
- try {
- if (createBuffer()) {
- // Newly created buffer should be painted over at full
- repaint(PAINT_ALL);
- return;
- }
- localBuffer = buffer;
- } finally {
- XToolkit.awtUnlock();
- }
- switch (localBuffer.validate(getGraphicsConfiguration())) {
- case VolatileImage.IMAGE_INCOMPATIBLE:
- invalidate();
- case VolatileImage.IMAGE_RESTORED:
- // Since we've lost the content we can't just scroll - we should paint again
- repaint(PAINT_ALL);
- return;
- }
- Graphics g = localBuffer.createGraphics();
- try {
- g.copyArea(x, y, width, height, dx, dy);
- } finally {
- g.dispose();
- }
- } while (localBuffer.contentsLost());
- Graphics listG = getGraphics();
- listG.setClip(x, y, width, height);
- listG.drawImage(localBuffer, 0, 0, null);
- listG.dispose();
- }
-
- public boolean isBuffer() {
- boolean isBuffer;
- XToolkit.awtLock();
- try {
- isBuffer = (buffer != null);
- } finally {
- XToolkit.awtUnlock();
- }
- return isBuffer;
- }
}
}
--- a/jdk/src/solaris/classes/sun/awt/X11/XMSelection.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XMSelection.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -98,7 +98,7 @@
XToolkit.awtLock();
try {
long root = XlibWrapper.RootWindow(display,screen);
- XlibWrapper.XSelectInput(display, root, XlibWrapper.StructureNotifyMask);
+ XlibWrapper.XSelectInput(display, root, XConstants.StructureNotifyMask);
XToolkit.addEventDispatcher(root,
new XEventDispatcher() {
public void dispatchEvent(XEvent ev) {
@@ -130,7 +130,7 @@
synchronized(this) {
setOwner(owner, screen);
if (log.isLoggable(Level.FINE)) log.fine("New Selection Owner for screen " + screen + " = " + owner );
- XlibWrapper.XSelectInput(display, owner, XlibWrapper.StructureNotifyMask | eventMask);
+ XlibWrapper.XSelectInput(display, owner, XConstants.StructureNotifyMask | eventMask);
XToolkit.addEventDispatcher(owner,
new XEventDispatcher() {
public void dispatchEvent(XEvent ev) {
@@ -162,7 +162,7 @@
if (owner != 0) {
setOwner(owner, screen);
if (log.isLoggable(Level.FINE)) log.fine("Selection Owner for screen " + screen + " = " + owner );
- XlibWrapper.XSelectInput(display, owner, XlibWrapper.StructureNotifyMask | extra_mask);
+ XlibWrapper.XSelectInput(display, owner, XConstants.StructureNotifyMask | extra_mask);
XToolkit.addEventDispatcher(owner,
new XEventDispatcher() {
public void dispatchEvent(XEvent ev) {
@@ -205,7 +205,7 @@
static boolean processRootEvent(XEvent xev, int screen) {
switch (xev.get_type()) {
- case XlibWrapper.ClientMessage: {
+ case XConstants.ClientMessage: {
return processClientMessage(xev, screen);
}
}
@@ -225,7 +225,7 @@
*/
public XMSelection (String selname) {
- this(selname, XlibWrapper.PropertyChangeMask);
+ this(selname, XConstants.PropertyChangeMask);
}
@@ -319,11 +319,11 @@
void dispatchSelectionEvent(XEvent xev, int screen) {
if (log.isLoggable(Level.FINE)) log.fine("Event =" + xev);
- if (xev.get_type() == XlibWrapper.DestroyNotify) {
+ if (xev.get_type() == XConstants.DestroyNotify) {
XDestroyWindowEvent de = xev.get_xdestroywindow();
dispatchOwnerDeath( de, screen);
}
- else if (xev.get_type() == XlibWrapper.PropertyNotify) {
+ else if (xev.get_type() == XConstants.PropertyNotify) {
XPropertyEvent xpe = xev.get_xproperty();
dispatchSelectionChanged( xpe, screen);
}
--- a/jdk/src/solaris/classes/sun/awt/X11/XNETProtocol.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XNETProtocol.java Wed May 14 07:53:12 2008 -0700
@@ -99,7 +99,7 @@
return;
}
if (log.isLoggable(Level.FINE)) log.fine("Requesting state on " + window + " for " + state);
- req.set_type((int)XlibWrapper.ClientMessage);
+ req.set_type((int)XConstants.ClientMessage);
req.set_window(window.getWindow());
req.set_message_type(XA_NET_WM_STATE.getAtom());
req.set_format(32);
@@ -109,7 +109,7 @@
XlibWrapper.XSendEvent(XToolkit.getDisplay(),
XlibWrapper.RootWindow(XToolkit.getDisplay(), window.getScreenNumber()),
false,
- XlibWrapper.SubstructureRedirectMask | XlibWrapper.SubstructureNotifyMask,
+ XConstants.SubstructureRedirectMask | XConstants.SubstructureNotifyMask,
req.pData);
}
finally {
@@ -183,7 +183,7 @@
if (window.isShowing()) {
XClientMessageEvent req = new XClientMessageEvent();
try {
- req.set_type((int)XlibWrapper.ClientMessage);
+ req.set_type((int)XConstants.ClientMessage);
req.set_window(window.getWindow());
req.set_message_type(XA_NET_WM_STATE.getAtom());
req.set_format(32);
@@ -195,7 +195,7 @@
XlibWrapper.XSendEvent(XToolkit.getDisplay(),
XlibWrapper.RootWindow(XToolkit.getDisplay(), window.getScreenNumber()),
false,
- XlibWrapper.SubstructureRedirectMask | XlibWrapper.SubstructureNotifyMask,
+ XConstants.SubstructureRedirectMask | XConstants.SubstructureNotifyMask,
req.pData);
}
finally {
--- a/jdk/src/solaris/classes/sun/awt/X11/XProtocol.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XProtocol.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,7 @@
static XToolkit.XErrorHandler VerifyChangePropertyHandler = new XToolkit.XErrorHandler() {
public int handleError(long display, XErrorEvent err) {
XToolkit.XERROR_SAVE(err);
- if (err.get_request_code() == XlibWrapper.X_ChangeProperty) {
+ if (err.get_request_code() == XProtocolConstants.X_ChangeProperty) {
return 0;
} else {
return XToolkit.SAVED_ERROR_HANDLER(display, err);
--- a/jdk/src/solaris/classes/sun/awt/X11/XProtocolConstants.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XProtocolConstants.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,10 @@
package sun.awt.X11;
-public interface XProtocolConstants {
+final public class XProtocolConstants {
+
+ private XProtocolConstants(){}
+
/* Reply codes */
public static final int X_Reply = 1 ; /* Normal reply */
public static final int X_Error = 0 ; /* Error */
--- a/jdk/src/solaris/classes/sun/awt/X11/XScrollbar.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XScrollbar.java Wed May 14 07:53:12 2008 -0700
@@ -458,16 +458,16 @@
String type;
switch (id) {
case MouseEvent.MOUSE_PRESSED:
- type = new String("press");
+ type = "press";
break;
case MouseEvent.MOUSE_RELEASED:
- type = new String("release");
+ type = "release";
break;
case MouseEvent.MOUSE_DRAGGED:
- type = new String("drag");
+ type = "drag";
break;
default:
- type = new String("other");
+ type = "other";
}
log.finer("Mouse " + type + " event in scroll bar " + this +
"x = " + x + ", y = " + y +
--- a/jdk/src/solaris/classes/sun/awt/X11/XSelection.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XSelection.java Wed May 14 07:53:12 2008 -0700
@@ -141,7 +141,7 @@
long selection = selectionAtom.getAtom();
// ICCCM prescribes that CurrentTime should not be used for SetSelectionOwner.
- if (time == XlibWrapper.CurrentTime) {
+ if (time == XConstants.CurrentTime) {
time = XToolkit.getCurrentServerTime();
}
@@ -199,7 +199,7 @@
WindowPropertyGetter targetsGetter =
new WindowPropertyGetter(XWindow.getXAWTRootWindow().getWindow(),
selectionPropertyAtom, 0, MAX_LENGTH,
- true, XlibWrapper.AnyPropertyType);
+ true, XConstants.AnyPropertyType);
try {
XToolkit.awtLock();
@@ -274,7 +274,7 @@
new WindowPropertyGetter(XWindow.getXAWTRootWindow().getWindow(),
selectionPropertyAtom, 0, MAX_LENGTH,
false, // don't delete to handle INCR properly.
- XlibWrapper.AnyPropertyType);
+ XConstants.AnyPropertyType);
try {
XToolkit.awtLock();
@@ -353,7 +353,7 @@
new WindowPropertyGetter(XWindow.getXAWTRootWindow().getWindow(),
selectionPropertyAtom,
0, MAX_LENGTH, false,
- XlibWrapper.AnyPropertyType);
+ XConstants.AnyPropertyType);
try {
XToolkit.awtLock();
@@ -520,7 +520,7 @@
try {
XlibWrapper.XChangeProperty(XToolkit.getDisplay(), requestor, property,
format, dataFormat,
- XlibWrapper.PropModeReplace,
+ XConstants.PropModeReplace,
nativeDataPtr, count);
} finally {
XToolkit.awtUnlock();
@@ -543,14 +543,14 @@
boolean conversionSucceeded = false;
if (ownershipTime != 0 &&
- (requestTime == XlibWrapper.CurrentTime || requestTime >= ownershipTime))
+ (requestTime == XConstants.CurrentTime || requestTime >= ownershipTime))
{
// Handle MULTIPLE requests as per ICCCM.
if (format == XDataTransferer.MULTIPLE_ATOM.getAtom()) {
conversionSucceeded = handleMultipleRequest(requestor, property);
} else {
// Support for obsolete clients as per ICCCM.
- if (property == XlibWrapper.None) {
+ if (property == XConstants.None) {
property = format;
}
@@ -564,12 +564,12 @@
if (!conversionSucceeded) {
// None property indicates conversion failure.
- property = XlibWrapper.None;
+ property = XConstants.None;
}
XSelectionEvent xse = new XSelectionEvent();
try {
- xse.set_type(XlibWrapper.SelectionNotify);
+ xse.set_type(XConstants.SelectionNotify);
xse.set_send_event(true);
xse.set_requestor(requestor);
xse.set_selection(selectionAtom.getAtom());
@@ -580,7 +580,7 @@
XToolkit.awtLock();
try {
XlibWrapper.XSendEvent(XToolkit.getDisplay(), requestor, false,
- XlibWrapper.NoEventMask, xse.pData);
+ XConstants.NoEventMask, xse.pData);
} finally {
XToolkit.awtUnlock();
}
@@ -590,7 +590,7 @@
}
private boolean handleMultipleRequest(final long requestor, long property) {
- if (XlibWrapper.None == property) {
+ if (XConstants.None == property) {
// The property cannot be None for a MULTIPLE request.
return false;
}
@@ -601,7 +601,7 @@
WindowPropertyGetter wpg =
new WindowPropertyGetter(requestor, XAtom.get(property),
0, MAX_LENGTH, false,
- XlibWrapper.AnyPropertyType);
+ XConstants.AnyPropertyType);
try {
wpg.execute();
@@ -629,7 +629,7 @@
property,
wpg.getActualType(),
wpg.getActualFormat(),
- XlibWrapper.PropModeReplace,
+ XConstants.PropModeReplace,
wpg.getData(),
wpg.getNumberOfItems());
} finally {
@@ -673,7 +673,7 @@
try {
XlibWrapper.XChangeProperty(XToolkit.getDisplay(), requestor,
property, XAtom.XA_ATOM, dataFormat,
- XlibWrapper.PropModeReplace,
+ XConstants.PropModeReplace,
nativeDataPtr, count);
} finally {
XToolkit.awtUnlock();
@@ -712,7 +712,7 @@
private static class SelectionEventHandler implements XEventDispatcher {
public void dispatchEvent(XEvent ev) {
switch (ev.get_type()) {
- case XlibWrapper.SelectionNotify: {
+ case XConstants.SelectionNotify: {
XToolkit.awtLock();
try {
XSelectionEvent xse = ev.get_xselection();
@@ -733,7 +733,7 @@
}
break;
}
- case XlibWrapper.SelectionRequest: {
+ case XConstants.SelectionRequest: {
XSelectionRequestEvent xsre = ev.get_xselectionrequest();
long atom = xsre.get_selection();
XSelection selection = XSelection.getSelection(XAtom.get(atom));
@@ -743,7 +743,7 @@
}
break;
}
- case XlibWrapper.SelectionClear: {
+ case XConstants.SelectionClear: {
XSelectionClearEvent xsce = ev.get_xselectionclear();
long atom = xsce.get_selection();
XSelection selection = XSelection.getSelection(XAtom.get(atom));
@@ -793,7 +793,7 @@
wattr.pData);
XlibWrapper.XSelectInput(XToolkit.getDisplay(), requestor,
wattr.get_your_event_mask() |
- XlibWrapper.PropertyChangeMask);
+ XConstants.PropertyChangeMask);
} finally {
XToolkit.awtUnlock();
}
@@ -805,10 +805,10 @@
public void dispatchEvent(XEvent ev) {
switch (ev.get_type()) {
- case XlibWrapper.PropertyNotify:
+ case XConstants.PropertyNotify:
XPropertyEvent xpe = ev.get_xproperty();
if (xpe.get_window() == requestor &&
- xpe.get_state() == XlibWrapper.PropertyDelete &&
+ xpe.get_state() == XConstants.PropertyDelete &&
xpe.get_atom() == property) {
int count = data.length - offset;
@@ -834,7 +834,7 @@
XlibWrapper.XChangeProperty(XToolkit.getDisplay(),
requestor, property,
target, format,
- XlibWrapper.PropModeReplace,
+ XConstants.PropModeReplace,
nativeDataPtr, count);
} finally {
XToolkit.awtUnlock();
@@ -853,9 +853,9 @@
private static class IncrementalTransferHandler implements XEventDispatcher {
public void dispatchEvent(XEvent ev) {
switch (ev.get_type()) {
- case XlibWrapper.PropertyNotify:
+ case XConstants.PropertyNotify:
XPropertyEvent xpe = ev.get_xproperty();
- if (xpe.get_state() == XlibWrapper.PropertyNewValue &&
+ if (xpe.get_state() == XConstants.PropertyNewValue &&
xpe.get_atom() == selectionPropertyAtom.getAtom()) {
XToolkit.awtLock();
try {
--- a/jdk/src/solaris/classes/sun/awt/X11/XSystemTrayPeer.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XSystemTrayPeer.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2005-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -131,7 +131,7 @@
XClientMessageEvent xev = new XClientMessageEvent();
try {
- xev.set_type(XlibWrapper.ClientMessage);
+ xev.set_type(XConstants.ClientMessage);
xev.set_window(win);
xev.set_format(32);
xev.set_message_type(_NET_SYSTEM_TRAY_OPCODE.getAtom());
@@ -144,7 +144,7 @@
XToolkit.awtLock();
try {
XlibWrapper.XSendEvent(XToolkit.getDisplay(), win, false,
- XlibWrapper.NoEventMask, xev.pData);
+ XConstants.NoEventMask, xev.pData);
} finally {
XToolkit.awtUnlock();
}
--- a/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java Wed May 14 07:53:12 2008 -0700
@@ -54,8 +54,7 @@
import sun.misc.PerformanceLogger;
import sun.print.PrintJob2D;
-public final class XToolkit extends UNIXToolkit implements Runnable, XConstants
-{
+public final class XToolkit extends UNIXToolkit implements Runnable {
private static Logger log = Logger.getLogger("sun.awt.X11.XToolkit");
private static Logger eventLog = Logger.getLogger("sun.awt.X11.event.XToolkit");
private static final Logger timeoutTaskLog = Logger.getLogger("sun.awt.X11.timeoutTask.XToolkit");
@@ -169,7 +168,7 @@
static XErrorHandler IgnoreBadWindowHandler = new XErrorHandler() {
public int handleError(long display, XErrorEvent err) {
XERROR_SAVE(err);
- if (err.get_error_code() == BadWindow) {
+ if (err.get_error_code() == XConstants.BadWindow) {
return 0;
} else {
return SAVED_ERROR_HANDLER(display, err);
@@ -425,7 +424,7 @@
// Only our windows guaranteely generate MotionNotify, so we
// should track enter/leave, to catch the moment when to
// switch to XQueryPointer
- if (e.get_type() == MotionNotify) {
+ if (e.get_type() == XConstants.MotionNotify) {
XMotionEvent ev = e.get_xmotion();
awtLock();
try {
@@ -437,7 +436,7 @@
} finally {
awtUnlock();
}
- } else if (e.get_type() == LeaveNotify) {
+ } else if (e.get_type() == XConstants.LeaveNotify) {
// Leave from our window
awtLock();
try {
@@ -445,7 +444,7 @@
} finally {
awtUnlock();
}
- } else if (e.get_type() == EnterNotify) {
+ } else if (e.get_type() == XConstants.EnterNotify) {
// Entrance into our window
XCrossingEvent ev = e.get_xcrossing();
awtLock();
@@ -492,7 +491,7 @@
final XAnyEvent xany = ev.get_xany();
if (windowToXWindow(xany.get_window()) != null &&
- (ev.get_type() == MotionNotify || ev.get_type() == EnterNotify || ev.get_type() == LeaveNotify))
+ (ev.get_type() == XConstants.MotionNotify || ev.get_type() == XConstants.EnterNotify || ev.get_type() == XConstants.LeaveNotify))
{
processGlobalMotionEvent(ev);
}
@@ -549,15 +548,15 @@
// If no events are queued, waitForEvents() causes calls to
// awtUnlock(), awtJNI_ThreadYield, poll, awtLock(),
// so it spends most of its time in poll, without holding the lock.
- while ((XlibWrapper.XEventsQueued(getDisplay(), XlibWrapper.QueuedAfterReading) == 0) &&
- (XlibWrapper.XEventsQueued(getDisplay(), XlibWrapper.QueuedAfterFlush) == 0)) {
+ while ((XlibWrapper.XEventsQueued(getDisplay(), XConstants.QueuedAfterReading) == 0) &&
+ (XlibWrapper.XEventsQueued(getDisplay(), XConstants.QueuedAfterFlush) == 0)) {
callTimeoutTasks();
waitForEvents(getNextTaskTime());
}
XlibWrapper.XNextEvent(getDisplay(),ev.pData);
}
- if (ev.get_type() != NoExpose) {
+ if (ev.get_type() != XConstants.NoExpose) {
eventNumber++;
}
@@ -582,13 +581,13 @@
}
}
}
- if( keyEventLog.isLoggable(Level.FINE) && (ev.get_type() == KeyPress || ev.get_type() == KeyRelease) ) {
+ if( keyEventLog.isLoggable(Level.FINE) && (ev.get_type() == XConstants.KeyPress || ev.get_type() == XConstants.KeyRelease) ) {
keyEventLog.fine("before XFilterEvent:"+ev);
}
if (XlibWrapper.XFilterEvent(ev.getPData(), w)) {
continue;
}
- if( keyEventLog.isLoggable(Level.FINE) && (ev.get_type() == KeyPress || ev.get_type() == KeyRelease) ) {
+ if( keyEventLog.isLoggable(Level.FINE) && (ev.get_type() == XConstants.KeyPress || ev.get_type() == XConstants.KeyRelease) ) {
keyEventLog.fine("after XFilterEvent:"+ev); // IS THIS CORRECT?
}
@@ -750,7 +749,7 @@
* _NET_WM_STRUT[_PARTIAL] hints for iconified windows
* are not included to the screen insets.
*/
- if (XlibUtil.getWindowMapState(window) == XlibWrapper.IsUnmapped)
+ if (XlibUtil.getWindowMapState(window) == XConstants.IsUnmapped)
{
continue;
}
@@ -1289,7 +1288,7 @@
new XEventDispatcher() {
public void dispatchEvent(XEvent ev) {
switch (ev.get_type()) {
- case PropertyNotify:
+ case XConstants.PropertyNotify:
XPropertyEvent xpe = ev.get_xproperty();
awtLock();
@@ -1322,7 +1321,7 @@
XlibWrapper.XChangeProperty(XToolkit.getDisplay(),
XBaseWindow.getXAWTRootWindow().getWindow(),
_XA_JAVA_TIME_PROPERTY_ATOM.getAtom(), XAtom.XA_ATOM, 32,
- PropModeAppend,
+ XConstants.PropModeAppend,
0, 0);
XlibWrapper.XFlush(XToolkit.getDisplay());
@@ -1539,8 +1538,8 @@
final int shiftLock = keysymToPrimaryKeycode(XKeySymConstants.XK_Shift_Lock);
final int capsLock = keysymToPrimaryKeycode(XKeySymConstants.XK_Caps_Lock);
- final int modmask[] = { ShiftMask, LockMask, ControlMask, Mod1Mask,
- Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask };
+ final int modmask[] = { XConstants.ShiftMask, XConstants.LockMask, XConstants.ControlMask, XConstants.Mod1Mask,
+ XConstants.Mod2Mask, XConstants.Mod3Mask, XConstants.Mod4Mask, XConstants.Mod5Mask };
log.fine("In setupModifierMap");
awtLock();
@@ -2047,7 +2046,7 @@
if (oops_waiter == null) {
oops_waiter = new XEventDispatcher() {
public void dispatchEvent(XEvent e) {
- if (e.get_type() == SelectionNotify) {
+ if (e.get_type() == XConstants.SelectionNotify) {
XSelectionEvent pe = e.get_xselection();
if (pe.get_property() == oops.getAtom()) {
oops_updated = true;
@@ -2083,7 +2082,7 @@
eventLog.log(Level.FINER, "WM_S0 selection owner {0}", new Object[] {XlibWrapper.XGetSelectionOwner(getDisplay(), atom.getAtom())});
XlibWrapper.XConvertSelection(getDisplay(), atom.getAtom(),
XAtom.get("VERSION").getAtom(), oops.getAtom(),
- win.getWindow(), XlibWrapper.CurrentTime);
+ win.getWindow(), XConstants.CurrentTime);
XSync();
--- a/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java Wed May 14 07:53:12 2008 -0700
@@ -98,7 +98,7 @@
parentXED = new XEventDispatcher() {
// It's executed under AWTLock.
public void dispatchEvent(XEvent ev) {
- if (isDisposed() || ev.get_type() != XlibWrapper.ConfigureNotify) {
+ if (isDisposed() || ev.get_type() != XConstants.ConfigureNotify) {
return;
}
@@ -194,7 +194,7 @@
XTrayIconPeer xtiPeer = XTrayIconPeer.this;
public void dispatchEvent(XEvent ev) {
- if (isDisposed() || ev.get_type() != XlibWrapper.ReparentNotify) {
+ if (isDisposed() || ev.get_type() != XConstants.ReparentNotify) {
return;
}
@@ -214,7 +214,7 @@
}
if (!isTrayIconDisplayed) {
- addXED(eframeParentID, parentXED, XlibWrapper.StructureNotifyMask);
+ addXED(eframeParentID, parentXED, XConstants.StructureNotifyMask);
isTrayIconDisplayed = true;
XToolkit.awtLockNotifyAll();
@@ -222,7 +222,7 @@
}
};
- addXED(getWindow(), eframeXED, XlibWrapper.StructureNotifyMask);
+ addXED(getWindow(), eframeXED, XConstants.StructureNotifyMask);
XSystemTrayPeer.getPeerInstance().addTrayIcon(this); // throws AWTException
@@ -833,6 +833,7 @@
Dimension tpSize = textPanel.getSize();
iconCanvas.setSize(BALLOON_ICON_WIDTH, (BALLOON_ICON_HEIGHT > tpSize.height ?
BALLOON_ICON_HEIGHT : tpSize.height));
+ iconCanvas.validate();
}
SunToolkit.executeOnEventHandlerThread(xtiPeer.target, new Runnable() {
--- a/jdk/src/solaris/classes/sun/awt/X11/XUtilConstants.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XUtilConstants.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,10 @@
package sun.awt.X11;
-public interface XUtilConstants {
+final public class XUtilConstants {
+
+ private XUtilConstants(){}
+
/*
* Bitmask returned by XParseGeometry(). Each bit tells if the corresponding
* value (x, y, width, height) was found in the parsed string.
--- a/jdk/src/solaris/classes/sun/awt/X11/XWINProtocol.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XWINProtocol.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -58,7 +58,7 @@
}
XClientMessageEvent req = new XClientMessageEvent();
- req.set_type(XlibWrapper.ClientMessage);
+ req.set_type(XConstants.ClientMessage);
req.set_window(window.getWindow());
req.set_message_type(XA_WIN_STATE.getAtom());
req.set_format(32);
@@ -71,7 +71,7 @@
XlibWrapper.RootWindow(XToolkit.getDisplay(),
window.getScreenNumber()),
false,
- XlibWrapper.SubstructureRedirectMask | XlibWrapper.SubstructureNotifyMask,
+ XConstants.SubstructureRedirectMask | XConstants.SubstructureNotifyMask,
req.pData);
}
finally {
@@ -150,7 +150,7 @@
public void setLayer(XWindowPeer window, int layer) {
if (window.isShowing()) {
XClientMessageEvent req = new XClientMessageEvent();
- req.set_type(XlibWrapper.ClientMessage);
+ req.set_type(XConstants.ClientMessage);
req.set_window(window.getWindow());
req.set_message_type(XA_WIN_LAYER.getAtom());
req.set_format(32);
@@ -164,7 +164,7 @@
XlibWrapper.RootWindow(XToolkit.getDisplay(),
window.getScreenNumber()),
false,
- /*XlibWrapper.SubstructureRedirectMask | */XlibWrapper.SubstructureNotifyMask,
+ /*XConstants.SubstructureRedirectMask | */XConstants.SubstructureNotifyMask,
req.pData);
}
finally {
--- a/jdk/src/solaris/classes/sun/awt/X11/XWM.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XWM.java Wed May 14 07:53:12 2008 -0700
@@ -46,7 +46,7 @@
* Class incapsulating knowledge about window managers in general
* Descendants should provide some information about specific window manager.
*/
-final class XWM implements MWMConstants, XUtilConstants
+final class XWM
{
private final static Logger log = Logger.getLogger("sun.awt.X11.XWM");
@@ -274,12 +274,12 @@
}
winmgr_running = false;
- substruct.set_event_mask(XlibWrapper.SubstructureRedirectMask);
+ substruct.set_event_mask(XConstants.SubstructureRedirectMask);
XToolkit.WITH_XERROR_HANDLER(DetectWMHandler);
XlibWrapper.XChangeWindowAttributes(XToolkit.getDisplay(),
XToolkit.getDefaultRootWindow(),
- XlibWrapper.CWEventMask,
+ XConstants.CWEventMask,
substruct.pData);
XToolkit.RESTORE_XERROR_HANDLER();
@@ -291,7 +291,7 @@
substruct.set_event_mask(0);
XlibWrapper.XChangeWindowAttributes(XToolkit.getDisplay(),
XToolkit.getDefaultRootWindow(),
- XlibWrapper.CWEventMask,
+ XConstants.CWEventMask,
substruct.pData);
if (insLog.isLoggable(Level.FINE)) {
insLog.finer("It looks like there is no WM thus NO_WM");
@@ -322,7 +322,7 @@
XAtom.XA_STRING);
try {
int status = getter.execute(XToolkit.IgnoreBadWindowHandler);
- if (status != XlibWrapper.Success || getter.getData() == 0) {
+ if (status != XConstants.Success || getter.getData() == 0) {
return 0;
}
@@ -411,7 +411,7 @@
false, XA_DT_SM_WINDOW_INFO);
try {
int status = getter.execute();
- if (status != XlibWrapper.Success || getter.getData() == 0) {
+ if (status != XConstants.Success || getter.getData() == 0) {
log.finer("Getting of _DT_SM_WINDOW_INFO is not successfull");
return false;
}
@@ -442,7 +442,7 @@
status = getter2.execute(XToolkit.IgnoreBadWindowHandler);
- if (status != XlibWrapper.Success || getter2.getData() == 0) {
+ if (status != XConstants.Success || getter2.getData() == 0) {
log.finer("Getting of _DT_SM_STATE_INFO is not successfull");
return false;
}
@@ -480,18 +480,18 @@
WindowPropertyGetter getter =
new WindowPropertyGetter(XToolkit.getDefaultRootWindow(),
XA_MOTIF_WM_INFO, 0,
- PROP_MOTIF_WM_INFO_ELEMENTS,
+ MWMConstants.PROP_MOTIF_WM_INFO_ELEMENTS,
false, XA_MOTIF_WM_INFO);
try {
int status = getter.execute();
- if (status != XlibWrapper.Success || getter.getData() == 0) {
+ if (status != XConstants.Success || getter.getData() == 0) {
return false;
}
if (getter.getActualType() != XA_MOTIF_WM_INFO.getAtom()
|| getter.getActualFormat() != 32
- || getter.getNumberOfItems() != PROP_MOTIF_WM_INFO_ELEMENTS
+ || getter.getNumberOfItems() != MWMConstants.PROP_MOTIF_WM_INFO_ELEMENTS
|| getter.getBytesAfter() != 0)
{
return false;
@@ -516,7 +516,7 @@
0, 1, false,
XA_WM_STATE);
try {
- if (state_getter.execute() == XlibWrapper.Success &&
+ if (state_getter.execute() == XConstants.Success &&
state_getter.getData() != 0 &&
state_getter.getActualType() == XA_WM_STATE.getAtom())
{
@@ -577,7 +577,7 @@
static XToolkit.XErrorHandler VerifyChangePropertyHandler = new XToolkit.XErrorHandler() {
public int handleError(long display, XErrorEvent err) {
XToolkit.XERROR_SAVE(err);
- if (err.get_request_code() == XlibWrapper.X_ChangeProperty) {
+ if (err.get_request_code() == XProtocolConstants.X_ChangeProperty) {
return 0;
} else {
return XToolkit.SAVED_ERROR_HANDLER(display, err);
@@ -621,11 +621,11 @@
XlibWrapper.XChangePropertyS(XToolkit.getDisplay(), XToolkit.getDefaultRootWindow(),
XA_ICEWM_WINOPTHINT.getAtom(),
XA_ICEWM_WINOPTHINT.getAtom(),
- 8, XlibWrapper.PropModeReplace,
+ 8, XConstants.PropModeReplace,
new String(opt));
XToolkit.RESTORE_XERROR_HANDLER();
- if (XToolkit.saved_error != null && XToolkit.saved_error.get_error_code() != XlibWrapper.Success) {
+ if (XToolkit.saved_error != null && XToolkit.saved_error.get_error_code() != XConstants.Success) {
log.finer("Erorr getting XA_ICEWM_WINOPTHINT property");
return false;
}
@@ -654,7 +654,7 @@
true, XA_ICEWM_WINOPTHINT);
try {
int status = getter.execute();
- boolean res = (status == XlibWrapper.Success && getter.getActualType() != 0);
+ boolean res = (status == XConstants.Success && getter.getActualType() != 0);
log.finer("Status getting XA_ICEWM_WINOPTHINT: " + !res);
return !res || isNetWMName("IceWM");
} finally {
@@ -686,8 +686,8 @@
static XToolkit.XErrorHandler DetectWMHandler = new XToolkit.XErrorHandler() {
public int handleError(long display, XErrorEvent err) {
XToolkit.XERROR_SAVE(err);
- if (err.get_request_code() == XlibWrapper.X_ChangeWindowAttributes
- && err.get_error_code() == XlibWrapper.BadAccess)
+ if (err.get_request_code() == XProtocolConstants.X_ChangeWindowAttributes
+ && err.get_error_code() == XConstants.BadAccess)
{
winmgr_running = true;
return 0;
@@ -804,7 +804,7 @@
* XXX: Why do we need this in the first place???
*/
static void removeSizeHints(XDecoratedPeer window, long mask) {
- mask &= PMaxSize | PMinSize;
+ mask &= XUtilConstants.PMaxSize | XUtilConstants.PMinSize;
XToolkit.awtLock();
try {
@@ -830,13 +830,13 @@
* rest of the code.
*/
static int normalizeMotifDecor(int decorations) {
- if ((decorations & MWM_DECOR_ALL) == 0) {
+ if ((decorations & MWMConstants.MWM_DECOR_ALL) == 0) {
return decorations;
}
- int d = MWM_DECOR_BORDER | MWM_DECOR_RESIZEH
- | MWM_DECOR_TITLE
- | MWM_DECOR_MENU | MWM_DECOR_MINIMIZE
- | MWM_DECOR_MAXIMIZE;
+ int d = MWMConstants.MWM_DECOR_BORDER | MWMConstants.MWM_DECOR_RESIZEH
+ | MWMConstants.MWM_DECOR_TITLE
+ | MWMConstants.MWM_DECOR_MENU | MWMConstants.MWM_DECOR_MINIMIZE
+ | MWMConstants.MWM_DECOR_MAXIMIZE;
d &= ~decorations;
return d;
}
@@ -848,14 +848,14 @@
* rest of the code.
*/
static int normalizeMotifFunc(int functions) {
- if ((functions & MWM_FUNC_ALL) == 0) {
+ if ((functions & MWMConstants.MWM_FUNC_ALL) == 0) {
return functions;
}
- int f = MWM_FUNC_RESIZE |
- MWM_FUNC_MOVE |
- MWM_FUNC_MAXIMIZE |
- MWM_FUNC_MINIMIZE |
- MWM_FUNC_CLOSE;
+ int f = MWMConstants.MWM_FUNC_RESIZE |
+ MWMConstants.MWM_FUNC_MOVE |
+ MWMConstants.MWM_FUNC_MAXIMIZE |
+ MWMConstants.MWM_FUNC_MINIMIZE |
+ MWMConstants.MWM_FUNC_CLOSE;
f &= ~functions;
return f;
}
@@ -872,15 +872,15 @@
XAtomList decorDel = new XAtomList();
decorations = normalizeMotifDecor(decorations);
if (insLog.isLoggable(Level.FINER)) insLog.finer("Setting OL_DECOR to " + Integer.toBinaryString(decorations));
- if ((decorations & MWM_DECOR_TITLE) == 0) {
+ if ((decorations & MWMConstants.MWM_DECOR_TITLE) == 0) {
decorDel.add(XA_OL_DECOR_HEADER);
}
- if ((decorations & (MWM_DECOR_RESIZEH | MWM_DECOR_MAXIMIZE)) == 0) {
+ if ((decorations & (MWMConstants.MWM_DECOR_RESIZEH | MWMConstants.MWM_DECOR_MAXIMIZE)) == 0) {
decorDel.add(XA_OL_DECOR_RESIZE);
}
- if ((decorations & (MWM_DECOR_MENU |
- MWM_DECOR_MAXIMIZE |
- MWM_DECOR_MINIMIZE)) == 0)
+ if ((decorations & (MWMConstants.MWM_DECOR_MENU |
+ MWMConstants.MWM_DECOR_MAXIMIZE |
+ MWMConstants.MWM_DECOR_MINIMIZE)) == 0)
{
decorDel.add(XA_OL_DECOR_CLOSE);
}
@@ -898,19 +898,21 @@
*/
static void setMotifDecor(XWindowPeer window, boolean resizable, int decorations, int functions) {
/* Apparently some WMs don't implement MWM_*_ALL semantic correctly */
- if ((decorations & MWM_DECOR_ALL) != 0
- && (decorations != MWM_DECOR_ALL))
+ if ((decorations & MWMConstants.MWM_DECOR_ALL) != 0
+ && (decorations != MWMConstants.MWM_DECOR_ALL))
{
decorations = normalizeMotifDecor(decorations);
}
- if ((functions & MWM_FUNC_ALL) != 0
- && (functions != MWM_FUNC_ALL))
+ if ((functions & MWMConstants.MWM_FUNC_ALL) != 0
+ && (functions != MWMConstants.MWM_FUNC_ALL))
{
functions = normalizeMotifFunc(functions);
}
PropMwmHints hints = window.getMWMHints();
- hints.set_flags(hints.get_flags() | MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS);
+ hints.set_flags(hints.get_flags() |
+ MWMConstants.MWM_HINTS_FUNCTIONS |
+ MWMConstants.MWM_HINTS_DECORATIONS);
hints.set_functions(functions);
hints.set_decorations(decorations);
@@ -950,10 +952,10 @@
boolean resizable = window.isResizable();
if (!resizable) {
- if ((decorations & MWM_DECOR_ALL) != 0) {
- decorations |= MWM_DECOR_RESIZEH | MWM_DECOR_MAXIMIZE;
+ if ((decorations & MWMConstants.MWM_DECOR_ALL) != 0) {
+ decorations |= MWMConstants.MWM_DECOR_RESIZEH | MWMConstants.MWM_DECOR_MAXIMIZE;
} else {
- decorations &= ~(MWM_DECOR_RESIZEH | MWM_DECOR_MAXIMIZE);
+ decorations &= ~(MWMConstants.MWM_DECOR_RESIZEH | MWMConstants.MWM_DECOR_MAXIMIZE);
}
}
setMotifDecor(window, resizable, decorations, functions);
@@ -988,7 +990,7 @@
/* REMINDER: will need to revisit when setExtendedStateBounds is added */
//Fix for 4320050: Minimum size for java.awt.Frame is not being enforced.
//We need to update frame's minimum size, not to reset it
- removeSizeHints(window, PMaxSize);
+ removeSizeHints(window, XUtilConstants.PMaxSize);
window.updateMinimumSize();
/* Restore decorations */
@@ -1134,7 +1136,7 @@
}
int wm_state = window.getWMState();
- if (wm_state == XlibWrapper.WithdrawnState) {
+ if (wm_state == XUtilConstants.WithdrawnState) {
stateLog.finer("WithdrawnState");
return false;
} else {
@@ -1158,7 +1160,7 @@
int getState(XDecoratedPeer window) {
int res = 0;
final int wm_state = window.getWMState();
- if (wm_state == XlibWrapper.IconicState) {
+ if (wm_state == XUtilConstants.IconicState) {
res = Frame.ICONIFIED;
} else {
res = Frame.NORMAL;
@@ -1397,7 +1399,7 @@
new WindowPropertyGetter(window, atom,
0, 4, false, XAtom.XA_CARDINAL);
try {
- if (getter.execute() != XlibWrapper.Success
+ if (getter.execute() != XConstants.Success
|| getter.getData() == 0
|| getter.getActualType() != XAtom.XA_CARDINAL
|| getter.getActualFormat() != 32)
@@ -1426,7 +1428,7 @@
XClientMessageEvent msg = new XClientMessageEvent();
msg.zero();
- msg.set_type(XlibWrapper.ClientMessage);
+ msg.set_type(XConstants.ClientMessage);
msg.set_display(XToolkit.getDisplay());
msg.set_window(window);
msg.set_format(32);
@@ -1436,13 +1438,15 @@
if (net_protocol != null && net_protocol.active()) {
msg.set_message_type(XA_NET_REQUEST_FRAME_EXTENTS.getAtom());
XlibWrapper.XSendEvent(XToolkit.getDisplay(), XToolkit.getDefaultRootWindow(),
- false, XlibWrapper.SubstructureRedirectMask | XlibWrapper.SubstructureNotifyMask,
+ false,
+ XConstants.SubstructureRedirectMask | XConstants.SubstructureNotifyMask,
msg.getPData());
}
if (getWMID() == XWM.KDE2_WM) {
msg.set_message_type(XA_KDE_NET_WM_FRAME_STRUT.getAtom());
XlibWrapper.XSendEvent(XToolkit.getDisplay(), XToolkit.getDefaultRootWindow(),
- false, XlibWrapper.SubstructureRedirectMask | XlibWrapper.SubstructureNotifyMask,
+ false,
+ XConstants.SubstructureRedirectMask | XConstants.SubstructureNotifyMask,
msg.getPData());
}
// XXX: should we wait for response? XIfEvent() would be useful here :)
--- a/jdk/src/solaris/classes/sun/awt/X11/XWindow.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XWindow.java Wed May 14 07:53:12 2008 -0700
@@ -103,12 +103,14 @@
return defaultFont;
}
- /*
- * Keeps all buttons which were pressed at the time of the last mouse
- * drag until all buttons will be released, contains state as bit masks
- * Button1Mask, Button2Mask, Button3Mask
- */
- private int mouseDragState = 0;
+ /* A bitmask keeps the button's numbers as Button1Mask, Button2Mask, Button3Mask
+ * which are allowed to
+ * generate the CLICK event after the RELEASE has happened.
+ * There are conditions that must be true for that sending CLICK event:
+ * 1) button was initially PRESSED
+ * 2) no movement or drag has happened until RELEASE
+ */
+ private int mouseButtonClickAllowed = 0;
native int getNativeColor(Color clr, GraphicsConfiguration gc);
native void getWMInsets(long window, long left, long top, long right, long bottom, long border);
@@ -178,10 +180,10 @@
AwtGraphicsConfigData gData = getGraphicsConfigurationData();
X11GraphicsConfig config = (X11GraphicsConfig) getGraphicsConfiguration();
XVisualInfo visInfo = gData.get_awt_visInfo();
- params.putIfNull(EVENT_MASK, KeyPressMask | KeyReleaseMask
- | FocusChangeMask | ButtonPressMask | ButtonReleaseMask
- | EnterWindowMask | LeaveWindowMask | PointerMotionMask
- | ButtonMotionMask | ExposureMask | StructureNotifyMask);
+ params.putIfNull(EVENT_MASK, XConstants.KeyPressMask | XConstants.KeyReleaseMask
+ | XConstants.FocusChangeMask | XConstants.ButtonPressMask | XConstants.ButtonReleaseMask
+ | XConstants.EnterWindowMask | XConstants.LeaveWindowMask | XConstants.PointerMotionMask
+ | XConstants.ButtonMotionMask | XConstants.ExposureMask | XConstants.StructureNotifyMask);
if (target != null) {
params.putIfNull(BOUNDS, target.getBounds());
@@ -192,9 +194,9 @@
getColorModel(); // fix 4948833: this call forces the color map to be initialized
params.putIfNull(COLORMAP, gData.get_awt_cmap());
params.putIfNull(DEPTH, gData.get_awt_depth());
- params.putIfNull(VISUAL_CLASS, Integer.valueOf((int)XlibWrapper.InputOutput));
+ params.putIfNull(VISUAL_CLASS, Integer.valueOf((int)XConstants.InputOutput));
params.putIfNull(VISUAL, visInfo.get_visual());
- params.putIfNull(VALUE_MASK, XlibWrapper.CWBorderPixel | XlibWrapper.CWEventMask | XlibWrapper.CWColormap);
+ params.putIfNull(VALUE_MASK, XConstants.CWBorderPixel | XConstants.CWEventMask | XConstants.CWColormap);
Long parentWindow = (Long)params.get(PARENT_WINDOW);
if (parentWindow == null || parentWindow.longValue() == 0) {
XToolkit.awtLock();
@@ -553,10 +555,10 @@
static int getModifiers(int state, int button, int keyCode) {
int modifiers = 0;
- if (((state & XlibWrapper.ShiftMask) != 0) ^ (keyCode == KeyEvent.VK_SHIFT)) {
+ if (((state & XConstants.ShiftMask) != 0) ^ (keyCode == KeyEvent.VK_SHIFT)) {
modifiers |= InputEvent.SHIFT_DOWN_MASK;
}
- if (((state & XlibWrapper.ControlMask) != 0) ^ (keyCode == KeyEvent.VK_CONTROL)) {
+ if (((state & XConstants.ControlMask) != 0) ^ (keyCode == KeyEvent.VK_CONTROL)) {
modifiers |= InputEvent.CTRL_DOWN_MASK;
}
if (((state & XToolkit.metaMask) != 0) ^ (keyCode == KeyEvent.VK_META)) {
@@ -568,13 +570,13 @@
if (((state & XToolkit.modeSwitchMask) != 0) ^ (keyCode == KeyEvent.VK_ALT_GRAPH)) {
modifiers |= InputEvent.ALT_GRAPH_DOWN_MASK;
}
- if (((state & XlibWrapper.Button1Mask) != 0) ^ (button == MouseEvent.BUTTON1)) {
+ if (((state & XConstants.Button1Mask) != 0) ^ (button == MouseEvent.BUTTON1)) {
modifiers |= InputEvent.BUTTON1_DOWN_MASK;
}
- if (((state & XlibWrapper.Button2Mask) != 0) ^ (button == MouseEvent.BUTTON2)) {
+ if (((state & XConstants.Button2Mask) != 0) ^ (button == MouseEvent.BUTTON2)) {
modifiers |= InputEvent.BUTTON2_DOWN_MASK;
}
- if (((state & XlibWrapper.Button3Mask) != 0) ^ (button == MouseEvent.BUTTON3)) {
+ if (((state & XConstants.Button3Mask) != 0) ^ (button == MouseEvent.BUTTON3)) {
modifiers |= InputEvent.BUTTON3_DOWN_MASK;
}
return modifiers;
@@ -584,10 +586,10 @@
int mods = stroke.getModifiers();
int res = 0;
if ((mods & (InputEvent.SHIFT_DOWN_MASK | InputEvent.SHIFT_MASK)) != 0) {
- res |= XToolkit.ShiftMask;
+ res |= XConstants.ShiftMask;
}
if ((mods & (InputEvent.CTRL_DOWN_MASK | InputEvent.CTRL_MASK)) != 0) {
- res |= XToolkit.ControlMask;
+ res |= XConstants.ControlMask;
}
if ((mods & (InputEvent.ALT_DOWN_MASK | InputEvent.ALT_MASK)) != 0) {
res |= XToolkit.altMask;
@@ -602,12 +604,12 @@
}
private static int getButtonMask(long mouseButton) {
- if (mouseButton == XlibWrapper.Button1) {
- return XlibWrapper.Button1Mask;
- } else if (mouseButton == XlibWrapper.Button2) {
- return XlibWrapper.Button2Mask;
- } else if (mouseButton == XlibWrapper.Button3) {
- return XlibWrapper.Button3Mask;
+ if (mouseButton == XConstants.Button1) {
+ return XConstants.Button1Mask;
+ } else if (mouseButton == XConstants.Button2) {
+ return XConstants.Button2Mask;
+ } else if (mouseButton == XConstants.Button3) {
+ return XConstants.Button3Mask;
}
return 0;
}
@@ -659,7 +661,9 @@
y = localXY.y;
}
- if (type == XlibWrapper.ButtonPress) {
+ if (type == XConstants.ButtonPress) {
+ //Allow this mouse button to generate CLICK event on next ButtonRelease
+ mouseButtonClickAllowed |= getButtonMask(lbutton);
XWindow lastWindow = (lastWindowRef != null) ? ((XWindow)lastWindowRef.get()):(null);
/*
multiclick checking
@@ -689,16 +693,16 @@
}
}
- if (lbutton == XlibWrapper.Button1)
+ if (lbutton == XConstants.Button1)
button = MouseEvent.BUTTON1;
- else if (lbutton == XlibWrapper.Button2 )
+ else if (lbutton == XConstants.Button2 )
button = MouseEvent.BUTTON2;
- else if (lbutton == XlibWrapper.Button3)
+ else if (lbutton == XConstants.Button3)
button = MouseEvent.BUTTON3;
- else if (lbutton == XlibWrapper.Button4) {
+ else if (lbutton == XConstants.Button4) {
button = 4;
wheel_mouse = true;
- } else if (lbutton == XlibWrapper.Button5) {
+ } else if (lbutton == XConstants.Button5) {
button = 5;
wheel_mouse = true;
}
@@ -707,7 +711,7 @@
if (!wheel_mouse) {
MouseEvent me = new MouseEvent((Component)getEventSource(),
- type == XlibWrapper.ButtonPress ? MouseEvent.MOUSE_PRESSED : MouseEvent.MOUSE_RELEASED,
+ type == XConstants.ButtonPress ? MouseEvent.MOUSE_PRESSED : MouseEvent.MOUSE_RELEASED,
jWhen,modifiers, x, y,
xbe.get_x_root(),
xbe.get_y_root(),
@@ -715,8 +719,8 @@
postEventToEventQueue(me);
- if (((mouseDragState & getButtonMask(lbutton)) == 0) && // No up-button in the drag-state
- (type == XlibWrapper.ButtonRelease))
+ if ((type == XConstants.ButtonRelease) &&
+ ((mouseButtonClickAllowed & getButtonMask(lbutton)) != 0) ) // No up-button in the drag-state
{
postEventToEventQueue(me = new MouseEvent((Component)getEventSource(),
MouseEvent.MOUSE_CLICKED,
@@ -731,7 +735,7 @@
}
else {
- if (xev.get_type() == XlibWrapper.ButtonPress) {
+ if (xev.get_type() == XConstants.ButtonPress) {
MouseWheelEvent mwe = new MouseWheelEvent((Component)getEventSource(),MouseEvent.MOUSE_WHEEL, jWhen,
modifiers,
x, y,
@@ -743,7 +747,11 @@
}
}
- mouseDragState &= ~getButtonMask(lbutton); // Exclude the up-button from the drag-state
+ /* Update the state variable AFTER the CLICKED event post. */
+ if (type == XConstants.ButtonRelease) {
+ /* Exclude this mouse button from allowed list.*/
+ mouseButtonClickAllowed &= ~getButtonMask(lbutton);
+ }
}
public void handleMotionNotify(XEvent xev) {
@@ -753,7 +761,7 @@
return;
}
- int mouseKeyState = (xme.get_state() & (Button1Mask | Button2Mask | Button3Mask));
+ int mouseKeyState = (xme.get_state() & (XConstants.Button1Mask | XConstants.Button2Mask | XConstants.Button3Mask));
boolean isDragging = (mouseKeyState != 0);
int mouseEventType = 0;
@@ -776,7 +784,7 @@
Math.abs(lastY - y) < AWT_MULTICLICK_SMUDGE))) {
clickCount = 0;
lastWindowRef = null;
- mouseDragState = mouseKeyState;
+ mouseButtonClickAllowed = 0;
lastTime = 0;
lastX = 0;
lastY = 0;
@@ -823,10 +831,10 @@
// accordingly. This leads to impossibility to make a double click on Component (6404708)
XWindowPeer toplevel = getToplevelXWindow();
if (toplevel != null && !toplevel.isModalBlocked()){
- if (xce.get_mode() != NotifyNormal) {
+ if (xce.get_mode() != XConstants.NotifyNormal) {
// 6404708 : need update cursor in accordance with skipping Leave/EnterNotify event
// whereas it doesn't need to handled further.
- if (xce.get_type() == EnterNotify) {
+ if (xce.get_type() == XConstants.EnterNotify) {
XAwtState.setComponentMouseEntered(getEventSource());
XGlobalCursorManager.nativeUpdateCursor(getEventSource());
} else { // LeaveNotify:
@@ -840,7 +848,7 @@
// From java point the event is bogus as ancestor is obscured, so if
// the child can get java event itself, we skip it on ancestor.
long childWnd = xce.get_subwindow();
- if (childWnd != None) {
+ if (childWnd != XConstants.None) {
XBaseWindow child = XToolkit.windowToXWindow(childWnd);
if (child != null && child instanceof XWindow &&
!child.isEventDisabled(xev))
@@ -853,7 +861,7 @@
final Component compWithMouse = XAwtState.getComponentMouseEntered();
if (toplevel != null) {
if(!toplevel.isModalBlocked()){
- if (xce.get_type() == EnterNotify) {
+ if (xce.get_type() == XConstants.EnterNotify) {
// Change XAwtState's component mouse entered to the up-to-date one before requesting
// to update the cursor since XAwtState.getComponentMouseEntered() is used when the
// cursor is updated (in XGlobalCursorManager.findHeavyweightUnderCursor()).
@@ -895,7 +903,7 @@
eventLog.finest("Clearing last window ref");
lastWindowRef = null;
}
- if (xce.get_type() == EnterNotify) {
+ if (xce.get_type() == XConstants.EnterNotify) {
MouseEvent me = new MouseEvent(getEventSource(), MouseEvent.MOUSE_ENTERED,
jWhen, modifiers, xce.get_x(), xce.get_y(), xce.get_x_root(), xce.get_y_root(), clickCount,
popupTrigger, MouseEvent.NOBUTTON);
@@ -990,7 +998,7 @@
final void handleKeyPress(XKeyEvent ev) {
long keysym[] = new long[2];
char unicodeKey = 0;
- keysym[0] = NoSymbol;
+ keysym[0] = XConstants.NoSymbol;
if (keyEventLog.isLoggable(Level.FINE)) {
logIncomingKeyEvent( ev );
@@ -1073,7 +1081,7 @@
private void handleKeyRelease(XKeyEvent ev) {
long keysym[] = new long[2];
char unicodeKey = 0;
- keysym[0] = NoSymbol;
+ keysym[0] = XConstants.NoSymbol;
if (keyEventLog.isLoggable(Level.FINE)) {
logIncomingKeyEvent( ev );
@@ -1153,10 +1161,10 @@
}
void updateSizeHints(int x, int y, int width, int height) {
- long flags = XlibWrapper.PSize | (isLocationByPlatform() ? 0 : (XlibWrapper.PPosition | XlibWrapper.USPosition));
+ long flags = XUtilConstants.PSize | (isLocationByPlatform() ? 0 : (XUtilConstants.PPosition | XUtilConstants.USPosition));
if (!isResizable()) {
log.log(Level.FINER, "Window {0} is not resizable", new Object[] {this});
- flags |= XlibWrapper.PMinSize | XlibWrapper.PMaxSize;
+ flags |= XUtilConstants.PMinSize | XUtilConstants.PMaxSize;
} else {
log.log(Level.FINER, "Window {0} is resizable", new Object[] {this});
}
@@ -1164,10 +1172,10 @@
}
void updateSizeHints(int x, int y) {
- long flags = isLocationByPlatform() ? 0 : (XlibWrapper.PPosition | XlibWrapper.USPosition);
+ long flags = isLocationByPlatform() ? 0 : (XUtilConstants.PPosition | XUtilConstants.USPosition);
if (!isResizable()) {
log.log(Level.FINER, "Window {0} is not resizable", new Object[] {this});
- flags |= XlibWrapper.PMinSize | XlibWrapper.PMaxSize | XlibWrapper.PSize;
+ flags |= XUtilConstants.PMinSize | XUtilConstants.PMaxSize | XUtilConstants.PSize;
} else {
log.log(Level.FINER, "Window {0} is resizable", new Object[] {this});
}
--- a/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java Wed May 14 07:53:12 2008 -0700
@@ -50,7 +50,7 @@
import sun.awt.X11GraphicsEnvironment;
class XWindowPeer extends XPanelPeer implements WindowPeer,
- DisplayChangedListener, MWMConstants {
+ DisplayChangedListener {
private static final Logger log = Logger.getLogger("sun.awt.X11.XWindowPeer");
private static final Logger focusLog = Logger.getLogger("sun.awt.X11.focus.XWindowPeer");
@@ -65,7 +65,6 @@
static XAtom wm_delete_window;
static XAtom wm_take_focus;
- Insets insets = new Insets( 0, 0, 0, 0 );
XWindowAttributesData winAttr;
private boolean cachedFocusableWindow;
XWarningWindow warningWindow;
@@ -133,13 +132,12 @@
params.put(REPARENTED,
Boolean.valueOf(isOverrideRedirect() || isSimpleWindow()));
super.preInit(params);
- params.putIfNull(BIT_GRAVITY, Integer.valueOf(NorthWestGravity));
+ params.putIfNull(BIT_GRAVITY, Integer.valueOf(XConstants.NorthWestGravity));
- savedState = WithdrawnState;
+ savedState = XUtilConstants.WithdrawnState;
XA_NET_WM_STATE = XAtom.get("_NET_WM_STATE");
winAttr = new XWindowAttributesData();
- insets = new Insets(0,0,0,0);
params.put(OVERRIDE_REDIRECT, Boolean.valueOf(isOverrideRedirect()));
@@ -239,7 +237,7 @@
// Set group leader
XWMHints hints = getWMHints();
- hints.set_flags(hints.get_flags() | (int)XlibWrapper.WindowGroupHint);
+ hints.set_flags(hints.get_flags() | (int)XUtilConstants.WindowGroupHint);
hints.set_window_group(ownerWindow);
XlibWrapper.XSetWMHints(XToolkit.getDisplay(), getWindow(), hints.pData);
}
@@ -260,7 +258,6 @@
setSaveUnder(true);
- XWM.requestWMExtents(getWindow());
updateIconImages();
}
@@ -503,7 +500,7 @@
Rectangle bounds = getBounds();
XSizeHints hints = getHints();
- setSizeHints(hints.get_flags() | XlibWrapper.PPosition | XlibWrapper.PSize,
+ setSizeHints(hints.get_flags() | XUtilConstants.PPosition | XUtilConstants.PSize,
bounds.x, bounds.y, bounds.width, bounds.height);
XWM.setMotifDecor(this, false, 0, 0);
@@ -531,7 +528,7 @@
XToolkit.awtLock();
try {
XWMHints hints = getWMHints();
- hints.set_flags(hints.get_flags() | (int)XlibWrapper.InputHint);
+ hints.set_flags(hints.get_flags() | (int)XUtilConstants.InputHint);
hints.set_input(false/*isNativelyNonFocusableWindow() ? (0):(1)*/);
XlibWrapper.XSetWMHints(XToolkit.getDisplay(), getWindow(), hints.pData);
}
@@ -541,9 +538,7 @@
}
public Insets getInsets() {
- Insets in = (Insets)(insets.clone());
- in.top += getWarningWindowHeight();
- return in;
+ return new Insets(getWarningWindowHeight(), 0, 0, 0);
}
// NOTE: This method may be called by privileged threads.
@@ -582,7 +577,7 @@
}
/*
- * Converts native focused X window id into Java peer.
+ * Retrives real native focused window and converts it into Java peer.
*/
static XWindowPeer getNativeFocusedWindowPeer() {
XBaseWindow baseWindow = XToolkit.windowToXWindow(xGetInputFocus());
@@ -591,6 +586,14 @@
((XFocusProxyWindow)baseWindow).getOwner() : null;
}
+ /*
+ * Retrives real native focused window and converts it into Java window.
+ */
+ static Window getNativeFocusedWindow() {
+ XWindowPeer peer = getNativeFocusedWindowPeer();
+ return peer != null ? (Window)peer.target : null;
+ }
+
boolean isFocusableWindow() {
if (XToolkit.isToolkitThread() || SunToolkit.isAWTLockHeldByCurrentThread())
{
@@ -821,12 +824,12 @@
if (isEventDisabled(xev)) {
return;
}
- if (xev.get_type() == XlibWrapper.FocusIn)
+ if (xev.get_type() == XConstants.FocusIn)
{
// If this window is non-focusable don't post any java focus event
if (focusAllowedFor()) {
- if (xfe.get_mode() == XlibWrapper.NotifyNormal // Normal notify
- || xfe.get_mode() == XlibWrapper.NotifyWhileGrabbed) // Alt-Tab notify
+ if (xfe.get_mode() == XConstants.NotifyNormal // Normal notify
+ || xfe.get_mode() == XConstants.NotifyWhileGrabbed) // Alt-Tab notify
{
handleWindowFocusIn(xfe.get_serial());
}
@@ -834,8 +837,8 @@
}
else
{
- if (xfe.get_mode() == XlibWrapper.NotifyNormal // Normal notify
- || xfe.get_mode() == XlibWrapper.NotifyWhileGrabbed) // Alt-Tab notify
+ if (xfe.get_mode() == XConstants.NotifyNormal // Normal notify
+ || xfe.get_mode() == XConstants.NotifyWhileGrabbed) // Alt-Tab notify
{
// If this window is non-focusable don't post any java focus event
if (!isNativelyNonFocusableWindow()) {
@@ -994,7 +997,8 @@
return ret;
}
- private boolean isDesktopWindow( long wi ) {
+
+ private static boolean isDesktopWindow( long wi ) {
return XWM.getWM().isDesktopWindow( wi );
}
@@ -1022,7 +1026,7 @@
try {
Rectangle bounds = getBounds();
XSizeHints hints = getHints();
- setSizeHints(hints.get_flags() & ~(USPosition | PPosition),
+ setSizeHints(hints.get_flags() & ~(XUtilConstants.USPosition | XUtilConstants.PPosition),
bounds.x, bounds.y, bounds.width, bounds.height);
} finally {
XToolkit.awtUnlock();
@@ -1059,10 +1063,10 @@
XUnmapEvent unmap = new XUnmapEvent();
unmap.set_window(window);
unmap.set_event(XToolkit.getDefaultRootWindow());
- unmap.set_type((int)XlibWrapper.UnmapNotify);
+ unmap.set_type((int)XConstants.UnmapNotify);
unmap.set_from_configure(false);
XlibWrapper.XSendEvent(XToolkit.getDisplay(), XToolkit.getDefaultRootWindow(),
- false, XlibWrapper.SubstructureNotifyMask | XlibWrapper.SubstructureRedirectMask,
+ false, XConstants.SubstructureNotifyMask | XConstants.SubstructureRedirectMask,
unmap.pData);
unmap.dispose();
}
@@ -1168,10 +1172,6 @@
// State has changed, invalidate saved value
stateChanged = true;
stateChanged(ev.get_time(), savedState, getWMState());
- } else if (ev.get_atom() == XWM.XA_KDE_NET_WM_FRAME_STRUT.getAtom()
- || ev.get_atom() == XWM.XA_NET_FRAME_EXTENTS.getAtom())
- {
- getWMSetInsets(XAtom.get(ev.get_atom()));
}
}
@@ -1252,7 +1252,7 @@
return res;
}
- private boolean isWMStateNetHidden() {
+ protected boolean isWMStateNetHidden() {
XNETProtocol protocol = XWM.getWM().getNETProtocol();
return (protocol != null && protocol.isWMStateNetHidden(this));
}
@@ -1305,12 +1305,12 @@
XWM.XA_WM_STATE);
try {
int status = getter.execute();
- if (status != XlibWrapper.Success || getter.getData() == 0) {
- return savedState = XlibWrapper.WithdrawnState;
+ if (status != XConstants.Success || getter.getData() == 0) {
+ return savedState = XUtilConstants.WithdrawnState;
}
if (getter.getActualType() != XWM.XA_WM_STATE.getAtom() && getter.getActualFormat() != 32) {
- return savedState = XlibWrapper.WithdrawnState;
+ return savedState = XUtilConstants.WithdrawnState;
}
savedState = (int)Native.getCard32(getter.getData());
} finally {
@@ -1321,7 +1321,7 @@
}
boolean isWithdrawn() {
- return getWMState() == XlibWrapper.WithdrawnState;
+ return getWMState() == XUtilConstants.WithdrawnState;
}
boolean hasDecorations(int decor) {
@@ -1740,6 +1740,11 @@
return window;
}
+ public boolean requestWindowFocus(XWindowPeer actualFocusedWindow) {
+ setActualFocusedWindow(actualFocusedWindow);
+ return requestWindowFocus();
+ }
+
public boolean requestWindowFocus() {
return requestWindowFocus(0, false);
}
@@ -1748,25 +1753,25 @@
focusLog.fine("Request for window focus");
// If this is Frame or Dialog we can't assure focus request success - but we still can try
// If this is Window and its owner Frame is active we can be sure request succedded.
- Window win = (Window) target;
- Window owner = XWindowPeer.getDecoratedOwner(win);
+ Window ownerWindow = XWindowPeer.getDecoratedOwner((Window)target);
+ Window focusedWindow = XKeyboardFocusManagerPeer.getCurrentNativeFocusedWindow();
+ Window activeWindow = XWindowPeer.getDecoratedOwner(focusedWindow);
- final Window activeWindow =
- XWindowPeer.getDecoratedOwner(XKeyboardFocusManagerPeer.getCurrentNativeFocusedWindow());
- if (activeWindow == owner) {
+ if (isWMStateNetHidden()) {
+ focusLog.fine("The window is unmapped, so rejecting the request");
+ return false;
+ }
+ if (activeWindow == ownerWindow) {
focusLog.fine("Parent window is active - generating focus for this window");
handleWindowFocusInSync(-1);
return true;
- } else {
- focusLog.fine("Parent window is not active");
}
- ComponentPeer peer = ComponentAccessor.getPeer(owner);
- if (peer instanceof XDecoratedPeer) {
- XDecoratedPeer wpeer = (XDecoratedPeer) peer;
- if (wpeer.requestWindowFocus(this, time, timeProvided)) {
- focusLog.fine("Parent window accepted focus request - generating focus for this window");
- return true;
- }
+ focusLog.fine("Parent window is not active");
+
+ XDecoratedPeer wpeer = (XDecoratedPeer)ComponentAccessor.getPeer(ownerWindow);
+ if (wpeer != null && wpeer.requestWindowFocus(this, time, timeProvided)) {
+ focusLog.fine("Parent window accepted focus request - generating focus for this window");
+ return true;
}
focusLog.fine("Denied - parent window is not active and didn't accept focus request");
return false;
@@ -1818,14 +1823,14 @@
if( rootPropertyEventDispatcher == null ) {
rootPropertyEventDispatcher = new XEventDispatcher() {
public void dispatchEvent(XEvent ev) {
- if( ev.get_type() == PropertyNotify ) {
+ if( ev.get_type() == XConstants.PropertyNotify ) {
handleRootPropertyNotify( ev );
}
}
};
XlibWrapper.XSelectInput( XToolkit.getDisplay(),
XToolkit.getDefaultRootWindow(),
- XlibWrapper.PropertyChangeMask);
+ XConstants.PropertyChangeMask);
XToolkit.addEventDispatcher(XToolkit.getDefaultRootWindow(),
rootPropertyEventDispatcher);
}
@@ -1860,7 +1865,7 @@
public PropMwmHints getMWMHints() {
if (mwm_hints == null) {
mwm_hints = new PropMwmHints();
- if (!XWM.XA_MWM_HINTS.getAtomData(getWindow(), mwm_hints.pData, PROP_MWM_HINTS_ELEMENTS)) {
+ if (!XWM.XA_MWM_HINTS.getAtomData(getWindow(), mwm_hints.pData, MWMConstants.PROP_MWM_HINTS_ELEMENTS)) {
mwm_hints.zero();
}
}
@@ -1870,41 +1875,10 @@
public void setMWMHints(PropMwmHints hints) {
mwm_hints = hints;
if (hints != null) {
- XWM.XA_MWM_HINTS.setAtomData(getWindow(), mwm_hints.pData, PROP_MWM_HINTS_ELEMENTS);
+ XWM.XA_MWM_HINTS.setAtomData(getWindow(), mwm_hints.pData, MWMConstants.PROP_MWM_HINTS_ELEMENTS);
}
}
- private Insets wm_set_insets;
- public Insets getWMSetInsets(XAtom changedAtom) {
- if (isEmbedded()) {
- return null;
- }
-
- if (wm_set_insets != null) {
- return wm_set_insets;
- }
-
- if (changedAtom == null) {
- wm_set_insets = XWM.getInsetsFromExtents(getWindow());
- } else {
- wm_set_insets = XWM.getInsetsFromProp(getWindow(), changedAtom);
- }
-
- insLog.log(Level.FINER, "FRAME_EXTENTS: {0}", new Object[]{wm_set_insets});
-
- if (wm_set_insets != null) {
- handleWMSetInsets(wm_set_insets);
- }
- return wm_set_insets;
- }
-
- protected void handleWMSetInsets(Insets newInsets) {
- wm_set_insets = (Insets)newInsets.clone();
- }
-
- public void resetWMSetInsets() {
- wm_set_insets = null;
- }
protected synchronized void updateDropTarget() {
if (dropTargetCount > 0) {
long window = getWindow();
@@ -1960,7 +1934,7 @@
new Object[] {xme, isGrabbed(), containsGlobal(xme.get_x_root(), xme.get_y_root())});
}
if (isGrabbed()) {
- boolean dragging = (xme.get_state() & (Button1Mask | Button2Mask | Button3Mask)) != 0;
+ boolean dragging = (xme.get_state() & (XConstants.Button1Mask | XConstants.Button2Mask | XConstants.Button3Mask)) != 0;
// When window is grabbed, all events are dispatched to
// it. Retarget them to the corresponding windows (notice
// that XBaseWindow.dispatchEvent does the opposite
@@ -1974,8 +1948,9 @@
// So, I do not want to implement complicated logic for better retargeting.
target = pressTarget.isVisible() ? pressTarget : this;
xme.set_window(target.getWindow());
- xme.set_x(xme.get_x_root() - target.getX());
- xme.set_y(xme.get_y_root() - target.getY());
+ Point localCoord = target.toLocal(xme.get_x_root(), xme.get_y_root());
+ xme.set_x(localCoord.x);
+ xme.set_y(localCoord.y);
}
grabLog.log(Level.FINER, " - Grab event target {0}", new Object[] {target});
if (target != null) {
@@ -2013,12 +1988,12 @@
try {
grabLog.log(Level.FINER, " - Grab event target {0} (press target {1})", new Object[] {target, pressTarget});
if (xbe.get_type() == XConstants.ButtonPress
- && xbe.get_button() == XlibWrapper.Button1)
+ && xbe.get_button() == XConstants.Button1)
{
// need to keep it to retarget mouse release
pressTarget = target;
} else if (xbe.get_type() == XConstants.ButtonRelease
- && xbe.get_button() == XlibWrapper.Button1
+ && xbe.get_button() == XConstants.Button1
&& pressTarget != target)
{
// during grab we do receive mouse release on different component (not on the source
@@ -2026,8 +2001,9 @@
// see 6390326 for more information.
target = pressTarget.isVisible() ? pressTarget : this;
xbe.set_window(target.getWindow());
- xbe.set_x(xbe.get_x_root() - target.getX());
- xbe.set_y(xbe.get_y_root() - target.getY());
+ Point localCoord = target.toLocal(xbe.get_x_root(), xbe.get_y_root());
+ xbe.set_x(localCoord.x);
+ xbe.set_y(localCoord.y);
pressTarget = this;
}
if (target != null && target != getContentXWindow() && target != this) {
--- a/jdk/src/solaris/classes/sun/awt/X11/XlibUtil.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XlibUtil.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2006-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -152,7 +152,7 @@
int status = xtc.execute(XToolkit.IgnoreBadWindowHandler);
if ((status != 0) &&
((XToolkit.saved_error == null) ||
- (XToolkit.saved_error.get_error_code() == XlibWrapper.Success)))
+ (XToolkit.saved_error.get_error_code() == XConstants.Success)))
{
translated = new Point(xtc.get_dest_x(), xtc.get_dest_y());
}
@@ -351,7 +351,7 @@
XToolkit.RESTORE_XERROR_HANDLER();
if ((status != 0) &&
((XToolkit.saved_error == null) ||
- (XToolkit.saved_error.get_error_code() == XlibWrapper.Success)))
+ (XToolkit.saved_error.get_error_code() == XConstants.Success)))
{
return wattr.get_map_state();
}
@@ -362,7 +362,7 @@
XToolkit.awtUnlock();
}
- return XlibWrapper.IsUnmapped;
+ return XConstants.IsUnmapped;
}
/**
--- a/jdk/src/solaris/classes/sun/awt/X11/XlibWrapper.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XlibWrapper.java Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2002-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,8 +29,7 @@
import java.security.PrivilegedAction;
import sun.misc.*;
-public class XlibWrapper implements XConstants, XUtilConstants, XProtocolConstants,
- XCursorFontConstants
+final public class XlibWrapper
{
static Unsafe unsafe = Unsafe.getUnsafe();
// strange constants
@@ -321,7 +320,7 @@
if (XPropertyCache.isCachingSupported() &&
XToolkit.windowToXWindow(window) != null &&
WindowPropertyGetter.isCacheableProperty(XAtom.get(atom)) &&
- mode == PropModeReplace)
+ mode == XConstants.PropModeReplace)
{
int length = (format / 8) * nelements;
XPropertyCache.storeCache(
@@ -585,25 +584,25 @@
static String hintsToString(long flags) {
StringBuffer buf = new StringBuffer();
- if ((flags & PMaxSize) != 0) {
+ if ((flags & XUtilConstants.PMaxSize) != 0) {
buf.append("PMaxSize ");
}
- if ((flags & PMinSize) != 0) {
+ if ((flags & XUtilConstants.PMinSize) != 0) {
buf.append("PMinSize ");
}
- if ((flags & USSize) != 0) {
+ if ((flags & XUtilConstants.USSize) != 0) {
buf.append("USSize ");
}
- if ((flags & USPosition) != 0) {
+ if ((flags & XUtilConstants.USPosition) != 0) {
buf.append("USPosition ");
}
- if ((flags & PPosition) != 0) {
+ if ((flags & XUtilConstants.PPosition) != 0) {
buf.append("PPosition ");
}
- if ((flags & PSize) != 0) {
+ if ((flags & XUtilConstants.PSize) != 0) {
buf.append("PSize ");
}
- if ((flags & PWinGravity) != 0) {
+ if ((flags & XUtilConstants.PWinGravity) != 0) {
buf.append("PWinGravity ");
}
return buf.toString();
--- a/jdk/src/solaris/classes/sun/awt/X11/genhash.awk Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/genhash.awk Wed May 14 07:53:12 2008 -0700
@@ -1,4 +1,4 @@
-# Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
+# Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -38,8 +38,8 @@
if( $1 != "0x0000" ) {
ndx = toupper($1);
sub(/0X/, "", ndx);
- printf(" keysym2UCSHash.put( (long)%s, (char)%s); // %s --> %s \n",
- $4, $1, $3, unic[ndx]);
+ printf(" keysym2UCSHash.put( (long)%s, (char)%s); // %s -->%s\n",
+ $4, $1, $3, (unic[ndx]=="" ? "" : " " unic[ndx]));
}
}
/tojava/ { sub(/tojava /, ""); sub(/tojava$/, ""); print}
--- a/jdk/src/solaris/classes/sun/awt/X11/keysym2ucs.h Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/keysym2ucs.h Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2005-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,7 @@
*/
tojava /*
-tojava * Copyright 2005-2007 Sun Microsystems, Inc. All Rights Reserved.
+tojava * Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved.
tojava * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
tojava *
tojava * This code is free software; you can redistribute it and/or modify it
@@ -2546,6 +2546,7 @@
tojava
tojava keysym2JavaKeycodeHash.put( Long.valueOf(XKeySymConstants.XK_Multi_key), new Keysym2JavaKeycode(java.awt.event.KeyEvent.VK_COMPOSE, java.awt.event.KeyEvent.KEY_LOCATION_STANDARD));
tojava keysym2JavaKeycodeHash.put( Long.valueOf(XKeySymConstants.XK_Mode_switch), new Keysym2JavaKeycode(java.awt.event.KeyEvent.VK_ALT_GRAPH, java.awt.event.KeyEvent.KEY_LOCATION_STANDARD));
+tojava keysym2JavaKeycodeHash.put( Long.valueOf(XKeySymConstants.XK_ISO_Level3_Shift), new Keysym2JavaKeycode(java.awt.event.KeyEvent.VK_ALT_GRAPH, java.awt.event.KeyEvent.KEY_LOCATION_STANDARD));
tojava
tojava /* Editing block */
tojava keysym2JavaKeycodeHash.put( Long.valueOf(XKeySymConstants.XK_Redo), new Keysym2JavaKeycode(java.awt.event.KeyEvent.VK_AGAIN, java.awt.event.KeyEvent.KEY_LOCATION_STANDARD));
--- a/jdk/src/solaris/classes/sun/awt/X11GraphicsConfig.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11GraphicsConfig.java Wed May 14 07:53:12 2008 -0700
@@ -421,7 +421,7 @@
{
return new SunVolatileImage(target,
target.getWidth(), target.getHeight(),
- new Long(backBuffer));
+ Long.valueOf(backBuffer));
}
/**
--- a/jdk/src/solaris/classes/sun/awt/X11GraphicsDevice.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11GraphicsDevice.java Wed May 14 07:53:12 2008 -0700
@@ -164,7 +164,7 @@
if (ret[i] == null) {
boolean doubleBuffer =
(dbeSupported &&
- doubleBufferVisuals.contains(new Integer(visNum)));
+ doubleBufferVisuals.contains(Integer.valueOf(visNum)));
ret[i] = X11GraphicsConfig.getConfig(this, visNum, depth,
getConfigColormap(i, screen),
doubleBuffer);
@@ -199,7 +199,7 @@
public static native boolean isDBESupported();
// Callback for adding a new double buffer visual into our set
private void addDoubleBufferVisual(int visNum) {
- doubleBufferVisuals.add(new Integer(visNum));
+ doubleBufferVisuals.add(Integer.valueOf(visNum));
}
// Enumerates all visuals that support double buffering
private native void getDoubleBufferVisuals(int screen);
@@ -239,7 +239,7 @@
doubleBufferVisuals = new HashSet();
getDoubleBufferVisuals(screen);
doubleBuffer =
- doubleBufferVisuals.contains(new Integer(visNum));
+ doubleBufferVisuals.contains(Integer.valueOf(visNum));
}
defaultConfig = X11GraphicsConfig.getConfig(this, visNum,
depth, getConfigColormap(0, screen),
--- a/jdk/src/solaris/classes/sun/print/UnixPrintJob.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/classes/sun/print/UnixPrintJob.java Wed May 14 07:53:12 2008 -0700
@@ -867,39 +867,38 @@
execCmd[n++] = "/usr/bin/lp";
execCmd[n++] = "-c"; // make a copy of the spool file
if ((pFlags & PRINTER) != 0) {
- execCmd[n++] = new String("-d" + printer);
+ execCmd[n++] = "-d" + printer;
}
if ((pFlags & BANNER) != 0) {
String quoteChar = "\"";
- execCmd[n++] = new String("-t " + quoteChar+banner+quoteChar);
+ execCmd[n++] = "-t " + quoteChar+banner+quoteChar;
}
if ((pFlags & COPIES) != 0) {
- execCmd[n++] = new String("-n " +
- new Integer(copies).toString());
+ execCmd[n++] = "-n " + copies;
}
if ((pFlags & NOSHEET) != 0) {
- execCmd[n++] = new String("-o nobanner");
+ execCmd[n++] = "-o nobanner";
}
if ((pFlags & OPTIONS) != 0) {
- execCmd[n++] = new String("-o " + options);
+ execCmd[n++] = "-o " + options;
}
} else {
execCmd = new String[ncomps];
execCmd[n++] = "/usr/bin/lpr";
if ((pFlags & PRINTER) != 0) {
- execCmd[n++] = new String("-P" + printer);
+ execCmd[n++] = "-P" + printer;
}
if ((pFlags & BANNER) != 0) {
- execCmd[n++] = new String("-J " + banner);
+ execCmd[n++] = "-J " + banner;
}
if ((pFlags & COPIES) != 0) {
- execCmd[n++] = new String("-#" + new Integer(copies).toString());
+ execCmd[n++] = "-#" + copies;
}
if ((pFlags & NOSHEET) != 0) {
- execCmd[n++] = new String("-h");
+ execCmd[n++] = "-h";
}
if ((pFlags & OPTIONS) != 0) {
- execCmd[n++] = new String("-o" + options);
+ execCmd[n++] = "-o" + options;
}
}
execCmd[n++] = spoolFile;
--- a/jdk/src/solaris/native/sun/awt/MouseInfo.c Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/native/sun/awt/MouseInfo.c Wed May 14 07:53:12 2008 -0700
@@ -54,7 +54,7 @@
int i;
int32_t xr, yr, xw, yw;
uint32_t keys;
- BOOL pointerFound;
+ Bool pointerFound;
AWT_LOCK();
if (pointClass == NULL) {
@@ -102,7 +102,7 @@
int32_t xr = 0, yr = 0, xw = 0, yw = 0;
uint32_t keys = 0;
uint32_t nchildren = 0;
- BOOL pointerFound = 0;
+ Bool pointerFound = 0;
struct FrameData *wdata = NULL;
jobject winPeer = NULL;
--- a/jdk/src/solaris/native/sun/awt/splashscreen/splashscreen_sys.c Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/native/sun/awt/splashscreen/splashscreen_sys.c Wed May 14 07:53:12 2008 -0700
@@ -436,6 +436,7 @@
break;
}
case PseudoColor: {
+ int availableColors;
int numColors;
int numComponents[3];
unsigned long colorIndex[SPLASH_COLOR_MAP_SIZE];
@@ -444,9 +445,20 @@
int depth = XDefaultDepthOfScreen(splash->screen);
int scale = 65535 / MAX_COLOR_VALUE;
- numColors = GetNumAvailableColors(splash->display, splash->screen,
+ availableColors = GetNumAvailableColors(splash->display, splash->screen,
splash->visual->map_entries);
- numColors = quantizeColors(numColors, numComponents);
+ numColors = quantizeColors(availableColors, numComponents);
+ if (numColors > availableColors) {
+ // Could not allocate the color cells. Most probably
+ // the pool got exhausted. Disable the splash screen.
+ XCloseDisplay(splash->display);
+ splash->isVisible = -1;
+ splash->display = NULL;
+ splash->screen = NULL;
+ splash->visual = NULL;
+ fprintf(stderr, "Warning: unable to initialize the splashscreen. Not enough available color cells.\n");
+ return;
+ }
splash->cmap = AllocColors(splash->display, splash->screen,
numColors, colorIndex);
for (i = 0; i < numColors; i++) {
--- a/jdk/src/solaris/native/sun/xawt/XWindow.c Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/native/sun/xawt/XWindow.c Wed May 14 07:53:12 2008 -0700
@@ -1234,7 +1234,7 @@
}
}
-JNIEXPORT int JNICALL
+JNIEXPORT jint JNICALL
Java_sun_awt_X11_XWindow_getKeySymForAWTKeyCode(JNIEnv* env, jclass clazz, jint keycode) {
return awt_getX11KeySym(keycode);
}
--- a/jdk/src/solaris/native/sun/xawt/XlibWrapper.c Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/solaris/native/sun/xawt/XlibWrapper.c Wed May 14 07:53:12 2008 -0700
@@ -359,7 +359,7 @@
XDestroyWindow( (Display *)jlong_to_ptr(display),(Window) window);
}
-JNIEXPORT int JNICALL Java_sun_awt_X11_XlibWrapper_XGrabPointer
+JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XGrabPointer
(JNIEnv *env, jclass clazz, jlong display, jlong window,
jint owner_events, jint event_mask, jint pointer_mode,
jint keyboard_mode, jlong confine_to, jlong cursor, jlong time)
@@ -377,7 +377,7 @@
XUngrabPointer( (Display *)jlong_to_ptr(display), (Time) time);
}
-JNIEXPORT int JNICALL Java_sun_awt_X11_XlibWrapper_XGrabKeyboard
+JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XGrabKeyboard
(JNIEnv *env, jclass clazz, jlong display, jlong window,
jint owner_events, jint pointer_mode,
jint keyboard_mode, jlong time)
@@ -621,7 +621,7 @@
}
-JNIEXPORT int JNICALL Java_sun_awt_X11_XlibWrapper_XTranslateCoordinates
+JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XTranslateCoordinates
(JNIEnv *env, jclass clazz, jlong display, jlong src_w, jlong dest_w,
jlong src_x, jlong src_y, jlong dest_x_return, jlong dest_y_return,
jlong child_return)
@@ -634,7 +634,7 @@
(Window *) jlong_to_ptr(child_return));
}
-JNIEXPORT int JNICALL Java_sun_awt_X11_XlibWrapper_XEventsQueued
+JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XEventsQueued
(JNIEnv *env, jclass clazz, jlong display, jint mode) {
AWT_CHECK_HAVE_LOCK();
--- a/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java Wed May 14 07:53:12 2008 -0700
@@ -568,7 +568,7 @@
byte[] headerBytes = null, trailerBytes = null;
try {
- headerBytes = new String(header).getBytes(ENCODING);
+ headerBytes = header.toString().getBytes(ENCODING);
trailerBytes = htmlSuffix.getBytes(ENCODING);
} catch (UnsupportedEncodingException cannotHappen) {
}
--- a/jdk/src/windows/classes/sun/awt/windows/WInputMethod.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WInputMethod.java Wed May 14 07:53:12 2008 -0700
@@ -488,7 +488,7 @@
attrStr.addAttribute(Attribute.INPUT_METHOD_SEGMENT,
new Annotation(null), 0, text.length());
attrStr.addAttribute(Attribute.READING,
- new Annotation(new String("")), 0, text.length());
+ new Annotation(""), 0, text.length());
}
// set Hilight Information
--- a/jdk/src/windows/classes/sun/awt/windows/WPanelPeer.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WPanelPeer.java Wed May 14 07:53:12 2008 -0700
@@ -30,9 +30,11 @@
import java.util.Vector;
import sun.awt.SunGraphicsCallback;
+import java.util.logging.*;
class WPanelPeer extends WCanvasPeer implements PanelPeer {
+ private static final Logger log = Logger.getLogger("sun.awt.windows.WPanelPeer");
// ComponentPeer overrides
public void paint(Graphics g) {
@@ -131,8 +133,16 @@
for (int i = 0; i < cont.getComponentCount(); i++) {
Component comp = cont.getComponent(i);
if (!comp.isLightweight()) {
- if (comp.getPeer() != null) {
- peers.add(comp.getPeer());
+ ComponentPeer peer = comp.getPeer();
+ if (peer != null && (peer instanceof WComponentPeer))
+ {
+ peers.add(peer);
+ } else {
+ if (log.isLoggable(Level.FINE)) {
+ log.log(Level.FINE,
+ "peer of a {0} is null or not a WComponentPeer: {1}.",
+ new Object[]{comp, peer});
+ }
}
}
if (comp.isLightweight() && comp instanceof Container) {
--- a/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java Wed May 14 07:53:12 2008 -0700
@@ -123,7 +123,7 @@
public void setTitle(String title) {
// allow a null title to pass as an empty string.
if (title == null) {
- title = new String("");
+ title = "";
}
_setTitle(title);
}
--- a/jdk/src/windows/classes/sun/print/Win32PrintService.java Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/windows/classes/sun/print/Win32PrintService.java Wed May 14 07:53:12 2008 -0700
@@ -348,7 +348,7 @@
idList = new ArrayList();
for (int i=0; i < media.length; i++) {
- idList.add(new Integer(media[i]));
+ idList.add(Integer.valueOf(media[i]));
}
mediaSizes = getMediaSizes(idList, media);
@@ -517,7 +517,7 @@
if ((wid <= 0) || (ht <= 0)) {
//Remove corresponding ID from list
if (nMedia == media.length) {
- Integer remObj = new Integer(media[i]);
+ Integer remObj = Integer.valueOf(media[i]);
idList.remove(idList.indexOf(remObj));
}
continue;
@@ -539,7 +539,7 @@
msList.add(ms);
} catch(IllegalArgumentException e) {
if (nMedia == media.length) {
- Integer remObj = new Integer(media[i]);
+ Integer remObj = Integer.valueOf(media[i]);
idList.remove(idList.indexOf(remObj));
}
}
@@ -984,7 +984,7 @@
// cannot be null but to be safe, add a check
if ((idList != null) && (mediaSizes != null) &&
(idList.size() == mediaSizes.length)) {
- Integer defIdObj = new Integer(defPaper);
+ Integer defIdObj = Integer.valueOf(defPaper);
int index = idList.indexOf(defIdObj);
if (index>=0 && index<mediaSizes.length) {
return mediaSizes[index].getMediaSizeName();
--- a/jdk/src/windows/native/sun/windows/awt_Component.cpp Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/windows/native/sun/windows/awt_Component.cpp Wed May 14 07:53:12 2008 -0700
@@ -234,6 +234,7 @@
AwtComponent::AwtComponent()
{
+ m_mouseButtonClickAllowed = 0;
m_callbacksEnabled = FALSE;
m_hwnd = NULL;
@@ -246,7 +247,6 @@
m_nextControlID = 1;
m_childList = NULL;
m_myControlID = 0;
- m_mouseDragState = 0;
m_hdwp = NULL;
m_validationNestCount = 0;
@@ -903,8 +903,27 @@
void AwtComponent::Hide()
{
+ JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
+ jobject peer = GetPeer(env);
+ BOOL oldValue = sm_suppressFocusAndActivation;
m_visible = false;
+
+ // On disposal the focus owner actually loses focus at the moment of hiding.
+ // So, focus change suppression (if requested) should be made here.
+ if (GetHWnd() == sm_focusOwner &&
+ !JNU_CallMethodByName(env, NULL, peer, "isAutoFocusTransferOnDisposal", "()Z").z)
+ {
+ sm_suppressFocusAndActivation = TRUE;
+ // The native system may autotransfer focus on hiding to the parent
+ // of the component. Nevertheless this focus change won't be posted
+ // to the Java level, we're better to avoid this. Anyway, after
+ // the disposal focus should be requested to the right component.
+ ::SetFocus(NULL);
+ sm_focusOwner = NULL;
+ }
::ShowWindow(GetHWnd(), SW_HIDE);
+
+ sm_suppressFocusAndActivation = oldValue;
}
BOOL
@@ -2495,9 +2514,11 @@
lastClickX = x;
lastClickY = y;
}
+ /*
+ *Set appropriate bit of the mask on WM_MOUSE_DOWN message.
+ */
+ m_mouseButtonClickAllowed |= GetButtonMK(button);
lastTime = now;
- // it's needed only if WM_LBUTTONUP doesn't come for some reason
- m_mouseDragState &= ~GetButtonMK(button);
MSG msg;
InitMessage(&msg, lastMessage, flags, MAKELPARAM(x, y), x, y);
@@ -2535,14 +2556,17 @@
(GetButton(button) == java_awt_event_MouseEvent_BUTTON3 ?
TRUE : FALSE), GetButton(button), &msg);
/*
- * If no movement, then report a click following the button release
+ * If no movement, then report a click following the button release.
+ * When WM_MOUSEUP comes to a window without previous WM_MOUSEDOWN,
+ * spurous MOUSE_CLICK is about to happen. See 6430553.
*/
- if (!(m_mouseDragState & GetButtonMK(button))) { // No up-button in the drag-state
+ if ((m_mouseButtonClickAllowed & GetButtonMK(button)) != 0) { //CLICK allowed
SendMouseEvent(java_awt_event_MouseEvent_MOUSE_CLICKED,
TimeHelper::getMessageTimeUTC(), x, y, GetJavaModifiers(),
clickCount, JNI_FALSE, GetButton(button));
}
- m_mouseDragState &= ~GetButtonMK(button); // Exclude the up-button from the drag-state
+ // Exclude button from allowed to generate CLICK messages
+ m_mouseButtonClickAllowed &= ~GetButtonMK(button);
if ((flags & ALL_MK_BUTTONS) == 0) {
// only update if all buttons have been released
@@ -2586,7 +2610,8 @@
SendMouseEvent(java_awt_event_MouseEvent_MOUSE_DRAGGED, TimeHelper::getMessageTimeUTC(), x, y,
GetJavaModifiers(), 0, JNI_FALSE,
java_awt_event_MouseEvent_NOBUTTON, &msg);
- m_mouseDragState = flags;
+ //dragging means no more CLICKs until next WM_MOUSE_DOWN/WM_MOUSE_UP message sequence
+ m_mouseButtonClickAllowed = 0;
} else {
MSG msg;
InitMessage(&msg, lastMessage, flags, MAKELPARAM(x, y), x, y);
@@ -5740,6 +5765,10 @@
env->DeleteGlobalRef(event);
delete nhes;
return;
+
+ } else if (id == java_awt_event_KeyEvent_KEY_PRESSED) {
+ // Fix for 6637607: reset consuming
+ keyDownConsumed = FALSE;
}
/* Consume a KEY_TYPED event if a KEY_PRESSED had been, to support
--- a/jdk/src/windows/native/sun/windows/awt_Component.h Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/windows/native/sun/windows/awt_Component.h Wed May 14 07:53:12 2008 -0700
@@ -707,13 +707,6 @@
BOOL m_backgroundColorSet;
BOOL m_visible; /* copy of Component.visible */
- /*
- * Keeps all buttons which were pressed at the time of the last mouse
- * drag until all buttons will be released, contains state as bit masks
- * MK_LBUTTON, MK_MBUTTON, MK_RBUTTON
- */
- UINT m_mouseDragState;
-
static BOOL sm_suppressFocusAndActivation;
static HWND sm_realFocusOpposite;
@@ -725,6 +718,15 @@
static UINT sm_95WheelSupport;
private:
+ /* A bitmask keeps the button's numbers as MK_LBUTTON, MK_MBUTTON, MK_RBUTTON
+ * which are allowed to
+ * generate the CLICK event after the RELEASE has happened.
+ * There are conditions that must be true for that sending CLICK event:
+ * 1) button was initially PRESSED
+ * 2) no movement or drag has happened until RELEASE
+ */
+ UINT m_mouseButtonClickAllowed;
+
BOOL m_bSubclassed;
COLORREF m_colorForeground;
--- a/jdk/src/windows/native/sun/windows/awt_Dialog.cpp Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/windows/native/sun/windows/awt_Dialog.cpp Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -428,8 +428,12 @@
{
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
- jlongArray windows = (jlongArray)(env->CallStaticObjectMethod(AwtWindow::wwindowPeerCls,
- AwtWindow::getActiveWindowsMID));
+ jclass wwindowPeerCls = env->FindClass("sun/awt/windows/WWindowPeer");
+ jmethodID getActiveWindowsMID = env->GetStaticMethodID(wwindowPeerCls,
+ "getActiveWindowHandles", "()[J");
+ DASSERT(getActiveWindowsMID != NULL);
+ jlongArray windows = (jlongArray)(env->CallStaticObjectMethod(wwindowPeerCls,
+ getActiveWindowsMID));
if (windows == NULL) {
return;
}
--- a/jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp Wed May 14 07:53:12 2008 -0700
@@ -84,7 +84,7 @@
if (sm_instCount++ == 0 && AwtTrayIcon::sm_msgWindow == NULL) {
sm_msgWindow = AwtTrayIcon::CreateMessageWindow();
}
- m_mouseDragState = 0;
+ m_mouseButtonClickAllowed = 0;
}
AwtTrayIcon::~AwtTrayIcon() {
@@ -349,7 +349,7 @@
}
lastTime = now;
// it's needed only if WM_LBUTTONUP doesn't come for some reason
- m_mouseDragState &= ~AwtComponent::GetButtonMK(button);
+ m_mouseButtonClickAllowed |= AwtComponent::GetButtonMK(button);
MSG msg;
AwtComponent::InitMessage(&msg, lastMessage, flags, MAKELPARAM(x, y), x, y);
@@ -371,12 +371,12 @@
(AwtComponent::GetButton(button) == java_awt_event_MouseEvent_BUTTON3 ?
TRUE : FALSE), AwtComponent::GetButton(button), &msg);
- if (!(m_mouseDragState & AwtComponent::GetButtonMK(button))) { // No up-button in the drag-state
+ if ((m_mouseButtonClickAllowed & AwtComponent::GetButtonMK(button)) != 1) { // No up-button in the drag-state
SendMouseEvent(java_awt_event_MouseEvent_MOUSE_CLICKED,
TimeHelper::windowsToUTC(::GetTickCount()), x, y, AwtComponent::GetJavaModifiers(),
clickCount, JNI_FALSE, AwtComponent::GetButton(button));
}
- m_mouseDragState &= ~AwtComponent::GetButtonMK(button); // Exclude the up-button from the drag-state
+ m_mouseButtonClickAllowed &= ~AwtComponent::GetButtonMK(button); // Exclude the up-button from the drag-state
return mrConsume;
}
@@ -398,7 +398,7 @@
lastY = y;
AwtComponent::InitMessage(&msg, lastMessage, flags, MAKELPARAM(x, y), x, y);
if ((flags & AwtComponent::ALL_MK_BUTTONS) != 0) {
- m_mouseDragState = flags;
+ m_mouseButtonClickAllowed = 0;
} else {
SendMouseEvent(java_awt_event_MouseEvent_MOUSE_MOVED, TimeHelper::windowsToUTC(::GetTickCount()), x, y,
AwtComponent::GetJavaModifiers(), 0, JNI_FALSE,
--- a/jdk/src/windows/native/sun/windows/awt_TrayIcon.h Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/windows/native/sun/windows/awt_TrayIcon.h Wed May 14 07:53:12 2008 -0700
@@ -176,12 +176,14 @@
private:
AWT_NOTIFYICONDATA m_nid;
- /*
- * Keeps all buttons which were pressed at the time of the last mouse
- * drag until all buttons will be released, contains state as bit masks
- * MK_LBUTTON, MK_MBUTTON, MK_RBUTTON
- */
- UINT m_mouseDragState;
+ /* A bitmask keeps the button's numbers as MK_LBUTTON, MK_MBUTTON, MK_RBUTTON
+ * which are allowed to
+ * generate the CLICK event after the RELEASE has happened.
+ * There are conditions that must be true for that sending CLICK event:
+ * 1) button was initially PRESSED
+ * 2) no movement or drag has happened until RELEASE
+ */
+ UINT m_mouseButtonClickAllowed;
class TrayIconListItem {
public:
--- a/jdk/src/windows/native/sun/windows/awt_Window.cpp Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/windows/native/sun/windows/awt_Window.cpp Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -122,9 +122,6 @@
jfieldID AwtWindow::locationByPlatformID;
jfieldID AwtWindow::autoRequestFocusID;
-jclass AwtWindow::wwindowPeerCls;
-jmethodID AwtWindow::getActiveWindowsMID;
-
jfieldID AwtWindow::sysXID;
jfieldID AwtWindow::sysYID;
jfieldID AwtWindow::sysWID;
@@ -2159,11 +2156,6 @@
{
TRY;
- AwtWindow::wwindowPeerCls = cls;
- AwtWindow::getActiveWindowsMID =
- env->GetStaticMethodID(cls, "getActiveWindowHandles", "()[J");
- DASSERT(AwtWindow::getActiveWindowsMID != NULL);
-
AwtWindow::sysXID = env->GetFieldID(cls, "sysX", "I");
AwtWindow::sysYID = env->GetFieldID(cls, "sysY", "I");
AwtWindow::sysWID = env->GetFieldID(cls, "sysW", "I");
--- a/jdk/src/windows/native/sun/windows/awt_Window.h Wed May 07 23:20:32 2008 +0400
+++ b/jdk/src/windows/native/sun/windows/awt_Window.h Wed May 14 07:53:12 2008 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -57,11 +57,6 @@
static jfieldID screenID; /* screen number passed over from WindowPeer */
static jfieldID autoRequestFocusID;
- /* WWindowPeer class */
- static jclass wwindowPeerCls;
- /* long[] getActiveWindowHandles() method in WWindowPeer */
- static jmethodID getActiveWindowsMID;
-
// The coordinates at the peer.
static jfieldID sysXID;
static jfieldID sysYID;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Component/isLightweightCrash/IsLightweightCrash.java Wed May 14 07:53:12 2008 -0700
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ @test
+ @bug 6255653
+ @summary REGRESSION: Override isLightweight() causes access violation in awt.dll
+ @author Andrei Dmitriev: area=awt-component
+ @run main IsLightweightCrash
+*/
+
+/*
+ * The test may not crash for several times so iteratively continue up to some limit.
+ */
+
+import java.awt.*;
+
+public class IsLightweightCrash {
+ public static int ITERATIONS = 20;
+
+ public static void main(String []s)
+ {
+ for (int i = 0; i < ITERATIONS; i++){
+ showFrame(i);
+ }
+ }
+
+ private static void showFrame(int i){
+ System.out.println("iteration = "+i);
+ Frame f = new Frame();
+ f.add(new AHeavyweightComponent());
+ f.setVisible(true);
+ f.setVisible(false);
+ }
+}
+
+class AHeavyweightComponent extends Component {
+ public boolean isLightweight() { return false; }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Component/isLightweightCrash/StubPeerCrash.java Wed May 14 07:53:12 2008 -0700
@@ -0,0 +1,188 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ @test
+ @bug 6255653
+ @summary REGRESSION: Override isLightweight() causes access violation in awt.dll
+ @author Andrei Dmitriev: area=awt-component
+ @run main StubPeerCrash
+*/
+
+/*
+ * The test may not crash for several times so iteratively continue up to some limit.
+ */
+
+import java.awt.*;
+import java.awt.peer.*;
+import java.awt.event.PaintEvent;
+import java.awt.image.ImageProducer;
+import java.awt.image.ImageObserver;
+import java.awt.image.ColorModel;
+import java.awt.image.VolatileImage;
+import java.awt.GraphicsConfiguration;
+import sun.awt.CausedFocusEvent;
+import sun.java2d.pipe.Region;
+
+public class StubPeerCrash {
+ public static int ITERATIONS = 20;
+
+ public static void main(String []s)
+ {
+ for (int i = 0; i < ITERATIONS; i++){
+ showFrame(i);
+ }
+ }
+
+ private static void showFrame(int i){
+ System.out.println("iteration = "+i);
+ Frame f = new Frame();
+ f.add(new AHeavyweightComponent());
+ f.setVisible(true);
+ f.setVisible(false);
+ }
+}
+
+class AHeavyweightComponent extends Component {
+ private ComponentPeer peer = new StubComponentPeer();
+
+ public AHeavyweightComponent(){
+ }
+
+ public boolean isLightweight() {
+ return false;
+ }
+
+ public ComponentPeer getPeer(){
+ return peer;
+ }
+}
+
+class StubComponentPeer implements ComponentPeer {
+ public boolean isObscured(){return true;};
+ public boolean canDetermineObscurity(){return true;};
+ public void setVisible(boolean b){};
+ public void setEnabled(boolean b){};
+ public void paint(Graphics g){};
+ public void repaint(long tm, int x, int y, int width, int height){};
+ public void print(Graphics g){};
+ public void setBounds(int x, int y, int width, int height, int op){};
+ public void handleEvent(AWTEvent e){};
+ public void coalescePaintEvent(PaintEvent e){};
+ public Point getLocationOnScreen(){return null;};
+ public Dimension getPreferredSize(){return null;};
+ public Dimension getMinimumSize(){return null;};
+ public ColorModel getColorModel(){return null;};
+ public Toolkit getToolkit(){return null;};
+ public Graphics getGraphics(){return null;};
+ public FontMetrics getFontMetrics(Font font){return null;};
+ public void dispose(){};
+ public void setForeground(Color c){};
+ public void setBackground(Color c){};
+ public void setFont(Font f){};
+ public void updateCursorImmediately(){};
+ public boolean requestFocus(Component lightweightChild,
+ boolean temporary,
+ boolean focusedWindowChangeAllowed,
+ long time, CausedFocusEvent.Cause cause){
+ return true;
+ };
+ public boolean isFocusable(){return true;};
+
+ public Image createImage(ImageProducer producer){return null;};
+ public Image createImage(int width, int height){return null;};
+ public VolatileImage createVolatileImage(int width, int height){return null;};
+ public boolean prepareImage(Image img, int w, int h, ImageObserver o){return true;};
+ public int checkImage(Image img, int w, int h, ImageObserver o){return 0;};
+ public GraphicsConfiguration getGraphicsConfiguration(){return null;};
+ public boolean handlesWheelScrolling(){return true;};
+ public void createBuffers(int numBuffers, BufferCapabilities caps) throws AWTException{};
+ public Image getBackBuffer(){return null;};
+ public void flip(BufferCapabilities.FlipContents flipAction){};
+ public void destroyBuffers(){};
+
+ /**
+ * Reparents this peer to the new parent referenced by <code>newContainer</code> peer
+ * Implementation depends on toolkit and container.
+ * @param newContainer peer of the new parent container
+ * @since 1.5
+ */
+ public void reparent(ContainerPeer newContainer){};
+ /**
+ * Returns whether this peer supports reparenting to another parent withour destroying the peer
+ * @return true if appropriate reparent is supported, false otherwise
+ * @since 1.5
+ */
+ public boolean isReparentSupported(){return true;};
+
+ /**
+ * Used by lightweight implementations to tell a ComponentPeer to layout
+ * its sub-elements. For instance, a lightweight Checkbox needs to layout
+ * the box, as well as the text label.
+ */
+ public void layout(){};
+
+
+ public Rectangle getBounds(){return null;};
+
+ /**
+ * Applies the shape to the native component window.
+ * @since 1.7
+ */
+ public void applyShape(Region shape){};
+
+ /**
+ * DEPRECATED: Replaced by getPreferredSize().
+ */
+ public Dimension preferredSize(){return null;};
+
+ /**
+ * DEPRECATED: Replaced by getMinimumSize().
+ */
+ public Dimension minimumSize(){return null;};
+
+ /**
+ * DEPRECATED: Replaced by setVisible(boolean).
+ */
+ public void show(){};
+
+ /**
+ * DEPRECATED: Replaced by setVisible(boolean).
+ */
+ public void hide(){};
+
+ /**
+ * DEPRECATED: Replaced by setEnabled(boolean).
+ */
+ public void enable(){};
+
+ /**
+ * DEPRECATED: Replaced by setEnabled(boolean).
+ */
+ public void disable(){};
+
+ /**
+ * DEPRECATED: Replaced by setBounds(int, int, int, int).
+ */
+ public void reshape(int x, int y, int width, int height){};
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Dialog/CrashXCheckJni/CrashXCheckJni.java Wed May 14 07:53:12 2008 -0700
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ @test
+ @bug 6610244
+ @library ../../regtesthelpers
+ @build Util Sysout AbstractTest
+ @summary modal dialog closes with fatal error if -Xcheck:jni is set
+ @author Andrei Dmitriev : area=awt.dialog
+ @run main/othervm -Xcheck:jni CrashXCheckJni
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.Timer;
+import java.util.TimerTask;
+import test.java.awt.regtesthelpers.Util;
+import test.java.awt.regtesthelpers.AbstractTest;
+import test.java.awt.regtesthelpers.Sysout;
+
+public class CrashXCheckJni {
+
+ public static void main(String []s)
+ {
+ final Dialog fd = new Dialog(new Frame(), true);
+ Timer t = new Timer();
+ t.schedule(new TimerTask() {
+
+ public void run() {
+ System.out.println("RUNNING TASK");
+ fd.setVisible(false);
+ fd.dispose();
+ System.out.println("FINISHING TASK");
+ }
+ }, 3000L);
+
+ fd.setVisible(true);
+ t.cancel();
+ Util.waitForIdle(null);
+
+ AbstractTest.pass();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/ActualFocusedWindowTest/ActualFocusedWindowBlockingTest.java Wed May 14 07:53:12 2008 -0700
@@ -0,0 +1,165 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ @test
+ @bug 6314575
+ @summary Tests that previosly focused owned window doesn't steal focus when an owner's component requests focus.
+ @author Anton.Tarasov: area=awt.focus
+ @library ../../regtesthelpers
+ @build Util
+ @run main ActualFocusedWindowBlockingTest
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+import java.applet.Applet;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.lang.reflect.InvocationTargetException;
+import sun.awt.SunToolkit;
+import test.java.awt.regtesthelpers.Util;
+
+public class ActualFocusedWindowBlockingTest extends Applet {
+ Robot robot = Util.createRobot();
+ Frame owner = new Frame("Owner Frame");
+ Window win = new Window(owner);
+ Frame frame = new Frame("Auxiliary Frame");
+ Button fButton = new Button("frame button") {public String toString() {return "Frame_Button";}};
+ Button wButton = new Button("window button") {public String toString() {return "Window_Button";}};
+ Button aButton = new Button("auxiliary button") {public String toString() {return "Auxiliary_Button";}};
+
+ public static void main(String[] args) {
+ ActualFocusedWindowBlockingTest app = new ActualFocusedWindowBlockingTest();
+ app.init();
+ app.start();
+ }
+
+ public void init() {
+ Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
+ public void eventDispatched(AWTEvent e) {
+ System.out.println("--> " + e);
+ }
+ }, FocusEvent.FOCUS_EVENT_MASK | WindowEvent.WINDOW_FOCUS_EVENT_MASK);
+
+ owner.add(fButton);
+ win.add(wButton);
+ frame.add(aButton);
+
+ owner.setName("OWNER_FRAME");
+ win.setName("OWNED_WINDOW");
+ frame.setName("AUX_FRAME");
+
+ tuneAndShowWindows(new Window[] {owner, win, frame});
+ }
+
+ public void start() {
+ if ("sun.awt.motif.MToolkit".equals(Toolkit.getDefaultToolkit().getClass().getName())) {
+ System.out.println("No testing on Motif. Test passed.");
+ return;
+ }
+
+ System.out.println("\nTest started:\n");
+
+ // Test 1.
+
+ clickOnCheckFocus(wButton);
+ clickOnCheckFocus(aButton);
+
+ Util.clickOnComp(fButton, robot);
+ if (!testFocused(fButton)) {
+ throw new TestFailedException("The owner's component [" + fButton + "] couldn't be focused by click");
+ }
+
+ // Test 2.
+
+ clickOnCheckFocus(wButton);
+ clickOnCheckFocus(aButton);
+
+ fButton.requestFocus();
+ Util.waitForIdle(robot);
+ if (!testFocused(fButton)) {
+ throw new TestFailedException("The owner's component [" + fButton + "] couldn't be focused by request");
+ }
+
+ // Test 3.
+
+ clickOnCheckFocus(wButton);
+ clickOnCheckFocus(aButton);
+ clickOnCheckFocus(fButton);
+ clickOnCheckFocus(aButton);
+
+ Util.clickOnTitle(owner, robot);
+ if (!testFocused(fButton)) {
+ throw new TestFailedException("The owner's component [" + fButton + "] couldn't be focused as the most recent focus owner");
+ }
+
+ System.out.println("Test passed.");
+ }
+
+ void tuneAndShowWindows(Window[] arr) {
+ int y = 0;
+ for (Window w: arr) {
+ w.setLayout(new FlowLayout());
+ w.setBounds(100, y, 400, 150);
+ w.setBackground(Color.blue);
+ w.setVisible(true);
+ y += 200;
+ Util.waitForIdle(robot);
+ }
+ }
+
+ void clickOnCheckFocus(Component c) {
+ if (c instanceof Frame) {
+ Util.clickOnTitle((Frame)c, robot);
+ } else {
+ Util.clickOnComp(c, robot);
+ }
+ if (!testFocused(c)) {
+ throw new TestErrorException(c + "couldn't get focus by click.");
+ }
+ }
+
+ boolean testFocused(Component c) {
+ for (int i=0; i<10; i++) {
+ if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() == c) {
+ return true;
+ }
+ Util.waitForIdle(robot);
+ }
+ return false;
+ }
+
+ // Thrown when the behavior being verified is found wrong.
+ class TestFailedException extends RuntimeException {
+ TestFailedException(String msg) {
+ super("Test failed: " + msg);
+ }
+ }
+
+ // Thrown when an error not related to the behavior being verified is encountered.
+ class TestErrorException extends RuntimeException {
+ TestErrorException(String msg) {
+ super("Unexpected error: " + msg);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/ActualFocusedWindowTest/ActualFocusedWindowRetaining.java Wed May 14 07:53:12 2008 -0700
@@ -0,0 +1,211 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ @test
+ @bug 4823903
+ @summary Tests actual focused window retaining.
+ @author Anton.Tarasov: area=awt.focus
+ @library ../../regtesthelpers
+ @build Util
+ @run main ActualFocusedWindowRetaining
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+import java.lang.reflect.*;
+import java.applet.*;
+import test.java.awt.regtesthelpers.Util;
+
+public class ActualFocusedWindowRetaining extends Applet {
+ public static Frame frame = new Frame("Other Frame");
+ public static Frame owner = new Frame("Test Frame");
+ public static Button otherButton1 = new Button("Other Button 1");
+ public static Button otherButton2 = new Button("Other Button 2");
+ public static Button otherButton3 = new Button("Other Button 3");
+ public static Button testButton1 = new Button("Test Button 1");
+ public static Button testButton2 = new Button("Test Button 2");
+ public static Button testButton3 = new Button("Test Button 3");
+ public static Window window1 = new TestWindow(owner, otherButton2, testButton2, 800, 200);
+ public static Window window2 = new TestWindow(owner, otherButton3, testButton3, 800, 300);
+ public static int step;
+ public static Robot robot = Util.createRobot();
+
+ public static void main(String[] args) {
+ ActualFocusedWindowRetaining a = new ActualFocusedWindowRetaining();
+ a.init();
+ a.start();
+ }
+
+ public void start () {
+ Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
+ public void eventDispatched(AWTEvent e) {
+ Object src = e.getSource();
+ Class cls = src.getClass();
+
+ if (cls == TestWindow.class) {
+ System.out.println(e.paramString() + " on <" + (src == window1 ? "Window 1" : "Window 2") + ">");
+ } else if (cls == Frame.class) {
+ System.out.println(e.paramString() + " on <" + ((Frame)src).getTitle() + ">");
+ } else if (cls == Button.class) {
+ System.out.println(e.paramString() + " on <" + ((Button)src).getLabel() + ">");
+ } else {
+ System.out.println(e.paramString() + " on <Non-testing component>");
+ }
+ }
+ }, AWTEvent.WINDOW_EVENT_MASK | AWTEvent.WINDOW_FOCUS_EVENT_MASK | AWTEvent.FOCUS_EVENT_MASK);
+
+ setSize (500, 200);
+ setVisible(true);
+ validate();
+
+ frame.setSize(new Dimension(400, 100));
+ frame.setLocation(800, 400);
+ frame.setVisible(true);
+ frame.toFront();
+
+ owner.setLayout(new FlowLayout());
+ owner.add(testButton1);
+ owner.add(otherButton1);
+ owner.pack();
+ owner.setLocation(800, 100);
+ owner.setSize(new Dimension(400, 100));
+ owner.setVisible(true);
+ owner.toFront();
+ Util.waitTillShown(owner);
+
+ window1.setVisible(true);
+ window2.setVisible(true);
+ window1.toFront();
+ window2.toFront();
+ // Wait longer...
+ Util.waitTillShown(window1);
+ Util.waitTillShown(window2);
+
+ test();
+
+ frame.dispose();
+ owner.dispose();
+ }
+
+ public void test() {
+ Button[] butArr = new Button[] {testButton3, testButton2, testButton1};
+ Window[] winArr = new Window[] {window2, window1, owner};
+
+ step = 1;
+ for (int i = 0; i < 3; i++) {
+ clickInSeriesCheckFocus(null, butArr[i], frame);
+ clickOwnerCheckFocus(winArr[i], butArr[i]);
+ step++;
+ }
+
+ step = 4;
+ clickInSeriesCheckFocus(testButton3, testButton1, frame);
+ clickOwnerCheckFocus(owner, testButton1);
+
+ step = 5;
+ clickInSeriesCheckFocus(testButton3, testButton2, frame);
+ clickOwnerCheckFocus(window1, testButton2);
+
+ step = 6;
+ clickInSeriesCheckFocus(testButton1, testButton2, frame);
+ clickOwnerCheckFocus(window1, testButton2);
+
+ step = 7;
+ clickInSeriesCheckFocus(testButton1, testButton2, frame);
+ window1.setVisible(false);
+ Util.waitForIdle(robot);
+ clickOwnerCheckFocus(owner, testButton1);
+
+ step = 8;
+ window1.setVisible(true);
+ Util.waitTillShown(window1);
+ clickInSeriesCheckFocus(null, testButton2, frame);
+ clickOwnerCheckFocus(window1, testButton2);
+ }
+
+ boolean checkFocusOwner(Component comp) {
+ return (comp == KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner());
+ }
+
+ boolean checkFocusedWindow(Window win) {
+ return (win == KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow());
+ }
+
+ void clickOwnerCheckFocus(Window focusedWindow, Component focusedComp) {
+ Util.clickOnTitle(owner, robot);
+ robot.delay(500);
+
+ if (!checkFocusedWindow(focusedWindow)) {
+ stopTest("Test failed: actual focused window didn't get a focus");
+ }
+ if (!checkFocusOwner(focusedComp)) {
+ stopTest("Test failed: actual focus owner didn't get a focus");
+ }
+ }
+
+ void clickInSeriesCheckFocus(Component comp1, Component comp2, Frame frame) {
+ if (comp1 != null) {
+ clickOnCheckFocusOwner(comp1);
+ }
+ if (comp2 != null) {
+ clickOnCheckFocusOwner(comp2);
+ }
+ clickOnCheckFocusedWindow(frame);
+ }
+
+ void clickOnCheckFocusOwner(Component c) {
+ Util.clickOnComp(c, robot);
+ robot.delay(500);
+
+ if (!checkFocusOwner(c)) {
+ stopTest("Error: can't bring a focus on Component by clicking on it");
+ }
+ }
+
+ void clickOnCheckFocusedWindow(Frame f) {
+ Util.clickOnTitle(f, robot);
+ robot.delay(500);
+
+ if (!checkFocusedWindow(f)) {
+ stopTest("Error: can't bring a focus on Frame by clicking on it");
+ }
+ }
+
+ void stopTest(String msg) {
+ throw new RuntimeException(new String("Step " + step + ": " + msg));
+ }
+}
+
+class TestWindow extends Window {
+ TestWindow(Frame owner, Button otherButton, Button testButton, int x, int y) {
+ super(owner);
+
+ setLayout(new FlowLayout());
+ setLocation(x, y);
+ add(testButton);
+ add(otherButton);
+ pack();
+ setBackground(Color.green);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/AppletInitialFocusTest/AppletInitialFocusTest.html Wed May 14 07:53:12 2008 -0700
@@ -0,0 +1,23 @@
+<html>
+<!--
+ @test
+ @bug 4041703 4096228 4025223 4260929
+ @summary Ensures that appletviewer sets a reasonable default focus for an Applet on start
+ @author das area=appletviewer
+ @library ../../regtesthelpers
+ @build Util
+ @run applet AppletInitialFocusTest.html
+ -->
+<head>
+<title> AppletInitialFocusTest </title>
+</head>
+<body>
+
+<h1>AppletInitialFocusTest<br>Bug ID: 4041703</h1>
+
+<p> See the dialog box (usually in upper left corner) for instructions</p>
+
+<APPLET CODE="AppletInitialFocusTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/AppletInitialFocusTest/AppletInitialFocusTest.java Wed May 14 07:53:12 2008 -0700
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ test
+ @bug 4041703 4096228 4025223 4260929
+ @summary Ensures that appletviewer sets a reasonable default focus for an Applet on start
+ @author das area=appletviewer
+ @run applet AppletInitialFocusTest.html
+*/
+
+import java.applet.Applet;
+import java.awt.Button;
+import java.awt.Component;
+import java.awt.Robot;
+import java.awt.Window;
+import test.java.awt.regtesthelpers.Util;
+
+public class AppletInitialFocusTest extends Applet {
+ Robot robot = Util.createRobot();
+ Button button = new Button("Button");
+
+ public void init() {
+ add(button);
+ }
+
+ public void start() {
+ new Thread(new Runnable() {
+ public void run() {
+ Util.waitTillShown(button);
+ robot.delay(1000); // delay the thread to let EDT to start dispatching focus events
+ Util.waitForIdle(robot);
+ if (!button.hasFocus()) {
+ throw new RuntimeException("Appletviewer doesn't set default focus correctly.");
+ }
+ }
+ }).start();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/AppletInitialFocusTest/AppletInitialFocusTest1.html Wed May 14 07:53:12 2008 -0700
@@ -0,0 +1,24 @@
+<html>
+<!--
+ @test
+ @bug 4411534 4517274
+ @summary ensures that user's requestFocus() during applet initialization
+ is not ignored
+ @author prs area=appletviewer
+ @library ../../regtesthelpers
+ @build Util
+ @run applet AppletInitialFocusTest1.html
+ -->
+<head>
+<title> AppletInitialFocusTest1 </title>
+</head>
+<body>
+
+<h1>AppletInitialFocusTest1<br>Bug ID: 4517274</h1>
+
+<p> See the dialog box (usually in upper left corner) for instructions</p>
+
+<APPLET CODE="AppletInitialFocusTest1.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/AppletInitialFocusTest/AppletInitialFocusTest1.java Wed May 14 07:53:12 2008 -0700
@@ -0,0 +1,71 @@
+/*
+ test %W% %E%
+ @bug 4411534 4517274
+ @summary ensures that user's requestFocus() during applet initialization
+ is not ignored.
+ @author prs@sparc.spb.su area=appletviewer
+ @run shell AppletInitialFocusTest1.sh
+*/
+
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.event.*;
+
+public class AppletInitialFocusTest1 extends Applet implements FocusListener {
+
+ Button button1 = new Button("Button1");
+ Button button2 = new Button("Button2");
+
+ Object lock = new Object();
+
+ public void init() {
+
+ Component parent = this;
+ while (parent != null && !(parent instanceof Window)) {
+ parent = parent.getParent();
+ }
+ /*
+ * This applet is designed to be run only with appletviewer,
+ * so there always should be a toplevel frame.
+ */
+ if (parent == null) {
+ synchronized (lock) {
+ System.err.println("appletviewer not running");
+ System.exit(3);
+ }
+ }
+ button1.addFocusListener(this);
+ button2.addFocusListener(this);
+ add(button1);
+ add(button2);
+ button2.requestFocus();
+ }
+
+ public void focusGained(FocusEvent e) {
+ if (e.getSource() == button1) {
+ synchronized (lock) {
+ System.err.println("failed: focus on the wrong button");
+ System.exit(2);
+ }
+ }
+ }
+
+ public void focusLost(FocusEvent e) {
+ }
+
+ public void start() {
+ Thread thread = new Thread(new Runnable() {
+ public void run() {
+ try {
+ Thread.sleep(10000);
+ synchronized (lock) {
+ System.err.println("passed");
+ System.exit(0);
+ }
+ } catch(InterruptedException e) {
+ }
+ }
+ });
+ thread.start();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/ConsumeNextKeyTypedOnModalShowTest/ConsumeNextKeyTypedOnModalShowTest.java Wed May 14 07:53:12 2008 -0700
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ @test %W% %E%
+ @bug 6637607
+ @summary Showing a modal dlg on TAB KEY_PRESS shouldn't consume inappropriate KEY_TYPED.
+ @author Anton Tarasov: area=awt-focus
+ @library ../../regtesthelpers
+ @build Util
+ @run main ConsumeNextKeyTypedOnModalShowTest
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+import java.applet.Applet;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.lang.reflect.InvocationTargetException;
+import test.java.awt.regtesthelpers.Util;
+
+public class ConsumeNextKeyTypedOnModalShowTest extends Applet {
+ Robot robot;
+ Frame frame = new Frame("Frame");
+ Dialog dialog = new Dialog(frame, "Dialog", true);
+ TextField tf0 = new TextField();
+ TextField tf1 = new TextField();
+ Button button = new Button("Button");
+
+ public static void main(String[] args) {
+ ConsumeNextKeyTypedOnModalShowTest app = new ConsumeNextKeyTypedOnModalShowTest();
+ app.init();
+ app.start();
+ }
+
+ public void init() {
+ robot = Util.createRobot();
+
+ tf0.setPreferredSize(new Dimension(50, 30));
+ tf1.setPreferredSize(new Dimension(50, 30));
+ frame.setLayout(new FlowLayout());
+ frame.add(tf0);
+ frame.add(tf1);
+ frame.pack();
+
+ dialog.add(button);
+ dialog.pack();
+
+ Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
+ public void eventDispatched(AWTEvent e) {
+ if (e.getID() == KeyEvent.KEY_PRESSED && e.getSource() == tf0) {
+ dialog.setVisible(true);
+ }
+ }
+ }, KeyEvent.KEY_EVENT_MASK);
+ }
+
+ public void start() {
+ frame.setVisible(true);
+ Util.waitTillShown(frame);
+
+ // Show the dialog.
+ robot.keyPress(KeyEvent.VK_TAB);
+ robot.delay(50);
+ robot.keyRelease(KeyEvent.VK_TAB);
+
+ Util.waitForIdle(robot);
+
+ // Dispose the dialog.
+ Runnable action = new Runnable() {
+ public void run() {
+ dialog.dispose();
+ }
+ };
+ if (!Util.trackFocusGained(tf1, action, 2000, false)) {
+ throw new RuntimeException("Test failed: TAB was processed incorrectly!");
+ }
+
+ // Check for type-ability.
+ robot.keyPress(KeyEvent.VK_A);
+ robot.delay(50);
+ robot.keyRelease(KeyEvent.VK_A);
+
+ Util.waitForIdle(robot);
+
+ if (tf1.getText().equals("")) {
+ throw new RuntimeException("Test failed: couldn't type a char!");
+ }
+ System.out.println("Test passed.");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/ContainerFocusAutoTransferTest/ContainerFocusAutoTransferTest.java Wed May 14 07:53:12 2008 -0700
@@ -0,0 +1,243 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ @test
+ @bug 6607170
+ @summary Tests for focus-auto-transfer.
+ @author Anton Tarasov: area=awt-focus
+ @library ../../regtesthelpers
+ @build Util
+ @run main ContainerFocusAutoTransferTest
+*/
+
+import java.applet.Applet;
+import java.awt.AWTEvent;
+import java.awt.Component;
+import java.awt.ComponentOrientation;
+import java.awt.DefaultKeyboardFocusManager;
+import java.awt.KeyboardFocusManager;
+import java.awt.Robot;
+import java.awt.Color;
+import java.awt.FlowLayout;
+import java.awt.Toolkit;
+import java.awt.event.AWTEventListener;
+import java.awt.event.FocusEvent;
+import java.awt.event.WindowEvent;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import test.java.awt.regtesthelpers.Util;
+
+public class ContainerFocusAutoTransferTest extends Applet {
+ Robot robot;
+ TestFrame frame;
+ KeyboardFocusManager kfm;
+ enum TestCase {
+ REMOVAL { public String toString() { return "removal"; } },
+ HIDING { public String toString() { return "hiding"; } },
+ DISABLING { public String toString() { return "disabling"; } },
+ DEFOCUSING { public String toString() { return "defocusing"; } };
+ public abstract String toString();
+ };
+
+ public static void main(String[] args) {
+ ContainerFocusAutoTransferTest app = new ContainerFocusAutoTransferTest();
+ app.init();
+ app.start();
+ }
+
+ public void init() {
+ robot = Util.createRobot();
+ kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
+ Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
+ public void eventDispatched(AWTEvent event) {
+ System.out.println("--> " + event);
+ }
+ }, FocusEvent.FOCUS_EVENT_MASK | WindowEvent.WINDOW_FOCUS_EVENT_MASK);
+ }
+
+ public void start() {
+ System.out.println("*** TEST #1 ***");
+ test(TestCase.HIDING);
+
+ System.out.println("*** TEST #2 ***");
+ test(TestCase.REMOVAL);
+
+ System.out.println("*** TEST #3 ***");
+ test3(TestCase.DISABLING);
+
+ System.out.println("*** TEST #4 ***");
+ test3(TestCase.DEFOCUSING);
+
+ System.out.println("*** TEST #5 ***");
+ test4();
+
+ System.out.println("Test passed.");
+ }
+
+ void test(final TestCase t) {
+ showFrame();
+ test1(t); // Test for correct auto-transfer
+ test2(t); // Test for clearing focus
+ }
+
+ void test1(final TestCase t) {
+ Runnable action = new Runnable() {
+ public void run() {
+ KeyboardFocusManager.setCurrentKeyboardFocusManager(new TestKFM());
+ if (t == TestCase.REMOVAL) {
+ frame.remove(frame.panel0);
+
+ } else if (t == TestCase.HIDING) {
+ frame.panel0.setVisible(false);
+ }
+ frame.repaint();
+ }
+ };
+ if (!Util.trackFocusGained(frame.b3, action, 2000, false)) {
+ throw new TestFailedException(t + ": focus wasn't transfered as expected!");
+ }
+ KeyboardFocusManager.setCurrentKeyboardFocusManager(kfm);
+ }
+
+ void test2(TestCase t) {
+ frame.setFocusable(false); // exclude it from the focus cycle
+ if (t == TestCase.REMOVAL) {
+ frame.remove(frame.panel1);
+
+ } else if (t == TestCase.HIDING) {
+ frame.panel1.setVisible(false);
+ }
+ frame.repaint();
+ Util.waitForIdle(robot);
+ if (kfm.getFocusOwner() != null) {
+ throw new TestFailedException(t + ": focus wasn't cleared!");
+ }
+ }
+
+ void test3(final TestCase t) {
+ showFrame();
+ Runnable action = new Runnable() {
+ public void run() {
+ if (t == TestCase.DISABLING) {
+ frame.b0.setEnabled(false);
+
+ } else if (t == TestCase.DEFOCUSING) {
+ frame.b0.setFocusable(false);
+ }
+ }};
+ if (!Util.trackFocusGained(frame.b1, action, 2000, false)) {
+ throw new TestFailedException(t + ": focus wasn't transfered as expected!");
+ }
+ }
+
+ void test4() {
+ showFrame();
+ frame.setFocusableWindowState(false);
+ Util.waitForIdle(robot);
+ if (kfm.getFocusOwner() != null) {
+ throw new TestFailedException("defocusing the frame: focus wasn't cleared!");
+ }
+ }
+
+ void showFrame() {
+ if (frame != null) {
+ frame.dispose();
+ Util.waitForIdle(robot);
+ }
+ frame = new TestFrame();
+ frame.setVisible(true);
+ Util.waitTillShown(frame);
+
+ if (!frame.b0.hasFocus()) {
+ Util.clickOnComp(frame.b0, robot);
+ Util.waitForIdle(robot);
+ if (!frame.b0.hasFocus()) {
+ throw new TestErrorException("couldn't set focus on " + frame.b2);
+ }
+ }
+ }
+
+ class TestKFM extends DefaultKeyboardFocusManager {
+ public boolean dispatchEvent(AWTEvent e) {
+ if (e.getID() == FocusEvent.FOCUS_GAINED) {
+ System.out.println(e);
+ Component src = (Component)e.getSource();
+ if (src == frame.b1 || src == frame.b2) {
+ throw new TestFailedException("wrong focus transfer on removal!");
+ }
+ }
+ return super.dispatchEvent(e);
+ }
+ }
+}
+
+class TestFrame extends JFrame {
+ public JPanel panel0 = new JPanel();
+ public JPanel panel1 = new JPanel();
+ public JButton b0 = new JButton("b0");
+ public JButton b1 = new JButton("b1");
+ public JButton b2 = new JButton("b2");
+ public JButton b3 = new JButton("b3");
+ public JButton b4 = new JButton("b4");
+
+ public TestFrame() {
+ super("TestFrame");
+
+ // The change of the orientation and the reverse order of
+ // adding the buttons to the panel is because in Container.removeNotify()
+ // the child components are removed in the reverse order.
+ // We want that the focus owner (b0) would be removed first and
+ // that the next traversable component would be b1.
+ panel0.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ panel0.add(b2);
+ panel0.add(b1);
+ panel0.add(b0);
+
+ panel1.add(b3);
+ panel1.add(b4);
+
+ setLayout(new FlowLayout());
+ add(panel0);
+ add(panel1);
+ pack();
+
+ panel0.setBackground(Color.red);
+ panel1.setBackground(Color.blue);
+ }
+}
+
+// Thrown when the behavior being verified is found wrong.
+class TestFailedException extends RuntimeException {
+ TestFailedException(String msg) {
+ super("Test failed: " + msg);
+ }
+}
+
+// Thrown when an error not related to the behavior being verified is encountered.
+class TestErrorException extends RuntimeException {
+ TestErrorException(String msg) {
+ super("Unexpected error: " + msg);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/FrameJumpingToMouse/FrameJumpingToMouse.java Wed May 14 07:53:12 2008 -0700
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ @test
+ @bug 4752312
+ @summary Tests that after moving non-focusable window it ungrabs mouse pointer
+ @author Denis Mikhalkin: area=awt.focus
+ @library ../../regtesthelpers
+ @build Util
+ @run main FrameJumpingToMouse
+*/
+
+import java.applet.Applet;
+import java.awt.BorderLayout;
+import java.awt.Dialog;
+import java.awt.Frame;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.TextArea;
+import java.awt.Toolkit;
+import java.awt.event.InputEvent;
+import javax.swing.JFrame;
+import test.java.awt.regtesthelpers.Util;
+
+public class FrameJumpingToMouse extends Applet
+{
+ JFrame frame = new JFrame("Test jumping frame");
+ Robot robot = Util.createRobot();
+
+ public static void main(String[] args) {
+ FrameJumpingToMouse test = new FrameJumpingToMouse();
+ test.init();
+ test.start();
+ }
+
+ public void init() {
+ frame.setFocusableWindowState(false);
+ frame.setBounds(100, 100, 100, 100);
+ }
+
+ public void start() {
+ frame.setVisible(true);
+ Util.waitTillShown(frame);
+
+ Point loc = frame.getLocationOnScreen();
+ robot.mouseMove(loc.x + frame.getWidth() / 4, loc.y + frame.getInsets().top / 2);
+ robot.delay(50);
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ robot.delay(50);
+ robot.mouseMove(loc.x + 100, loc.y + 50);
+ robot.delay(50);
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+ Util.waitForIdle(robot);
+
+ loc = frame.getLocation();
+ robot.mouseMove(loc.x + frame.getWidth() / 2, loc.y + frame.getHeight() / 2);
+ Util.waitForIdle(robot);
+
+ if (!(frame.getLocation().equals(loc))) {
+ throw new RuntimeException("Test failed: frame is moving to mouse with grab!");
+ }
+ System.out.println("Test passed.");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/IconifiedFrameFocusChangeTest/IconifiedFrameFocusChangeTest.java Wed May 14 07:53:12 2008 -0700
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ @test
+ @bug 6522725
+ @summary Tests for proper request-focus-back on FOCUS_LOST.
+ @author Anton Tarasov: area=awt-focus
+ @library ../../regtesthelpers
+ @build Util
+ @run main IconifiedFrameFocusChangeTest
+*/
+
+import java.awt.*;
+import java.applet.Applet;
+import java.awt.event.*;
+import test.java.awt.regtesthelpers.Util;
+
+public class IconifiedFrameFocusChangeTest extends Applet {
+ Frame testFrame = new Frame("Test Frame");
+ Frame otherFrame = new Frame("Other Frame");
+ Button testButton = new Button("test button");
+ Button otherButton = new Button("other button");
+ Robot robot;
+
+ public static void main(String[] args) {
+ IconifiedFrameFocusChangeTest app = new IconifiedFrameFocusChangeTest();
+ app.init();
+ app.start();
+ }
+
+ public void init() {
+ robot = Util.createRobot();
+
+ testFrame.add(testButton);
+ testFrame.pack();
+ otherFrame.add(otherButton);
+ otherFrame.pack();
+ otherFrame.setLocation(200, 0);
+
+ testButton.addFocusListener(new FocusAdapter() {
+ public void focusLost(FocusEvent e) {
+ testButton.requestFocus();
+ }
+ });
+ }
+
+ public void start() {
+ otherFrame.setVisible(true);
+ Util.waitForIdle(robot);
+ testFrame.setVisible(true);
+ Util.waitForIdle(robot);
+
+ if (!testButton.hasFocus()) {
+ throw new TestErrorException("wrong initial focus");
+ }
+
+ /*
+ * Iconify the Frame. Test that focus switches properly.
+ */
+ Runnable action = new Runnable() {
+ public void run() {
+ testFrame.setExtendedState(Frame.ICONIFIED);
+ }
+ };
+ if (!Util.trackFocusGained(otherButton, action, 2000, true)) {
+ throw new TestFailedException("iconifying focused window didn't trigger focus change");
+ }
+
+ /*
+ * Test that key events go into the focus owner.
+ */
+ action = new Runnable() {
+ public void run() {
+ robot.keyPress(KeyEvent.VK_SPACE);
+ robot.delay(50);
+ robot.keyRelease(KeyEvent.VK_SPACE);
+ }
+ };
+ if (!Util.trackActionPerformed(otherButton, action, 2000, true)) {
+ throw new TestFailedException("Java focus owner doesn't match to the native one");
+ }
+
+ System.out.println("Test passed.");
+ }
+}
+
+/**
+ * Thrown when the behavior being verified is found wrong.
+ */
+class TestFailedException extends RuntimeException {
+ TestFailedException(String msg) {
+ super("Test failed: " + msg);
+ }
+}
+
+/**
+ * Thrown when an error not related to the behavior being verified is encountered.
+ */
+class TestErrorException extends RuntimeException {
+ TestErrorException(String msg) {
+ super("Unexpected error: " + msg);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/NonFocusableWindowTest/NoEventsTest.java Wed May 14 07:53:12 2008 -0700
@@ -0,0 +1,420 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ @test
+ @bug 4452384
+ @summary Tests that non-focusable windows doesn't generate any focus events when accessed.
+ @author Denis.Mikhalkin: area=awt.focus
+ @run main NoEventsTest
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+
+public class NoEventsTest extends Frame {
+ public static final int DEF_WIDTH = 400,
+ DEF_HEIGHT = 300,
+ DEF_TOP = 1,
+ DEF_LEFT = 100,
+ DEF_ROW = 0,
+ DEF_COL = 0;
+ static boolean automatic = true;
+ static Window[] windows;
+ static Frame main_frame, jumpingFrame;
+ static Button focus_button;
+ static Robot robot;
+ static void pause(int timeout) {
+ Toolkit.getDefaultToolkit().sync();
+ robot.waitForIdle();
+ robot.delay(100);
+ }
+ static GlobalListener listener;
+ public static void main(String[] args) {
+
+ listener = new GlobalListener();
+ Toolkit.getDefaultToolkit().addAWTEventListener(listener,
+ AWTEvent.FOCUS_EVENT_MASK |
+ AWTEvent.WINDOW_EVENT_MASK);
+ try{
+ robot = new Robot();
+ } catch(Exception e) {}
+ // Create several pairs - focusable Frame with focusable component(button) and non-focusable:
+ // window, resizable frame, non-resizable frame, dialog, non-resiable dialog
+ main_frame = new Frame("focusable frame");
+ focus_button = new Button("button to focus");
+ main_frame.add(focus_button);
+ main_frame.pack();
+ main_frame.setVisible(true);
+ main_frame.setLocation(10, 600);
+ main_frame.addWindowListener(new WindowAdapter() {
+ public void windowClosing(WindowEvent e) {
+ listener.report();
+ System.exit(0);
+ }
+ });
+
+ jumpingFrame = new Frame("Jumping frame");
+ jumpingFrame.setBounds(DEF_LEFT, DEF_TOP, DEF_WIDTH, DEF_HEIGHT);
+
+ windows = new Window[7];
+ windows[0] = new TestWindow(0, 0, false, main_frame);
+ //windows[1] = new TestWindow(2, 1, true, main_frame);
+ windows[2] = new NoEventsTest(1, 0, false, true);
+ windows[3] = new NoEventsTest(2, 0, false, false);
+ //windows[4] = new Test(3, 0, true, true);
+ windows[5] = new TestDialog(0, 1, false, true, main_frame);
+ windows[6] = new TestDialog(1, 1, false, false, main_frame);
+ if (!automatic) {
+ int windowInd;
+ for (windowInd = 0; windowInd < windows.length; windowInd++) {
+ if (windows[windowInd] != null) {
+ windows[windowInd].setVisible(true);
+ }
+ }
+ }
+ // Run the test
+ // 1. Click on all controls, check for no focus events for non-focusable, right focus events for focusable
+ // 2. Perform some action with control, check if it works
+ if (automatic) {
+ int windowInd;
+ for (windowInd = 0; windowInd < windows.length; windowInd++) {
+ if (windows[windowInd] != null) {
+ windows[windowInd].setVisible(true);
+ focus_button.requestFocus();
+ pause(1000);
+
+ // Verify that click on non-focusable window causes no focus lost on active window
+ performFocusClick(windows[windowInd]);
+ focus_button.requestFocus();
+ pause(500);
+ performActionClick(windows[windowInd]);
+
+ // Verify that toFront, toBack doesn't cause non-focusable window to become active
+ jumpingFrame.setVisible(true);
+ pause(1000);
+ jumpingFrame.toBack();
+ pause(500);
+ jumpingFrame.toFront();
+ pause(500);
+ windows[windowInd].toBack();
+ pause(500);
+ windows[windowInd].toFront();
+ pause(500);
+
+ // Verify that iconifiyng/deiconfiying and
+ // zooming/unzooming doesn't cause non-focusable
+ // window to become active
+ if (windows[windowInd] instanceof Frame) {
+ Frame toTest = (Frame)windows[windowInd];
+ // Deiconification currently doesn't work!
+// toTest.setExtendedState(Frame.ICONIFIED);
+// pause(500);
+// toTest.setExtendedState(Frame.NORMAL);
+ pause(500);
+ toTest.setExtendedState(Frame.MAXIMIZED_BOTH);
+ pause(500);
+ toTest.setExtendedState(Frame.NORMAL);
+ }
+
+ windows[windowInd].dispose();
+ jumpingFrame.dispose();
+ }
+ }
+ pause(1000);
+ System.err.println("Test finished.");
+ if (!listener.report()) {
+ throw new RuntimeException("Test Failed. See error stream output for details");
+ }
+ }
+ }
+ static void performFocusClick(Window parent) {
+ if (parent == null) {
+ return;
+ }
+ for (int compInd = 0; compInd < parent.getComponentCount(); compInd++) {
+ Component child = parent.getComponent(compInd);
+ if (child instanceof TestPanel) {
+ TestPanel pan = (TestPanel)child;
+ pan.performFocusClicks(robot);
+ pause(100);
+ }
+ }
+ }
+ static void performActionClick(Window parent) {
+ if (parent == null) {
+ return;
+ }
+ for (int compInd = 0; compInd < parent.getComponentCount(); compInd++) {
+ Component child = parent.getComponent(compInd);
+ if (child instanceof TestPanel) {
+ TestPanel pan = (TestPanel)child;
+ pan.performActionClicks(robot);
+ pause(100);
+ }
+ }
+ }
+ public NoEventsTest(int row, int col, boolean focusable, boolean resizable) {
+ super("Frame" + row + "" + col);
+ TestPanel panel = new TestPanel(row, col);
+ if (NoEventsTest.automatic) {
+ row = NoEventsTest.DEF_ROW;
+ col = NoEventsTest.DEF_COL;
+ }
+ setName(getTitle());
+ add("Center", panel);
+ Label l = new Label(getClass().getSuperclass().getName() + ", " + (focusable?"focusable":"non-focusable") +
+ ", " + (resizable?"resizable":"non-resizable"));
+ l.setBackground(Color.green);
+ add("North", l);
+ setBounds(NoEventsTest.DEF_LEFT + DEF_WIDTH*col, DEF_TOP + DEF_HEIGHT*row, DEF_WIDTH, DEF_HEIGHT);
+ if (!focusable) {
+ setFocusableWindowState(false);
+ }
+ if (!resizable) {
+ setResizable(false);
+ }
+// setVisible(true);
+ }
+}
+class TestWindow extends Window {
+ public TestWindow(int row, int col, boolean focusable, Frame owner) {
+ super(owner);
+ setName("Window" + row + "" + col);
+ TestPanel panel = new TestPanel(row, col);
+ if (NoEventsTest.automatic) {
+ row = NoEventsTest.DEF_ROW;
+ col = NoEventsTest.DEF_COL;
+ }
+
+ add("Center", panel);
+ Label l = new Label(getClass().getSuperclass().getName() + ", " + (focusable?"focusable":"non-focusable") +
+ ", " + (false?"resizable":"non-resizable"));
+ l.setBackground(Color.green);
+ add("North", l);
+
+ setBounds(NoEventsTest.DEF_LEFT + NoEventsTest.DEF_WIDTH*col, NoEventsTest.DEF_TOP + NoEventsTest.DEF_HEIGHT*row, NoEventsTest.DEF_WIDTH, NoEventsTest.DEF_HEIGHT);
+ if (!focusable) {
+ setFocusableWindowState(false);
+ }
+// setVisible(true);
+ }
+}
+class TestDialog extends Dialog {
+ public TestDialog(int row, int col, boolean focusable, boolean resizable, Frame owner) {
+ super(owner);
+ setName("Dialog" + row + "" + col);
+ TestPanel panel = new TestPanel(row, col);
+ if (NoEventsTest.automatic) {
+ row = NoEventsTest.DEF_ROW;
+ col = NoEventsTest.DEF_COL;
+ }
+
+ add("Center", panel);
+ Label l = new Label(getClass().getSuperclass().getName() + ", " + (focusable?"focusable":"non-focusable") +
+ ", " + (resizable?"resizable":"non-resizable"));
+ l.setBackground(Color.green);
+ add("North", l);
+
+ setBounds(NoEventsTest.DEF_LEFT + NoEventsTest.DEF_WIDTH*col, NoEventsTest.DEF_TOP + NoEventsTest.DEF_HEIGHT*row, NoEventsTest.DEF_WIDTH, NoEventsTest.DEF_HEIGHT);
+ if (!focusable) {
+ setFocusableWindowState(false);
+ }
+ if (!resizable) {
+ setResizable(false);
+ }
+// setVisible(true);
+ }
+}
+
+class TestPanel extends Panel {
+
+ void clickComponent(Component comp, Robot robot) {
+ if (comp instanceof Choice) {
+ return;
+ }
+ Point compLoc = comp.getLocationOnScreen();
+ Dimension size = comp.getSize();
+ robot.mouseMove(compLoc.x + size.width/2, compLoc.y + size.height/2);
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+ }
+ void performFocusClicks(Robot robot) {
+ for (int childInd = 0; childInd < getComponentCount(); childInd++) {
+ performFocusClick(getComponent(childInd), robot);
+ }
+ }
+ void performFocusClick(Component comp, Robot robot) {
+ clickComponent(comp, robot);
+ }
+
+ void performActionClicks(Robot robot) {
+ for (int childInd = 0; childInd < getComponentCount(); childInd++) {
+ performActionClick(getComponent(childInd), robot);
+ }
+ }
+ void performActionClick(Component comp, Robot robot) {
+ }
+
+ public TestPanel(int row, int col) {
+ setLayout(new FlowLayout());
+ Button b;
+ add(b = new Button("press"+ row + "" + col));
+ b.setName(b.getLabel());
+// b.addMouseListener(new MouseAdapter() {
+// public void mousePressed(MouseEvent e) {
+// System.err.println(e);
+// }
+// });
+ TextField t;
+ add(t = new TextField("text" + row + "" + col));
+ t.setName(t.getText());
+
+ java.awt.List list = new java.awt.List();
+ add(list);
+ list.setName("list");
+ list.add("one");
+ list.add("two");
+ list.add("three");
+ list.setMultipleMode(true);
+ list.setName("list" + row + "" + col);
+
+ Checkbox check = new Checkbox("checker");
+ add(check);
+ check.setName("check" + row + "" + col);
+
+ Choice choice = new Choice();
+ choice.add("one");
+ choice.add("two");
+ choice.add("three");
+ add(choice);
+ choice.setName("choice" + row + "" + col);
+
+ Canvas can = new Canvas() {
+ public Dimension getPreferredSize() {
+ return new Dimension(10, 10);
+ }
+ };
+ can.setBackground(Color.blue);
+ add(can);
+ can.setName("canvas" + row + "" + col);
+
+ TextArea ta = new TextArea("text\ntttt\naaaa\nwwwww\nqqqqqq\neeeeee\nrrrrrr\nyyyyyy\nuuuuu", 3, 5);
+ add(ta);
+ ta.setName("textarea" + row + "" + col);
+
+ Scrollbar bar = new Scrollbar(Scrollbar.HORIZONTAL);
+ add(bar);
+ bar.setName("scrollbar" + row + "" + col);
+
+ CheckboxGroup group = new CheckboxGroup();
+ Checkbox ch1 = new Checkbox("one", group, true);
+ Checkbox ch2 = new Checkbox("two", group, false);
+ add(ch1);
+ add(ch2);
+ ch1.setName("checkbox1 " + row + "" + col);
+ ch2.setName("checkbox2 " + row + "" + col);
+
+
+ ScrollPane pane = new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS);
+ add(pane);
+ Button bigButton = new Button("abc") {
+ public Dimension getPreferredSize() {
+ return new Dimension(100, 100);
+ }
+ };
+ pane.add(bigButton);
+ bigButton.setName("bigbutton" + row + "" + col);
+ }
+}
+
+class GlobalListener implements AWTEventListener {
+ java.util.List errors = new java.util.LinkedList();
+ public boolean report() {
+ if (errors.size() != 0) {
+ System.err.println("Test FAILED");
+ } else {
+ System.err.println("Test PASSED");
+ return true;
+ }
+ ListIterator iter = errors.listIterator();
+ while (iter.hasNext()) {
+ System.err.println(iter.next());
+ }
+ return false;
+ }
+ public GlobalListener() {
+ }
+ Window getWindowParent(Component comp) {
+ while (comp != null && !(comp instanceof Window)) {
+ comp = comp.getParent();
+ }
+ return (Window)comp;
+ }
+ void reportError(AWTEvent e, String message) {
+ String error = "ERROR: " + message + " : " + e;
+ errors.add(error);
+ System.err.println(error);
+ }
+ public void eventDispatched(AWTEvent e) {
+ Component comp = (Component)e.getSource();
+ Window parent = getWindowParent(comp);
+ if (!(e instanceof WindowEvent || e instanceof FocusEvent)) {
+ System.err.println("Strange event " + e);
+ }
+
+ // Skip WINDOW_OPENED
+ if (e.getID() == WindowEvent.WINDOW_CLOSING) {
+ System.err.println(e);
+ }
+ switch (e.getID()) {
+ case WindowEvent.WINDOW_OPENED:
+ case WindowEvent.WINDOW_CLOSING:
+ case WindowEvent.WINDOW_CLOSED:
+ case WindowEvent.WINDOW_ICONIFIED:
+ case WindowEvent.WINDOW_DEICONIFIED:
+ case WindowEvent.WINDOW_STATE_CHANGED:
+ return;
+ case WindowEvent.WINDOW_LOST_FOCUS: {
+ WindowEvent we = (WindowEvent)e;
+ if (we.getOppositeWindow() != null && !we.getOppositeWindow().getFocusableWindowState()) {
+ reportError(e, "frame lost focus because of non-focusable window");
+ }
+ break;
+ }
+ }
+ // Check that Window owner is focusable
+ if (!parent.getFocusableWindowState()) {
+ reportError(e, "focus event for component in non-focusable window " + parent.getName());
+ }
+ if (!comp.isFocusable()) {
+ reportError(e, "focus event for non-focusable component");
+ }
+// if (e instanceof WindowEvent || e instanceof FocusEvent) {
+// // System.err.println(e);
+// }
+ }
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/NonFocusableWindowTest/NonfocusableOwnerTest.java Wed May 14 07:53:12 2008 -0700
@@ -0,0 +1,159 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ @test
+ @bug 6182359
+ @summary Tests that Window having non-focusable owner can't be a focus owner.
+ @author Anton.Tarasov: area=awt.focus
+ @library ../../regtesthelpers
+ @build Util
+ @run main NonfocusableOwnerTest
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+import java.applet.Applet;
+import java.lang.reflect.*;
+import java.io.*;
+import test.java.awt.regtesthelpers.Util;
+
+public class NonfocusableOwnerTest extends Applet {
+ Robot robot = Util.createRobot();
+ Frame frame;
+ Dialog dialog;
+ Window window1;
+ Window window2;
+ Button button = new Button("button");
+
+ public static void main(String[] args) {
+ NonfocusableOwnerTest test = new NonfocusableOwnerTest();
+ test.start();
+ }
+
+ public void start() {
+ Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
+ public void eventDispatched(AWTEvent e) {
+ System.out.println(e.toString());
+ }
+ }, FocusEvent.FOCUS_EVENT_MASK | WindowEvent.WINDOW_FOCUS_EVENT_MASK | WindowEvent.WINDOW_EVENT_MASK);
+
+ frame = new Frame("Frame");
+ frame.setName("Frame-owner");
+ frame.setBounds(100, 0, 100, 100);
+ dialog = new Dialog(frame, "Dialog");
+ dialog.setName("Dialog-owner");
+ dialog.setBounds(100, 0, 100, 100);
+
+ window1 = new Window(frame);
+ window1.setName("1st child");
+ window1.setBounds(100, 300, 100, 100);
+ window2 = new Window(window1);
+ window2.setName("2nd child");
+ window2.setBounds(100, 500, 100, 100);
+
+ test1(frame, window1);
+ test2(frame, window1, window2);
+ test3(frame, window1, window2);
+
+ window1 = new Window(dialog);
+ window1.setBounds(100, 300, 100, 100);
+ window1.setName("1st child");
+ window2 = new Window(window1);
+ window2.setName("2nd child");
+ window2.setBounds(100, 500, 100, 100);
+
+ test1(dialog, window1);
+ test2(dialog, window1, window2);
+ test3(dialog, window1, window2);
+
+ System.out.println("Test passed.");
+ }
+
+ void test1(Window owner, Window child) {
+ System.out.println("* * * STAGE 1 * * *\nWindow owner: " + owner);
+
+ owner.setFocusableWindowState(false);
+ owner.setVisible(true);
+
+ child.add(button);
+ child.setVisible(true);
+
+ Util.waitTillShown(child);
+
+ Util.clickOnComp(button, robot);
+ if (button == KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner()) {
+ throw new RuntimeException("Test Failed.");
+ }
+ child.dispose();
+ owner.dispose();
+ }
+
+ void test2(Window owner, Window child1, Window child2) {
+ System.out.println("* * * STAGE 2 * * *\nWindow nowner: " + owner);
+
+ owner.setFocusableWindowState(false);
+ owner.setVisible(true);
+
+ child1.setFocusableWindowState(true);
+ child1.setVisible(true);
+
+ child2.add(button);
+ child2.setVisible(true);
+
+ Util.waitTillShown(child2);
+
+ Util.clickOnComp(button, robot);
+ if (button == KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner()) {
+ throw new RuntimeException("Test failed.");
+ }
+ child2.dispose();
+ child1.dispose();
+ owner.dispose();
+ }
+
+ void test3(Window owner, Window child1, Window child2) {
+ System.out.println("* * * STAGE 3 * * *\nWidow owner: " + owner);
+
+ owner.setFocusableWindowState(true);
+ owner.setVisible(true);
+
+ child1.setFocusableWindowState(false);
+ child1.setVisible(true);
+
+ child2.setFocusableWindowState(true);
+ child2.add(button);
+ child2.setVisible(true);
+
+ Util.waitTillShown(child2);
+
+ Util.clickOnComp(button, robot);
+ System.err.println("focus owner: " + KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner());
+ if (button != KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner()) {
+ throw new RuntimeException("Test failed.");
+ }
+ child1.dispose();
+ child2.dispose();
+ owner.dispose();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/TypeAhead/TestFocusFreeze.java Wed May 14 07:53:12 2008 -0700
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ @test
+ @bug 6183877 6216005 6225560
+ @library ../../regtesthelpers
+ @build Util
+ @summary Tests that keyboard input doesn't freeze due to type-ahead problems
+ @author Denis.Mikhalkin, Anton.Tarasov: area=awt.focus
+ @run main TestFocusFreeze
+*/
+
+import java.awt.Component;
+import java.awt.DefaultKeyboardFocusManager;
+import java.awt.KeyboardFocusManager;
+import java.awt.Robot;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.util.concurrent.atomic.AtomicBoolean;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import test.java.awt.regtesthelpers.Util;
+
+public class TestFocusFreeze {
+ private static JFrame frame;
+ private static JDialog dialog;
+ private static JButton dlgButton;
+ private static JButton frameButton;
+ private static AtomicBoolean lock = new AtomicBoolean(false);
+ private static Robot robot = Util.createRobot();
+
+ public static void main(String[] args) {
+ boolean all_passed = true;
+ KeyboardFocusManager testKFM = new TestKFM(robot);
+ KeyboardFocusManager defKFM = KeyboardFocusManager.getCurrentKeyboardFocusManager();
+
+ for (int i = 0; i < 10; i++) {
+ test(testKFM, defKFM);
+ Util.waitForIdle(robot);
+ System.out.println("Iter " + i + ": " + (lock.get() ? "passed." : "failed!"));
+ if (!lock.get()) {
+ all_passed = false;
+ }
+ }
+ if (!all_passed) {
+ throw new RuntimeException("Test failed: not all iterations passed!");
+ }
+ System.out.println("Test passed.");
+ }
+
+ public static void test(final KeyboardFocusManager testKFM, final KeyboardFocusManager defKFM) {
+ frame = new JFrame("Frame");
+ dialog = new JDialog(frame, "Dialog", true);
+ dlgButton = new JButton("Dialog_Button");
+ frameButton = new JButton("Frame_Button");
+
+ lock.set(false);
+
+ dialog.add(dlgButton);
+ dialog.setLocation(200, 0);
+ dialog.pack();
+ frame.add(frameButton);
+ frame.pack();
+
+ dlgButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ dialog.dispose();
+ frame.dispose();
+ synchronized (lock) {
+ lock.set(true);
+ lock.notifyAll();
+ }
+ }
+ });
+
+ frameButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ // Right before the dialog will be shown, there will be called
+ // enqueuKeyEvents() method. We are to catch it.
+ KeyboardFocusManager.setCurrentKeyboardFocusManager(testKFM);
+ dialog.setVisible(true);
+ KeyboardFocusManager.setCurrentKeyboardFocusManager(defKFM);
+ }
+ });
+
+ Runnable showAction = new Runnable() {
+ public void run() {
+ frame.setVisible(true);
+ }
+ };
+ if (!Util.trackFocusGained(frameButton, showAction, 2000, false)) {
+ System.out.println("Test error: wrong initial focus!");
+ return;
+ }
+
+ robot.keyPress(KeyEvent.VK_SPACE);
+ robot.delay(50);
+ robot.keyRelease(KeyEvent.VK_SPACE);
+
+ Util.waitForCondition(lock, 2000);
+ Util.waitForIdle(robot);
+ }
+}
+
+class TestKFM extends DefaultKeyboardFocusManager {
+ Robot robot;
+ public TestKFM(Robot robot) {
+ this.robot = robot;
+ }
+ protected synchronized void enqueueKeyEvents(long after, Component untilFocused) {
+ super.enqueueKeyEvents(after, untilFocused);
+ robot.keyPress(KeyEvent.VK_SPACE);
+ robot.delay(50);
+ robot.keyRelease(KeyEvent.VK_SPACE);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/WrongKeyTypedConsumedTest/WrongKeyTypedConsumedTest.java Wed May 14 07:53:12 2008 -0700
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ @test
+ @bug 4782886
+ @summary FocusManager consumes wrong KEY_TYPED events
+ @author Oleg.Sukhodolsky: area=awt.focus
+ @library ../../regtesthelpers
+ @build Util
+ @run main WrongKeyTypedConsumedTest
+*/
+
+import java.applet.Applet;
+import java.awt.AWTException;
+import java.awt.AWTKeyStroke;
+import java.awt.BorderLayout;
+import java.awt.Dialog;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Frame;
+import java.awt.KeyboardFocusManager;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.TextArea;
+
+import java.awt.event.KeyEvent;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.swing.JCheckBox;
+import javax.swing.JFrame;
+import javax.swing.JTextArea;
+
+import test.java.awt.regtesthelpers.Util;
+
+public class WrongKeyTypedConsumedTest extends Applet
+{
+ Robot robot = Util.createRobot();
+
+ public static void main(String[] args) {
+ WrongKeyTypedConsumedTest test = new WrongKeyTypedConsumedTest();
+ test.start();
+ }
+
+ public void start ()
+ {
+ setSize (200,200);
+ setVisible(true);
+ validate();
+
+ JFrame frame = new JFrame("The Frame");
+ Set ftk = new HashSet();
+ ftk.add(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_DOWN, 0));
+ frame.getContentPane().
+ setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
+ ftk);
+
+ JCheckBox checkbox = new JCheckBox("test");
+ frame.getContentPane().add(checkbox, BorderLayout.NORTH);
+
+ JTextArea textarea = new JTextArea(40, 10);
+ frame.getContentPane().add(textarea);
+
+ frame.pack();
+ frame.setVisible(true);
+ Util.waitForIdle(robot);
+
+ if (!frame.isActive()) {
+ throw new RuntimeException("Test Fialed: frame isn't active");
+ }
+
+ // verify if checkbox has focus
+ if (!checkbox.isFocusOwner()) {
+ checkbox.requestFocusInWindow();
+ Util.waitForIdle(robot);
+ if (!checkbox.isFocusOwner()) {
+ throw new RuntimeException("Test Failed: checkbox doesn't have focus");
+ }
+ }
+
+ // press VK_DOWN
+ robot.keyPress(KeyEvent.VK_DOWN);
+ robot.delay(50);
+ robot.keyRelease(KeyEvent.VK_DOWN);
+ robot.delay(50);
+
+ Util.waitForIdle(robot);
+
+ // verify if text area has focus
+ if (!textarea.isFocusOwner()) {
+ throw new RuntimeException("Test Failed: focus wasn't transfered to text area");
+ }
+ // press '1'
+ robot.keyPress(KeyEvent.VK_1);
+ robot.delay(50);
+ robot.keyRelease(KeyEvent.VK_1);
+ robot.delay(50);
+
+ Util.waitForIdle(robot);
+
+ // verify if KEY_TYPED arrived
+ if (!"1".equals(textarea.getText())) {
+ throw new RuntimeException("Test Failed: text area text is \"" + textarea.getText() + "\", not \"1\"");
+ }
+ System.out.println("Test Passed");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Insets/WindowWithWarningTest/WindowWithWarningTest.html Wed May 14 07:53:12 2008 -0700
@@ -0,0 +1,20 @@
+<html>
+<!--
+ @test
+ @bug 6391770
+ @summary Content of the Window should be laid out in the area left after WarningWindow was added.
+ @author Yuri Nesterenko
+ @run applet WindowWithWarningTest.html
+-->
+
+ <head>
+ <title>WindowWithWarningTest</title>
+ </head>
+ <pre>
+ This test will run automatically.
+ </pre>
+ <body>
+ <applet code="WindowWithWarningTest.class" width=350 height=300></applet>
+ </body>
+</html>
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Insets/WindowWithWarningTest/WindowWithWarningTest.java Wed May 14 07:53:12 2008 -0700
@@ -0,0 +1,315 @@
+/*
+ * Copyright 2006-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+
+/*
+ test
+ @bug 6391770
+ @summary Content of the Window should be laid out in the area left after WarningWindow was added.
+ @author yuri nesterenko: area=
+ @run applet WindowWithWarningTest.html
+*/
+
+// Note there is no @ in front of test above. This is so that the
+// harness will not mistake this file as a test file. It should
+// only see the html file as a test file. (the harness runs all
+// valid test files, so it would run this test twice if this file
+// were valid as well as the html file.)
+// Also, note the area= after Your Name in the author tag. Here, you
+// should put which functional area the test falls in. See the
+// AWT-core home page -> test areas and/or -> AWT team for a list of
+// areas.
+// Note also the 'AutomaticAppletTest.html' in the run tag. This should
+// be changed to the name of the test.
+
+
+/**
+ * WindowWithWarningTest.java
+ *
+ * summary:
+ */
+
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+
+//Automated tests should run as applet tests if possible because they
+// get their environments cleaned up, including AWT threads, any
+// test created threads, and any system resources used by the test
+// such as file descriptors. (This is normally not a problem as
+// main tests usually run in a separate VM, however on some platforms
+// such as the Mac, separate VMs are not possible and non-applet
+// tests will cause problems). Also, you don't have to worry about
+// synchronisation stuff in Applet tests they way you do in main
+// tests...
+
+
+public class WindowWithWarningTest extends Applet
+{
+ //Declare things used in the test, like buttons and labels here
+ boolean buttonClicked = false;
+ public static final int MAX_COUNT = 100;
+
+ public void init()
+ {
+ //Create instructions for the user here, as well as set up
+ // the environment -- set the layout manager, add buttons,
+ // etc.
+
+ this.setLayout (new BorderLayout ());
+
+ String[] instructions =
+ {
+ "This is an AUTOMATIC test",
+ "simply wait until it is done"
+ };
+ //Sysout.createDialog( );
+ //Sysout.printInstructions( instructions );
+
+ }//End init()
+ public void start ()
+ {
+ //Get things going. Request focus, set size, et cetera
+ System.setSecurityManager( new SecurityManager() {
+ // deny AWTPermission("showWindowWithoutWarningBanner")
+ public boolean checkTopLevelWindow(Object window) {
+ return false;
+ }
+ });
+ JFrame frame = new JFrame("Window Test");
+ frame.setBounds(50, 50, 200, 200);
+ frame.show();
+
+ JWindow window = new JWindow( frame );
+ JButton jbutton1 = new JButton( "First" );
+ jbutton1.addMouseListener( new MouseAdapter() {
+ public void mousePressed( MouseEvent me ) {
+ buttonClicked = true;
+ }
+ });
+ JButton jbutton2 = new JButton( "Second" );
+ window.setLocation( 300, 300 );
+
+ window.add("North", jbutton1);
+ window.add("South", jbutton2);
+
+ window.pack();
+ window.show();
+ //wait for frame to show:
+ getLocation( frame );
+ window.toFront();
+
+ Dimension size0 = window.getSize();
+ Dimension size1 = null;
+ try {
+ Robot robot = new Robot();
+
+ robot.delay(500);
+ window.pack();
+ robot.delay(500);
+ window.pack();
+ // size1 must be the same as size0
+ size1 = window.getSize();
+ robot.delay(500);
+ Point pt = jbutton1.getLocationOnScreen();
+ robot.mouseMove((int) jbutton1.getLocationOnScreen().x + jbutton1.getWidth() / 2,
+ (int) jbutton1.getLocationOnScreen().y + jbutton1.getHeight() / 2);
+ robot.delay(500);
+ robot.mousePress(MouseEvent.BUTTON1_MASK);
+ robot.delay(100);
+ robot.mouseRelease(MouseEvent.BUTTON1_MASK);
+ robot.delay(2000);
+ }catch(Exception e) {
+ throw new RuntimeException( "Exception "+e );
+ }
+ if( !size0.equals(size1) ) {
+ throw new RuntimeException( "Wrong Window size after multiple pack()s");
+ }
+ if( !buttonClicked ) {
+ throw new RuntimeException( "Button was not clicked");
+ }
+ window.dispose();
+ frame.dispose();
+
+ System.out.println("Test Passed.");
+ }// start()
+ public static Point getLocation( Component co ) throws RuntimeException {
+ Point pt = null;
+ boolean bFound = false;
+ int count = 0;
+ while( !bFound ) {
+ try {
+ pt = co.getLocationOnScreen();
+ bFound = true;
+ }catch( Exception ex ) {
+ bFound = false;
+ count++;
+ }
+ if( !bFound && count > MAX_COUNT ) {
+ throw new RuntimeException("don't see a component to get location");
+ }
+ }
+ return pt;
+ }
+
+
+}// class AutomaticAppletTest
+
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+ chunk of code whose purpose is to make user
+ interaction uniform, and thereby make it simpler
+ to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+ for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+ WithInstructions method. Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+ with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+ as standalone.
+ */
+
+class Sysout
+{
+ private static TestDialog dialog;
+
+ public static void createDialogWithInstructions( String[] instructions )
+ {
+ dialog = new TestDialog( new Frame(), "Instructions" );
+ dialog.printInstructions( instructions );
+ dialog.setVisible(true);
+ println( "Any messages for the tester will display here." );
+ }
+
+ public static void createDialog( )
+ {
+ dialog = new TestDialog( new Frame(), "Instructions" );
+ String[] defInstr = { "Instructions will appear here. ", "" } ;
+ dialog.printInstructions( defInstr );
+ dialog.setVisible(true);
+ println( "Any messages for the tester will display here." );
+ }
+
+
+ public static void printInstructions( String[] instructions )
+ {
+ dialog.printInstructions( instructions );
+ }
+
+
+ public static void println( String messageIn )
+ {
+ dialog.displayMessage( messageIn );
+ }
+
+}// Sysout class
+
+/**
+ This is part of the standard test machinery. It provides a place for the
+ test instructions to be displayed, and a place for interactive messages
+ to the user to be displayed.
+ To have the test instructions displayed, see Sysout.
+ To have a message to the user be displayed, see Sysout.
+ Do not call anything in this dialog directly.
+ */
+class TestDialog extends Dialog
+{
+
+ TextArea instructionsText;
+ TextArea messageText;
+ int maxStringLength = 80;
+
+ //DO NOT call this directly, go through Sysout
+ public TestDialog( Frame frame, String name )
+ {
+ super( frame, name );
+ int scrollBoth = TextArea.SCROLLBARS_BOTH;
+ instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+ add( "North", instructionsText );
+
+ messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+ add("Center", messageText);
+
+ pack();
+
+ show();
+ }// TestDialog()
+
+ //DO NOT call this directly, go through Sysout
+ public void printInstructions( String[] instructions )
+ {
+ //Clear out any current instructions
+ instructionsText.setText( "" );
+
+ //Go down array of instruction strings
+
+ String printStr, remainingStr;
+ for( int i=0; i < instructions.length; i++ )
+ {
+ //chop up each into pieces maxSringLength long
+ remainingStr = instructions[ i ];
+ while( remainingStr.length() > 0 )
+ {
+ //if longer than max then chop off first max chars to print
+ if( remainingStr.length() >= maxStringLength )
+ {
+ //Try to chop on a word boundary
+ int posOfSpace = remainingStr.
+ lastIndexOf( ' ', maxStringLength - 1 );
+
+ if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+ printStr = remainingStr.substring( 0, posOfSpace + 1 );
+ remainingStr = remainingStr.substring( posOfSpace + 1 );
+ }
+ //else just print
+ else
+ {
+ printStr = remainingStr;
+ remainingStr = "";
+ }
+
+ instructionsText.append( printStr + "\n" );
+
+ }// while
+
+ }// for
+
+ }//printInstructions()
+
+ //DO NOT call this directly, go through Sysout
+ public void displayMessage( String messageIn )
+ {
+ messageText.append( messageIn + "\n" );
+ System.out.println(messageIn);
+ }
+
+}// TestDialog class
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/List/ListFlickers/ListFlickers.java Wed May 14 07:53:12 2008 -0700
@@ -0,0 +1,402 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ @test
+ @bug 6471693
+ @summary Moving the vertical scroll bar of List leads flickering.
+ @author Dmitry Cherepanov area=awt.list
+ @run main/manual ListFlickers
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+
+public class ListFlickers
+{
+
+ //*** test-writer defined static variables go here ***
+
+
+ private static void init()
+ {
+ //*** Create instructions for the user here ***
+
+ String[] instructions =
+ {
+ "drag the scrollbar of the list up and down,",
+ "if the list flickers then the test fails,",
+ "otherwise it passes."
+ };
+ Sysout.createDialog( );
+ Sysout.printInstructions( instructions );
+
+
+ Frame f = new Frame();
+ List list = new List(10, false);
+ for (int i = 0; i < 100; i++) {
+ list.add(" item "+i);
+ }
+ f.add(list);
+ f.setBounds(100,100,300,300);
+ f.setVisible(true);
+
+ }//End init()
+
+
+
+ /*****************************************************
+ * Standard Test Machinery Section
+ * DO NOT modify anything in this section -- it's a
+ * standard chunk of code which has all of the
+ * synchronisation necessary for the test harness.
+ * By keeping it the same in all tests, it is easier
+ * to read and understand someone else's test, as
+ * well as insuring that all tests behave correctly
+ * with the test harness.
+ * There is a section following this for test-defined
+ * classes
+ ******************************************************/
+ private static boolean theTestPassed = false;
+ private static boolean testGeneratedInterrupt = false;
+ private static String failureMessage = "";
+
+ private static Thread mainThread = null;
+
+ private static int sleepTime = 300000;
+
+ public static void main( String args[] ) throws InterruptedException
+ {
+ mainThread = Thread.currentThread();
+ try
+ {
+ init();
+ }
+ catch( TestPassedException e )
+ {
+ //The test passed, so just return from main and harness will
+ // interepret this return as a pass
+ return;
+ }
+ //At this point, neither test passed nor test failed has been
+ // called -- either would have thrown an exception and ended the
+ // test, so we know we have multiple threads.
+
+ //Test involves other threads, so sleep and wait for them to
+ // called pass() or fail()
+ try
+ {
+ Thread.sleep( sleepTime );
+ //Timed out, so fail the test
+ throw new RuntimeException( "Timed out after " + sleepTime/1000 + " seconds" );
+ }
+ catch (InterruptedException e)
+ {
+ if( ! testGeneratedInterrupt ) throw e;
+
+ //reset flag in case hit this code more than once for some reason (just safety)
+ testGeneratedInterrupt = false;
+ if ( theTestPassed == false )
+ {
+ throw new RuntimeException( failureMessage );
+ }
+ }
+
+ }//main
+
+ public static synchronized void setTimeoutTo( int seconds )
+ {
+ sleepTime = seconds * 1000;
+ }
+
+ public static synchronized void pass()
+ {
+ Sysout.println( "The test passed." );
+ Sysout.println( "The test is over, hit Ctl-C to stop Java VM" );
+ //first check if this is executing in main thread
+ if ( mainThread == Thread.currentThread() )
+ {
+ //Still in the main thread, so set the flag just for kicks,
+ // and throw a test passed exception which will be caught
+ // and end the test.
+ theTestPassed = true;
+ throw new TestPassedException();
+ }
+ //pass was called from a different thread, so set the flag and interrupt
+ // the main thead.
+ theTestPassed = true;
+ testGeneratedInterrupt = true;
+ if (mainThread != null){
+ mainThread.interrupt();
+ }
+ }//pass()
+
+ public static synchronized void fail()
+ {
+ //test writer didn't specify why test failed, so give generic
+ fail( "it just plain failed! :-)" );
+ }
+
+ public static synchronized void fail( String whyFailed )
+ {
+ Sysout.println( "The test failed: " + whyFailed );
+ Sysout.println( "The test is over, hit Ctl-C to stop Java VM" );
+ //check if this called from main thread
+ if ( mainThread == Thread.currentThread() )
+ {
+ //If main thread, fail now 'cause not sleeping
+ throw new RuntimeException( whyFailed );
+ }
+ theTestPassed = false;
+ testGeneratedInterrupt = true;
+ failureMessage = whyFailed;
+ mainThread.interrupt();
+ }//fail()
+
+}// class ManualMainTest
+
+//This exception is used to exit from any level of call nesting
+// when it's determined that the test has passed, and immediately
+// end the test.
+class TestPassedException extends RuntimeException
+{
+}
+
+//*********** End Standard Test Machinery Section **********
+
+
+//************ Begin classes defined for the test ****************
+
+// make listeners in a class defined here, and instantiate them in init()
+
+/* Example of a class which may be written as part of a test
+class NewClass implements anInterface
+ {
+ static int newVar = 0;
+
+ public void eventDispatched(AWTEvent e)
+ {
+ //Counting events to see if we get enough
+ eventCount++;
+
+ if( eventCount == 20 )
+ {
+ //got enough events, so pass
+
+ ManualMainTest.pass();
+ }
+ else if( tries == 20 )
+ {
+ //tried too many times without getting enough events so fail
+
+ ManualMainTest.fail();
+ }
+
+ }// eventDispatched()
+
+ }// NewClass class
+
+*/
+
+
+//************** End classes defined for the test *******************
+
+
+
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+ chunk of code whose purpose is to make user
+ interaction uniform, and thereby make it simpler
+ to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+ for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+ WithInstructions method. Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+ with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+ as standalone.
+ */
+
+class Sysout
+{
+ private static TestDialog dialog;
+ private static boolean numbering = false;
+ private static int messageNumber = 0;
+
+ public static void createDialogWithInstructions( String[] instructions )
+ {
+ dialog = new TestDialog( new Frame(), "Instructions" );
+ dialog.printInstructions( instructions );
+ dialog.setVisible(true);
+ println( "Any messages for the tester will display here." );
+ }
+
+ public static void createDialog( )
+ {
+ dialog = new TestDialog( new Frame(), "Instructions" );
+ String[] defInstr = { "Instructions will appear here. ", "" } ;
+ dialog.printInstructions( defInstr );
+ dialog.setVisible(true);
+ println( "Any messages for the tester will display here." );
+ }
+
+
+ /* Enables message counting for the tester. */
+ public static void enableNumbering(boolean enable){
+ numbering = enable;
+ }
+
+ public static void printInstructions( String[] instructions )
+ {
+ dialog.printInstructions( instructions );
+ }
+
+
+ public static void println( String messageIn )
+ {
+ if (numbering) {
+ messageIn = "" + messageNumber + " " + messageIn;
+ messageNumber++;
+ }
+ dialog.displayMessage( messageIn );
+ }
+
+}// Sysout class
+
+/**
+ This is part of the standard test machinery. It provides a place for the
+ test instructions to be displayed, and a place for interactive messages
+ to the user to be displayed.
+ To have the test instructions displayed, see Sysout.
+ To have a message to the user be displayed, see Sysout.
+ Do not call anything in this dialog directly.
+ */
+class TestDialog extends Dialog implements ActionListener
+{
+
+ TextArea instructionsText;
+ TextArea messageText;
+ int maxStringLength = 80;
+ Panel buttonP = new Panel();
+ Button passB = new Button( "pass" );
+ Button failB = new Button( "fail" );
+
+ //DO NOT call this directly, go through Sysout
+ public TestDialog( Frame frame, String name )
+ {
+ super( frame, name );
+ int scrollBoth = TextArea.SCROLLBARS_BOTH;
+ instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+ add( "North", instructionsText );
+
+ messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+ add("Center", messageText);
+
+ passB = new Button( "pass" );
+ passB.setActionCommand( "pass" );
+ passB.addActionListener( this );
+ buttonP.add( "East", passB );
+
+ failB = new Button( "fail" );
+ failB.setActionCommand( "fail" );
+ failB.addActionListener( this );
+ buttonP.add( "West", failB );
+
+ add( "South", buttonP );
+ pack();
+
+ setVisible(true);
+ }// TestDialog()
+
+ //DO NOT call this directly, go through Sysout
+ public void printInstructions( String[] instructions )
+ {
+ //Clear out any current instructions
+ instructionsText.setText( "" );
+
+ //Go down array of instruction strings
+
+ String printStr, remainingStr;
+ for( int i=0; i < instructions.length; i++ )
+ {
+ //chop up each into pieces maxSringLength long
+ remainingStr = instructions[ i ];
+ while( remainingStr.length() > 0 )
+ {
+ //if longer than max then chop off first max chars to print
+ if( remainingStr.length() >= maxStringLength )
+ {
+ //Try to chop on a word boundary
+ int posOfSpace = remainingStr.
+ lastIndexOf( ' ', maxStringLength - 1 );
+
+ if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+ printStr = remainingStr.substring( 0, posOfSpace + 1 );
+ remainingStr = remainingStr.substring( posOfSpace + 1 );
+ }
+ //else just print
+ else
+ {
+ printStr = remainingStr;
+ remainingStr = "";
+ }
+
+ instructionsText.append( printStr + "\n" );
+
+ }// while
+
+ }// for
+
+ }//printInstructions()
+
+ //DO NOT call this directly, go through Sysout
+ public void displayMessage( String messageIn )
+ {
+ messageText.append( messageIn + "\n" );
+ System.out.println(messageIn);
+ }
+
+ //catch presses of the passed and failed buttons.
+ //simply call the standard pass() or fail() static methods of
+ //ManualMainTest
+ public void actionPerformed( ActionEvent e )
+ {
+ if( e.getActionCommand() == "pass" )
+ {
+ ListFlickers.pass();
+ }
+ else
+ {
+ ListFlickers.fail();
+ }
+ }
+
+}// TestDialog class
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/TextField/ScrollSelectionTest/ScrollSelectionTest.html Wed May 14 07:53:12 2008 -0700
@@ -0,0 +1,20 @@
+<html>
+<!--
+ @test
+ @bug 4118621
+ @summary tests that selected text isn't scrolled if there is enough room.
+ @author prs: area=TextField
+ @run applet/manual=yesno ScrollSelectionTest.html
+ -->
+<head>
+<title> ScrollSelectionTest </title>
+</head>
+<body>
+
+<h1>ScrollSelectionTest<br>4118621: </h1>
+
+<p> See the dialog box (usually in upper left corner) for instructions</p>
+
+<APPLET CODE="ScrollSelectionTest.class" WIDTH=300 HEIGHT=300></APPLET>
+</body>
+</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/TextField/ScrollSelectionTest/ScrollSelectionTest.java Wed May 14 07:53:12 2008 -0700
@@ -0,0 +1,213 @@
+/*
+ * Copyright 1999-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ test
+ @bug 4118621
+ @summary tests that selected text isn't scrolled when there is enough room.
+ @author prs: area=TextField
+ @run applet/manual=yesno ScrollSelectionTest.html
+*/
+
+/**
+ * ScrollSelectionTest.java
+ *
+ * summary: tests that selected text isn't scrolled when there is enough room.
+ */
+
+import java.applet.Applet;
+import java.awt.Dialog;
+import java.awt.Frame;
+import java.awt.TextField;
+import java.awt.TextArea;
+
+public class ScrollSelectionTest extends Applet
+ {
+
+ Frame frame = new Frame("ScrollSelectionTest frame");
+ TextField tf = new TextField(40);
+
+ public void init()
+ {
+ tf.setText("abcdefghijklmnopqrstuvwxyz");
+ frame.add(tf);
+ tf.select(0, 20);
+
+ String[] instructions =
+ {
+ "INSTRUCTIONS:",
+ "This is a test for a win32 specific problem",
+ "If you see all the letters from 'a' to 'z' and",
+ "letters from 'a' to 't' are selected then test passes"
+ };
+ Sysout.createDialogWithInstructions( instructions );
+
+ }// init()
+
+ public void start ()
+ {
+ setSize (300,300);
+ setVisible(true);
+
+ frame.setVisible(true);
+ frame.setBounds (400, 0, 300, 300);
+
+ }// start()
+
+ }// class ScrollSelectionTest
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+ chunk of code whose purpose is to make user
+ interaction uniform, and thereby make it simpler
+ to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+ for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+ WithInstructions method. Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+ with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+ as standalone.
+ */
+
+class Sysout
+ {
+ private static TestDialog dialog;
+
+ public static void createDialogWithInstructions( String[] instructions )
+ {
+ dialog = new TestDialog( new Frame(), "Instructions" );
+ dialog.printInstructions( instructions );
+ dialog.show();
+ println( "Any messages for the tester will display here." );
+ }
+
+ public static void createDialog( )
+ {
+ dialog = new TestDialog( new Frame(), "Instructions" );
+ String[] defInstr = { "Instructions will appear here. ", "" } ;
+ dialog.printInstructions( defInstr );
+ dialog.show();
+ println( "Any messages for the tester will display here." );
+ }
+
+
+ public static void printInstructions( String[] instructions )
+ {
+ dialog.printInstructions( instructions );
+ }
+
+
+ public static void println( String messageIn )
+ {
+ dialog.displayMessage( messageIn );
+ }
+
+ }// Sysout class
+
+/**
+ This is part of the standard test machinery. It provides a place for the
+ test instructions to be displayed, and a place for interactive messages
+ to the user to be displayed.
+ To have the test instructions displayed, see Sysout.
+ To have a message to the user be displayed, see Sysout.
+ Do not call anything in this dialog directly.
+ */
+class TestDialog extends Dialog
+ {
+
+ TextArea instructionsText;
+ TextArea messageText;
+ int maxStringLength = 80;
+
+ //DO NOT call this directly, go through Sysout
+ public TestDialog( Frame frame, String name )
+ {
+ super( frame, name );
+ int scrollBoth = TextArea.SCROLLBARS_BOTH;
+ instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+ add( "North", instructionsText );
+
+ messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+ add("South", messageText);
+
+ pack();
+
+ show();
+ }// TestDialog()
+
+ //DO NOT call this directly, go through Sysout
+ public void printInstructions( String[] instructions )
+ {
+ //Clear out any current instructions
+ instructionsText.setText( "" );
+
+ //Go down array of instruction strings
+
+ String printStr, remainingStr;
+ for( int i=0; i < instructions.length; i++ )
+ {
+ //chop up each into pieces maxSringLength long
+ remainingStr = instructions[ i ];
+ while( remainingStr.length() > 0 )
+ {
+ //if longer than max then chop off first max chars to print
+ if( remainingStr.length() >= maxStringLength )
+ {
+ //Try to chop on a word boundary
+ int posOfSpace = remainingStr.
+ lastIndexOf( ' ', maxStringLength - 1 );
+
+ if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+ printStr = remainingStr.substring( 0, posOfSpace + 1 );
+ remainingStr = remainingStr.substring( posOfSpace + 1 );
+ }
+ //else just print
+ else
+ {
+ printStr = remainingStr;
+ remainingStr = "";
+ }
+
+ instructionsText.append( printStr + "\n" );
+
+ }// while
+
+ }// for
+
+ }//printInstructions()
+
+ //DO NOT call this directly, go through Sysout
+ public void displayMessage( String messageIn )
+ {
+ messageText.append( messageIn + "\n" );
+ }
+
+ }// TestDialog class
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Window/PropertyChangeListenerLockSerialization/PropertyChangeListenerLockSerialization.java Wed May 14 07:53:12 2008 -0700
@@ -0,0 +1,402 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ @test
+ @bug 6681889
+ @summary Showing a deserialized frame should not throw NPE
+ @author anthony.petrov@...: area=awt.toplevel
+ @run main PropertyChangeListenerLockSerialization
+*/
+
+
+/**
+ * PropertyChangeListenerLockSerialization.java
+ *
+ * summary: Showing a deserialized frame should not throw NPE
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+import java.io.*;
+import java.net.*;
+
+public class PropertyChangeListenerLockSerialization
+{
+
+ private static void init()
+ {
+ //*** Create instructions for the user here ***
+
+ String[] instructions =
+ {
+ "This is an AUTOMATIC test, simply wait until it is done.",
+ "The result (passed or failed) will be shown in the",
+ "message window below."
+ };
+ Sysout.createDialog( );
+ Sysout.printInstructions( instructions );
+
+ File file =
+ new File(System.getProperty("test.classes", "."), "frame.ser");
+
+ Frame f = new Frame("Frame");
+ f.setBounds(250, 50, 300, 300);
+ try {
+ OutputStream o = new FileOutputStream(file);
+ ObjectOutputStream oo = new ObjectOutputStream(o);
+
+ oo.writeObject(f);
+ oo.close();
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ fail("Unable to serialize the frame: " + ex);
+ }
+
+ // Cleanup the frame
+ f.dispose();
+ f = null;
+
+ try {
+ ObjectInputStream i = new ObjectInputStream(new FileInputStream(file));
+
+ f = (Frame)i.readObject();
+ f.show();
+ } catch (NullPointerException ex) {
+ ex.printStackTrace();
+ fail("The NullPointerException has been thrown: " + ex);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ fail("Error while deserializing the frame: " + ex);
+ }
+
+ // Cleanup the frame
+ f.dispose();
+ f = null;
+
+ pass();
+
+ }//End init()
+
+
+
+ /*****************************************************
+ * Standard Test Machinery Section
+ * DO NOT modify anything in this section -- it's a
+ * standard chunk of code which has all of the
+ * synchronisation necessary for the test harness.
+ * By keeping it the same in all tests, it is easier
+ * to read and understand someone else's test, as
+ * well as insuring that all tests behave correctly
+ * with the test harness.
+ * There is a section following this for test-
+ * classes
+ ******************************************************/
+ private static boolean theTestPassed = false;
+ private static boolean testGeneratedInterrupt = false;
+ private static String failureMessage = "";
+
+ private static Thread mainThread = null;
+
+ private static int sleepTime = 300000;
+
+ // Not sure about what happens if multiple of this test are
+ // instantiated in the same VM. Being static (and using
+ // static vars), it aint gonna work. Not worrying about
+ // it for now.
+ public static void main( String args[] ) throws InterruptedException
+ {
+ mainThread = Thread.currentThread();
+ try
+ {
+ init();
+ }
+ catch( TestPassedException e )
+ {
+ //The test passed, so just return from main and harness will
+ // interepret this return as a pass
+ return;
+ }
+ //At this point, neither test pass nor test fail has been
+ // called -- either would have thrown an exception and ended the
+ // test, so we know we have multiple threads.
+
+ //Test involves other threads, so sleep and wait for them to
+ // called pass() or fail()
+ try
+ {
+ Thread.sleep( sleepTime );
+ //Timed out, so fail the test
+ throw new RuntimeException( "Timed out after " + sleepTime/1000 + " seconds" );
+ }
+ catch (InterruptedException e)
+ {
+ //The test harness may have interrupted the test. If so, rethrow the exception
+ // so that the harness gets it and deals with it.
+ if( ! testGeneratedInterrupt ) throw e;
+
+ //reset flag in case hit this code more than once for some reason (just safety)
+ testGeneratedInterrupt = false;
+
+ if ( theTestPassed == false )
+ {
+ throw new RuntimeException( failureMessage );
+ }
+ }
+
+ }//main
+
+ public static synchronized void setTimeoutTo( int seconds )
+ {
+ sleepTime = seconds * 1000;
+ }
+
+ public static synchronized void pass()
+ {
+ Sysout.println( "The test passed." );
+ Sysout.println( "The test is over, hit Ctl-C to stop Java VM" );
+ //first check if this is executing in main thread
+ if ( mainThread == Thread.currentThread() )
+ {
+ //Still in the main thread, so set the flag just for kicks,
+ // and throw a test passed exception which will be caught
+ // and end the test.
+ theTestPassed = true;
+ throw new TestPassedException();
+ }
+ theTestPassed = true;
+ testGeneratedInterrupt = true;
+ mainThread.interrupt();
+ }//pass()
+
+ public static synchronized void fail()
+ {
+ //test writer didn't specify why test failed, so give generic
+ fail( "it just plain failed! :-)" );
+ }
+
+ public static synchronized void fail( String whyFailed )
+ {
+ Sysout.println( "The test failed: " + whyFailed );
+ Sysout.println( "The test is over, hit Ctl-C to stop Java VM" );
+ //check if this called from main thread
+ if ( mainThread == Thread.currentThread() )
+ {
+ //If main thread, fail now 'cause not sleeping
+ throw new RuntimeException( whyFailed );
+ }
+ theTestPassed = false;
+ testGeneratedInterrupt = true;
+ failureMessage = whyFailed;
+ mainThread.interrupt();
+ }//fail()
+
+}// class PropertyChangeListenerLockSerialization
+
+//This exception is used to exit from any level of call nesting
+// when it's determined that the test has passed, and immediately
+// end the test.
+class TestPassedException extends RuntimeException
+{
+}
+
+//*********** End Standard Test Machinery Section **********
+
+
+//************ Begin classes defined for the test ****************
+
+// if want to make listeners, here is the recommended place for them, then instantiate
+// them in init()
+
+/* Example of a class which may be written as part of a test
+class NewClass implements anInterface
+ {
+ static int newVar = 0;
+
+ public void eventDispatched(AWTEvent e)
+ {
+ //Counting events to see if we get enough
+ eventCount++;
+
+ if( eventCount == 20 )
+ {
+ //got enough events, so pass
+
+ PropertyChangeListenerLockSerialization.pass();
+ }
+ else if( tries == 20 )
+ {
+ //tried too many times without getting enough events so fail
+
+ PropertyChangeListenerLockSerialization.fail();
+ }
+
+ }// eventDispatched()
+
+ }// NewClass class
+
+*/
+
+
+//************** End classes defined for the test *******************
+
+
+
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+ chunk of code whose purpose is to make user
+ interaction uniform, and thereby make it simpler
+ to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+ for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+ WithInstructions method. Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+ with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+ as standalone.
+ */
+
+class Sysout
+{
+ private static TestDialog dialog;
+
+ public static void createDialogWithInstructions( String[] instructions )
+ {
+ dialog = new TestDialog( new Frame(), "Instructions" );
+ dialog.printInstructions( instructions );
+ dialog.setVisible(true);
+ println( "Any messages for the tester will display here." );
+ }
+
+ public static void createDialog( )
+ {
+ dialog = new TestDialog( new Frame(), "Instructions" );
+ String[] defInstr = { "Instructions will appear here. ", "" } ;
+ dialog.printInstructions( defInstr );
+ dialog.setVisible(true);
+ println( "Any messages for the tester will display here." );
+ }
+
+
+ public static void printInstructions( String[] instructions )
+ {
+ dialog.printInstructions( instructions );
+ }
+
+
+ public static void println( String messageIn )
+ {
+ dialog.displayMessage( messageIn );
+ System.out.println(messageIn);
+ }
+
+}// Sysout class
+
+/**
+ This is part of the standard test machinery. It provides a place for the
+ test instructions to be displayed, and a place for interactive messages
+ to the user to be displayed.
+ To have the test instructions displayed, see Sysout.
+ To have a message to the user be displayed, see Sysout.
+ Do not call anything in this dialog directly.
+ */
+class TestDialog extends Dialog
+{
+
+ TextArea instructionsText;
+ TextArea messageText;
+ int maxStringLength = 80;
+
+ //DO NOT call this directly, go through Sysout
+ public TestDialog( Frame frame, String name )
+ {
+ super( frame, name );
+ int scrollBoth = TextArea.SCROLLBARS_BOTH;
+ instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+ add( "North", instructionsText );
+
+ messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+ add("Center", messageText);
+
+ pack();
+
+ setVisible(true);
+ }// TestDialog()
+
+ //DO NOT call this directly, go through Sysout
+ public void printInstructions( String[] instructions )
+ {
+ //Clear out any current instructions
+ instructionsText.setText( "" );
+
+ //Go down array of instruction strings
+
+ String printStr, remainingStr;
+ for( int i=0; i < instructions.length; i++ )
+ {
+ //chop up each into pieces maxSringLength long
+ remainingStr = instructions[ i ];
+ while( remainingStr.length() > 0 )
+ {
+ //if longer than max then chop off first max chars to print
+ if( remainingStr.length() >= maxStringLength )
+ {
+ //Try to chop on a word boundary
+ int posOfSpace = remainingStr.
+ lastIndexOf( ' ', maxStringLength - 1 );
+
+ if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+ printStr = remainingStr.substring( 0, posOfSpace + 1 );
+ remainingStr = remainingStr.substring( posOfSpace + 1 );
+ }
+ //else just print
+ else
+ {
+ printStr = remainingStr;
+ remainingStr = "";
+ }
+
+ instructionsText.append( printStr + "\n" );
+
+ }// while
+
+ }// for
+
+ }//printInstructions()
+
+ //DO NOT call this directly, go through Sysout
+ public void displayMessage( String messageIn )
+ {
+ messageText.append( messageIn + "\n" );
+ System.out.println(messageIn);
+ }
+
+}// TestDialog class
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/appletviewer/IOExceptionIfEncodedURLTest/IOExceptionIfEncodedURLTest.java Wed May 14 07:53:12 2008 -0700
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ test
+ @bug 6193279
+ @summary REGRESSION: AppletViewer throws IOException when path is encoded URL
+ @author Dmitry Cherepanov: area=appletviewer
+ @run compile IOExceptionIfEncodedURLTest.java
+ @run main IOExceptionIfEncodedURLTest
+ @run shell IOExceptionIfEncodedURLTest.sh
+*/
+
+import java.applet.Applet;
+import sun.net.www.ParseUtil;
+import java.io.File;
+import java.net.MalformedURLException;
+
+public class IOExceptionIfEncodedURLTest extends Applet{
+ public void init(){
+ }
+
+ public void start(){
+ // We check that appletviewer writes this message to log file
+ System.err.println("the appletviewer started");
+ }
+
+ // We expect that sun.net.www.ParseUtil.fileToEncodedURL works like following
+ // if relative file URL, like this "file:index.html" is processed
+ static String url = "file:IOExceptionIfEncodedURLTest.java";
+ public static final void main(String args[])
+ throws MalformedURLException{
+ System.err.println("prior checking...");
+ String prefix = "file:";
+ String path = ParseUtil.fileToEncodedURL(new File(System.getProperty("user.dir"))).getPath();
+ String filename = url.substring(prefix.length());
+ System.err.println("url="+url+" -> path="+path+",filename="+filename);
+
+ if (!path.endsWith("/") && !filename.startsWith("/")) {
+ throw new RuntimeException("Incorrect '/' processing");
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/appletviewer/IOExceptionIfEncodedURLTest/IOExceptionIfEncodedURLTest.sh Wed May 14 07:53:12 2008 -0700
@@ -0,0 +1,231 @@
+#
+# Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Sun designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Sun in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+# CA 95054 USA or visit www.sun.com if you need additional information or
+# have any questions.
+#
+
+#!/bin/ksh -p
+#
+# @test IOExceptionIfEncodedURLTest.sh
+# @bug 6193279 6619458
+# @summary REGRESSION: AppletViewer throws IOException when path is encoded URL
+# @author Dmitry Cherepanov: area=appletviewer
+# @run compile IOExceptionIfEncodedURLTest.java
+# @run main IOExceptionIfEncodedURLTest
+# @run shell IOExceptionIfEncodedURLTest.sh
+
+# Beginning of subroutines:
+status=1
+
+#Call this from anywhere to fail the test with an error message
+# usage: fail "reason why the test failed"
+fail()
+ { echo "The test failed :-("
+ echo "$*" 1>&2
+ echo "exit status was $status"
+ exit $status
+ } #end of fail()
+
+#Call this from anywhere to pass the test with a message
+# usage: pass "reason why the test passed if applicable"
+pass()
+ { echo "The test passed!!!"
+ echo "$*" 1>&2
+ exit 0
+ } #end of pass()
+
+#Call this to run the test with a file name
+test()
+ {
+ ${TESTJAVA}${FILESEP}bin${FILESEP}appletviewer -Xnosecurity ${URL} > err 2>&1 &
+ APPLET_ID=$!
+ sleep 15
+ kill -9 $APPLET_ID
+
+ # these exceptions will be thrown if the test fails
+ cat err | grep "I/O exception while reading"
+ exception=$?
+ if [ $exception = "0" ];
+ then fail "test failed for "${URL}", see err file and CRs #6193279,6329251,6376334"
+ fi
+
+ cat err | grep "java.lang.ClassNotFoundException"
+ exception=$?
+ if [ $exception = "0" ];
+ then fail "test failed for "${URL}", see err file and CRs #6193279,6329251,6376334"
+ fi
+
+ # the applet will log the same message
+ cat err | grep "the appletviewer started"
+ started=$?
+
+ echo $started | grep "2"
+ if [ $? = 0 ] ;
+ then fail "test failed for "${URL}": syntax errors or inaccessible files"
+ fi
+
+ if [ $started = "0" ];
+ then echo "the test passed for "${URL}
+ else fail "test failed for "${URL}": the appletviewer behaviour is unexpected: "$started", see err file"
+ fi
+ }
+
+# end of subroutines
+
+
+# The beginning of the script proper
+
+# Checking for proper OS
+OS=`uname -s`
+case "$OS" in
+ SunOS )
+ VAR="One value for Sun"
+ DEFAULT_JDK=/usr/local/java/jdk1.2.1/solaris
+ FILESEP="/"
+ ;;
+
+ Linux )
+ VAR="A different value for Linux"
+ DEFAULT_JDK=/usr/local/java/jdk1.4/linux-i386
+ FILESEP="/"
+ ;;
+
+ Windows_95 | Windows_98 | Windows_NT | Windows_ME | CYGWIN_NT-5.1)
+ VAR="A different value for Win32"
+ DEFAULT_JDK=/usr/local/java/jdk1.2.1/win32
+ FILESEP="\\"
+ ;;
+
+ # catch all other OSs
+ * )
+ echo "Unrecognized system! $OS"
+ fail "Unrecognized system! $OS"
+ ;;
+esac
+
+# 6438730: Only a minimal set of env variables are set for shell tests.
+# To guarantee that env variable holds correct value we need to set it ourselves.
+if [ -z "${PWD}" ] ; then
+ PWD=`pwd`
+fi
+
+# check that some executable or other file you need is available, abort if not
+# note that the name of the executable is in the fail string as well.
+# this is how to check for presence of the compiler, etc.
+#RESOURCE=`whence SomeProgramOrFileNeeded`
+#if [ "${RESOURCE}" = "" ] ;
+# then fail "Need SomeProgramOrFileNeeded to perform the test" ;
+#fi
+
+# Want this test to run standalone as well as in the harness, so do the
+# following to copy the test's directory into the harness's scratch directory
+# and set all appropriate variables:
+
+if [ -z "${TESTJAVA}" ] ; then
+ # TESTJAVA is not set, so the test is running stand-alone.
+ # TESTJAVA holds the path to the root directory of the build of the JDK
+ # to be tested. That is, any java files run explicitly in this shell
+ # should use TESTJAVA in the path to the java interpreter.
+ # So, we'll set this to the JDK spec'd on the command line. If none
+ # is given on the command line, tell the user that and use a cheesy
+ # default.
+ # THIS IS THE JDK BEING TESTED.
+ if [ -n "$1" ] ;
+ then TESTJAVA=$1
+ else echo "no JDK specified on command line so using default!"
+ TESTJAVA=$DEFAULT_JDK
+ fi
+ TESTSRC=.
+ TESTCLASSES=.
+ STANDALONE=1;
+fi
+echo "JDK under test is: $TESTJAVA"
+
+#Deal with .class files:
+if [ -n "${STANDALONE}" ] ;
+ then
+ #if standalone, remind user to cd to dir. containing test before running it
+ echo "Just a reminder: cd to the dir containing this test when running it"
+ # then compile all .java files (if there are any) into .class files
+ if [ -a *.java ] ;
+ then echo "Reminder, this test should be in its own directory with all"
+ echo "supporting files it needs in the directory with it."
+ ${TESTJAVA}/bin/javac ./*.java ;
+ fi
+ # else in harness so copy all the class files from where jtreg put them
+ # over to the scratch directory this test is running in.
+ else cp ${TESTCLASSES}/*.class . ;
+fi
+
+#if in test harness, then copy the entire directory that the test is in over
+# to the scratch directory. This catches any support files needed by the test.
+#if [ -z "${STANDALONE}" ] ;
+# then cp ${TESTSRC}/* .
+#fi
+
+#Just before executing anything, make sure it has executable permission!
+chmod 777 ./*
+
+############### YOUR TEST CODE HERE!!!!!!! #############
+
+#All files required for the test should be in the same directory with
+# this file. If converting a standalone test to run with the harness,
+# as long as all files are in the same directory and it returns 0 for
+# pass, you should be able to cut and paste it into here and it will
+# run with the test harness.
+
+# This is an example of running something -- test
+# The stuff below catches the exit status of test then passes or fails
+# this shell test as appropriate ( 0 status is considered a pass here )
+
+# The test verifies that appletviewer correctly works with the different
+# names of the files, including relative and absolute paths
+
+# 6619458: exclude left brace from the name of the files managed by the VCS
+NAME='test.html'
+
+ENCODED='te%7Bst.html'
+UNENCODED='te{st.html'
+
+# Copy needed files into the harness's scratch directory
+# or create a copy with the required name if the test is
+# running as stand-alone
+cp ${TESTSRC}${FILESEP}${NAME} ${UNENCODED}
+
+# the encoded name, the path is absolute
+URL="file:"${PWD}${FILESEP}${ENCODED}
+test
+
+# the encoded name, the path is relative
+URL="file:"${ENCODED}
+test
+
+# the unencoded name, the path is absolute
+URL="file:"${PWD}${FILESEP}${UNENCODED}
+test
+
+# the unencoded name, the path is relative
+URL="file:"${UNENCODED}
+test
+
+# pick up our toys from the scratch directory
+rm ${UNENCODED}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/appletviewer/IOExceptionIfEncodedURLTest/test.html Wed May 14 07:53:12 2008 -0700
@@ -0,0 +1,21 @@
+<html>
+<!--
+ test
+ @bug 6193279
+ @summary REGRESSION: AppletViewer throws IOException when path is encoded URL
+ @author Dmitry.Cherepanov@SUN.COM : area=appletviewer
+ @run compile IOExceptionIfEncodedURLTest.java
+ @run shell IOExceptionIfEncodedURLTest.sh
+ -->
+<head>
+<title>Started by shell script</title>
+</head>
+<body>
+
+<h1>IOExceptionIfEncodedURLTest<br>Bug ID: 6193279</h1>
+
+<p> See the dialog box (usually in upper left corner) for instructions</p>
+
+<APPLET CODE="IOExceptionIfEncodedURLTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/xembed/server/JavaClient.java Wed May 14 07:53:12 2008 -0700
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2004-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+import java.awt.*;
+import sun.awt.*;
+import java.awt.event.*;
+import java.lang.reflect.*;
+import java.awt.dnd.*;
+import java.awt.datatransfer.*;
+
+public class JavaClient {
+ ClientContainer cont;
+ public static void main(String[] args) {
+ if (System.getProperty("os.name").toLowerCase().startsWith("win")) {
+ return;
+ }
+
+ // Enable testing extensions in XEmbed server
+ System.setProperty("sun.awt.xembed.testing", "true");
+
+ boolean xtoolkit = "sun.awt.X11.XToolkit".equals(Toolkit.getDefaultToolkit().getClass().getName());
+ final EmbeddedFrame ef = createEmbeddedFrame(xtoolkit, Long.parseLong(args[0]));
+ ef.setBackground(new Color(100, 100, 200));
+ ef.setLayout(new BorderLayout());
+ ef.add(new ClientContainer(ef), BorderLayout.CENTER);
+ ef.pack();
+ ef.registerListeners();
+ ef.setVisible(true);
+ }
+ private static EmbeddedFrame createEmbeddedFrame(boolean xtoolkit, long window) {
+ try {
+ Class cl = (xtoolkit?Class.forName("sun.awt.X11.XEmbeddedFrame"):Class.forName("sun.awt.motif.MEmbeddedFrame"));
+ Constructor cons = cl.getConstructor(new Class[]{Long.TYPE, Boolean.TYPE});
+ return (EmbeddedFrame)cons.newInstance(new Object[] {window, true});
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new RuntimeException("Can't create embedded frame");
+ }
+ }
+}
+
+class ClientContainer extends Container {
+ Window parent;
+ int width, height;
+ public ClientContainer(Window w) {
+ parent = w;
+ width = 500;
+ height = 50;
+ final TextField tf = new TextField(30);
+
+ DragSource ds = new DragSource();
+ final DragSourceListener dsl = new DragSourceAdapter() {
+ public void dragDropEnd(DragSourceDropEvent dsde) {
+ }
+ };
+ final DragGestureListener dgl = new DragGestureListener() {
+ public void dragGestureRecognized(DragGestureEvent dge) {
+ dge.startDrag(null, new StringSelection(tf.getText()), dsl);
+ }
+ };
+ ds.createDefaultDragGestureRecognizer(tf, DnDConstants.ACTION_COPY, dgl);
+
+ final DropTargetListener dtl = new DropTargetAdapter() {
+ public void drop(DropTargetDropEvent dtde) {
+ dtde.acceptDrop(DnDConstants.ACTION_COPY);
+ try {
+ tf.setText(tf.getText() + (String)dtde.getTransferable().getTransferData(DataFlavor.stringFlavor));
+ } catch (Exception e) {
+ }
+ }
+ };
+ final DropTarget dt = new DropTarget(tf, dtl);
+
+ setLayout(new FlowLayout());
+ add(tf);
+ Button close = new Button("Close");
+ close.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ parent.dispose();
+ }
+ });
+ Button inc = new Button("Increase size");
+ inc.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ changeSize(10);
+ }
+ });
+ Button dec = new Button("Decrease size");
+ dec.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ changeSize(-10);
+ }
+ });
+ add(close);
+ add(inc);
+ add(dec);
+ }
+ void changeSize(int step) {
+ width += step;
+ height += step;
+ parent.pack();
+ }
+ public Dimension getPreferredSize() {
+ return new Dimension(width, height);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/xembed/server/RunTestXEmbed.java Wed May 14 07:53:12 2008 -0700
@@ -0,0 +1,176 @@
+/*
+ * Copyright 2004-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/**
+ * @test
+ * @bug 4931668
+ * @summary Tests XEmbed server/client functionality
+ * @author Denis Mikhalkin: area=awt.xembed
+ * @compile JavaClient.java TesterClient.java TestXEmbedServer.java
+ * @run main/timeout=6000 RunTestXEmbed
+ */
+
+import java.awt.Rectangle;
+import java.lang.reflect.Method;
+import java.util.logging.*;
+import java.util.*;
+import java.io.*;
+
+public class RunTestXEmbed extends TestXEmbedServer {
+ private static final Logger log = Logger.getLogger("test.xembed");
+ private Method test;
+ private boolean passed = false;
+ public RunTestXEmbed(Method test) {
+ super(false);
+ this.test = test;
+ }
+
+ public Process startClient(Rectangle bounds[], long window) {
+ try {
+ String java_home = System.getProperty("java.home");
+ StringBuilder buf = new StringBuilder();
+ for (int i = 0; i < bounds.length; i++) {
+ buf.append(" " + bounds[i].x);
+ buf.append(" " + bounds[i].y);
+ buf.append(" " + bounds[i].width);
+ buf.append(" " + bounds[i].height);
+ }
+ Map envs = System.getenv();
+ String enva[] = new String[envs.size()];
+ int ind = 0;
+ Iterator iter = envs.entrySet().iterator();
+ while (iter.hasNext()) {
+ Map.Entry entry = (Map.Entry)iter.next();
+ if (!"AWT_TOOLKIT".equals(entry.getKey())) {
+ enva[ind++] = entry.getKey() + "=" + entry.getValue();
+ } else {
+ enva[ind++] = "AWT_TOOLKIT=sun.awt.X11.XToolkit";
+ }
+ }
+ Process proc = Runtime.getRuntime().exec(java_home +
+ "/bin/java -Dawt.toolkit=sun.awt.X11.XToolkit TesterClient "
+ + test.getName() + " " + window + buf,
+ enva);
+ System.err.println("Test for " + test.getName() + " has started.");
+ log.fine("Test for " + test.getName() + " has started.");
+ new InputReader(proc.getInputStream());
+ new InputReader(proc.getErrorStream());
+ try {
+ passed = (proc.waitFor() == 0);
+ } catch (InterruptedException ie) {
+ }
+ log.fine("Test for " + test.getName() + " has finished.");
+ File logFile = new File("java3.txt");
+ if (logFile.exists()) {
+ logFile.renameTo(new File(test.getName() + ".txt"));
+ }
+ return proc;
+ } catch (IOException ex1) {
+ ex1.printStackTrace();
+ }
+ return null;
+ }
+
+ public static void main(String[] args) throws Throwable {
+ if (System.getProperty("os.name").toLowerCase().startsWith("win")) {
+ return;
+ }
+
+ // Enabled XEmbed
+ System.setProperty("sun.awt.xembedserver", "true");
+
+ if (args.length == 1) {
+ Class cl = Class.forName("sun.awt.X11.XEmbedServerTester");
+ Method meth = cl.getMethod(args[0], new Class[0]);
+ System.err.println("Performing single test " + args[0]);
+ boolean res = performTest(meth);
+ if (!res) {
+ System.err.println("Test " + args[0] + " has failed");
+ } else {
+ System.err.println("Test " + args[0] + " has passed");
+ }
+ } else {
+ Class cl = Class.forName("sun.awt.X11.XEmbedServerTester");
+ Method[] meths = cl.getMethods();
+ LinkedList failed = new LinkedList();
+ for (int i = 0; i < meths.length; i++) {
+ Method meth = meths[i];
+ if (meth.getReturnType() == Void.TYPE && meth.getName().startsWith("test") && meth.getParameterTypes().length == 0) {
+ System.err.println("Performing " + meth.getName());
+ boolean res = performTest(meth);
+ if (!res) {
+ failed.add(meth);
+ }
+ }
+ }
+ log.info("Testing finished.");
+ if (failed.size() != 0) {
+ System.err.println("Some tests have failed:");
+ Iterator iter = failed.iterator();
+ while(iter.hasNext()) {
+ Method meth = (Method)iter.next();
+ System.err.println(meth.getName());
+ }
+ throw new RuntimeException("TestFAILED: some of the testcases are failed");
+ } else {
+ System.err.println("All PASSED");
+ }
+ }
+ }
+
+ private static boolean performTest(Method meth) {
+ RunTestXEmbed test = new RunTestXEmbed(meth);
+ test.addClient();
+ test.dispose();
+ return test.isPassed();
+ }
+
+ public boolean isPassed() {
+ return passed;
+ }
+}
+
+class InputReader extends Thread {
+ private InputStream stream;
+ public InputReader(InputStream stream) {
+ this.stream = stream;
+ start();
+ }
+ public void run() {
+ while (!interrupted()) {
+ try {
+ int inp = stream.read();
+ if (inp != -1) {
+ System.out.write(inp);
+ } else {
+ try {
+ Thread.sleep(100);
+ } catch (Exception iie) {
+ }
+ }
+ } catch (IOException ie) {
+ break;
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/xembed/server/TestXEmbedServer.java Wed May 14 07:53:12 2008 -0700
@@ -0,0 +1,228 @@
+/*
+ * Copyright 2004-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import java.io.*;
+import java.util.logging.*;
+import sun.awt.WindowIDProvider;
+import java.awt.dnd.*;
+import java.awt.datatransfer.*;
+
+public abstract class TestXEmbedServer {
+ private static final Logger log = Logger.getLogger("test.xembed");
+ Frame f;
+ Canvas client;
+ Button toFocus;
+ Button b_modal;
+ JButton b_close;
+ JDialog modal_d;
+ JFrame dummy;
+ Container clientCont;
+ boolean passed;
+
+ public boolean isPassed() {
+ return passed;
+ }
+
+ public TestXEmbedServer(boolean manual) {
+
+ // Enable testing extensions in XEmbed server
+ System.setProperty("sun.awt.xembed.testing", "true");
+
+ f = new Frame("Main frame");
+ f.addWindowListener(new WindowAdapter() {
+ public void windowClosing(WindowEvent e) {
+ synchronized(TestXEmbedServer.this) {
+ TestXEmbedServer.this.notifyAll();
+ }
+ dummy.dispose();
+ f.dispose();
+ }
+ });
+
+ f.setLayout(new BorderLayout());
+
+ Container bcont = new Container();
+
+ toFocus = new Button("Click to focus server");
+ final TextField tf = new TextField(20);
+ tf.setName("0");
+ DragSource ds = new DragSource();
+ final DragSourceListener dsl = new DragSourceAdapter() {
+ public void dragDropEnd(DragSourceDropEvent dsde) {
+ }
+ };
+ final DragGestureListener dgl = new DragGestureListener() {
+ public void dragGestureRecognized(DragGestureEvent dge) {
+ dge.startDrag(null, new StringSelection(tf.getText()), dsl);
+ }
+ };
+ ds.createDefaultDragGestureRecognizer(tf, DnDConstants.ACTION_COPY, dgl);
+
+ final DropTargetListener dtl = new DropTargetAdapter() {
+ public void drop(DropTargetDropEvent dtde) {
+ dtde.acceptDrop(DnDConstants.ACTION_COPY);
+ try {
+ tf.setText(tf.getText() + (String)dtde.getTransferable().getTransferData(DataFlavor.stringFlavor));
+ } catch (Exception e) {
+ }
+ }
+ };
+ final DropTarget dt = new DropTarget(tf, dtl);
+
+ Button b_add = new Button("Add client");
+ b_add.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ addClient();
+ }
+ });
+ Button b_remove = new Button("Remove client");
+ b_remove.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ if (clientCont.getComponentCount() != 0) {
+ clientCont.remove(clientCont.getComponentCount()-1);
+ }
+ }
+ });
+ b_close = new JButton("Close modal dialog");
+ b_close.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ modal_d.dispose();
+ }
+ });
+ b_modal = new Button("Show modal dialog");
+ b_modal.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ modal_d = new JDialog(f, "Modal dialog", true);
+ modal_d.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
+ modal_d.setBounds(0, 100, 200, 50);
+ modal_d.getContentPane().add(b_close);
+ modal_d.validate();
+ modal_d.show();
+ }
+ });
+
+ bcont.add(tf);
+ bcont.add(toFocus);
+ bcont.add(b_add);
+ bcont.add(b_remove);
+ bcont.add(b_modal);
+ if (manual) {
+ Button pass = new Button("Pass");
+ pass.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ passed = true;
+ synchronized(TestXEmbedServer.this) {
+ TestXEmbedServer.this.notifyAll();
+ }
+ }
+ });
+ bcont.add(pass);
+ Button fail = new Button("Fail");
+ fail.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ passed = false;
+ synchronized(TestXEmbedServer.this) {
+ TestXEmbedServer.this.notifyAll();
+ }
+ }
+ });
+ bcont.add(fail);
+ }
+ b_modal.setName("2");
+ bcont.setLayout(new FlowLayout());
+ f.add(bcont, BorderLayout.NORTH);
+
+ clientCont = Box.createVerticalBox();
+ f.add(clientCont, BorderLayout.CENTER);
+
+ dummy = new JFrame("Dummy");
+ dummy.getContentPane().add(new JButton("Button"));
+ dummy.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
+ dummy.setBounds(0, 0, 100, 100);
+ dummy.setVisible(true);
+
+ f.setBounds(300, 0, 800, 300);
+ f.setVisible(true);
+ }
+
+ public abstract Process startClient(Rectangle bounds[], long window);
+
+ public void addClient() {
+ client = new Canvas() {
+ public void paint(Graphics g) {
+ super.paint(g);
+ }
+ };
+ client.setBackground(new Color(30, 220, 40));
+ clientCont.add(client);
+ clientCont.validate();
+ WindowIDProvider pid = (WindowIDProvider)client.getPeer();
+ log.fine("Added XEmbed server(Canvas) with X window ID " + pid.getWindow());
+ Rectangle toFocusBounds = toFocus.getBounds();
+ toFocusBounds.setLocation(toFocus.getLocationOnScreen());
+ f.validate();
+
+ // KDE doesn't accept clicks on title as activation - click below title
+ Rectangle fbounds = f.getBounds();
+ fbounds.y += f.getInsets().top;
+ fbounds.height -= f.getInsets().top;
+
+ Process proc = startClient(new Rectangle[] {fbounds, dummy.getBounds(), toFocusBounds,
+ new Rectangle(b_modal.getLocationOnScreen(), b_modal.getSize()),
+ new Rectangle(10, 130, 20, 20)}, pid.getWindow());
+ new ClientWatcher(client, proc, clientCont).start();
+ }
+
+ public void dispose() {
+ f.dispose();
+ f = null;
+ dummy.dispose();
+ dummy = null;
+ if (modal_d != null) {
+ modal_d.dispose();
+ modal_d = null;
+ }
+ }
+}
+
+class ClientWatcher extends Thread {
+ private Process clientProcess;
+ private Canvas client;
+ private Container parent;
+ public ClientWatcher(Canvas client, Process proc, Container parent) {
+ this.client = client;
+ this.clientProcess = proc;
+ this.parent = parent;
+ }
+
+ public void run() {
+ try {
+ clientProcess.waitFor();
+ } catch (InterruptedException ie) {
+ }
+ parent.remove(client);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/xembed/server/TestXEmbedServerJava.java Wed May 14 07:53:12 2008 -0700
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2004-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/**
+ * @test
+ * @bug 4931668
+ * @summary Tests XEmbed server/client functionality
+ * @author denis mikhalkin: area=awt.xembed
+ * @compile JavaClient.java TesterClient.java TestXEmbedServer.java
+ * @run main/manual TestXEmbedServerJava
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import java.io.*;
+
+public class TestXEmbedServerJava extends TestXEmbedServer {
+ public static void main(String[] args) {
+ if (System.getProperty("os.name").toLowerCase().startsWith("win")) {
+ return;
+ }
+
+ // Enabled XEmbed
+ System.setProperty("sun.awt.xembedserver", "true");
+
+ String instruction =
+ "This is a manual test for XEmbed server functionality. \n" +
+ "You may start XEmbed client by pressing 'Add client' button.\n" +
+ "Check that focus transfer with mouse works, that focus traversal with Tab/Shift-Tab works.\n" +
+ "Check that XEmbed server client's growing and shrinking.\n" +
+ "Check that Drag&Drop works in all combinations.\n" +
+ "Check the keyboard input works in both text fields.\n";
+ Frame f = new Frame("Instructions");
+ f.setLayout(new BorderLayout());
+ f.add(new TextArea(instruction), BorderLayout.CENTER);
+ f.pack();
+ f.setLocation(0, 400);
+ f.setVisible(true);
+
+ TestXEmbedServerJava lock = new TestXEmbedServerJava();
+ try {
+ synchronized(lock) {
+ lock.wait();
+ }
+ } catch (InterruptedException e) {
+ }
+ if (!lock.isPassed()) {
+ throw new RuntimeException("Test failed");
+ }
+ }
+
+ public TestXEmbedServerJava() {
+ super(true);
+ }
+
+ public Process startClient(Rectangle[] bounds, long window) {
+ try {
+ String java_home = System.getProperty("java.home");
+ return Runtime.getRuntime().exec(java_home + "/bin/java JavaClient " + window);
+ } catch (IOException ex1) {
+ ex1.printStackTrace();
+ }
+ return null;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/xembed/server/TesterClient.java Wed May 14 07:53:12 2008 -0700
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2004-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+import java.lang.reflect.*;
+import java.awt.Rectangle;
+import java.util.logging.*;
+
+public class TesterClient {
+ private static final Logger log = Logger.getLogger("test.xembed.TesterClient");
+ private static Method test;
+ private static boolean passed = false;
+ public static void main(String[] args) throws Throwable {
+ // First parameter is the name of the test, second is the window, the rest are rectangles
+ Class cl = Class.forName("sun.awt.X11.XEmbedServerTester");
+ test = cl.getMethod(args[0], new Class[0]);
+ long window = Long.parseLong(args[1]);
+ Rectangle r[] = new Rectangle[(args.length-2)/4];
+ for (int i = 0; i < r.length; i++) {
+ r[i] = new Rectangle(Integer.parseInt(args[2+i*4]), Integer.parseInt(args[2+i*4+1]),
+ Integer.parseInt(args[2+i*4+2]), Integer.parseInt(args[2+i*4+3]));
+ }
+ startClient(r, window);
+ }
+
+ public static void startClient(Rectangle bounds[], long window) throws Throwable {
+ Method m_getTester = Class.forName("sun.awt.X11.XEmbedServerTester").
+ getMethod("getTester", new Class[] {bounds.getClass(), Long.TYPE});
+ final Object tester = m_getTester.invoke(null, new Object[] {bounds, window});
+ try {
+ log.info("Starting test " + test.getName());
+ test.invoke(tester, (Object[])null);
+ log.info("Test " + test.getName() + " PASSED.");
+ passed = true;
+ } catch (Exception e) {
+ log.log(Level.WARNING, "Test " + test.getName() + " FAILED.", e);
+ }
+ System.exit(passed?0:1);
+ }
+}