# HG changeset patch # User mlapshin # Date 1210776792 25200 # Node ID 3bcc915c092591250437b045f8d50271c43ac89f # Parent 6acd5ec503a82f720151f71c1b5a5a101fb8ea78# Parent deabc19e963ea9dd57a77b66bc90f0a87f4a896a Merge diff -r 6acd5ec503a8 -r 3bcc915c0925 jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java --- 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); } diff -r 6acd5ec503a8 -r 3bcc915c0925 jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFWritableImageMetadata.java --- 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(); } } diff -r 6acd5ec503a8 -r 3bcc915c0925 jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKColorChooserPanel.java --- 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; } diff -r 6acd5ec503a8 -r 3bcc915c0925 jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java --- 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", diff -r 6acd5ec503a8 -r 3bcc915c0925 jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java --- 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(); - 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)); } } diff -r 6acd5ec503a8 -r 3bcc915c0925 jdk/src/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java --- 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())); } } diff -r 6acd5ec503a8 -r 3bcc915c0925 jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifLookAndFeel.java --- 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"), diff -r 6acd5ec503a8 -r 3bcc915c0925 jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java --- 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); } } diff -r 6acd5ec503a8 -r 3bcc915c0925 jdk/src/share/classes/java/awt/Button.java --- 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; } diff -r 6acd5ec503a8 -r 3bcc915c0925 jdk/src/share/classes/java/awt/Color.java --- 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 * . *

+ * @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 Color object to be used - * as an argument to any method requiring an object implementing the - * {@link Paint} interface. - * The same PaintContext is returned, regardless of - * whether or not r, r2d, - * xform, or hints are null. - * @param cm the specified ColorModel - * @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 PaintContext 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, diff -r 6acd5ec503a8 -r 3bcc915c0925 jdk/src/share/classes/java/awt/Component.java --- 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(); diff -r 6acd5ec503a8 -r 3bcc915c0925 jdk/src/share/classes/java/awt/Container.java --- 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(); diff -r 6acd5ec503a8 -r 3bcc915c0925 jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java --- 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( diff -r 6acd5ec503a8 -r 3bcc915c0925 jdk/src/share/classes/java/awt/GradientPaint.java --- 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 Paint 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, diff -r 6acd5ec503a8 -r 3bcc915c0925 jdk/src/share/classes/java/awt/KeyboardFocusManager.java --- 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 diff -r 6acd5ec503a8 -r 3bcc915c0925 jdk/src/share/classes/java/awt/LinearGradientPaint.java --- 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, diff -r 6acd5ec503a8 -r 3bcc915c0925 jdk/src/share/classes/java/awt/MenuItem.java --- 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; } diff -r 6acd5ec503a8 -r 3bcc915c0925 jdk/src/share/classes/java/awt/Paint.java --- 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. - *

- * Since the API documentation was not specific about this in - * releases before 1.4, there may be implementations of - * Paint that do not accept a null - * ColorModel argument. - * If a developer is writing code which passes a null - * ColorModel argument to the - * createContext method of Paint - * objects from arbitrary sources it would be wise to code defensively - * by manufacturing a non-null ColorModel for those - * objects which throw a NullPointerException. - * @param cm the {@link ColorModel} that receives the - * Paint 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 PaintContext 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, diff -r 6acd5ec503a8 -r 3bcc915c0925 jdk/src/share/classes/java/awt/RadialGradientPaint.java --- 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, diff -r 6acd5ec503a8 -r 3bcc915c0925 jdk/src/share/classes/java/awt/TexturePaint.java --- 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 Rectangle2D. * @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 - * Paint 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, diff -r 6acd5ec503a8 -r 3bcc915c0925 jdk/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java --- 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 diff -r 6acd5ec503a8 -r 3bcc915c0925 jdk/src/share/classes/java/awt/dnd/DragGestureEvent.java --- 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 Component that it is tracking. * + * The {@code action} field of any {@code DragGestureEvent} instance should take one of the following + * values: + *

+ * 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 DragGestureEvent given the - * DragGestureRecognizer firing this event, - * an int representing - * the user's preferred action, a Point - * indicating the origin of the drag, and a List - * of events that comprise the gesture. + * Constructs a DragGestureEvent object given by the + * DragGestureRecognizer 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). *

* @param dgr The DragGestureRecognizer 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 List of events that comprise the gesture *

- * @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, diff -r 6acd5ec503a8 -r 3bcc915c0925 jdk/src/share/classes/java/awt/dnd/DropTargetEvent.java --- 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 DropTargetEvent with - * a specified DropTargetContext. + * Construct a DropTargetEvent object with + * the specified DropTargetContext. *

- * @param dtc the DropTargetContext + * @param dtc The DropTargetContext + * @throws NullPointerException if {@code dtc} equals {@code null}. + * @see #getSource() + * @see #getDropTargetContext() */ public DropTargetEvent(DropTargetContext dtc) { diff -r 6acd5ec503a8 -r 3bcc915c0925 jdk/src/share/classes/java/awt/event/ActionEvent.java --- 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". + *

