diff --git a/jdk/src/demo/share/applets/NervousText/NervousText.java b/jdk/src/demo/share/applets/NervousText/NervousText.java
index 12dd678d00a..dd60d497576 100644
--- a/jdk/src/demo/share/applets/NervousText/NervousText.java
+++ b/jdk/src/demo/share/applets/NervousText/NervousText.java
@@ -72,8 +72,9 @@ public class NervousText extends Applet implements Runnable, MouseListener {
public void init() {
banner = getParameter("text");
if (banner == null) {
- banner = "HotJava";
+ banner = "Java Development Kit ";
}
+ banner += System.getProperty("java.version", "");
int bannerLength = banner.length();
StringBuilder bc = new StringBuilder(bannerLength);
diff --git a/jdk/src/demo/share/applets/NervousText/example1.html b/jdk/src/demo/share/applets/NervousText/example1.html
index 96013da6f45..a026b37d5cf 100644
--- a/jdk/src/demo/share/applets/NervousText/example1.html
+++ b/jdk/src/demo/share/applets/NervousText/example1.html
@@ -1,7 +1,7 @@
Nervous Text 1.1The source.
diff --git a/jdk/src/java.base/share/conf/security/java.security b/jdk/src/java.base/share/conf/security/java.security
index b1b616c2175..4523ddcd226 100644
--- a/jdk/src/java.base/share/conf/security/java.security
+++ b/jdk/src/java.base/share/conf/security/java.security
@@ -246,6 +246,10 @@ package.access=sun.,\
jdk.nashorn.tools.,\
jdk.tools.jimage.,\
com.sun.activation.registries.,\
+ com.sun.java.accessibility.util.internal.,\
+#ifdef windows
+ com.sun.java.accessibility.internal.,\
+#endif
#ifdef macosx
apple.,\
#endif
@@ -297,6 +301,10 @@ package.definition=sun.,\
jdk.nashorn.tools.,\
jdk.tools.jimage.,\
com.sun.activation.registries.,\
+ com.sun.java.accessibility.util.internal.,\
+#ifdef windows
+ com.sun.java.accessibility.internal.,\
+#endif
#ifdef macosx
apple.,\
#endif
diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java
index 619675890e0..d1f5f7e7265 100644
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java
@@ -746,7 +746,7 @@ public class LWWindowPeer
*/
@Override
public void notifyMouseEvent(int id, long when, int button,
- int x, int y, int screenX, int screenY,
+ int x, int y, int absX, int absY,
int modifiers, int clickCount, boolean popupTrigger,
byte[] bdata)
{
@@ -763,7 +763,7 @@ public class LWWindowPeer
this);
Component target = lastMouseEventPeer.getTarget();
postMouseExitedEvent(target, when, modifiers, lp,
- screenX, screenY, clickCount, popupTrigger, button);
+ absX, absY, clickCount, popupTrigger, button);
}
// Sometimes we may get MOUSE_EXITED after lastCommonMouseEventPeer is switched
@@ -781,7 +781,7 @@ public class LWWindowPeer
Point lp = targetPeer.windowToLocal(x, y, this);
Component target = targetPeer.getTarget();
postMouseEnteredEvent(target, when, modifiers, lp,
- screenX, screenY, clickCount, popupTrigger, button);
+ absX, absY, clickCount, popupTrigger, button);
}
lastCommonMouseEventPeer = targetPeer;
lastMouseEventPeer = targetPeer;
@@ -798,12 +798,12 @@ public class LWWindowPeer
// implemented in CPlatformEmbeddedFrame class
if (topmostWindowPeer == this || topmostWindowPeer == null) {
generateMouseEnterExitEventsForComponents(when, button, x, y,
- screenX, screenY, modifiers, clickCount, popupTrigger,
+ absX, absY, modifiers, clickCount, popupTrigger,
targetPeer);
} else {
LWComponentPeer, ?> topmostTargetPeer = topmostWindowPeer.findPeerAt(r.x + x, r.y + y);
topmostWindowPeer.generateMouseEnterExitEventsForComponents(when, button, x, y,
- screenX, screenY, modifiers, clickCount, popupTrigger,
+ absX, absY, modifiers, clickCount, popupTrigger,
topmostTargetPeer);
}
@@ -874,7 +874,7 @@ public class LWWindowPeer
if (targetPeer.isEnabled()) {
MouseEvent event = new MouseEvent(targetPeer.getTarget(), id,
when, modifiers, lp.x, lp.y,
- screenX, screenY, clickCount,
+ absX, absY, clickCount,
popupTrigger, button);
postEvent(event);
}
@@ -885,7 +885,7 @@ public class LWWindowPeer
postEvent(new MouseEvent(targetPeer.getTarget(),
MouseEvent.MOUSE_CLICKED,
when, modifiers,
- lp.x, lp.y, screenX, screenY,
+ lp.x, lp.y, absX, absY,
clickCount, popupTrigger, button));
}
mouseClickButtons &= ~eventButtonMask;
@@ -948,10 +948,10 @@ public class LWWindowPeer
}
@Override
- public void notifyMouseWheelEvent(long when, int x, int y, int modifiers,
- int scrollType, int scrollAmount,
- int wheelRotation, double preciseWheelRotation,
- byte[] bdata)
+ public void notifyMouseWheelEvent(long when, int x, int y, int absX,
+ int absY, int modifiers, int scrollType,
+ int scrollAmount, int wheelRotation,
+ double preciseWheelRotation, byte[] bdata)
{
// TODO: could we just use the last mouse event target here?
Rectangle r = getBounds();
@@ -963,12 +963,11 @@ public class LWWindowPeer
Point lp = targetPeer.windowToLocal(x, y, this);
// TODO: fill "bdata" member of AWTEvent
- // TODO: screenX/screenY
postEvent(new MouseWheelEvent(targetPeer.getTarget(),
MouseEvent.MOUSE_WHEEL,
when, modifiers,
lp.x, lp.y,
- 0, 0, /* screenX, Y */
+ absX, absY, /* absX, absY */
0 /* clickCount */, false /* popupTrigger */,
scrollType, scrollAmount,
wheelRotation, preciseWheelRotation));
diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/PlatformEventNotifier.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/PlatformEventNotifier.java
index 5bb336881f2..d613b9cea25 100644
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/PlatformEventNotifier.java
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/PlatformEventNotifier.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. 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
@@ -49,14 +49,14 @@ public interface PlatformEventNotifier {
* point of the client area is (insets.top, insets.left).
*/
void notifyMouseEvent(int id, long when, int button,
- int x, int y, int screenX, int screenY,
+ int x, int y, int absX, int absY,
int modifiers, int clickCount, boolean popupTrigger,
byte[] bdata);
- void notifyMouseWheelEvent(long when, int x, int y, int modifiers,
- int scrollType, int scrollAmount,
- int wheelRotation, double preciseWheelRotation,
- byte[] bdata);
+ void notifyMouseWheelEvent(long when, int x, int y, final int absX,
+ final int absY, int modifiers, int scrollType,
+ int scrollAmount, int wheelRotation,
+ double preciseWheelRotation, byte[] bdata);
/*
* Called by the delegate when a key is pressed.
*/
diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDataTransferer.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDataTransferer.java
index c07356057ee..249b5ed975b 100644
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDataTransferer.java
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDataTransferer.java
@@ -26,8 +26,6 @@
package sun.lwawt.macosx;
import java.awt.*;
-import java.awt.image.*;
-import sun.awt.image.ImageRepresentation;
import java.io.*;
import java.net.URL;
@@ -35,6 +33,7 @@ import java.nio.charset.Charset;
import java.text.Normalizer;
import java.text.Normalizer.Form;
import java.util.*;
+import java.util.regex.*;
import java.awt.datatransfer.*;
import sun.awt.datatransfer.*;
@@ -123,26 +122,52 @@ public class CDataTransferer extends DataTransferer {
@Override
public Object translateBytes(byte[] bytes, DataFlavor flavor,
- long format, Transferable transferable) throws IOException {
+ long format, Transferable transferable) throws IOException {
- if (format == CF_URL && URL.class.equals(flavor.getRepresentationClass()))
- {
- String charset = Charset.defaultCharset().name();
- if (transferable != null && transferable.isDataFlavorSupported(javaTextEncodingFlavor)) {
- try {
- charset = new String((byte[])transferable.getTransferData(javaTextEncodingFlavor), "UTF-8");
- } catch (UnsupportedFlavorException cannotHappen) {
- }
+ if (format == CF_URL && URL.class.equals(flavor.getRepresentationClass())) {
+ String charset = Charset.defaultCharset().name();
+ if (transferable != null && transferable.isDataFlavorSupported(javaTextEncodingFlavor)) {
+ try {
+ charset = new String((byte[]) transferable.getTransferData(javaTextEncodingFlavor), "UTF-8");
+ } catch (UnsupportedFlavorException cannotHappen) {
}
-
- return new URL(new String(bytes, charset));
}
+ String xml = new String(bytes, charset);
+ // macosx pasteboard returns a property list that consists of one URL
+ // let's extract it.
+ return new URL(extractURL(xml));
+ }
- if (format == CF_STRING) {
- bytes = Normalizer.normalize(new String(bytes, "UTF8"), Form.NFC).getBytes("UTF8");
- }
+ if (format == CF_STRING) {
+ bytes = Normalizer.normalize(new String(bytes, "UTF8"), Form.NFC).getBytes("UTF8");
+ }
- return super.translateBytes(bytes, flavor, format, transferable);
+ return super.translateBytes(bytes, flavor, format, transferable);
+ }
+
+ /**
+ * Macosx pasteboard returns xml document that contains one URL, for exmple:
+ *
+ */
+ private String extractURL(String xml) {
+ Pattern urlExtractorPattern = Pattern.compile("(.*)");
+ Matcher matcher = urlExtractorPattern.matcher(xml);
+ if (matcher.find()) {
+ return matcher.group(1);
+ } else {
+ return null;
+ }
}
@Override
diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java
index b34eff3f373..0fbdf00246c 100644
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java
@@ -75,8 +75,8 @@ public class CEmbeddedFrame extends EmbeddedFrame {
int x = (int)pluginX;
int y = (int)pluginY;
Point locationOnScreen = getLocationOnScreen();
- int screenX = locationOnScreen.x + x;
- int screenY = locationOnScreen.y + y;
+ int absX = locationOnScreen.x + x;
+ int absY = locationOnScreen.y + y;
if (eventType == CocoaConstants.NPCocoaEventMouseEntered) {
CCursorManager.nativeSetAllowsCursorSetInBackground(true);
@@ -85,15 +85,19 @@ public class CEmbeddedFrame extends EmbeddedFrame {
}
responder.handleMouseEvent(eventType, modifierFlags, buttonNumber,
- clickCount, x, y, screenX, screenY);
+ clickCount, x, y, absX, absY);
}
public void handleScrollEvent(double pluginX, double pluginY, int modifierFlags,
double deltaX, double deltaY, double deltaZ) {
int x = (int)pluginX;
int y = (int)pluginY;
+ Point locationOnScreen = getLocationOnScreen();
+ int absX = locationOnScreen.x + x;
+ int absY = locationOnScreen.y + y;
- responder.handleScrollEvent(x, y, modifierFlags, deltaX, deltaY);
+ responder.handleScrollEvent(x, y, absX, absY, modifierFlags, deltaX,
+ deltaY);
}
public void handleKeyEvent(int eventType, int modifierFlags, String characters,
diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java
index 591c16d2879..5457b1f291a 100644
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. 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
@@ -54,8 +54,7 @@ final class CPlatformResponder {
* Handles mouse events.
*/
void handleMouseEvent(int eventType, int modifierFlags, int buttonNumber,
- int clickCount, int x, int y, int absoluteX,
- int absoluteY) {
+ int clickCount, int x, int y, int absX, int absY) {
final SunToolkit tk = (SunToolkit)Toolkit.getDefaultToolkit();
if ((buttonNumber > 2 && !tk.areExtraMouseButtonsEnabled())
|| buttonNumber > tk.getNumberOfButtons() - 1) {
@@ -81,14 +80,15 @@ final class CPlatformResponder {
boolean jpopupTrigger = NSEvent.isPopupTrigger(jmodifiers);
eventNotifier.notifyMouseEvent(jeventType, System.currentTimeMillis(), jbuttonNumber,
- x, y, absoluteX, absoluteY, jmodifiers, jclickCount,
+ x, y, absX, absY, jmodifiers, jclickCount,
jpopupTrigger, null);
}
/**
* Handles scroll events.
*/
- void handleScrollEvent(final int x, final int y, final int modifierFlags,
+ void handleScrollEvent(final int x, final int y, final int absX,
+ final int absY, final int modifierFlags,
final double deltaX, final double deltaY) {
final int buttonNumber = CocoaConstants.kCGMouseButtonCenter;
int jmodifiers = NSEvent.nsToJavaMouseModifiers(buttonNumber,
@@ -97,18 +97,19 @@ final class CPlatformResponder {
// Vertical scroll.
if (!isShift && deltaY != 0.0) {
- dispatchScrollEvent(x, y, jmodifiers, deltaY);
+ dispatchScrollEvent(x, y, absX, absY, jmodifiers, deltaY);
}
// Horizontal scroll or shirt+vertical scroll.
final double delta = isShift && deltaY != 0.0 ? deltaY : deltaX;
if (delta != 0.0) {
jmodifiers |= InputEvent.SHIFT_DOWN_MASK;
- dispatchScrollEvent(x, y, jmodifiers, delta);
+ dispatchScrollEvent(x, y, absX, absY, jmodifiers, delta);
}
}
- private void dispatchScrollEvent(final int x, final int y,
- final int modifiers, final double delta) {
+ private void dispatchScrollEvent(final int x, final int y, final int absX,
+ final int absY, final int modifiers,
+ final double delta) {
final long when = System.currentTimeMillis();
final int scrollType = MouseWheelEvent.WHEEL_UNIT_SCROLL;
final int scrollAmount = 1;
@@ -118,8 +119,9 @@ final class CPlatformResponder {
wheelRotation = signum;
}
// invert the wheelRotation for the peer
- eventNotifier.notifyMouseWheelEvent(when, x, y, modifiers, scrollType,
- scrollAmount, -wheelRotation, -delta, null);
+ eventNotifier.notifyMouseWheelEvent(when, x, y, absX, absY, modifiers,
+ scrollType, scrollAmount,
+ -wheelRotation, -delta, null);
}
/**
diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformView.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformView.java
index 3c2cd2325e4..ee88f8f75ce 100644
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformView.java
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformView.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. 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
@@ -186,16 +186,19 @@ public class CPlatformView extends CFRetainedResource {
}
- private void deliverMouseEvent(NSEvent event) {
+ private void deliverMouseEvent(final NSEvent event) {
int x = event.getX();
int y = getBounds().height - event.getY();
+ int absX = event.getAbsX();
+ int absY = event.getAbsY();
if (event.getType() == CocoaConstants.NSScrollWheel) {
- responder.handleScrollEvent(x, y, event.getModifierFlags(),
+ responder.handleScrollEvent(x, y, absX, absY, event.getModifierFlags(),
event.getScrollDeltaX(), event.getScrollDeltaY());
} else {
responder.handleMouseEvent(event.getType(), event.getModifierFlags(), event.getButtonNumber(),
- event.getClickCount(), x, y, event.getAbsX(), event.getAbsY());
+ event.getClickCount(), x, y,
+ absX, absY);
}
}
diff --git a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CWarningWindow.java b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CWarningWindow.java
index 0acc67feed6..05db2784b95 100644
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CWarningWindow.java
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CWarningWindow.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. 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
@@ -173,7 +173,7 @@ public final class CWarningWindow extends CPlatformWindow
@Override
public void notifyMouseEvent(int id, long when, int button, int x, int y,
- int screenX, int screenY, int modifiers,
+ int absX, int absY, int modifiers,
int clickCount, boolean popupTrigger,
byte[] bdata) {
LWWindowPeer peer = ownerPeer.get();
@@ -239,9 +239,10 @@ public final class CWarningWindow extends CPlatformWindow
}
@Override
- public void notifyMouseWheelEvent(long when, int x, int y, int modifiers,
- int scrollType, int scrollAmount,
- int wheelRotation, double preciseWheelRotation,
+ public void notifyMouseWheelEvent(long when, int x, int y, int absX,
+ int absY, int modifiers, int scrollType,
+ int scrollAmount, int wheelRotation,
+ double preciseWheelRotation,
byte[] bdata) {
}
diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m
index f84a3d3f996..2a4ab93f4e2 100644
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. 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
@@ -71,7 +71,7 @@ static long eventCount;
return eventCount;
}
-+ (void) eventCountPlusPlus{
++ (void) eventCountPlusPlus{
eventCount++;
}
@@ -167,7 +167,7 @@ static void setUpAWTAppKit(BOOL installObservers)
^(CFRunLoopObserverRef observer, CFRunLoopActivity activity) {
setBusy(YES);
});
-
+
CFRunLoopObserverRef notBusyObserver = CFRunLoopObserverCreateWithHandler(
NULL, // CFAllocator
kCFRunLoopBeforeWaiting, // CFOptionFlags
@@ -176,14 +176,14 @@ static void setUpAWTAppKit(BOOL installObservers)
^(CFRunLoopObserverRef observer, CFRunLoopActivity activity) {
setBusy(NO);
});
-
+
CFRunLoopRef runLoop = [[NSRunLoop currentRunLoop] getCFRunLoop];
CFRunLoopAddObserver(runLoop, busyObserver, kCFRunLoopDefaultMode);
CFRunLoopAddObserver(runLoop, notBusyObserver, kCFRunLoopDefaultMode);
-
+
CFRelease(busyObserver);
CFRelease(notBusyObserver);
-
+
setBusy(YES);
}
@@ -344,19 +344,19 @@ static void AWT_NSUncaughtExceptionHandler(NSException *exception) {
// We're either embedded, or showing a splash screen
if (isEmbedded) {
AWT_STARTUP_LOG(@"running embedded");
-
+
// We don't track if the runloop is busy, so set it free to let AWT finish when it needs
setBusy(NO);
} else {
AWT_STARTUP_LOG(@"running after showing a splash screen");
}
-
+
// Signal so that JNI_OnLoad can proceed.
if (!wasOnMainThread) [AWTStarter appKitIsRunning:nil];
-
+
// Proceed to exit this call as there is no reason to run the NSApplication event loop.
}
-
+
[pool drain];
}
@@ -370,24 +370,34 @@ static void AWT_NSUncaughtExceptionHandler(NSException *exception) {
JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_LWCToolkit_nativeSyncQueue
(JNIEnv *env, jobject self, jlong timeout)
{
- int currentEventNum = [AWTToolkit getEventCount];
+ long currentEventNum = [AWTToolkit getEventCount];
NSApplication* sharedApp = [NSApplication sharedApplication];
if ([sharedApp isKindOfClass:[NSApplicationAWT class]]) {
NSApplicationAWT* theApp = (NSApplicationAWT*)sharedApp;
- [theApp postDummyEvent];
- [theApp waitForDummyEvent:timeout];
+ // We use two different API to post events to the application,
+ // - [NSApplication postEvent]
+ // - CGEventPost(), see CRobot.m
+ // It was found that if we post an event via CGEventPost in robot and
+ // immediately after this we will post the second event via
+ // [NSApp postEvent] then sometimes the second event will be handled
+ // first. The opposite isn't proved, but we use both here to be safer.
+ [theApp postDummyEvent:false];
+ [theApp waitForDummyEvent:timeout / 2.0];
+ [theApp postDummyEvent:true];
+ [theApp waitForDummyEvent:timeout / 2.0];
+
} else {
// could happen if we are embedded inside SWT application,
- // in this case just spin a single empty block through
+ // in this case just spin a single empty block through
// the event loop to give it a chance to process pending events
[JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){}];
}
-
+
if (([AWTToolkit getEventCount] - currentEventNum) != 0) {
return JNI_TRUE;
}
-
+
return JNI_FALSE;
}
@@ -516,7 +526,7 @@ JNF_COCOA_ENTER(env);
beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.010]];
if (processEvents) {
//We do not spin a runloop here as date is nil, so does not matter which mode to use
- // Processing all events excluding NSApplicationDefined which need to be processed
+ // Processing all events excluding NSApplicationDefined which need to be processed
// on the main loop only (those events are intended for disposing resources)
NSEvent *event;
if ((event = [NSApp nextEventMatchingMask:(NSAnyEventMask & ~NSApplicationDefined)
diff --git a/jdk/src/java.desktop/macosx/native/libosxapp/NSApplicationAWT.h b/jdk/src/java.desktop/macosx/native/libosxapp/NSApplicationAWT.h
index 1025cd7c533..69d380032df 100644
--- a/jdk/src/java.desktop/macosx/native/libosxapp/NSApplicationAWT.h
+++ b/jdk/src/java.desktop/macosx/native/libosxapp/NSApplicationAWT.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. 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
@@ -36,9 +36,9 @@
- (void) finishLaunching;
- (void) registerWithProcessManager;
- (void) setDockIconWithEnv:(JNIEnv *)env;
-- (void) postDummyEvent;
+- (void) postDummyEvent:(bool) useCocoa;
- (void) postRunnableEvent:(void (^)())block;
-- (void) waitForDummyEvent:(long long) timeout;
+- (void) waitForDummyEvent:(double) timeout;
+ (void) runAWTLoopWithApp:(NSApplication*)app;
diff --git a/jdk/src/java.desktop/macosx/native/libosxapp/NSApplicationAWT.m b/jdk/src/java.desktop/macosx/native/libosxapp/NSApplicationAWT.m
index 44382dac0bd..8a856bdabdd 100644
--- a/jdk/src/java.desktop/macosx/native/libosxapp/NSApplicationAWT.m
+++ b/jdk/src/java.desktop/macosx/native/libosxapp/NSApplicationAWT.m
@@ -349,6 +349,7 @@ AWT_ASSERT_APPKIT_THREAD;
&& [event subtype] == NativeSyncQueueEvent) {
[seenDummyEventLock lockWhenCondition:NO];
[seenDummyEventLock unlockWithCondition:YES];
+
} else if ([event type] == NSApplicationDefined && [event subtype] == ExecuteBlockEvent) {
void (^block)() = (void (^)()) [event data1];
block();
@@ -387,9 +388,7 @@ AWT_ASSERT_APPKIT_THREAD;
[pool drain];
}
-
-
-- (void)postDummyEvent {
+- (void)postDummyEvent:(bool)useCocoa {
seenDummyEventLock = [[NSConditionLock alloc] initWithCondition:NO];
dummyEventTimestamp = [NSProcessInfo processInfo].systemUptime;
@@ -403,19 +402,28 @@ AWT_ASSERT_APPKIT_THREAD;
subtype: NativeSyncQueueEvent
data1: 0
data2: 0];
- [NSApp postEvent: event atStart: NO];
+ if (useCocoa) {
+ [NSApp postEvent:event atStart:NO];
+ } else {
+ ProcessSerialNumber psn;
+ GetCurrentProcess(&psn);
+ CGEventPostToPSN(&psn, [event CGEvent]);
+ }
[pool drain];
}
-- (void)waitForDummyEvent:(long long) timeout {
+- (void)waitForDummyEvent:(double)timeout {
+ bool unlock = true;
if (timeout >= 0) {
- double sec = ((double) timeout)/1000;
- [seenDummyEventLock lockWhenCondition:YES
+ double sec = timeout / 1000;
+ unlock = [seenDummyEventLock lockWhenCondition:YES
beforeDate:[NSDate dateWithTimeIntervalSinceNow:sec]];
} else {
[seenDummyEventLock lockWhenCondition:YES];
}
- [seenDummyEventLock unlock];
+ if (unlock) {
+ [seenDummyEventLock unlock];
+ }
[seenDummyEventLock release];
seenDummyEventLock = nil;
diff --git a/jdk/src/java.desktop/share/classes/java/applet/AppletContext.java b/jdk/src/java.desktop/share/classes/java/applet/AppletContext.java
index d14fd155092..7caae99949d 100644
--- a/jdk/src/java.desktop/share/classes/java/applet/AppletContext.java
+++ b/jdk/src/java.desktop/share/classes/java/applet/AppletContext.java
@@ -55,8 +55,8 @@ public interface AppletContext {
AudioClip getAudioClip(URL url);
/**
- * Returns an Image object that can then be painted on
- * the screen. The url argument that is
+ * Returns an {@code Image} object that can then be painted on
+ * the screen. The {@code url} argument that is
* passed as an argument must specify an absolute URL.
*
* This method always returns immediately, whether or not the image
@@ -73,10 +73,10 @@ public interface AppletContext {
/**
* Finds and returns the applet in the document represented by this
* applet context with the given name. The name can be set in the
- * HTML tag by setting the name attribute.
+ * HTML tag by setting the {@code name} attribute.
*
* @param name an applet name.
- * @return the applet with the given name, or null if
+ * @return the applet with the given name, or {@code null} if
* not found.
*/
Applet getApplet(String name);
@@ -92,7 +92,7 @@ public interface AppletContext {
/**
* Requests that the browser or applet viewer show the Web page
- * indicated by the url argument. The browser or
+ * indicated by the {@code url} argument. The browser or
* applet viewer determines which window or frame to display the
* Web page. This method may be ignored by applet contexts that
* are not browsers.
@@ -103,22 +103,22 @@ public interface AppletContext {
/**
* Requests that the browser or applet viewer show the Web page
- * indicated by the url argument. The
- * target argument indicates in which HTML frame the
+ * indicated by the {@code url} argument. The
+ * {@code target} argument indicates in which HTML frame the
* document is to be displayed.
* The target argument is interpreted as follows:
*
*
*
Target Argument
Description
- *
"_self"
Show in the window and frame that
+ *
{@code "_self"}
Show in the window and frame that
* contain the applet.
- *
"_parent"
Show in the applet's parent frame. If
+ *
{@code "_parent"}
Show in the applet's parent frame. If
* the applet's frame has no parent frame,
* acts the same as "_self".
- *
"_top"
Show in the top-level frame of the applet's
+ *
{@code "_top"}
Show in the top-level frame of the applet's
* window. If the applet's frame is the
* top-level frame, acts the same as "_self".
- *
"_blank"
Show in a new, unnamed
+ *
{@code "_blank"}
Show in a new, unnamed
* top-level window.
*
name
Show in the frame or window named name. If
* a target named name does not already exist, a
@@ -126,10 +126,10 @@ public interface AppletContext {
* and the document is shown there.
*
*
- * An applet viewer or browser is free to ignore showDocument.
+ * An applet viewer or browser is free to ignore {@code showDocument}.
*
* @param url an absolute URL giving the location of the document.
- * @param target a String indicating where to display
+ * @param target a {@code String} indicating where to display
* the page.
*/
public void showDocument(URL url, String target);
@@ -155,7 +155,7 @@ public interface AppletContext {
*
* @param key key with which the specified value is to be associated.
* @param stream stream to be associated with the specified key. If this
- * parameter is null, the specified key is removed
+ * parameter is {@code null}, the specified key is removed
* in this applet context.
* @throws IOException if the stream size exceeds a certain
* size limit. Size limit is decided by the implementor of this
@@ -166,7 +166,7 @@ public interface AppletContext {
/**
* Returns the stream to which specified key is associated within this
- * applet context. Returns null if the applet context contains
+ * applet context. Returns {@code null} if the applet context contains
* no stream for this key.
*
* For security reasons, mapping of streams and keys exists for each
diff --git a/jdk/src/java.desktop/share/classes/java/applet/AppletStub.java b/jdk/src/java.desktop/share/classes/java/applet/AppletStub.java
index 621068f16d6..7a7e614536a 100644
--- a/jdk/src/java.desktop/share/classes/java/applet/AppletStub.java
+++ b/jdk/src/java.desktop/share/classes/java/applet/AppletStub.java
@@ -28,7 +28,7 @@ import java.net.URL;
/**
* When an applet is first created, an applet stub is attached to it
- * using the applet's setStub method. This stub
+ * using the applet's {@code setStub} method. This stub
* serves as the interface between the applet and the browser
* environment or applet viewer environment in which the application
* is running.
@@ -40,11 +40,11 @@ import java.net.URL;
public interface AppletStub {
/**
* Determines if the applet is active. An applet is active just
- * before its start method is called. It becomes
- * inactive just before its stop method is called.
+ * before its {@code start} method is called. It becomes
+ * inactive just before its {@code stop} method is called.
*
- * @return true if the applet is active;
- * false otherwise.
+ * @return {@code true} if the applet is active;
+ * {@code false} otherwise.
*/
boolean isActive();
@@ -85,12 +85,12 @@ public interface AppletStub {
* </applet>
*
*
- * then a call to getParameter("Color") returns the
- * value "blue".
+ * then a call to {@code getParameter("Color")} returns the
+ * value {@code "blue"}.
*
* @param name a parameter name.
* @return the value of the named parameter,
- * or null if not set.
+ * or {@code null} if not set.
*/
String getParameter(String name);
diff --git a/jdk/src/java.desktop/share/classes/java/awt/BasicStroke.java b/jdk/src/java.desktop/share/classes/java/awt/BasicStroke.java
index 21a4bba8f14..a2b14cfa798 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/BasicStroke.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/BasicStroke.java
@@ -30,14 +30,14 @@ import java.beans.ConstructorProperties;
import java.lang.annotation.Native;
/**
- * The BasicStroke class defines a basic set of rendering
+ * The {@code BasicStroke} class defines a basic set of rendering
* attributes for the outlines of graphics primitives, which are rendered
* with a {@link Graphics2D} object that has its Stroke attribute set to
- * this BasicStroke.
- * The rendering attributes defined by BasicStroke describe
+ * this {@code BasicStroke}.
+ * The rendering attributes defined by {@code BasicStroke} describe
* the shape of the mark made by a pen drawn along the outline of a
* {@link Shape} and the decorations applied at the ends and joins of
- * path segments of the Shape.
+ * path segments of the {@code Shape}.
* These rendering attributes include:
*
* All attributes that specify measurements and distances controlling
* the shape of the returned outline are measured in the same
- * coordinate system as the original unstroked Shape
- * argument. When a Graphics2D object uses a
- * Stroke object to redefine a path during the execution
- * of one of its draw methods, the geometry is supplied
- * in its original form before the Graphics2D transform
+ * coordinate system as the original unstroked {@code Shape}
+ * argument. When a {@code Graphics2D} object uses a
+ * {@code Stroke} object to redefine a path during the execution
+ * of one of its {@code draw} methods, the geometry is supplied
+ * in its original form before the {@code Graphics2D} transform
* attribute is applied. Therefore, attributes such as the pen width
* are interpreted in the user space coordinate system of the
- * Graphics2D object and are subject to the scaling and
+ * {@code Graphics2D} object and are subject to the scaling and
* shearing effects of the user-space-to-device-space transform in that
- * particular Graphics2D.
+ * particular {@code Graphics2D}.
* For example, the width of a rendered shape's outline is determined
- * not only by the width attribute of this BasicStroke,
+ * not only by the width attribute of this {@code BasicStroke},
* but also by the transform attribute of the
- * Graphics2D object. Consider this code:
- *
+ * {@code Graphics2D} object. Consider this code:
+ *
+ * }
* Assuming there are no other scaling transforms added to the
- * Graphics2D object, the resulting line
+ * {@code Graphics2D} object, the resulting line
* will be approximately 15 pixels wide.
* As the example code demonstrates, a floating-point line
* offers better precision, especially when large transforms are
- * used with a Graphics2D object.
+ * used with a {@code Graphics2D} object.
* When a line is diagonal, the exact width depends on how the
* rendering pipeline chooses which pixels to fill as it traces the
* theoretical widened outline. The choice of which pixels to turn
@@ -107,7 +107,7 @@ import java.lang.annotation.Native;
* partially-covered pixels.
*
* For more information on the user space coordinate system and the
- * rendering process, see the Graphics2D class comments.
+ * rendering process, see the {@code Graphics2D} class comments.
* @see Graphics2D
* @author Jim Graham
*/
@@ -161,30 +161,30 @@ public class BasicStroke implements Stroke {
float dash_phase;
/**
- * Constructs a new BasicStroke with the specified
+ * Constructs a new {@code BasicStroke} with the specified
* attributes.
- * @param width the width of this BasicStroke. The
+ * @param width the width of this {@code BasicStroke}. The
* width must be greater than or equal to 0.0f. If width is
* set to 0.0f, the stroke is rendered as the thinnest
* possible line for the target device and the antialias
* hint setting.
- * @param cap the decoration of the ends of a BasicStroke
+ * @param cap the decoration of the ends of a {@code BasicStroke}
* @param join the decoration applied where path segments meet
* @param miterlimit the limit to trim the miter join. The miterlimit
* must be greater than or equal to 1.0f.
* @param dash the array representing the dashing pattern
* @param dash_phase the offset to start the dashing pattern
- * @throws IllegalArgumentException if width is negative
- * @throws IllegalArgumentException if cap is not either
+ * @throws IllegalArgumentException if {@code width} is negative
+ * @throws IllegalArgumentException if {@code cap} is not either
* CAP_BUTT, CAP_ROUND or CAP_SQUARE
- * @throws IllegalArgumentException if miterlimit is less
- * than 1 and join is JOIN_MITER
- * @throws IllegalArgumentException if join is not
+ * @throws IllegalArgumentException if {@code miterlimit} is less
+ * than 1 and {@code join} is JOIN_MITER
+ * @throws IllegalArgumentException if {@code join} is not
* either JOIN_ROUND, JOIN_BEVEL, or JOIN_MITER
- * @throws IllegalArgumentException if dash_phase
- * is negative and dash is not null
+ * @throws IllegalArgumentException if {@code dash_phase}
+ * is negative and {@code dash} is not {@code null}
* @throws IllegalArgumentException if the length of
- * dash is zero
+ * {@code dash} is zero
* @throws IllegalArgumentException if dash lengths are all zero.
*/
@ConstructorProperties({ "lineWidth", "endCap", "lineJoin", "miterLimit", "dashArray", "dashPhase" })
@@ -231,18 +231,18 @@ public class BasicStroke implements Stroke {
}
/**
- * Constructs a solid BasicStroke with the specified
+ * Constructs a solid {@code BasicStroke} with the specified
* attributes.
- * @param width the width of the BasicStroke
- * @param cap the decoration of the ends of a BasicStroke
+ * @param width the width of the {@code BasicStroke}
+ * @param cap the decoration of the ends of a {@code BasicStroke}
* @param join the decoration applied where path segments meet
* @param miterlimit the limit to trim the miter join
- * @throws IllegalArgumentException if width is negative
- * @throws IllegalArgumentException if cap is not either
+ * @throws IllegalArgumentException if {@code width} is negative
+ * @throws IllegalArgumentException if {@code cap} is not either
* CAP_BUTT, CAP_ROUND or CAP_SQUARE
- * @throws IllegalArgumentException if miterlimit is less
- * than 1 and join is JOIN_MITER
- * @throws IllegalArgumentException if join is not
+ * @throws IllegalArgumentException if {@code miterlimit} is less
+ * than 1 and {@code join} is JOIN_MITER
+ * @throws IllegalArgumentException if {@code join} is not
* either JOIN_ROUND, JOIN_BEVEL, or JOIN_MITER
*/
public BasicStroke(float width, int cap, int join, float miterlimit) {
@@ -250,17 +250,17 @@ public class BasicStroke implements Stroke {
}
/**
- * Constructs a solid BasicStroke with the specified
- * attributes. The miterlimit parameter is
+ * Constructs a solid {@code BasicStroke} with the specified
+ * attributes. The {@code miterlimit} parameter is
* unnecessary in cases where the default is allowable or the
* line joins are not specified as JOIN_MITER.
- * @param width the width of the BasicStroke
- * @param cap the decoration of the ends of a BasicStroke
+ * @param width the width of the {@code BasicStroke}
+ * @param cap the decoration of the ends of a {@code BasicStroke}
* @param join the decoration applied where path segments meet
- * @throws IllegalArgumentException if width is negative
- * @throws IllegalArgumentException if cap is not either
+ * @throws IllegalArgumentException if {@code width} is negative
+ * @throws IllegalArgumentException if {@code cap} is not either
* CAP_BUTT, CAP_ROUND or CAP_SQUARE
- * @throws IllegalArgumentException if join is not
+ * @throws IllegalArgumentException if {@code join} is not
* either JOIN_ROUND, JOIN_BEVEL, or JOIN_MITER
*/
public BasicStroke(float width, int cap, int join) {
@@ -268,18 +268,18 @@ public class BasicStroke implements Stroke {
}
/**
- * Constructs a solid BasicStroke with the specified
+ * Constructs a solid {@code BasicStroke} with the specified
* line width and with default values for the cap and join
* styles.
- * @param width the width of the BasicStroke
- * @throws IllegalArgumentException if width is negative
+ * @param width the width of the {@code BasicStroke}
+ * @throws IllegalArgumentException if {@code width} is negative
*/
public BasicStroke(float width) {
this(width, CAP_SQUARE, JOIN_MITER, 10.0f, null, 0.0f);
}
/**
- * Constructs a new BasicStroke with defaults for all
+ * Constructs a new {@code BasicStroke} with defaults for all
* attributes.
* The default attributes are a solid line of width 1.0, CAP_SQUARE,
* JOIN_MITER, a miter limit of 10.0.
@@ -290,10 +290,10 @@ public class BasicStroke implements Stroke {
/**
- * Returns a Shape whose interior defines the
- * stroked outline of a specified Shape.
- * @param s the Shape boundary be stroked
- * @return the Shape of the stroked outline.
+ * Returns a {@code Shape} whose interior defines the
+ * stroked outline of a specified {@code Shape}.
+ * @param s the {@code Shape} boundary be stroked
+ * @return the {@code Shape} of the stroked outline.
*/
public Shape createStrokedShape(Shape s) {
sun.java2d.pipe.RenderingEngine re =
@@ -305,9 +305,9 @@ public class BasicStroke implements Stroke {
/**
* Returns the line width. Line width is represented in user space,
* which is the default-coordinate space used by Java 2D. See the
- * Graphics2D class comments for more information on
+ * {@code Graphics2D} class comments for more information on
* the user space coordinate system.
- * @return the line width of this BasicStroke.
+ * @return the line width of this {@code BasicStroke}.
* @see Graphics2D
*/
public float getLineWidth() {
@@ -316,8 +316,8 @@ public class BasicStroke implements Stroke {
/**
* Returns the end cap style.
- * @return the end cap style of this BasicStroke as one
- * of the static int values that define possible end cap
+ * @return the end cap style of this {@code BasicStroke} as one
+ * of the static {@code int} values that define possible end cap
* styles.
*/
public int getEndCap() {
@@ -326,8 +326,8 @@ public class BasicStroke implements Stroke {
/**
* Returns the line join style.
- * @return the line join style of the BasicStroke as one
- * of the static int values that define possible line
+ * @return the line join style of the {@code BasicStroke} as one
+ * of the static {@code int} values that define possible line
* join styles.
*/
public int getLineJoin() {
@@ -336,7 +336,7 @@ public class BasicStroke implements Stroke {
/**
* Returns the limit of miter joins.
- * @return the limit of miter joins of the BasicStroke.
+ * @return the limit of miter joins of the {@code BasicStroke}.
*/
public float getMiterLimit() {
return miterlimit;
@@ -346,7 +346,7 @@ public class BasicStroke implements Stroke {
* Returns the array representing the lengths of the dash segments.
* Alternate entries in the array represent the user space lengths
* of the opaque and transparent segments of the dashes.
- * As the pen moves along the outline of the Shape
+ * As the pen moves along the outline of the {@code Shape}
* to be stroked, the user space
* distance that the pen travels is accumulated. The distance
* value is used to index into the dash array.
@@ -368,7 +368,7 @@ public class BasicStroke implements Stroke {
* represents an offset into the dashing pattern. In other words, the dash
* phase defines the point in the dashing pattern that will correspond to
* the beginning of the stroke.
- * @return the dash phase as a float value.
+ * @return the dash phase as a {@code float} value.
*/
public float getDashPhase() {
return dash_phase;
@@ -397,15 +397,15 @@ public class BasicStroke implements Stroke {
* stroking operation as the given argument.
*/
/**
- * Tests if a specified object is equal to this BasicStroke
- * by first testing if it is a BasicStroke and then comparing
+ * Tests if a specified object is equal to this {@code BasicStroke}
+ * by first testing if it is a {@code BasicStroke} and then comparing
* its width, join, cap, miter limit, dash, and dash phase attributes with
- * those of this BasicStroke.
+ * those of this {@code BasicStroke}.
* @param obj the specified object to compare to this
- * BasicStroke
- * @return true if the width, join, cap, miter limit, dash, and
+ * {@code BasicStroke}
+ * @return {@code true} if the width, join, cap, miter limit, dash, and
* dash phase are the same for both objects;
- * false otherwise.
+ * {@code false} otherwise.
*/
public boolean equals(Object obj) {
if (!(obj instanceof BasicStroke)) {
diff --git a/jdk/src/java.desktop/share/classes/java/awt/CheckboxGroup.java b/jdk/src/java.desktop/share/classes/java/awt/CheckboxGroup.java
index 15e91c4d2a0..6503e8548b6 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/CheckboxGroup.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/CheckboxGroup.java
@@ -25,10 +25,10 @@
package java.awt;
/**
- * The CheckboxGroup class is used to group together
- * a set of Checkbox buttons.
+ * The {@code CheckboxGroup} class is used to group together
+ * a set of {@code Checkbox} buttons.
*
- * Exactly one check box button in a CheckboxGroup can
+ * Exactly one check box button in a {@code CheckboxGroup} can
* be in the "on" state at any given time. Pushing any
* button sets its state to "on" and forces any other button that
* is in the "on" state into the "off" state.
@@ -69,7 +69,7 @@ public class CheckboxGroup implements java.io.Serializable {
private static final long serialVersionUID = 3729780091441768983L;
/**
- * Creates a new instance of CheckboxGroup.
+ * Creates a new instance of {@code CheckboxGroup}.
*/
public CheckboxGroup() {
}
@@ -78,10 +78,10 @@ public class CheckboxGroup implements java.io.Serializable {
* Gets the current choice from this check box group.
* The current choice is the check box in this
* group that is currently in the "on" state,
- * or null if all check boxes in the
+ * or {@code null} if all check boxes in the
* group are off.
* @return the check box that is currently in the
- * "on" state, or null.
+ * "on" state, or {@code null}.
* @see java.awt.Checkbox
* @see java.awt.CheckboxGroup#setSelectedCheckbox
* @since 1.1
@@ -96,7 +96,7 @@ public class CheckboxGroup implements java.io.Serializable {
*
* @return the selected checkbox
* @deprecated As of JDK version 1.1,
- * replaced by getSelectedCheckbox().
+ * replaced by {@code getSelectedCheckbox()}.
*/
@Deprecated
public Checkbox getCurrent() {
@@ -109,11 +109,11 @@ public class CheckboxGroup implements java.io.Serializable {
* This method sets the state of that check box to "on" and
* sets all other check boxes in the group to be off.
*
- * If the check box argument is null, all check boxes
+ * If the check box argument is {@code null}, all check boxes
* in this check box group are deselected. If the check box argument
* belongs to a different check box group, this method does
* nothing.
- * @param box the Checkbox to set as the
+ * @param box the {@code Checkbox} to set as the
* current selection.
* @see java.awt.Checkbox
* @see java.awt.CheckboxGroup#getSelectedCheckbox
@@ -130,7 +130,7 @@ public class CheckboxGroup implements java.io.Serializable {
* @param box the {@code Checkbox} to set as the
* current selection.
* @deprecated As of JDK version 1.1,
- * replaced by setSelectedCheckbox(Checkbox).
+ * replaced by {@code setSelectedCheckbox(Checkbox)}.
*/
@Deprecated
public synchronized void setCurrent(Checkbox box) {
diff --git a/jdk/src/java.desktop/share/classes/java/awt/GridLayout.java b/jdk/src/java.desktop/share/classes/java/awt/GridLayout.java
index 26b0bef769c..a5eab8ad9ab 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/GridLayout.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/GridLayout.java
@@ -26,7 +26,7 @@
package java.awt;
/**
- * The GridLayout class is a layout manager that
+ * The {@code GridLayout} class is a layout manager that
* lays out a container's components in a rectangular grid.
* The container is divided into equal-sized rectangles,
* and one component is placed in each rectangle.
@@ -50,9 +50,9 @@ package java.awt;
* }
*
*
- * If the container's ComponentOrientation property is horizontal
+ * If the container's {@code ComponentOrientation} property is horizontal
* and left-to-right, the above example produces the output shown in Figure 1.
- * If the container's ComponentOrientation property is horizontal
+ * If the container's {@code ComponentOrientation} property is horizontal
* and right-to-left, the example produces the output shown in Figure 2.
*
*
@@ -77,7 +77,7 @@ package java.awt;
*
* When both the number of rows and the number of columns have
* been set to non-zero values, either by a constructor or
- * by the setRows and setColumns methods, the number of
+ * by the {@code setRows} and {@code setColumns} methods, the number of
* columns specified is ignored. Instead, the number of
* columns is determined from the specified number of rows
* and the total number of components in the layout. So, for
@@ -154,7 +154,7 @@ public class GridLayout implements LayoutManager, java.io.Serializable {
* Creates a grid layout with the specified number of rows and
* columns. All components in the layout are given equal size.
*
- * One, but not both, of rows and cols can
+ * One, but not both, of {@code rows} and {@code cols} can
* be zero, which means that any number of objects can be placed in a
* row or in a column.
* @param rows the rows, with the value zero meaning
@@ -175,11 +175,11 @@ public class GridLayout implements LayoutManager, java.io.Serializable {
* of the columns. Vertical gaps are placed between each of
* the rows.
*
- * One, but not both, of rows and cols can
+ * One, but not both, of {@code rows} and {@code cols} can
* be zero, which means that any number of objects can be placed in a
* row or in a column.
*
- * All GridLayout constructors defer to this one.
+ * All {@code GridLayout} constructors defer to this one.
* @param rows the rows, with the value zero meaning
* any number of rows
* @param cols the columns, with the value zero meaning
@@ -187,7 +187,7 @@ public class GridLayout implements LayoutManager, java.io.Serializable {
* @param hgap the horizontal gap
* @param vgap the vertical gap
* @exception IllegalArgumentException if the value of both
- * rows and cols is
+ * {@code rows} and {@code cols} is
* set to zero
*/
public GridLayout(int rows, int cols, int hgap, int vgap) {
@@ -213,7 +213,7 @@ public class GridLayout implements LayoutManager, java.io.Serializable {
* Sets the number of rows in this layout to the specified value.
* @param rows the number of rows in this layout
* @exception IllegalArgumentException if the value of both
- * rows and cols is set to zero
+ * {@code rows} and {@code cols} is set to zero
* @since 1.1
*/
public void setRows(int rows) {
@@ -236,12 +236,12 @@ public class GridLayout implements LayoutManager, java.io.Serializable {
* Sets the number of columns in this layout to the specified value.
* Setting the number of columns has no affect on the layout
* if the number of rows specified by a constructor or by
- * the setRows method is non-zero. In that case, the number
+ * the {@code setRows} method is non-zero. In that case, the number
* of columns displayed in the layout is determined by the total
* number of components and the number of rows specified.
* @param cols the number of columns in this layout
* @exception IllegalArgumentException if the value of both
- * rows and cols is set to zero
+ * {@code rows} and {@code cols} is set to zero
* @since 1.1
*/
public void setColumns(int cols) {
@@ -405,7 +405,7 @@ public class GridLayout implements LayoutManager, java.io.Serializable {
*
* This method reshapes the components in the specified target
* container in order to satisfy the constraints of the
- * GridLayout object.
+ * {@code GridLayout} object.
*
* The grid layout manager determines the size of individual
* components by dividing the free space in the container into
diff --git a/jdk/src/java.desktop/share/classes/java/awt/Window.java b/jdk/src/java.desktop/share/classes/java/awt/Window.java
index cd248d37227..0a03eeddee2 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/Window.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/Window.java
@@ -53,6 +53,7 @@ import sun.awt.AWTAccessor;
import sun.awt.AWTPermissions;
import sun.awt.AppContext;
import sun.awt.CausedFocusEvent;
+import sun.awt.DebugSettings;
import sun.awt.SunToolkit;
import sun.awt.util.IdentityArrayList;
import sun.java2d.pipe.Region;
@@ -2159,11 +2160,13 @@ public class Window extends Container implements Accessible {
* @param e the keyboard event
*/
void preProcessKeyEvent(KeyEvent e) {
- // Dump the list of child windows to System.out.
- if (e.isActionKey() && e.getKeyCode() == KeyEvent.VK_F1 &&
- e.isControlDown() && e.isShiftDown() &&
- e.getID() == KeyEvent.KEY_PRESSED) {
- list(System.out, 0);
+ // Dump the list of child windows to System.out if debug is enabled.
+ if (DebugSettings.getInstance().getBoolean("on", false)) {
+ if (e.isActionKey() && e.getKeyCode() == KeyEvent.VK_F1 &&
+ e.isControlDown() && e.isShiftDown() &&
+ e.getID() == KeyEvent.KEY_PRESSED) {
+ list(System.out, 0);
+ }
}
}
diff --git a/jdk/src/java.desktop/share/classes/java/awt/dnd/DropTargetContext.java b/jdk/src/java.desktop/share/classes/java/awt/dnd/DropTargetContext.java
index 1ed0038d689..839c543cb8e 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/dnd/DropTargetContext.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/dnd/DropTargetContext.java
@@ -43,11 +43,11 @@ import sun.awt.AWTAccessor;
import sun.awt.AWTAccessor.DropTargetContextAccessor;
/**
- * A DropTargetContext is created
+ * A {@code DropTargetContext} is created
* whenever the logical cursor associated
* with a Drag and Drop operation coincides with the visible geometry of
- * a Component associated with a DropTarget.
- * The DropTargetContext provides
+ * a {@code Component} associated with a {@code DropTarget}.
+ * The {@code DropTargetContext} provides
* the mechanism for a potential receiver
* of a drop operation to both provide the end user with the appropriate
* drag under feedback, but also to effect the subsequent data transfer
@@ -74,8 +74,8 @@ public class DropTargetContext implements Serializable {
});
}
/**
- * Construct a DropTargetContext
- * given a specified DropTarget.
+ * Construct a {@code DropTargetContext}
+ * given a specified {@code DropTarget}.
*
* @param dt the DropTarget to associate with
*/
@@ -87,17 +87,17 @@ public class DropTargetContext implements Serializable {
}
/**
- * This method returns the DropTarget associated with this
- * DropTargetContext.
+ * This method returns the {@code DropTarget} associated with this
+ * {@code DropTargetContext}.
*
- * @return the DropTarget associated with this DropTargetContext
+ * @return the {@code DropTarget} associated with this {@code DropTargetContext}
*/
public DropTarget getDropTarget() { return dropTarget; }
/**
- * This method returns the Component associated with
- * this DropTargetContext.
+ * This method returns the {@code Component} associated with
+ * this {@code DropTargetContext}.
*
* @return the Component associated with this Context
*/
@@ -105,7 +105,7 @@ public class DropTargetContext implements Serializable {
public Component getComponent() { return dropTarget.getComponent(); }
/**
- * Called when disassociated with the DropTargetContextPeer.
+ * Called when disassociated with the {@code DropTargetContextPeer}.
*/
void reset() {
dropTargetContextPeer = null;
@@ -114,9 +114,9 @@ public class DropTargetContext implements Serializable {
/**
* This method sets the current actions acceptable to
- * this DropTarget.
+ * this {@code DropTarget}.
*
- * @param actions an int representing the supported action(s)
+ * @param actions an {@code int} representing the supported action(s)
*/
protected void setTargetActions(int actions) {
@@ -132,10 +132,10 @@ public class DropTargetContext implements Serializable {
}
/**
- * This method returns an int representing the
- * current actions this DropTarget will accept.
+ * This method returns an {@code int} representing the
+ * current actions this {@code DropTarget} will accept.
*
- * @return the current actions acceptable to this DropTarget
+ * @return the current actions acceptable to this {@code DropTarget}
*/
protected int getTargetActions() {
@@ -215,11 +215,11 @@ public class DropTargetContext implements Serializable {
/**
* get the available DataFlavors of the
- * Transferable operand of this operation.
+ * {@code Transferable} operand of this operation.
*
- * @return a DataFlavor[] containing the
- * supported DataFlavors of the
- * Transferable operand.
+ * @return a {@code DataFlavor[]} containing the
+ * supported {@code DataFlavor}s of the
+ * {@code Transferable} operand.
*/
protected DataFlavor[] getCurrentDataFlavors() {
@@ -229,11 +229,11 @@ public class DropTargetContext implements Serializable {
/**
* This method returns a the currently available DataFlavors
- * of the Transferable operand
- * as a java.util.List.
+ * of the {@code Transferable} operand
+ * as a {@code java.util.List}.
*
* @return the currently available
- * DataFlavors as a java.util.List
+ * DataFlavors as a {@code java.util.List}
*/
protected List getCurrentDataFlavorsAsList() {
@@ -241,13 +241,13 @@ public class DropTargetContext implements Serializable {
}
/**
- * This method returns a boolean
- * indicating if the given DataFlavor is
- * supported by this DropTargetContext.
+ * This method returns a {@code boolean}
+ * indicating if the given {@code DataFlavor} is
+ * supported by this {@code DropTargetContext}.
*
- * @param df the DataFlavor
+ * @param df the {@code DataFlavor}
*
- * @return if the DataFlavor specified is supported
+ * @return if the {@code DataFlavor} specified is supported
*/
protected boolean isDataFlavorSupported(DataFlavor df) {
@@ -259,7 +259,7 @@ public class DropTargetContext implements Serializable {
*
* @throws InvalidDnDOperationException if a drag is not outstanding/extant
*
- * @return the Transferable
+ * @return the {@code Transferable}
*/
protected Transferable getTransferable() throws InvalidDnDOperationException {
@@ -282,7 +282,7 @@ public class DropTargetContext implements Serializable {
}
/**
- * Get the DropTargetContextPeer
+ * Get the {@code DropTargetContextPeer}
*
* @return the platform peer
*/
@@ -301,10 +301,10 @@ public class DropTargetContext implements Serializable {
* Creates a TransferableProxy to proxy for the specified
* Transferable.
*
- * @param t the Transferable to be proxied
- * @param local true if t represents
+ * @param t the {@code Transferable} to be proxied
+ * @param local {@code true} if {@code t} represents
* the result of a local drag-n-drop operation.
- * @return the new TransferableProxy instance.
+ * @return the new {@code TransferableProxy} instance.
*/
protected Transferable createTransferableProxy(Transferable t, boolean local) {
return new TransferableProxy(t, local);
@@ -314,9 +314,9 @@ public class DropTargetContext implements Serializable {
/**
- * TransferableProxy is a helper inner class that implements
- * Transferable interface and serves as a proxy for another
- * Transferable object which represents data transfer for
+ * {@code TransferableProxy} is a helper inner class that implements
+ * {@code Transferable} interface and serves as a proxy for another
+ * {@code Transferable} object which represents data transfer for
* a particular drag-n-drop operation.
*
* The proxy forwards all requests to the encapsulated transferable
@@ -327,14 +327,14 @@ public class DropTargetContext implements Serializable {
protected class TransferableProxy implements Transferable {
/**
- * Constructs a TransferableProxy given
- * a specified Transferable object representing
+ * Constructs a {@code TransferableProxy} given
+ * a specified {@code Transferable} object representing
* data transfer for a particular drag-n-drop operation and
- * a boolean which indicates whether the
+ * a {@code boolean} which indicates whether the
* drag-n-drop operation is local (within the same JVM).
*
- * @param t the Transferable object
- * @param local true, if t represents
+ * @param t the {@code Transferable} object
+ * @param local {@code true}, if {@code t} represents
* the result of local drag-n-drop operation
*/
TransferableProxy(Transferable t, boolean local) {
@@ -358,8 +358,8 @@ public class DropTargetContext implements Serializable {
* Returns whether or not the specified data flavor is supported by
* the encapsulated transferable.
* @param flavor the requested flavor for the data
- * @return true if the data flavor is supported,
- * false otherwise
+ * @return {@code true} if the data flavor is supported,
+ * {@code false} otherwise
*/
public boolean isDataFlavorSupported(DataFlavor flavor) {
return proxy.isDataFlavorSupported(flavor);
@@ -397,13 +397,13 @@ public class DropTargetContext implements Serializable {
// public constructor.
/**
- * The encapsulated Transferable object.
+ * The encapsulated {@code Transferable} object.
*/
protected Transferable transferable;
/**
- * A boolean indicating if the encapsulated
- * Transferable object represents the result
+ * A {@code boolean} indicating if the encapsulated
+ * {@code Transferable} object represents the result
* of local drag-n-drop operation (within the same JVM).
*/
protected boolean isLocal;
diff --git a/jdk/src/java.desktop/share/classes/java/awt/event/InvocationEvent.java b/jdk/src/java.desktop/share/classes/java/awt/event/InvocationEvent.java
index eee903a5d1a..aa0cc496424 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/event/InvocationEvent.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/event/InvocationEvent.java
@@ -31,16 +31,16 @@ import java.awt.ActiveEvent;
import java.awt.AWTEvent;
/**
- * An event which executes the run() method on a Runnable
- * when dispatched by the AWT event dispatcher thread. This class can
- * be used as a reference implementation of ActiveEvent rather
- * than declaring a new class and defining dispatch().
+ * An event which executes the {@code run()} method on a {@code Runnable
+ * } when dispatched by the AWT event dispatcher thread. This class can
+ * be used as a reference implementation of {@code ActiveEvent} rather
+ * than declaring a new class and defining {@code dispatch()}.
*
- * Instances of this class are placed on the EventQueue by calls
- * to invokeLater and invokeAndWait. Client code
- * can use this fact to write replacement functions for invokeLater
- * and invokeAndWait without writing special-case code
- * in any AWTEventListener objects.
+ * Instances of this class are placed on the {@code EventQueue} by calls
+ * to {@code invokeLater} and {@code invokeAndWait}. Client code
+ * can use this fact to write replacement functions for {@code invokeLater
+ * } and {@code invokeAndWait} without writing special-case code
+ * in any {@code AWTEventListener} objects.
*
* An unspecified behavior will be caused if the {@code id} parameter
* of any particular {@code InvocationEvent} instance is not
@@ -106,7 +106,7 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent {
private final Runnable listener;
/**
- * Indicates whether the run() method of the runnable
+ * Indicates whether the {@code run()} method of the {@code runnable}
* was executed or not.
*
* @see #isDispatched
@@ -149,20 +149,21 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent {
private static final long serialVersionUID = 436056344909459450L;
/**
- * Constructs an InvocationEvent with the specified
- * source which will execute the runnable's run
+ * Constructs an {@code InvocationEvent} with the specified
+ * source which will execute the runnable's {@code run}
* method when dispatched.
*
This is a convenience constructor. An invocation of the form
- * InvocationEvent(source, runnable)
+ * {@code InvocationEvent(source, runnable)}
* behaves in exactly the same way as the invocation of
- * {@link #InvocationEvent(Object, Runnable, Object, boolean) InvocationEvent}(source, runnable, null, false).
- *
This method throws an IllegalArgumentException
- * if source is null.
+ * {@link #InvocationEvent(Object, Runnable, Object, boolean)
+ * InvocationEvent(source, runnable, null, false)}.
+ *
This method throws an {@code IllegalArgumentException}
+ * if {@code source} is {@code null}.
*
- * @param source The Object that originated the event
- * @param runnable The Runnable whose run
+ * @param source The {@code Object} that originated the event
+ * @param runnable The {@code Runnable} whose {@code run}
* method will be executed
- * @throws IllegalArgumentException if source is null
+ * @throws IllegalArgumentException if {@code source} is null
*
* @see #getSource()
* @see #InvocationEvent(Object, Runnable, Object, boolean)
@@ -172,35 +173,36 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent {
}
/**
- * Constructs an InvocationEvent with the specified
- * source which will execute the runnable's run
- * method when dispatched. If notifier is non-null,
- * notifyAll() will be called on it
- * immediately after run has returned or thrown an exception.
- *
An invocation of the form InvocationEvent(source,
- * runnable, notifier, catchThrowables)
+ * Constructs an {@code InvocationEvent} with the specified
+ * source which will execute the runnable's {@code run}
+ * method when dispatched. If notifier is non-{@code null},
+ * {@code notifyAll()} will be called on it
+ * immediately after {@code run} has returned or thrown an exception.
+ *
An invocation of the form
+ * {@code InvocationEvent(source, runnable, notifier, catchThrowables)}
* behaves in exactly the same way as the invocation of
- * {@link #InvocationEvent(Object, int, Runnable, Object, boolean) InvocationEvent}(source, InvocationEvent.INVOCATION_DEFAULT, runnable, notifier, catchThrowables).
- *
This method throws an IllegalArgumentException
- * if source is null.
+ * {@link #InvocationEvent(Object, int, Runnable, Object, boolean)
+ * InvocationEvent(source, InvocationEvent.INVOCATION_DEFAULT, runnable, notifier, catchThrowables)}.
+ *
This method throws an {@code IllegalArgumentException}
+ * if {@code source} is {@code null}.
*
- * @param source The Object that originated
+ * @param source The {@code Object} that originated
* the event
- * @param runnable The Runnable whose
- * run method will be
+ * @param runnable The {@code Runnable} whose
+ * {@code run} method will be
* executed
- * @param notifier The {@code Object} whose notifyAll
+ * @param notifier The {@code Object} whose {@code notifyAll}
* method will be called after
- * Runnable.run has returned or
+ * {@code Runnable.run} has returned or
* thrown an exception or after the event was
* disposed
- * @param catchThrowables Specifies whether dispatch
+ * @param catchThrowables Specifies whether {@code dispatch}
* should catch Throwable when executing
- * the Runnable's run
+ * the {@code Runnable}'s {@code run}
* method, or should instead propagate those
* Throwables to the EventDispatchThread's
* dispatch loop
- * @throws IllegalArgumentException if source is null
+ * @throws IllegalArgumentException if {@code source} is null
*
* @see #getSource()
* @see #InvocationEvent(Object, int, Runnable, Object, boolean)
@@ -211,31 +213,31 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent {
}
/**
- * Constructs an InvocationEvent with the specified
- * source which will execute the runnable's run
- * method when dispatched. If listener is non-null,
- * listener.run() will be called immediately after
- * run has returned, thrown an exception or the event
+ * Constructs an {@code InvocationEvent} with the specified
+ * source which will execute the runnable's {@code run}
+ * method when dispatched. If listener is non-{@code null},
+ * {@code listener.run()} will be called immediately after
+ * {@code run} has returned, thrown an exception or the event
* was disposed.
- *
This method throws an IllegalArgumentException
- * if source is null.
+ *
This method throws an {@code IllegalArgumentException}
+ * if {@code source} is {@code null}.
*
- * @param source The Object that originated
+ * @param source The {@code Object} that originated
* the event
- * @param runnable The Runnable whose
- * run method will be
+ * @param runnable The {@code Runnable} whose
+ * {@code run} method will be
* executed
- * @param listener The RunnableRunnable whose
- * run() method will be called
+ * @param listener The {@code Runnable}Runnable whose
+ * {@code run()} method will be called
* after the {@code InvocationEvent}
* was dispatched or disposed
- * @param catchThrowables Specifies whether dispatch
+ * @param catchThrowables Specifies whether {@code dispatch}
* should catch Throwable when executing
- * the Runnable's run
+ * the {@code Runnable}'s {@code run}
* method, or should instead propagate those
* Throwables to the EventDispatchThread's
* dispatch loop
- * @throws IllegalArgumentException if source is null
+ * @throws IllegalArgumentException if {@code source} is null
*/
public InvocationEvent(Object source, Runnable runnable, Runnable listener,
boolean catchThrowables) {
@@ -243,34 +245,34 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent {
}
/**
- * Constructs an InvocationEvent with the specified
- * source and ID which will execute the runnable's run
- * method when dispatched. If notifier is non-null,
- * notifyAll will be called on it immediately after
- * run has returned or thrown an exception.
+ * Constructs an {@code InvocationEvent} with the specified
+ * source and ID which will execute the runnable's {@code run}
+ * method when dispatched. If notifier is non-{@code null},
+ * {@code notifyAll} will be called on it immediately after
+ * {@code run} has returned or thrown an exception.
*
This method throws an
- * IllegalArgumentException if source
- * is null.
+ * {@code IllegalArgumentException} if {@code source}
+ * is {@code null}.
*
- * @param source The Object that originated
+ * @param source The {@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 InvocationEvent}
- * @param runnable The Runnable whose
- * run method will be executed
- * @param notifier The Object whose notifyAll
+ * @param runnable The {@code Runnable} whose
+ * {@code run} method will be executed
+ * @param notifier The {@code Object} whose {@code notifyAll}
* method will be called after
- * Runnable.run has returned or
+ * {@code Runnable.run} has returned or
* thrown an exception or after the event was
* disposed
- * @param catchThrowables Specifies whether dispatch
+ * @param catchThrowables Specifies whether {@code dispatch}
* should catch Throwable when executing the
- * Runnable's run
+ * {@code Runnable}'s {@code run}
* method, or should instead propagate those
* Throwables to the EventDispatchThread's
* dispatch loop
- * @throws IllegalArgumentException if source is null
+ * @throws IllegalArgumentException if {@code source} is null
* @see #getSource()
* @see #getID()
*/
@@ -289,8 +291,8 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent {
this.when = System.currentTimeMillis();
}
/**
- * Executes the Runnable's run() method and notifies the
- * notifier (if any) when run() has returned or thrown an exception.
+ * Executes the Runnable's {@code run()} method and notifies the
+ * notifier (if any) when {@code run()} has returned or thrown an exception.
*
* @see #isDispatched
*/
@@ -316,8 +318,8 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent {
}
/**
- * Returns any Exception caught while executing the Runnable's run()
- * method.
+ * Returns any Exception caught while executing
+ * the Runnable's {@code run()} method.
*
* @return A reference to the Exception if one was thrown; null if no
* Exception was thrown or if this InvocationEvent does not
@@ -328,8 +330,8 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent {
}
/**
- * Returns any Throwable caught while executing the Runnable's run()
- * method.
+ * Returns any Throwable caught while executing
+ * the Runnable's {@code run()} method.
*
* @return A reference to the Throwable if one was thrown; null if no
* Throwable was thrown or if this InvocationEvent does not
diff --git a/jdk/src/java.desktop/share/classes/java/awt/event/MouseEvent.java b/jdk/src/java.desktop/share/classes/java/awt/event/MouseEvent.java
index 65a8626f872..2804f2b57ac 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/event/MouseEvent.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/event/MouseEvent.java
@@ -78,26 +78,26 @@ import sun.awt.SunToolkit;
*
*
*
- * A MouseEvent object is passed to every
- * MouseListener
- * or MouseAdapter object which is registered to receive
+ * A {@code MouseEvent} object is passed to every
+ * {@code MouseListener}
+ * or {@code MouseAdapter} object which is registered to receive
* the "interesting" mouse events using the component's
- * addMouseListener method.
- * (MouseAdapter objects implement the
- * MouseListener interface.) Each such listener object
- * gets a MouseEvent containing the mouse event.
+ * {@code addMouseListener} method.
+ * ({@code MouseAdapter} objects implement the
+ * {@code MouseListener} interface.) Each such listener object
+ * gets a {@code MouseEvent} containing the mouse event.
*
- * A MouseEvent object is also passed to every
- * MouseMotionListener or
- * MouseMotionAdapter object which is registered to receive
+ * A {@code MouseEvent} object is also passed to every
+ * {@code MouseMotionListener} or
+ * {@code MouseMotionAdapter} object which is registered to receive
* mouse motion events using the component's
- * addMouseMotionListener
- * method. (MouseMotionAdapter objects implement the
- * MouseMotionListener interface.) Each such listener object
- * gets a MouseEvent containing the mouse motion event.
+ * {@code addMouseMotionListener}
+ * method. ({@code MouseMotionAdapter} objects implement the
+ * {@code MouseMotionListener} interface.) Each such listener object
+ * gets a {@code MouseEvent} containing the mouse motion event.
*
* When a mouse button is clicked, events are generated and sent to the
- * registered MouseListeners.
+ * registered {@code MouseListener}s.
* The state of modal keys can be retrieved using {@link InputEvent#getModifiers}
* and {@link InputEvent#getModifiersEx}.
* The button mask returned by {@link InputEvent#getModifiers} reflects
@@ -111,31 +111,31 @@ import sun.awt.SunToolkit;
*
* For example, if the first mouse button is pressed, events are sent in the
* following order:
- *
* When multiple mouse buttons are pressed, each press, release, and click
* results in a separate event.
*
* For example, if the user presses button 1 followed by
* button 2, and then releases them in the same order,
* the following sequence of events is generated:
- *
* If button 2 is released first, the
- * MOUSE_RELEASED/MOUSE_CLICKED pair
- * for BUTTON2_MASK arrives first,
- * followed by the pair for BUTTON1_MASK.
+ * {@code MOUSE_RELEASED}/{@code MOUSE_CLICKED} pair
+ * for {@code BUTTON2_MASK} arrives first,
+ * followed by the pair for {@code BUTTON1_MASK}.
*
* Some extra mouse buttons are added to extend the standard set of buttons
* represented by the following constants:{@code BUTTON1}, {@code BUTTON2}, and {@code BUTTON3}.
@@ -154,20 +154,20 @@ import sun.awt.SunToolkit;
* Drag&Drop operation.
*
* In a multi-screen environment mouse drag events are delivered to the
- * Component even if the mouse position is outside the bounds of the
- * GraphicsConfiguration associated with that
- * Component. However, the reported position for mouse drag events
+ * {@code Component} even if the mouse position is outside the bounds of the
+ * {@code GraphicsConfiguration} associated with that
+ * {@code Component}. However, the reported position for mouse drag events
* in this case may differ from the actual mouse position:
*
*
In a multi-screen environment without a virtual device:
*
* The reported coordinates for mouse drag events are clipped to fit within the
- * bounds of the GraphicsConfiguration associated with
- * the Component.
+ * bounds of the {@code GraphicsConfiguration} associated with
+ * the {@code Component}.
*
In a multi-screen environment with a virtual device:
*
* The reported coordinates for mouse drag events are clipped to fit within the
- * bounds of the virtual device associated with the Component.
+ * bounds of the virtual device associated with the {@code Component}.
*
*
* An unspecified behavior will be caused if the {@code id} parameter
@@ -200,51 +200,51 @@ public class MouseEvent extends InputEvent {
public static final int MOUSE_LAST = 507;
/**
- * The "mouse clicked" event. This MouseEvent
+ * The "mouse clicked" event. This {@code MouseEvent}
* occurs when a mouse button is pressed and released.
*/
public static final int MOUSE_CLICKED = MOUSE_FIRST;
/**
- * The "mouse pressed" event. This MouseEvent
+ * The "mouse pressed" event. This {@code MouseEvent}
* occurs when a mouse button is pushed down.
*/
public static final int MOUSE_PRESSED = 1 + MOUSE_FIRST; //Event.MOUSE_DOWN
/**
- * The "mouse released" event. This MouseEvent
+ * The "mouse released" event. This {@code MouseEvent}
* occurs when a mouse button is let up.
*/
public static final int MOUSE_RELEASED = 2 + MOUSE_FIRST; //Event.MOUSE_UP
/**
- * The "mouse moved" event. This MouseEvent
+ * The "mouse moved" event. This {@code MouseEvent}
* occurs when the mouse position changes.
*/
public static final int MOUSE_MOVED = 3 + MOUSE_FIRST; //Event.MOUSE_MOVE
/**
- * The "mouse entered" event. This MouseEvent
+ * The "mouse entered" event. This {@code MouseEvent}
* occurs when the mouse cursor enters the unobscured part of component's
* geometry.
*/
public static final int MOUSE_ENTERED = 4 + MOUSE_FIRST; //Event.MOUSE_ENTER
/**
- * The "mouse exited" event. This MouseEvent
+ * The "mouse exited" event. This {@code MouseEvent}
* occurs when the mouse cursor exits the unobscured part of component's
* geometry.
*/
public static final int MOUSE_EXITED = 5 + MOUSE_FIRST; //Event.MOUSE_EXIT
/**
- * The "mouse dragged" event. This MouseEvent
+ * The "mouse dragged" event. This {@code MouseEvent}
* occurs when the mouse position changes while a mouse button is pressed.
*/
public static final int MOUSE_DRAGGED = 6 + MOUSE_FIRST; //Event.MOUSE_DRAG
/**
- * The "mouse wheel" event. This is the only MouseWheelEvent.
+ * The "mouse wheel" event. This is the only {@code MouseWheelEvent}.
* It occurs when a mouse equipped with a wheel has its wheel rotated.
* @since 1.4
*/
@@ -320,10 +320,10 @@ public class MouseEvent extends InputEvent {
* Indicates the number of quick consecutive clicks of
* a mouse button.
* clickCount will be valid for only three mouse events :
- * MOUSE_CLICKED,
- * MOUSE_PRESSED and
- * MOUSE_RELEASED.
- * For the above, the clickCount will be at least 1.
+ * {@code MOUSE_CLICKED},
+ * {@code MOUSE_PRESSED} and
+ * {@code MOUSE_RELEASED}.
+ * For the above, the {@code clickCount} will be at least 1.
* For all other events the count will be 0.
*
* @serial
@@ -365,8 +365,8 @@ public class MouseEvent extends InputEvent {
/**
* A property used to indicate whether a Popup Menu
* should appear with a certain gestures.
- * If popupTrigger = false,
- * no popup menu should appear. If it is true
+ * If {@code popupTrigger} = {@code false},
+ * no popup menu should appear. If it is {@code true}
* then a popup menu should appear.
*
* @serial
@@ -415,7 +415,7 @@ public class MouseEvent extends InputEvent {
* Otherwise, these coordinates are relative to the coordinate system
* associated with the Component's GraphicsConfiguration.
*
- * @return a Point object containing the absolute x
+ * @return a {@code Point} object containing the absolute x
* and y coordinates.
*
* @see java.awt.GraphicsConfiguration
@@ -460,7 +460,7 @@ public class MouseEvent extends InputEvent {
}
/**
- * Constructs a MouseEvent object with the
+ * Constructs a {@code MouseEvent} object with the
* specified source component,
* type, time, modifiers, coordinates, click count, popupTrigger flag,
* and button number.
@@ -469,19 +469,19 @@ public class MouseEvent extends InputEvent {
* 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
- * MouseEvent(source, id, when, modifiers, x, y, clickCount, popupTrigger, button)
+ * {@code MouseEvent(source, id, when, modifiers, x, y, clickCount, popupTrigger, button)}
* behaves in exactly the same way as the invocation
- * {@link #MouseEvent(Component, int, long, int, int, int,
- * int, int, int, boolean, int) MouseEvent}(source, id, when, modifiers,
- * x, y, xAbs, yAbs, clickCount, popupTrigger, button)
+ * {@link #MouseEvent(Component, int, long, int, int, int,
+ * int, int, int, boolean, int) MouseEvent(source, id, when, modifiers,
+ * x, y, xAbs, yAbs, clickCount, popupTrigger, button)}
* where xAbs and yAbs defines as source's location on screen plus
* relative coordinates x and y.
* xAbs and yAbs are set to zero if the source is not showing.
* This method throws an
- * IllegalArgumentException if source
- * is null.
+ * {@code IllegalArgumentException} if {@code source}
+ * is {@code null}.
*
- * @param source The Component that originated the event
+ * @param source The {@code 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 MouseEvent}
@@ -527,16 +527,16 @@ public class MouseEvent extends InputEvent {
* if the mouse has more than three buttons.
*
* @throws IllegalArgumentException if {@code button} is less then zero
- * @throws IllegalArgumentException if source is null
+ * @throws IllegalArgumentException if {@code source} is null
* @throws IllegalArgumentException if {@code button} is greater then BUTTON3 and the support for extended mouse buttons is
* {@link Toolkit#areExtraMouseButtonsEnabled() disabled} by Java
* @throws IllegalArgumentException if {@code button} is greater then the
* {@link java.awt.MouseInfo#getNumberOfButtons() current number of buttons} and the support
* for extended mouse buttons is {@link Toolkit#areExtraMouseButtonsEnabled() enabled}
* by Java
- * @throws IllegalArgumentException if an invalid button
+ * @throws IllegalArgumentException if an invalid {@code button}
* value is passed in
- * @throws IllegalArgumentException if source is null
+ * @throws IllegalArgumentException if {@code source} is null
* @see #getSource()
* @see #getID()
* @see #getWhen()
@@ -565,22 +565,22 @@ public class MouseEvent extends InputEvent {
}
/**
- * Constructs a MouseEvent object with the
+ * Constructs a {@code MouseEvent} object with the
* specified source component,
* type, modifiers, coordinates, click count, and popupTrigger flag.
* An invocation of the form
- * MouseEvent(source, id, when, modifiers, x, y, clickCount, popupTrigger)
+ * {@code MouseEvent(source, id, when, modifiers, x, y, clickCount, popupTrigger)}
* behaves in exactly the same way as the invocation
- * {@link #MouseEvent(Component, int, long, int, int, int,
- * int, int, int, boolean, int) MouseEvent}(source, id, when, modifiers,
- * x, y, xAbs, yAbs, clickCount, popupTrigger, MouseEvent.NOBUTTON)
+ * {@link #MouseEvent(Component, int, long, int, int, int,
+ * int, int, int, boolean, int) MouseEvent(source, id, when, modifiers,
+ * x, y, xAbs, yAbs, clickCount, popupTrigger, MouseEvent.NOBUTTON)}
* where xAbs and yAbs defines as source's location on screen plus
* relative coordinates x and y.
* xAbs and yAbs are set to zero if the source is not showing.
- * This method throws an IllegalArgumentException
- * if source is null.
+ * This method throws an {@code IllegalArgumentException}
+ * if {@code source} is {@code null}.
*
- * @param source The Component that originated the event
+ * @param source The {@code 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 MouseEvent}
@@ -605,7 +605,7 @@ public class MouseEvent extends InputEvent {
* is not recommended
* @param popupTrigger A boolean that equals {@code true} if this event
* is a trigger for a popup menu
- * @throws IllegalArgumentException if source is null
+ * @throws IllegalArgumentException if {@code source} is null
* @see #getSource()
* @see #getID()
* @see #getWhen()
@@ -637,7 +637,7 @@ public class MouseEvent extends InputEvent {
}
/**
- * Constructs a MouseEvent object with the
+ * Constructs a {@code MouseEvent} object with the
* specified source component,
* type, time, modifiers, coordinates, absolute coordinates, click count, popupTrigger flag,
* and button number.
@@ -649,10 +649,10 @@ public class MouseEvent extends InputEvent {
* passed to the constructor, the mouse event instance is still
* created and no exception is thrown.
* This method throws an
- * IllegalArgumentException if source
- * is null.
+ * {@code IllegalArgumentException} if {@code source}
+ * is {@code null}.
*
- * @param source The Component that originated the event
+ * @param source The {@code 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 MouseEvent}
@@ -702,16 +702,16 @@ public class MouseEvent extends InputEvent {
* if the mouse has more than three buttons.
*
* @throws IllegalArgumentException if {@code button} is less then zero
- * @throws IllegalArgumentException if source is null
+ * @throws IllegalArgumentException if {@code source} is null
* @throws IllegalArgumentException if {@code button} is greater then BUTTON3 and the support for extended mouse buttons is
* {@link Toolkit#areExtraMouseButtonsEnabled() disabled} by Java
* @throws IllegalArgumentException if {@code button} is greater then the
* {@link java.awt.MouseInfo#getNumberOfButtons() current number of buttons} and the support
* for extended mouse buttons is {@link Toolkit#areExtraMouseButtonsEnabled() enabled}
* by Java
- * @throws IllegalArgumentException if an invalid button
+ * @throws IllegalArgumentException if an invalid {@code button}
* value is passed in
- * @throws IllegalArgumentException if source is null
+ * @throws IllegalArgumentException if {@code source} is null
* @see #getSource()
* @see #getID()
* @see #getWhen()
@@ -803,7 +803,7 @@ public class MouseEvent extends InputEvent {
/**
* Returns the x,y position of the event relative to the source component.
*
- * @return a Point object containing the x and y coordinates
+ * @return a {@code Point} object containing the x and y coordinates
* relative to the source component
*
*/
@@ -819,7 +819,7 @@ public class MouseEvent extends InputEvent {
/**
* Translates the event's coordinates to a new position
- * by adding specified x (horizontal) and y
+ * by adding specified {@code x} (horizontal) and {@code y}
* (vertical) offsets.
*
* @param x the horizontal x value to add to the current x
@@ -901,9 +901,9 @@ public class MouseEvent extends InputEvent {
* Returns whether or not this mouse event is the popup menu
* trigger event for the platform.
*
Note: Popup menus are triggered differently
- * on different systems. Therefore, isPopupTrigger
- * should be checked in both mousePressed
- * and mouseReleased
+ * on different systems. Therefore, {@code isPopupTrigger}
+ * should be checked in both {@code mousePressed}
+ * and {@code mouseReleased}
* for proper cross-platform functionality.
*
* @return boolean, true if this event is the popup menu trigger
@@ -914,16 +914,16 @@ public class MouseEvent extends InputEvent {
}
/**
- * Returns a String instance describing the modifier keys and
+ * Returns a {@code String} 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 awt.properties file.
+ * the {@code awt.properties} file.
*
- * Note that the InputEvent.ALT_MASK and
- * InputEvent.BUTTON2_MASK have equal values,
+ * Note that the {@code InputEvent.ALT_MASK} and
+ * {@code InputEvent.BUTTON2_MASK} have equal values,
* so the "Alt" string is returned for both modifiers. Likewise,
- * the InputEvent.META_MASK and
- * InputEvent.BUTTON3_MASK have equal values,
+ * the {@code InputEvent.META_MASK} and
+ * {@code InputEvent.BUTTON3_MASK} have equal values,
* so the "Meta" string is returned for both modifiers.
*
* Note that passing negative parameter is incorrect,
diff --git a/jdk/src/java.desktop/share/classes/java/awt/image/PixelGrabber.java b/jdk/src/java.desktop/share/classes/java/awt/image/PixelGrabber.java
index 0448a7bc291..3c632a6fe1f 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/image/PixelGrabber.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/PixelGrabber.java
@@ -99,7 +99,7 @@ public class PixelGrabber implements ImageConsumer {
* The pixels are stored into the array in the default RGB ColorModel.
* The RGB data for pixel (i, j) where (i, j) is inside the rectangle
* (x, y, w, h) is stored in the array at
- * pix[(j - y) * scansize + (i - x) + off].
+ * {@code pix[(j - y) * scansize + (i - x) + off]}.
* @see ColorModel#getRGBdefault
* @param img the image to retrieve pixels from
* @param x the x coordinate of the upper left corner of the rectangle
@@ -127,8 +127,8 @@ public class PixelGrabber implements ImageConsumer {
* The pixels are stored into the array in the default RGB ColorModel.
* The RGB data for pixel (i, j) where (i, j) is inside the rectangle
* (x, y, w, h) is stored in the array at
- * pix[(j - y) * scansize + (i - x) + off].
- * @param ip the ImageProducer that produces the
+ * {@code pix[(j - y) * scansize + (i - x) + off]}.
+ * @param ip the {@code ImageProducer} that produces the
* image from which to retrieve pixels
* @param x the x coordinate of the upper left corner of the rectangle
* of pixels to retrieve from the image, relative to the default
@@ -231,13 +231,13 @@ public class PixelGrabber implements ImageConsumer {
* wait for all of the pixels in the rectangle of interest to be
* delivered or until the specified timeout has elapsed. This method
* behaves in the following ways, depending on the value of
- * ms:
+ * {@code ms}:
*
*
If {@code ms == 0}, waits until all pixels are delivered
*
If {@code ms > 0}, waits until all pixels are delivered
* as timeout expires.
- *
If {@code ms < 0}, returns true if all pixels
- * are grabbed, false otherwise and does not wait.
+ *
If {@code ms < 0}, returns {@code true} if all pixels
+ * are grabbed, {@code false} otherwise and does not wait.
*
* @param ms the number of milliseconds to wait for the image pixels
* to arrive before timing out
@@ -420,7 +420,7 @@ public class PixelGrabber implements ImageConsumer {
* this class to retrieve pixels from an image should avoid calling
* this method directly since that operation could result in problems
* with retrieving the requested pixels.
- * @param model the specified ColorModel
+ * @param model the specified {@code ColorModel}
* @see #getColorModel
*/
public void setColorModel(ColorModel model) {
@@ -461,7 +461,7 @@ public class PixelGrabber implements ImageConsumer {
* of the area of pixels to be set
* @param srcW the width of the area of pixels
* @param srcH the height of the area of pixels
- * @param model the specified ColorModel
+ * @param model the specified {@code ColorModel}
* @param pixels the array of pixels
* @param srcOff the offset into the pixels array
* @param srcScan the distance from one row of pixels to the next
@@ -548,7 +548,7 @@ public class PixelGrabber implements ImageConsumer {
* of the area of pixels to be set
* @param srcW the width of the area of pixels
* @param srcH the height of the area of pixels
- * @param model the specified ColorModel
+ * @param model the specified {@code ColorModel}
* @param pixels the array of pixels
* @param srcOff the offset into the pixels array
* @param srcScan the distance from one row of pixels to the next
@@ -658,7 +658,7 @@ public class PixelGrabber implements ImageConsumer {
* Returns the status of the pixels. The ImageObserver flags
* representing the available pixel information are returned.
* This method and {@link #getStatus() getStatus} have the
- * same implementation, but getStatus is the
+ * same implementation, but {@code getStatus} is the
* preferred method because it conforms to the convention of
* naming information-retrieval methods with the form
* "getXXX".
diff --git a/jdk/src/java.desktop/share/classes/java/awt/image/RescaleOp.java b/jdk/src/java.desktop/share/classes/java/awt/image/RescaleOp.java
index e8fa30ee947..1bf21db2354 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/image/RescaleOp.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/RescaleOp.java
@@ -326,16 +326,16 @@ public class RescaleOp implements BufferedImageOp, RasterOp {
public final BufferedImage filter (BufferedImage src, BufferedImage dst) {
ColorModel srcCM = src.getColorModel();
ColorModel dstCM;
- int numBands = srcCM.getNumColorComponents();
-
+ int numSrcColorComp = srcCM.getNumColorComponents();
+ int scaleConst = length;
if (srcCM instanceof IndexColorModel) {
throw new
IllegalArgumentException("Rescaling cannot be "+
"performed on an indexed image");
}
- if (length != 1 && length != numBands &&
- length != srcCM.getNumComponents())
+ if (scaleConst != 1 && scaleConst != numSrcColorComp &&
+ scaleConst != srcCM.getNumComponents())
{
throw new IllegalArgumentException("Number of scaling constants "+
"does not equal the number of"+
@@ -346,13 +346,14 @@ public class RescaleOp implements BufferedImageOp, RasterOp {
boolean needToConvert = false;
// Include alpha
- if (length > numBands && srcCM.hasAlpha()) {
- length = numBands+1;
+ if (scaleConst > numSrcColorComp && srcCM.hasAlpha()) {
+ scaleConst = numSrcColorComp+1;
}
int width = src.getWidth();
int height = src.getHeight();
+ BufferedImage origDst = dst;
if (dst == null) {
dst = createCompatibleDestImage(src, null);
dstCM = srcCM;
@@ -380,7 +381,19 @@ public class RescaleOp implements BufferedImageOp, RasterOp {
}
- BufferedImage origDst = dst;
+ boolean scaleAlpha = true;
+
+ //
+ // The number of sets of scaling constants may be one,
+ // in which case the same constants are applied to all color
+ // (but NOT alpha) components. Otherwise, the number of sets
+ // of scaling constants may equal the number of Source color
+ // components, in which case NO rescaling of the alpha component
+ // (if present) is performed.
+ //
+ if (numSrcColorComp == scaleConst || scaleConst == 1) {
+ scaleAlpha = false;
+ }
//
// Try to use a native BI rescale operation first
@@ -392,12 +405,13 @@ public class RescaleOp implements BufferedImageOp, RasterOp {
WritableRaster srcRaster = src.getRaster();
WritableRaster dstRaster = dst.getRaster();
- if (srcCM.hasAlpha()) {
- if (numBands-1 == length || length == 1) {
+ if (!scaleAlpha) {
+ if (srcCM.hasAlpha()) {
+ // Do not rescale Alpha component
int minx = srcRaster.getMinX();
int miny = srcRaster.getMinY();
- int[] bands = new int[numBands-1];
- for (int i=0; i < numBands-1; i++) {
+ int[] bands = new int[numSrcColorComp];
+ for (int i=0; i < numSrcColorComp; i++) {
bands[i] = i;
}
srcRaster =
@@ -407,14 +421,11 @@ public class RescaleOp implements BufferedImageOp, RasterOp {
minx, miny,
bands);
}
- }
- if (dstCM.hasAlpha()) {
- int dstNumBands = dstRaster.getNumBands();
- if (dstNumBands-1 == length || length == 1) {
+ if (dstCM.hasAlpha()) {
int minx = dstRaster.getMinX();
int miny = dstRaster.getMinY();
- int[] bands = new int[numBands-1];
- for (int i=0; i < numBands-1; i++) {
+ int[] bands = new int[numSrcColorComp];
+ for (int i=0; i < numSrcColorComp; i++) {
bands[i] = i;
}
dstRaster =
@@ -429,17 +440,42 @@ public class RescaleOp implements BufferedImageOp, RasterOp {
//
// Call the raster filter method
//
- filter(srcRaster, dstRaster);
+ filterRasterImpl(srcRaster, dstRaster, scaleConst);
+ //
+ // here copy the unscaled src alpha to destination alpha channel
+ //
+ if (!scaleAlpha) {
+ Raster srcAlphaRaster = null;
+ WritableRaster dstAlphaRaster = null;
+
+ if (srcCM.hasAlpha()) {
+ srcAlphaRaster = src.getAlphaRaster();
+ }
+ if (dstCM.hasAlpha()) {
+ dstAlphaRaster = dst.getAlphaRaster();
+ if (srcAlphaRaster != null) {
+ dstAlphaRaster.setRect(srcAlphaRaster);
+ } else {
+ int alpha = 0xff << 24;
+ for (int cy=0; cy < dst.getHeight(); cy++) {
+ for (int cx=0; cx < dst.getWidth(); cx++) {
+ int color = dst.getRGB(cx, cy);
+
+ dst.setRGB(cx, cy, color | alpha);
+ }
+ }
+ }
+ }
+ }
}
if (needToConvert) {
// ColorModels are not the same
ColorConvertOp ccop = new ColorConvertOp(hints);
- ccop.filter(dst, origDst);
+ dst = ccop.filter(dst, origDst);
}
-
- return origDst;
+ return dst;
}
/**
@@ -461,6 +497,10 @@ public class RescaleOp implements BufferedImageOp, RasterOp {
* stated in the class comments.
*/
public final WritableRaster filter (Raster src, WritableRaster dst) {
+ return filterRasterImpl(src, dst, length);
+ }
+
+ private WritableRaster filterRasterImpl(Raster src, WritableRaster dst, int scaleConst) {
int numBands = src.getNumBands();
int width = src.getWidth();
int height = src.getHeight();
@@ -484,15 +524,15 @@ public class RescaleOp implements BufferedImageOp, RasterOp {
+ " does not equal number of bands in dest "
+ dst.getNumBands());
}
+
// Make sure that the arrays match
// Make sure that the low/high/constant arrays match
- if (length != 1 && length != src.getNumBands()) {
+ if (scaleConst != 1 && scaleConst != src.getNumBands()) {
throw new IllegalArgumentException("Number of scaling constants "+
"does not equal the number of"+
" of bands in the src raster");
}
-
//
// Try for a native raster rescale first
//
@@ -523,7 +563,7 @@ public class RescaleOp implements BufferedImageOp, RasterOp {
//
// Fall back to the slow code
//
- if (length > 1) {
+ if (scaleConst > 1) {
step = 1;
}
diff --git a/jdk/src/java.desktop/share/classes/java/beans/EventSetDescriptor.java b/jdk/src/java.desktop/share/classes/java/beans/EventSetDescriptor.java
index 6850c7628ba..78ae5f26a2f 100644
--- a/jdk/src/java.desktop/share/classes/java/beans/EventSetDescriptor.java
+++ b/jdk/src/java.desktop/share/classes/java/beans/EventSetDescriptor.java
@@ -54,16 +54,16 @@ public class EventSetDescriptor extends FeatureDescriptor {
private boolean inDefaultEventSet = true;
/**
- * Creates an EventSetDescriptor assuming that you are
+ * Creates an {@code EventSetDescriptor} assuming that you are
* following the most simple standard design pattern where a named
- * event "fred" is (1) delivered as a call on the single method of
+ * event "fred" is (1) delivered as a call on the single method of
* interface FredListener, (2) has a single argument of type FredEvent,
* and (3) where the FredListener may be registered with a call on an
* addFredListener method of the source component and removed with a
* call on a removeFredListener method.
*
* @param sourceClass The class firing the event.
- * @param eventSetName The programmatic name of the event. E.g. "fred".
+ * @param eventSetName The programmatic name of the event. E.g. "fred".
* Note that this should normally start with a lower-case character.
* @param listenerType The target interface that events
* will get delivered to.
@@ -100,7 +100,7 @@ public class EventSetDescriptor extends FeatureDescriptor {
}
/**
- * Creates an EventSetDescriptor from scratch using
+ * Creates an {@code EventSetDescriptor} from scratch using
* string names.
*
* @param sourceClass The class firing the event.
@@ -199,8 +199,8 @@ public class EventSetDescriptor extends FeatureDescriptor {
}
/**
- * Creates an EventSetDescriptor from scratch using
- * java.lang.reflect.Method and java.lang.Class objects.
+ * Creates an {@code EventSetDescriptor} from scratch using
+ * {@code java.lang.reflect.Method} and {@code java.lang.Class} objects.
*
* @param eventSetName The programmatic name of the event set.
* @param listenerType The Class for the listener interface.
@@ -267,8 +267,8 @@ public class EventSetDescriptor extends FeatureDescriptor {
}
/**
- * Creates an EventSetDescriptor from scratch using
- * java.lang.reflect.MethodDescriptor and java.lang.Class
+ * Creates an {@code EventSetDescriptor} from scratch using
+ * {@code java.lang.reflect.MethodDescriptor} and {@code java.lang.Class}
* objects.
*
* @param eventSetName The programmatic name of the event set.
@@ -299,7 +299,7 @@ public class EventSetDescriptor extends FeatureDescriptor {
}
/**
- * Gets the Class object for the target interface.
+ * Gets the {@code Class} object for the target interface.
*
* @return The Class object for the target interface that will
* get invoked when the event is fired.
@@ -317,7 +317,7 @@ public class EventSetDescriptor extends FeatureDescriptor {
/**
* Gets the methods of the target listener interface.
*
- * @return An array of Method objects for the target methods
+ * @return An array of {@code Method} objects for the target methods
* within the target listener interface that will get called when
* events are fired.
*/
@@ -355,9 +355,9 @@ public class EventSetDescriptor extends FeatureDescriptor {
}
/**
- * Gets the MethodDescriptors of the target listener interface.
+ * Gets the {@code MethodDescriptor}s of the target listener interface.
*
- * @return An array of MethodDescriptor objects for the target methods
+ * @return An array of {@code MethodDescriptor} objects for the target methods
* within the target listener interface that will get called when
* events are fired.
*/
@@ -442,30 +442,30 @@ public class EventSetDescriptor extends FeatureDescriptor {
* Normally event sources are multicast. However there are some
* exceptions that are strictly unicast.
*
- * @return true if the event set is unicast.
- * Defaults to false.
+ * @return {@code true} if the event set is unicast.
+ * Defaults to {@code false}.
*/
public boolean isUnicast() {
return unicast;
}
/**
- * Marks an event set as being in the "default" set (or not).
- * By default this is true.
+ * Marks an event set as being in the "default" set (or not).
+ * By default this is {@code true}.
*
- * @param inDefaultEventSet true if the event set is in
- * the "default" set,
- * false if not
+ * @param inDefaultEventSet {@code true} if the event set is in
+ * the "default" set,
+ * {@code false} if not
*/
public void setInDefaultEventSet(boolean inDefaultEventSet) {
this.inDefaultEventSet = inDefaultEventSet;
}
/**
- * Reports if an event set is in the "default" set.
+ * Reports if an event set is in the "default" set.
*
- * @return true if the event set is in
- * the "default" set. Defaults to true.
+ * @return {@code true} if the event set is in
+ * the "default" set. Defaults to {@code true}.
*/
public boolean isInDefaultEventSet() {
return inDefaultEventSet;
diff --git a/jdk/src/java.desktop/share/classes/java/beans/SimpleBeanInfo.java b/jdk/src/java.desktop/share/classes/java/beans/SimpleBeanInfo.java
index 45d5b44ba58..20d23127cdf 100644
--- a/jdk/src/java.desktop/share/classes/java/beans/SimpleBeanInfo.java
+++ b/jdk/src/java.desktop/share/classes/java/beans/SimpleBeanInfo.java
@@ -27,8 +27,7 @@ package java.beans;
import java.awt.Image;
import java.awt.Toolkit;
-import java.awt.image.ImageProducer;
-import java.net.URL;
+import java.io.InputStream;
/**
* This is a support class to make it easier for people to provide
@@ -122,14 +121,8 @@ public class SimpleBeanInfo implements BeanInfo {
* @return an image object. May be null if the load failed.
*/
public Image loadImage(final String resourceName) {
- try {
- final URL url = getClass().getResource(resourceName);
- if (url != null) {
- final ImageProducer ip = (ImageProducer) url.getContent();
- if (ip != null) {
- return Toolkit.getDefaultToolkit().createImage(ip);
- }
- }
+ try (InputStream in = getClass().getResourceAsStream(resourceName)) {
+ return Toolkit.getDefaultToolkit().createImage(in.readAllBytes());
} catch (final Exception ignored) {
}
return null;
diff --git a/jdk/src/java.desktop/share/classes/java/beans/beancontext/BeanContextChildSupport.java b/jdk/src/java.desktop/share/classes/java/beans/beancontext/BeanContextChildSupport.java
index af95e03e284..4bfecc2a8fe 100644
--- a/jdk/src/java.desktop/share/classes/java/beans/beancontext/BeanContextChildSupport.java
+++ b/jdk/src/java.desktop/share/classes/java/beans/beancontext/BeanContextChildSupport.java
@@ -91,9 +91,9 @@ public class BeanContextChildSupport implements BeanContextChild, BeanContextSer
}
/**
- * Sets the BeanContext for
- * this BeanContextChildSupport.
- * @param bc the new value to be assigned to the BeanContext
+ * Sets the {@code BeanContext} for
+ * this {@code BeanContextChildSupport}.
+ * @param bc the new value to be assigned to the {@code BeanContext}
* property
* @throws PropertyVetoException if the change is rejected
*/
@@ -137,10 +137,10 @@ public class BeanContextChildSupport implements BeanContextChild, BeanContextSer
}
/**
- * Gets the nesting BeanContext
- * for this BeanContextChildSupport.
- * @return the nesting BeanContext for
- * this BeanContextChildSupport.
+ * Gets the nesting {@code BeanContext}
+ * for this {@code BeanContextChildSupport}.
+ * @return the nesting {@code BeanContext} for
+ * this {@code BeanContextChildSupport}.
*/
public synchronized BeanContext getBeanContext() { return beanContext; }
@@ -149,11 +149,11 @@ public class BeanContextChildSupport implements BeanContextChild, BeanContextSer
* The same listener object may be added more than once. For each
* property, the listener will be invoked the number of times it was added
* for that property.
- * If name or pcl is null, no exception is thrown
+ * If {@code name} or {@code pcl} is null, no exception is thrown
* and no action is taken.
*
* @param name The name of the property to listen on
- * @param pcl The PropertyChangeListener to be added
+ * @param pcl The {@code PropertyChangeListener} to be added
*/
public void addPropertyChangeListener(String name, PropertyChangeListener pcl) {
pcSupport.addPropertyChangeListener(name, pcl);
@@ -161,12 +161,12 @@ public class BeanContextChildSupport implements BeanContextChild, BeanContextSer
/**
* Remove a PropertyChangeListener for a specific property.
- * If pcl was added more than once to the same event
+ * If {@code pcl} was added more than once to the same event
* source for the specified property, it will be notified one less time
* after being removed.
- * If name is null, no exception is thrown
+ * If {@code name} is null, no exception is thrown
* and no action is taken.
- * If pcl is null, or was never added for the specified
+ * If {@code pcl} is null, or was never added for the specified
* property, no exception is thrown and no action is taken.
*
* @param name The name of the property that was listened on
@@ -181,28 +181,28 @@ public class BeanContextChildSupport implements BeanContextChild, BeanContextSer
* The same listener object may be added more than once. For each
* property, the listener will be invoked the number of times it was added
* for that property.
- * If name or vcl is null, no exception is thrown
+ * If {@code name} or {@code vcl} is null, no exception is thrown
* and no action is taken.
*
* @param name The name of the property to listen on
- * @param vcl The VetoableChangeListener to be added
+ * @param vcl The {@code VetoableChangeListener} to be added
*/
public void addVetoableChangeListener(String name, VetoableChangeListener vcl) {
vcSupport.addVetoableChangeListener(name, vcl);
}
/**
- * Removes a VetoableChangeListener.
- * If pcl was added more than once to the same event
+ * Removes a {@code VetoableChangeListener}.
+ * If {@code pcl} was added more than once to the same event
* source for the specified property, it will be notified one less time
* after being removed.
- * If name is null, no exception is thrown
+ * If {@code name} is null, no exception is thrown
* and no action is taken.
- * If vcl is null, or was never added for the specified
+ * If {@code vcl} is null, or was never added for the specified
* property, no exception is thrown and no action is taken.
*
* @param name The name of the property that was listened on
- * @param vcl The VetoableChangeListener to be removed
+ * @param vcl The {@code VetoableChangeListener} to be removed
*/
public void removeVetoableChangeListener(String name, VetoableChangeListener vcl) {
vcSupport.removeVetoableChangeListener(name, vcl);
@@ -213,7 +213,7 @@ public class BeanContextChildSupport implements BeanContextChild, BeanContextSer
*
* Subclasses may override this method in order to implement their own
* behaviors.
- * @param bcsre The BeanContextServiceRevokedEvent fired as a
+ * @param bcsre The {@code BeanContextServiceRevokedEvent} fired as a
* result of a service being revoked
*/
public void serviceRevoked(BeanContextServiceRevokedEvent bcsre) { }
@@ -230,10 +230,10 @@ public class BeanContextChildSupport implements BeanContextChild, BeanContextSer
public void serviceAvailable(BeanContextServiceAvailableEvent bcsae) { }
/**
- * Gets the BeanContextChild associated with this
- * BeanContextChildSupport.
+ * Gets the {@code BeanContextChild} associated with this
+ * {@code BeanContextChildSupport}.
*
- * @return the BeanContextChild peer of this class
+ * @return the {@code BeanContextChild} peer of this class
*/
public BeanContextChild getBeanContextChildPeer() { return beanContextChildPeer; }
@@ -283,7 +283,7 @@ public class BeanContextChildSupport implements BeanContextChild, BeanContextSer
* PropertyVetoException.
* @param newValue the new value that has been requested for
* the BeanContext property
- * @return true if the change operation is to be vetoed
+ * @return {@code true} if the change operation is to be vetoed
*/
public boolean validatePendingSetBeanContext(BeanContext newValue) {
return true;
@@ -345,20 +345,20 @@ public class BeanContextChildSupport implements BeanContextChild, BeanContextSer
*/
/**
- * The BeanContext in which
- * this BeanContextChild is nested.
+ * The {@code BeanContext} in which
+ * this {@code BeanContextChild} is nested.
*/
public BeanContextChild beanContextChildPeer;
/**
- * The PropertyChangeSupport associated with this
- * BeanContextChildSupport.
+ * The {@code PropertyChangeSupport} associated with this
+ * {@code BeanContextChildSupport}.
*/
protected PropertyChangeSupport pcSupport;
/**
- * The VetoableChangeSupport associated with this
- * BeanContextChildSupport.
+ * The {@code VetoableChangeSupport} associated with this
+ * {@code BeanContextChildSupport}.
*/
protected VetoableChangeSupport vcSupport;
@@ -369,7 +369,7 @@ public class BeanContextChildSupport implements BeanContextChild, BeanContextSer
/**
* A flag indicating that there has been
- * at least one PropertyChangeVetoException
+ * at least one {@code PropertyChangeVetoException}
* thrown for the attempted setBeanContext operation.
*/
protected transient boolean rejectedSetBCOnce;
diff --git a/jdk/src/java.desktop/share/classes/java/beans/beancontext/BeanContextServicesSupport.java b/jdk/src/java.desktop/share/classes/java/beans/beancontext/BeanContextServicesSupport.java
index 507e8ec0215..1103af5785d 100644
--- a/jdk/src/java.desktop/share/classes/java/beans/beancontext/BeanContextServicesSupport.java
+++ b/jdk/src/java.desktop/share/classes/java/beans/beancontext/BeanContextServicesSupport.java
@@ -134,10 +134,10 @@ public class BeanContextServicesSupport extends BeanContextSupport
}
/**
- * Gets the BeanContextServices associated with this
- * BeanContextServicesSupport.
+ * Gets the {@code BeanContextServices} associated with this
+ * {@code BeanContextServicesSupport}.
*
- * @return the instance of BeanContext
+ * @return the instance of {@code BeanContext}
* this object is providing the implementation for.
*/
public BeanContextServices getBeanContextServicesPeer() {
@@ -1001,7 +1001,7 @@ public class BeanContextServicesSupport extends BeanContextSupport
}
/**
- * Gets the BeanContextServicesListener (if any) of the specified
+ * Gets the {@code BeanContextServicesListener} (if any) of the specified
* child.
*
* @param child the specified child
@@ -1084,7 +1084,7 @@ public class BeanContextServicesSupport extends BeanContextSupport
}
/**
- * Fires a BeanContextServiceEvent notifying of a new service.
+ * Fires a {@code BeanContextServiceEvent} notifying of a new service.
* @param serviceClass the service class
*/
protected final void fireServiceAdded(Class> serviceClass) {
@@ -1094,10 +1094,10 @@ public class BeanContextServicesSupport extends BeanContextSupport
}
/**
- * Fires a BeanContextServiceAvailableEvent indicating that a new
+ * Fires a {@code BeanContextServiceAvailableEvent} indicating that a new
* service has become available.
*
- * @param bcssae the BeanContextServiceAvailableEvent
+ * @param bcssae the {@code BeanContextServiceAvailableEvent}
*/
protected final void fireServiceAdded(BeanContextServiceAvailableEvent bcssae) {
Object[] copy;
@@ -1110,9 +1110,9 @@ public class BeanContextServicesSupport extends BeanContextSupport
}
/**
- * Fires a BeanContextServiceEvent notifying of a service being revoked.
+ * Fires a {@code BeanContextServiceEvent} notifying of a service being revoked.
*
- * @param bcsre the BeanContextServiceRevokedEvent
+ * @param bcsre the {@code BeanContextServiceRevokedEvent}
*/
protected final void fireServiceRevoked(BeanContextServiceRevokedEvent bcsre) {
Object[] copy;
@@ -1125,7 +1125,7 @@ public class BeanContextServicesSupport extends BeanContextSupport
}
/**
- * Fires a BeanContextServiceRevokedEvent
+ * Fires a {@code BeanContextServiceRevokedEvent}
* indicating that a particular service is
* no longer available.
* @param serviceClass the service class
@@ -1235,25 +1235,25 @@ public class BeanContextServicesSupport extends BeanContextSupport
*/
/**
- * all accesses to the protected transient HashMap services
+ * all accesses to the {@code protected transient HashMap services}
* field should be synchronized on that object
*/
protected transient HashMap
*
* The semantics of the beanName parameter are defined by java.beans.Beans.instantiate.
@@ -213,8 +213,8 @@ public class BeanContextSupport extends BeanContextChildSupport
/**
* Reports whether or not this
- * BeanContext is empty.
- * A BeanContext is considered
+ * {@code BeanContext} is empty.
+ * A {@code BeanContext} is considered
* empty when it contains zero
* nested children.
* @return if there are not children
@@ -227,7 +227,7 @@ public class BeanContextSupport extends BeanContextChildSupport
/**
* Determines whether or not the specified object
- * is currently a child of this BeanContext.
+ * is currently a child of this {@code BeanContext}.
* @param o the Object in question
* @return if this object is a child
*/
@@ -239,7 +239,7 @@ public class BeanContextSupport extends BeanContextChildSupport
/**
* Determines whether or not the specified object
- * is currently a child of this BeanContext.
+ * is currently a child of this {@code BeanContext}.
* @param o the Object in question
* @return if this object is a child
*/
@@ -250,9 +250,9 @@ public class BeanContextSupport extends BeanContextChildSupport
}
/**
- * Gets all JavaBean or BeanContext instances
- * currently nested in this BeanContext.
- * @return an Iterator of the nested children
+ * Gets all JavaBean or {@code BeanContext} instances
+ * currently nested in this {@code BeanContext}.
+ * @return an {@code Iterator} of the nested children
*/
public Iterator