+ * 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 Tutorial: Java 1.1 Event Model @@ -134,18 +138,22 @@ /** * Constructs an ActionEvent object. *

- * Note that passing in an invalid id results in - * unspecified behavior. This method throws an + * This method throws an * IllegalArgumentException if source * is null. * A null command 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 source 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 ActionEvent object with modifier keys. *

- * Note that passing in an invalid id results in - * unspecified behavior. This method throws an + * This method throws an * IllegalArgumentException if source * is null. * A null command 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 source 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 ActionEvent object with the specified * modifier keys and timestamp. *

- * Note that passing in an invalid id results in - * unspecified behavior. This method throws an + * This method throws an * IllegalArgumentException if source * is null. * A null command 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 source is null + * @see #getSource() + * @see #getID() + * @see #getActionCommand() + * @see #getModifiers() + * @see #getWhen() * * @since 1.4 */ diff -r 6acd5ec503a8 -r 3bcc915c0925 jdk/src/share/classes/java/awt/event/AdjustmentEvent.java --- 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}. + *

+ * 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}. + *

+ * The {@code type} of any {@code AdjustmentEvent} instance takes one of the following + * values: + *

+ * Assigning the value different from listed above will cause an unspecified behavior. * @see java.awt.Adjustable * @see AdjustmentListener * @@ -130,17 +148,24 @@ * Constructs an AdjustmentEvent object with the * specified Adjustable source, event type, * adjustment type, and value. - *

Note that passing in an invalid id results in - * unspecified behavior. This method throws an + *

This method throws an * IllegalArgumentException if source * is null. * - * @param source the Adjustable object where the + * @param source The Adjustable 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 source 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 AdjustmentEvent object with the * specified Adjustable source, event type, adjustment type, and value. - *

Note that passing in an invalid id results in - * unspecified behavior. This method throws an + *

This method throws an * IllegalArgumentException if source * is null. - * - * @param source the Adjustable object where the + * @param source The Adjustable 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 true 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 true if the event is one * of a series of multiple adjusting events, * otherwise false * @throws IllegalArgumentException if source 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); diff -r 6acd5ec503a8 -r 3bcc915c0925 jdk/src/share/classes/java/awt/event/ComponentEvent.java --- 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 @@ * (ComponentAdapter objects implement the * ComponentListener interface.) Each such listener object * gets this ComponentEvent when the event occurs. + *

+ * 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 ComponentEvent object. - *

Note that passing in an invalid id results in - * unspecified behavior. This method throws an + *

This method throws an * IllegalArgumentException if source * is null. * - * @param source the Component that originated the event - * @param id an integer indicating the type of event + * @param source The Component 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 source is null + * @see #getComponent() + * @see #getID() */ public ComponentEvent(Component source, int id) { super(source, id); diff -r 6acd5ec503a8 -r 3bcc915c0925 jdk/src/share/classes/java/awt/event/ContainerEvent.java --- 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 @@ * (ContainerAdapter objects implement the * ContainerListener interface.) Each such listener object * gets this ContainerEvent when the event occurs. + *

+ * 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 ContainerEvent object. - *

Note that passing in an invalid id results in - * unspecified behavior. This method throws an + *

This method throws an * IllegalArgumentException if source * is null. * - * @param source the Component object (container) + * @param source The Component 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 source is null + * @see #getContainer() + * @see #getID() + * @see #getChild() */ public ContainerEvent(Component source, int id, Component child) { super(source, id); diff -r 6acd5ec503a8 -r 3bcc915c0925 jdk/src/share/classes/java/awt/event/FocusEvent.java --- 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. + *

+ * 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 Component, then the opposite * Component is null. - *

Note that passing in an invalid id results in - * unspecified behavior. This method throws an + *

This method throws an * IllegalArgumentException if source * is null. * - * @param source the Component that originated the event - * @param id FOCUS_GAINED or FOCUS_LOST - * @param temporary true if the focus change is temporary; + * @param source The Component 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 true if the focus change is temporary; * false otherwise - * @param opposite the other Component involved in the focus change, + * @param opposite The other Component involved in the focus change, * or null - * @throws IllegalArgumentException if source is null + * @throws IllegalArgumentException if source 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 FocusEvent object and identifies * whether or not the change is temporary. - *

Note that passing in an invalid id results in - * unspecified behavior. This method throws an + *

This method throws an * IllegalArgumentException if source * is null. * - * @param source the Component that originated the event - * @param id an integer indicating the type of event - * @param temporary true if the focus change is temporary; + * @param source The Component 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 true if the focus change is temporary; * false otherwise - * @throws IllegalArgumentException if source is null + * @throws IllegalArgumentException if source 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 FocusEvent object and identifies it * as a permanent change in focus. - *

Note that passing in an invalid id results in - * unspecified behavior. This method throws an + *

This method throws an * IllegalArgumentException if source * is null. * - * @param source the Component that originated the event - * @param id an integer indicating the type of event - * @throws IllegalArgumentException if source is null + * @param source The Component 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 source equals {@code null} + * @see #getSource() + * @see #getID() */ public FocusEvent(Component source, int id) { this(source, id, false); diff -r 6acd5ec503a8 -r 3bcc915c0925 jdk/src/share/classes/java/awt/event/HierarchyEvent.java --- 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 Component - * hierarchy to which a Component belongs. + * hierarchy to which Component belongs. *