diff --git a/.hgtags b/.hgtags
index 24dc9213f13fbcadddfb2807883e1d9b4f333064..5ca82e2575b4f101e0ceeffde6badd3dfb900b1b 100644
--- a/.hgtags
+++ b/.hgtags
@@ -93,3 +93,5 @@ e250cef36ea05e627e7e6f7d75e5e19f529e2ba3 jdk7-b114
1657ed4e1d86c8aa2028ab5a41f9da1ac4a369f8 jdk7-b116
3e6726bbf80a4254ecd01051c8ed77ee19325e46 jdk7-b117
b357910aa04aead2a16b6d6ff395a8df4b51d1dd jdk7-b118
+ecab7eefb8f2326fd90fb632f47f1b6f81e928f8 jdk7-b119
+37d74e29687cf07c2bf9411af58c7e42440855c3 jdk7-b120
diff --git a/make/sun/xawt/mapfile-vers b/make/sun/xawt/mapfile-vers
index fa5fe360ffc626ae25098661b2fea1142e6006bf..0d951efff1d200ae6110026c0a6594869d5de64b 100644
--- a/make/sun/xawt/mapfile-vers
+++ b/make/sun/xawt/mapfile-vers
@@ -429,6 +429,7 @@ SUNWprivate_1.1 {
Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetClassValue;
Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetPangoFontName;
+ Java_sun_awt_X11_GtkFileDialogPeer_initIDs;
Java_sun_awt_X11_GtkFileDialogPeer_run;
Java_sun_awt_X11_GtkFileDialogPeer_quit;
diff --git a/src/share/classes/java/awt/Component.java b/src/share/classes/java/awt/Component.java
index f8bdac15d408678cc4dc03a70c69de30c6aa8270..cff463b3526c0d7eadf1ddabfdc061189f3faf23 100644
--- a/src/share/classes/java/awt/Component.java
+++ b/src/share/classes/java/awt/Component.java
@@ -2154,6 +2154,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
*
* @param d the dimension specifying the new size
* of this component
+ * @throws NullPointerException if {@code d} is {@code null}
* @see #setSize
* @see #setBounds
* @see #invalidate
@@ -2351,6 +2352,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* invalidates the component hierarchy.
*
* @param r the new bounding rectangle for this component
+ * @throws NullPointerException if {@code r} is {@code null}
* @see #getBounds
* @see #setLocation(int, int)
* @see #setLocation(Point)
@@ -4545,6 +4547,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* where the point's x and y coordinates are defined
* to be relative to the coordinate system of this component.
* @param p the point
+ * @throws NullPointerException if {@code p} is {@code null}
* @see #getComponentAt(Point)
* @since JDK1.1
*/
@@ -5879,7 +5882,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @exception ClassCastException if listenerType
* doesn't specify a class or interface that implements
* java.util.EventListener
- *
+ * @throws NullPointerException if {@code listenerType} is {@code null}
* @see #getComponentListeners
* @see #getFocusListeners
* @see #getHierarchyListeners
@@ -8038,6 +8041,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* Prints a listing of this component to the specified output
* stream.
* @param out a print stream
+ * @throws NullPointerException if {@code out} is {@code null}
* @since JDK1.0
*/
public void list(PrintStream out) {
@@ -8050,6 +8054,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @param out a print stream
* @param indent number of spaces to indent
* @see java.io.PrintStream#println(java.lang.Object)
+ * @throws NullPointerException if {@code out} is {@code null}
* @since JDK1.0
*/
public void list(PrintStream out, int indent) {
@@ -8062,6 +8067,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
/**
* Prints a listing to the specified print writer.
* @param out the print writer to print to
+ * @throws NullPointerException if {@code out} is {@code null}
* @since JDK1.1
*/
public void list(PrintWriter out) {
@@ -8073,6 +8079,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* the specified print writer.
* @param out the print writer to print to
* @param indent the number of spaces to indent
+ * @throws NullPointerException if {@code out} is {@code null}
* @see java.io.PrintStream#println(java.lang.Object)
* @since JDK1.1
*/
diff --git a/src/share/classes/java/awt/Container.java b/src/share/classes/java/awt/Container.java
index bf635fd45acd364b4e9298ee55f93d9c4307d2c1..a7ee77e16cbf5a711e34256fade7a0d46796b97e 100644
--- a/src/share/classes/java/awt/Container.java
+++ b/src/share/classes/java/awt/Container.java
@@ -1231,6 +1231,7 @@ public class Container extends Component {
* reflect the changes.
*
* @param comp the component to be removed
+ * @throws NullPointerException if {@code comp} is {@code null}
* @see #add
* @see #invalidate
* @see #validate
@@ -2154,6 +2155,7 @@ public class Container extends Component {
* @exception ClassCastException if listenerType
* doesn't specify a class or interface that implements
* java.util.EventListener
+ * @exception NullPointerException if {@code listenerType} is {@code null}
*
* @see #getContainerListeners
*
@@ -2705,6 +2707,7 @@ public class Container extends Component {
* If there is no child component at the requested point and the
* point is within the bounds of the container the container itself
* is returned.
+ * @throws NullPointerException if {@code p} is {@code null}
* @see Component#contains
* @see #getComponentAt
* @since 1.2
@@ -2969,6 +2972,7 @@ public class Container extends Component {
*
* @param out a print stream
* @param indent the number of spaces to indent
+ * @throws NullPointerException if {@code out} is {@code null}
* @see Component#list(java.io.PrintStream, int)
* @since JDK1.0
*/
@@ -2995,6 +2999,7 @@ public class Container extends Component {
*
* @param out a print writer
* @param indent the number of spaces to indent
+ * @throws NullPointerException if {@code out} is {@code null}
* @see Component#list(java.io.PrintWriter, int)
* @since JDK1.1
*/
diff --git a/src/share/classes/java/awt/ScrollPane.java b/src/share/classes/java/awt/ScrollPane.java
index 6a06acb5403bc6d4cb96bda60b8e6919c32cd55a..104318abf6f292f7b2c05ec014accca1e612b484 100644
--- a/src/share/classes/java/awt/ScrollPane.java
+++ b/src/share/classes/java/awt/ScrollPane.java
@@ -377,6 +377,7 @@ public class ScrollPane extends Container implements Accessible {
* This is a convenience method which interfaces with the Adjustable
* objects which represent the state of the scrollbars.
* @param p the Point representing the position to scroll to
+ * @throws NullPointerException if {@code p} is {@code null}
*/
public void setScrollPosition(Point p) {
setScrollPosition(p.x, p.y);
diff --git a/src/share/classes/java/awt/Window.java b/src/share/classes/java/awt/Window.java
index 7dce80e9564de856c0cab5f1bfddfee284375171..03dbd535e9f0d5f146c83ba2ad6247399096e1e6 100644
--- a/src/share/classes/java/awt/Window.java
+++ b/src/share/classes/java/awt/Window.java
@@ -1888,6 +1888,7 @@ public class Window extends Container implements Accessible {
* @exception ClassCastException if listenerType
* doesn't specify a class or interface that implements
* java.util.EventListener
+ * @exception NullPointerException if {@code listenerType} is {@code null}
*
* @see #getWindowListeners
* @since 1.3
diff --git a/src/share/classes/javax/swing/GroupLayout.java b/src/share/classes/javax/swing/GroupLayout.java
index 7628076a99473e2a368b816f09d82aea90967220..9219932776ed301462aa613e838a81df0d352019 100644
--- a/src/share/classes/javax/swing/GroupLayout.java
+++ b/src/share/classes/javax/swing/GroupLayout.java
@@ -653,6 +653,10 @@ public class GroupLayout implements LayoutManager2 {
*/
public ParallelGroup createParallelGroup(Alignment alignment,
boolean resizable){
+ if (alignment == null) {
+ throw new IllegalArgumentException("alignment must be non null");
+ }
+
if (alignment == Alignment.BASELINE) {
return new BaselineGroup(resizable);
}
diff --git a/src/share/classes/javax/swing/JComponent.java b/src/share/classes/javax/swing/JComponent.java
index 6f017402ec7e01e9d8f6b1bc480a35ae7c38e0e8..78fddfcb11bb877c93da708b0fb05fa7d65ca947 100644
--- a/src/share/classes/javax/swing/JComponent.java
+++ b/src/share/classes/javax/swing/JComponent.java
@@ -4734,6 +4734,8 @@ public abstract class JComponent extends Container implements Serializable,
* Notifies this component that it now has a parent component.
* When this method is invoked, the chain of parent components is
* set up with KeyboardAction
event listeners.
+ * This method is called by the toolkit internally and should
+ * not be called directly by programs.
*
* @see #registerKeyboardAction
*/
@@ -4750,6 +4752,8 @@ public abstract class JComponent extends Container implements Serializable,
* Notifies this component that it no longer has a parent component.
* When this method is invoked, any KeyboardAction
s
* set up in the the chain of parent components are removed.
+ * This method is called by the toolkit internally and should
+ * not be called directly by programs.
*
* @see #registerKeyboardAction
*/
diff --git a/src/share/classes/javax/swing/Popup.java b/src/share/classes/javax/swing/Popup.java
index a77d574d72ecb4d45d77603ecad34d236913ee20..83cd7d6d789c6e9462fc241799e783f86a57adb4 100644
--- a/src/share/classes/javax/swing/Popup.java
+++ b/src/share/classes/javax/swing/Popup.java
@@ -156,7 +156,8 @@ public class Popup {
component.setLocation(ownerX, ownerY);
component.getContentPane().add(contents, BorderLayout.CENTER);
- contents.invalidate();
+ component.invalidate();
+ component.validate();
if(component.isVisible()) {
// Do not call pack() if window is not visible to
// avoid early native peer creation
diff --git a/src/share/classes/javax/swing/text/DefaultHighlighter.java b/src/share/classes/javax/swing/text/DefaultHighlighter.java
index d90128b82ac17f81f6503b5334405eba9d8a5dde..dc68ae474fd60305ae2e796cc0ad6ef44b1a93ae 100644
--- a/src/share/classes/javax/swing/text/DefaultHighlighter.java
+++ b/src/share/classes/javax/swing/text/DefaultHighlighter.java
@@ -113,6 +113,14 @@ public class DefaultHighlighter extends LayeredHighlighter {
* @exception BadLocationException if the specified location is invalid
*/
public Object addHighlight(int p0, int p1, Highlighter.HighlightPainter p) throws BadLocationException {
+ if (p0 < 0) {
+ throw new BadLocationException("Invalid start offset", p0);
+ }
+
+ if (p1 < p0) {
+ throw new BadLocationException("Invalid end offset", p1);
+ }
+
Document doc = component.getDocument();
HighlightInfo i = (getDrawsLayeredHighlights() &&
(p instanceof LayeredHighlighter.LayerPainter)) ?
@@ -217,6 +225,14 @@ public class DefaultHighlighter extends LayeredHighlighter {
* @exception BadLocationException if the specified location is invalid
*/
public void changeHighlight(Object tag, int p0, int p1) throws BadLocationException {
+ if (p0 < 0) {
+ throw new BadLocationException("Invalid beginning of the range", p0);
+ }
+
+ if (p1 < p0) {
+ throw new BadLocationException("Invalid end of the range", p1);
+ }
+
Document doc = component.getDocument();
if (tag instanceof LayeredHighlightInfo) {
LayeredHighlightInfo lhi = (LayeredHighlightInfo)tag;
diff --git a/src/share/classes/sun/awt/UngrabEvent.java b/src/share/classes/sun/awt/UngrabEvent.java
index e27e04068304e6aabdaebbd2be39de5a8ab1911a..7c1b8ecf9f515092238f9c7841c4dcf982bec1dd 100644
--- a/src/share/classes/sun/awt/UngrabEvent.java
+++ b/src/share/classes/sun/awt/UngrabEvent.java
@@ -40,8 +40,10 @@ import java.awt.Component;
*
To listen for this event, install AWTEventListener with {@value sun.awt.SunToolkit#GRAB_EVENT_MASK}
*/
public class UngrabEvent extends AWTEvent {
+ private final static int UNGRAB_EVENT_ID = 1998;
+
public UngrabEvent(Component source) {
- super(source, 0xffff);
+ super(source, UNGRAB_EVENT_ID);
}
public String toString() {
diff --git a/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java b/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java
index 57a0492ddee0fc045174645bad2c478d07f82de1..f67efb57fb687b6982e343dd0f4f4c3082099827 100644
--- a/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java
+++ b/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java
@@ -42,11 +42,19 @@ class GtkFileDialogPeer extends XDialogPeer implements FileDialogPeer {
private FileDialog fd;
+ // A pointer to the native GTK FileChooser widget
+ private volatile long widget = 0L;
+
public GtkFileDialogPeer(FileDialog fd) {
super((Dialog) fd);
this.fd = fd;
}
+ private static native void initIDs();
+ static {
+ initIDs();
+ }
+
private native void run(String title, int mode, String dir, String file,
FilenameFilter filter, boolean isMultipleMode);
diff --git a/src/solaris/native/sun/awt/awt_MToolkit.c b/src/solaris/native/sun/awt/awt_MToolkit.c
index 744646cf38ff5c3a77e4fbd00f5c442b4e8f4596..3a7c117b23bd1ff9acd6b789221f357b5a4a25c6 100644
--- a/src/solaris/native/sun/awt/awt_MToolkit.c
+++ b/src/solaris/native/sun/awt/awt_MToolkit.c
@@ -2773,11 +2773,6 @@ Java_sun_awt_motif_MToolkit_init(JNIEnv *env, jobject this,
}
}
- /*
- scrollBugWorkAround =
- (strcmp(XServerVendor(awt_display), "Sun Microsystems, Inc.") == 0
- && XVendorRelease(awt_display) == 3400);
- */
scrollBugWorkAround = TRUE;
/*
diff --git a/src/solaris/native/sun/awt/fontpath.c b/src/solaris/native/sun/awt/fontpath.c
index e7236e4a6ff3cce8e197827f82db38f09685b40e..22157d35a4e3f6bc19749f6ee581c5f59ef36771 100644
--- a/src/solaris/native/sun/awt/fontpath.c
+++ b/src/solaris/native/sun/awt/fontpath.c
@@ -557,7 +557,8 @@ JNIEXPORT jstring JNICALL Java_sun_awt_X11FontManager_getFontPath
#ifndef HEADLESS
static int isSunXServer() {
#ifdef __solaris__
- return (strcmp("Sun Microsystems, Inc.", ServerVendor(awt_display)) == 0 &&
+ return ((strncmp(ServerVendor(awt_display), "Sun Microsystems, Inc.", 22) == 0) ||
+ (strncmp(ServerVendor(awt_display), "Oracle Corporation", 18) == 0) &&
VendorRelease(awt_display) >= 6410);
#else
return 0;
diff --git a/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c b/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c
index 0c26096e58009cb3852cee3ed4b94865cfa40f6c..890284e570e423f7123035c75cd775f449e723ce 100644
--- a/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c
+++ b/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c
@@ -4,13 +4,29 @@
#include
#include "gtk2_interface.h"
#include "sun_awt_X11_GtkFileDialogPeer.h"
+#include "debug_assert.h"
static JavaVM *jvm;
-static GtkWidget *dialog = NULL;
/* To cache some method IDs */
static jmethodID filenameFilterCallbackMethodID = NULL;
static jmethodID setFileInternalMethodID = NULL;
+static jfieldID widgetFieldID = NULL;
+
+JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_initIDs
+(JNIEnv *env, jclass cx)
+{
+ filenameFilterCallbackMethodID = (*env)->GetMethodID(env, cx,
+ "filenameFilterCallback", "(Ljava/lang/String;)Z");
+ DASSERT(filenameFilterCallbackMethodID != NULL);
+
+ setFileInternalMethodID = (*env)->GetMethodID(env, cx,
+ "setFileInternal", "(Ljava/lang/String;[Ljava/lang/String;)V");
+ DASSERT(setFileInternalMethodID != NULL);
+
+ widgetFieldID = (*env)->GetFieldID(env, cx, "widget", "J");
+ DASSERT(widgetFieldID != NULL);
+}
static gboolean filenameFilterCallback(const GtkFileFilterInfo * filter_info, gpointer obj)
{
@@ -20,30 +36,17 @@ static gboolean filenameFilterCallback(const GtkFileFilterInfo * filter_info, gp
env = (JNIEnv *) JNU_GetEnv(jvm, JNI_VERSION_1_2);
- if (filenameFilterCallbackMethodID == NULL) {
- cx = (*env)->GetObjectClass(env, (jobject) obj);
- if (cx == NULL) {
- JNU_ThrowInternalError(env, "Could not get file filter class");
- return 0;
- }
-
- filenameFilterCallbackMethodID = (*env)->GetMethodID(env, cx,
- "filenameFilterCallback", "(Ljava/lang/String;)Z");
- if (filenameFilterCallbackMethodID == NULL) {
- JNU_ThrowInternalError(env,
- "Could not get filenameFilterCallback method id");
- return 0;
- }
- }
-
filename = (*env)->NewStringUTF(env, filter_info->filename);
return (*env)->CallBooleanMethod(env, obj, filenameFilterCallbackMethodID,
filename);
}
-static void quit(gboolean isSignalHandler)
+static void quit(JNIEnv * env, jobject jpeer, gboolean isSignalHandler)
{
+ GtkWidget * dialog = (GtkWidget*)jlong_to_ptr(
+ (*env)->GetLongField(env, jpeer, widgetFieldID));
+
if (dialog != NULL)
{
// Callbacks from GTK signals are made within the GTK lock
@@ -57,7 +60,8 @@ static void quit(gboolean isSignalHandler)
fp_gtk_widget_destroy (dialog);
fp_gtk_main_quit ();
- dialog = NULL;
+
+ (*env)->SetLongField(env, jpeer, widgetFieldID, 0);
if (!isSignalHandler) {
fp_gdk_threads_leave();
@@ -73,7 +77,7 @@ static void quit(gboolean isSignalHandler)
JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_quit
(JNIEnv * env, jobject jpeer)
{
- quit(FALSE);
+ quit(env, jpeer, FALSE);
}
/**
@@ -132,24 +136,8 @@ static void handle_response(GtkWidget* aDialog, gint responseId, gpointer obj)
if (responseId == GTK_RESPONSE_ACCEPT) {
current_folder = fp_gtk_file_chooser_get_current_folder(
- GTK_FILE_CHOOSER(dialog));
- filenames = fp_gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(dialog));
- }
-
- if (setFileInternalMethodID == NULL) {
- cx = (*env)->GetObjectClass(env, (jobject) obj);
- if (cx == NULL) {
- JNU_ThrowInternalError(env, "Could not get GTK peer class");
- return;
- }
-
- setFileInternalMethodID = (*env)->GetMethodID(env, cx,
- "setFileInternal", "(Ljava/lang/String;[Ljava/lang/String;)V");
- if (setFileInternalMethodID == NULL) {
- JNU_ThrowInternalError(env,
- "Could not get setFileInternalMethodID method id");
- return;
- }
+ GTK_FILE_CHOOSER(aDialog));
+ filenames = fp_gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(aDialog));
}
jcurrent_folder = (*env)->NewStringUTF(env, current_folder);
@@ -159,7 +147,7 @@ static void handle_response(GtkWidget* aDialog, gint responseId, gpointer obj)
jfilenames);
fp_g_free(current_folder);
- quit(TRUE);
+ quit(env, (jobject)obj, TRUE);
}
/*
@@ -172,6 +160,7 @@ Java_sun_awt_X11_GtkFileDialogPeer_run(JNIEnv * env, jobject jpeer,
jstring jtitle, jint mode, jstring jdir, jstring jfile,
jobject jfilter, jboolean multiple)
{
+ GtkWidget *dialog = NULL;
GtkFileFilter *filter;
if (jvm == NULL) {
@@ -233,8 +222,12 @@ Java_sun_awt_X11_GtkFileDialogPeer_run(JNIEnv * env, jobject jpeer,
fp_g_signal_connect(G_OBJECT(dialog), "response", G_CALLBACK(
handle_response), jpeer);
+
+ (*env)->SetLongField(env, jpeer, widgetFieldID, ptr_to_jlong(dialog));
+
fp_gtk_widget_show(dialog);
fp_gtk_main();
fp_gdk_threads_leave();
}
+
diff --git a/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.h b/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.h
index 91334b4ebeec3bfbe9ec58d0c8940f49297932e2..7c3c2338d10d4a85ed286520141b32db94d0962f 100644
--- a/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.h
+++ b/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.h
@@ -9,6 +9,14 @@ extern "C"
{
#endif
+/*
+ * Class: sun_awt_X11_GtkFileDialogPeer
+ * Method: initIDs
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_initIDs
+(JNIEnv *, jclass);
+
/*
* Class: sun_awt_X11_GtkFileDialogPeer
* Method: run
diff --git a/src/solaris/native/sun/xawt/XWindow.c b/src/solaris/native/sun/xawt/XWindow.c
index 4a66d4d7e6bf6c903a82271e8ac386ab9c64c9e0..d33c87f424c9393535c75fd8a758b711c6c27767 100644
--- a/src/solaris/native/sun/xawt/XWindow.c
+++ b/src/solaris/native/sun/xawt/XWindow.c
@@ -766,7 +766,9 @@ adjustKeySym(XEvent *event, KeySym *keysym)
static Boolean
isXsunServer(XEvent *event) {
if( awt_ServerDetected ) return awt_IsXsun;
- if( strncmp( ServerVendor( event->xkey.display ), "Sun Microsystems, Inc.", 32) ) {
+ if( (strncmp( ServerVendor( event->xkey.display ), "Sun Microsystems, Inc.", 22) != 0) &&
+ (strncmp( ServerVendor( event->xkey.display ), "Oracle Corporation", 18) != 0) )
+ {
awt_ServerDetected = True;
awt_IsXsun = False;
return False;
diff --git a/src/windows/native/sun/windows/awt_Component.cpp b/src/windows/native/sun/windows/awt_Component.cpp
index 71307cb9e58b81de1eb24defea433100f8637fb7..fd75b8d52ee75fd5587764ee36e96cccf9e71676 100644
--- a/src/windows/native/sun/windows/awt_Component.cpp
+++ b/src/windows/native/sun/windows/awt_Component.cpp
@@ -6084,63 +6084,67 @@ void AwtComponent::SetParent(void * param) {
void AwtComponent::_SetRectangularShape(void *param)
{
- JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
+ if (!AwtToolkit::IsMainThread()) {
+ AwtToolkit::GetInstance().InvokeFunction(AwtComponent::_SetRectangularShape, param);
+ } else {
+ JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
- SetRectangularShapeStruct *data = (SetRectangularShapeStruct *)param;
- jobject self = data->component;
- jint x1 = data->x1;
- jint x2 = data->x2;
- jint y1 = data->y1;
- jint y2 = data->y2;
- jobject region = data->region;
+ SetRectangularShapeStruct *data = (SetRectangularShapeStruct *)param;
+ jobject self = data->component;
+ jint x1 = data->x1;
+ jint x2 = data->x2;
+ jint y1 = data->y1;
+ jint y2 = data->y2;
+ jobject region = data->region;
- AwtComponent *c = NULL;
+ AwtComponent *c = NULL;
- PDATA pData;
- JNI_CHECK_PEER_GOTO(self, ret);
+ PDATA pData;
+ JNI_CHECK_PEER_GOTO(self, ret);
- c = (AwtComponent *)pData;
- if (::IsWindow(c->GetHWnd())) {
- HRGN hRgn = NULL;
- if (region || x1 || x2 || y1 || y2) {
- // If all the params are zeros, the shape must be simply reset.
- // Otherwise, convert it into a region.
- RGNDATA *pRgnData = NULL;
- RGNDATAHEADER *pRgnHdr;
-
- /* reserving memory for the worst case */
- size_t worstBufferSize = size_t(((x2 - x1) / 2 + 1) * (y2 - y1));
- pRgnData = (RGNDATA *) safe_Malloc(sizeof(RGNDATAHEADER) +
- sizeof(RECT_T) * worstBufferSize);
- pRgnHdr = (RGNDATAHEADER *) pRgnData;
-
- pRgnHdr->dwSize = sizeof(RGNDATAHEADER);
- pRgnHdr->iType = RDH_RECTANGLES;
- pRgnHdr->nRgnSize = 0;
- pRgnHdr->rcBound.top = 0;
- pRgnHdr->rcBound.left = 0;
- pRgnHdr->rcBound.bottom = LONG(y2 - y1);
- pRgnHdr->rcBound.right = LONG(x2 - x1);
-
- RECT_T * pRect = (RECT_T *) (((BYTE *) pRgnData) + sizeof(RGNDATAHEADER));
- pRgnHdr->nCount = RegionToYXBandedRectangles(env, x1, y1, x2, y2, region, &pRect, worstBufferSize);
-
- hRgn = ::ExtCreateRegion(NULL,
- sizeof(RGNDATAHEADER) + sizeof(RECT_T) * pRgnHdr->nCount, pRgnData);
-
- free(pRgnData);
- }
+ c = (AwtComponent *)pData;
+ if (::IsWindow(c->GetHWnd())) {
+ HRGN hRgn = NULL;
+ if (region || x1 || x2 || y1 || y2) {
+ // If all the params are zeros, the shape must be simply reset.
+ // Otherwise, convert it into a region.
+ RGNDATA *pRgnData = NULL;
+ RGNDATAHEADER *pRgnHdr;
+
+ /* reserving memory for the worst case */
+ size_t worstBufferSize = size_t(((x2 - x1) / 2 + 1) * (y2 - y1));
+ pRgnData = (RGNDATA *) safe_Malloc(sizeof(RGNDATAHEADER) +
+ sizeof(RECT_T) * worstBufferSize);
+ pRgnHdr = (RGNDATAHEADER *) pRgnData;
+
+ pRgnHdr->dwSize = sizeof(RGNDATAHEADER);
+ pRgnHdr->iType = RDH_RECTANGLES;
+ pRgnHdr->nRgnSize = 0;
+ pRgnHdr->rcBound.top = 0;
+ pRgnHdr->rcBound.left = 0;
+ pRgnHdr->rcBound.bottom = LONG(y2 - y1);
+ pRgnHdr->rcBound.right = LONG(x2 - x1);
+
+ RECT_T * pRect = (RECT_T *) (((BYTE *) pRgnData) + sizeof(RGNDATAHEADER));
+ pRgnHdr->nCount = RegionToYXBandedRectangles(env, x1, y1, x2, y2, region, &pRect, worstBufferSize);
+
+ hRgn = ::ExtCreateRegion(NULL,
+ sizeof(RGNDATAHEADER) + sizeof(RECT_T) * pRgnHdr->nCount, pRgnData);
+
+ free(pRgnData);
+ }
- ::SetWindowRgn(c->GetHWnd(), hRgn, TRUE);
- }
+ ::SetWindowRgn(c->GetHWnd(), hRgn, TRUE);
+ }
ret:
- env->DeleteGlobalRef(self);
- if (region) {
- env->DeleteGlobalRef(region);
- }
+ env->DeleteGlobalRef(self);
+ if (region) {
+ env->DeleteGlobalRef(region);
+ }
- delete data;
+ delete data;
+ }
}
void AwtComponent::_SetZOrder(void *param) {
diff --git a/src/windows/native/sun/windows/awt_Robot.cpp b/src/windows/native/sun/windows/awt_Robot.cpp
index bef6f13ede5e79ffb85d3d66d5e96a437be61a67..bab9f61b8b780c7b2460eec9890dc0dbfd76e862 100644
--- a/src/windows/native/sun/windows/awt_Robot.cpp
+++ b/src/windows/native/sun/windows/awt_Robot.cpp
@@ -194,9 +194,9 @@ inline jint AwtRobot::WinToJavaPixel(USHORT r, USHORT g, USHORT b)
jint AwtRobot::GetRGBPixel( jint x, jint y)
{
- HDC hdc = GetDC(NULL);
+ HDC hdc = ::CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL);
COLORREF ref = ::GetPixel( hdc, x, y );
- ReleaseDC(NULL,hdc);
+ ::DeleteDC(hdc);
jint value = WinToJavaPixel(GetRValue(ref), GetGValue(ref), GetBValue(ref));
return value;
}
diff --git a/test/java/awt/Frame/ShapeNotSetSometimes/ShapeNotSetSometimes.java b/test/java/awt/Frame/ShapeNotSetSometimes/ShapeNotSetSometimes.java
new file mode 100644
index 0000000000000000000000000000000000000000..751b38e338bb5241e73ad249a8d1c539fd2f3c09
--- /dev/null
+++ b/test/java/awt/Frame/ShapeNotSetSometimes/ShapeNotSetSometimes.java
@@ -0,0 +1,177 @@
+/*
+ * Copyright (c) 2010, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ @test
+ @bug 6988428
+ @summary Tests whether shape is always set
+ @author anthony.petrov@oracle.com: area=awt.toplevel
+ @run main ShapeNotSetSometimes
+*/
+
+
+import java.awt.*;
+import java.awt.event.InputEvent;
+import java.awt.geom.*;
+
+
+public class ShapeNotSetSometimes {
+
+ private Frame backgroundFrame;
+ private Frame window;
+ private static final Color BACKGROUND_COLOR = Color.BLUE;
+ private Shape shape;
+ private int[][] pointsToCheck;
+
+ private static Robot robot;
+
+ public ShapeNotSetSometimes() throws Exception {
+ EventQueue.invokeAndWait(new Runnable() {
+ public void run() {
+ initializeGUI();
+ }
+ });
+ }
+
+ private void initializeGUI() {
+ backgroundFrame = new BackgroundFrame();
+ backgroundFrame.setUndecorated(true);
+ backgroundFrame.setSize(300, 300);
+ backgroundFrame.setLocation(20, 400);
+ backgroundFrame.setVisible(true);
+
+ shape = null;
+ String shape_name = null;
+ Area a;
+ GeneralPath gp;
+ shape_name = "Rounded-corners";
+ a = new Area();
+ a.add(new Area(new Rectangle2D.Float(50, 0, 100, 150)));
+ a.add(new Area(new Rectangle2D.Float(0, 50, 200, 50)));
+ a.add(new Area(new Ellipse2D.Float(0, 0, 100, 100)));
+ a.add(new Area(new Ellipse2D.Float(0, 50, 100, 100)));
+ a.add(new Area(new Ellipse2D.Float(100, 0, 100, 100)));
+ a.add(new Area(new Ellipse2D.Float(100, 50, 100, 100)));
+ shape = a;
+ pointsToCheck = new int[][] {
+ // inside shape
+ {106, 86}, {96, 38}, {76, 107}, {180, 25}, {24, 105},
+ {196, 77}, {165, 50}, {14, 113}, {89, 132}, {167, 117},
+ // outside shape
+ {165, 196}, {191, 163}, {146, 185}, {61, 170}, {148, 171},
+ {82, 172}, {186, 11}, {199, 141}, {13, 173}, {187, 3}
+ };
+
+ window = new TestFrame();
+ window.setUndecorated(true);
+ window.setSize(200, 200);
+ window.setLocation(70, 450);
+ window.setShape(shape);
+ window.setVisible(true);
+
+ System.out.println("Checking " + window.getClass().getSuperclass().getName() + " with " + shape_name + " shape (" + window.getShape() + ")...");
+ }
+
+ class BackgroundFrame extends Frame {
+
+ @Override
+ public void paint(Graphics g) {
+
+ g.setColor(BACKGROUND_COLOR);
+ g.fillRect(0, 0, 300, 300);
+
+ super.paint(g);
+ }
+ }
+
+ class TestFrame extends Frame {
+
+ @Override
+ public void paint(Graphics g) {
+
+ g.setColor(Color.WHITE);
+ g.fillRect(0, 0, 200, 200);
+
+ super.paint(g);
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ robot = new Robot();
+
+ for(int i = 0; i < 100; i++) {
+ System.out.println("Attempt " + i);
+ new ShapeNotSetSometimes().doTest();
+ }
+ }
+
+ private void doTest() throws Exception {
+ Point wls = backgroundFrame.getLocationOnScreen();
+
+ robot.mouseMove(wls.x + 5, wls.y + 5);
+ robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
+ robot.delay(10);
+ robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+ robot.delay(500);
+
+ EventQueue.invokeAndWait(new Runnable() {
+ public void run() {
+ window.requestFocus();
+ }
+ });
+
+ robot.waitForIdle();
+ try {
+ Thread.sleep(300);
+ } catch (InterruptedException e) {
+ // ignore this one
+ }
+
+ // check transparency
+ final int COUNT_TARGET = 10;
+
+ // checking outside points only
+ for(int i = COUNT_TARGET; i < COUNT_TARGET * 2; i++) {
+ int x = pointsToCheck[i][0];
+ int y = pointsToCheck[i][1];
+ boolean inside = i < COUNT_TARGET;
+ Color c = robot.getPixelColor(window.getX() + x, window.getY() + y);
+ System.out.println("checking " + x + ", " + y + ", color = " + c);
+ if (inside && BACKGROUND_COLOR.equals(c) || !inside && !BACKGROUND_COLOR.equals(c)) {
+ System.out.println("window.getX() = " + window.getX() + ", window.getY() = " + window.getY());
+ System.err.println("Checking for transparency failed: point: " +
+ (window.getX() + x) + ", " + (window.getY() + y) +
+ ", color = " + c + (inside ? " is of un" : " is not of ") +
+ "expected background color " + BACKGROUND_COLOR);
+ throw new RuntimeException("Test failed. The shape has not been applied.");
+ }
+ }
+
+ EventQueue.invokeAndWait(new Runnable() {
+ public void run() {
+ backgroundFrame.dispose();
+ window.dispose();
+ }
+ });
+ }
+}
diff --git a/test/java/awt/event/OtherEvents/UngrabID/UngrabID.java b/test/java/awt/event/OtherEvents/UngrabID/UngrabID.java
new file mode 100644
index 0000000000000000000000000000000000000000..34a7b7690570f6082ba3d5615c7f393de869e7b8
--- /dev/null
+++ b/test/java/awt/event/OtherEvents/UngrabID/UngrabID.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2010, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ @test
+ @bug 6960516
+ @summary check if the ungrab event has the ID < AWTEvent.RESERVED_ID_MAX
+ @author Andrei Dmitriev : area=awt.event
+ @run main UngrabID
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+
+public class UngrabID {
+ public static void main(String[] args){
+ Frame f = new Frame("Dummy");
+ sun.awt.UngrabEvent event = new sun.awt.UngrabEvent(f);
+ if (event.getID() > AWTEvent.RESERVED_ID_MAX) {
+ System.out.println( " Event ID : "+event.getID() + " " + event.toString());
+ throw new RuntimeException(" Ungrab Event ID should be less than AWTEvent.RESERVED_ID_MAX ("+AWTEvent.RESERVED_ID_MAX+"). Actual value : "+event.getID() + " Event:" + event.toString());
+ }
+ System.out.println("Test passed. ");
+ }
+}
diff --git a/test/javax/swing/GroupLayout/6613904/bug6613904.java b/test/javax/swing/GroupLayout/6613904/bug6613904.java
new file mode 100644
index 0000000000000000000000000000000000000000..0f0626e66c926d7cfe17e5cee5545c955d7b35dc
--- /dev/null
+++ b/test/javax/swing/GroupLayout/6613904/bug6613904.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2010, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6613904
+ * @summary javax.swing.GroupLayout.createParallelGroup(..) doesn't throw IllegalArgumentException for null arg
+ * @author Pavel Porvatov
+ */
+
+import javax.swing.*;
+
+public class bug6613904 {
+ public static void main(String[] args) {
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ GroupLayout groupLayout = new GroupLayout(new JPanel());
+
+ try {
+ groupLayout.createParallelGroup(null);
+
+ throw new RuntimeException("groupLayout.createParallelGroup(null) doesn't throw IAE");
+ } catch (IllegalArgumentException e) {
+ // Ok
+ }
+
+ try {
+ groupLayout.createParallelGroup(null, true);
+
+ throw new RuntimeException("groupLayout.createParallelGroup(null, true) doesn't throw IAE");
+ } catch (IllegalArgumentException e) {
+ // Ok
+ }
+
+ try {
+ groupLayout.createParallelGroup(null, false);
+
+ throw new RuntimeException("groupLayout.createParallelGroup(null, false) doesn't throw IAE");
+ } catch (IllegalArgumentException e) {
+ // Ok
+ }
+ }
+ });
+ }
+}
diff --git a/test/javax/swing/JPopupMenu/6987844/bug6987844.java b/test/javax/swing/JPopupMenu/6987844/bug6987844.java
new file mode 100644
index 0000000000000000000000000000000000000000..d8802351bcbff4b9b1700fe79c4dcc179daa9ab5
--- /dev/null
+++ b/test/javax/swing/JPopupMenu/6987844/bug6987844.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2010, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6987844
+ * @summary Incorrect width of JComboBox drop down
+ * @author Alexander Potochkin
+ * @run main bug6987844
+ */
+
+import sun.awt.SunToolkit;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.InputEvent;
+
+public class bug6987844 {
+ static JMenu menu1;
+ static JMenu menu2;
+
+ public static void main(String... args) throws Exception {
+ SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+ Robot robot = new Robot();
+ robot.setAutoDelay(200);
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ JFrame frame = new JFrame();
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+ JMenuBar bar = new JMenuBar();
+ menu1 = new JMenu("Menu1");
+ menu1.add(new JMenuItem("item"));
+ bar.add(menu1);
+ menu2 = new JMenu("Menu2");
+ menu2.add(new JMenuItem("item"));
+ menu2.add(new JMenuItem("item"));
+ bar.add(menu2);
+
+ frame.setJMenuBar(bar);
+ frame.pack();
+
+ frame.setVisible(true);
+ }
+ });
+ toolkit.realSync();
+ Point point1 = menu1.getLocationOnScreen();
+ Point point2 = menu2.getLocationOnScreen();
+
+ robot.mouseMove(point1.x + 1, point1.y + 1);
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+ robot.mouseMove(point2.x + 1, point2.y + 1);
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+ robot.mouseMove(point1.x + 1, point1.y + 1);
+ toolkit.realSync();
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ Dimension popupSize1 = menu1.getPopupMenu().getSize();
+ Dimension popupSize2 = menu2.getPopupMenu().getSize();
+ if (popupSize1.equals(popupSize2)) {
+ throw new RuntimeException("First popup unexpedetly changed its size");
+ }
+ }
+ });
+ }
+}
diff --git a/test/javax/swing/text/DefaultHighlighter/6771184/bug6771184.java b/test/javax/swing/text/DefaultHighlighter/6771184/bug6771184.java
new file mode 100644
index 0000000000000000000000000000000000000000..d63e8da0e61c204c011a94bac7a59a0bb35880bb
--- /dev/null
+++ b/test/javax/swing/text/DefaultHighlighter/6771184/bug6771184.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2010, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6771184
+ * @summary Some methods in text package don't throw BadLocationException when expected
+ * @author Pavel Porvatov
+ */
+
+import javax.swing.*;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.Highlighter;
+import javax.swing.text.JTextComponent;
+import java.awt.*;
+
+public class bug6771184 {
+ public static void main(String[] args) {
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ JTextArea textArea = new JTextArea("Tested string");
+
+ Highlighter highlighter = textArea.getHighlighter();
+ Highlighter.HighlightPainter myPainter = new Highlighter.HighlightPainter() {
+ public void paint(Graphics g, int p0, int p1, Shape bounds, JTextComponent c) {
+ }
+ };
+
+ int negativeTestedData[][] = {{50, 0},
+ {-1, 1},
+ {-5, -4},
+ {Integer.MAX_VALUE, Integer.MIN_VALUE},
+ {Integer.MIN_VALUE, Integer.MAX_VALUE},
+ {Integer.MIN_VALUE, Integer.MIN_VALUE}};
+
+ for (int[] data : negativeTestedData) {
+ try {
+ highlighter.addHighlight(data[0], data[1], myPainter);
+
+ throw new RuntimeException("Method addHighlight() does not throw BadLocationException for (" +
+ data[0] + ", " + data[1] + ") ");
+ } catch (BadLocationException e) {
+ // Ok
+ }
+
+ Object objRef;
+
+ try {
+ objRef = highlighter.addHighlight(0, 1, myPainter);
+ } catch (BadLocationException e) {
+ throw new RuntimeException("highlighter.addHighlight(0, 1, myPainter) throws exception", e);
+ }
+
+ try {
+ highlighter.changeHighlight(objRef, data[0], data[1]);
+
+ throw new RuntimeException("Method changeHighlight() does not throw BadLocationException for (" +
+ data[0] + ", " + data[1] + ") ");
+ } catch (BadLocationException e) {
+ // Ok
+ }
+ }
+ }
+ });
+ }
+}
diff --git a/test/sun/java2d/GdiRendering/InsetClipping.java b/test/sun/java2d/GdiRendering/InsetClipping.java
index 363f1609a35ab223623a0607d5be773af29ddcc3..0d03a4f83ddbe9c7c80289f0dbc26137d3e7f02c 100644
--- a/test/sun/java2d/GdiRendering/InsetClipping.java
+++ b/test/sun/java2d/GdiRendering/InsetClipping.java
@@ -84,6 +84,9 @@ public class InsetClipping extends Frame {
Thread.sleep(100);
} catch (Exception e) {}
}
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException ex) {}
try {
Robot robot = new Robot();
Point clientLoc = clipTest.getLocationOnScreen();
diff --git a/test/sun/java2d/SunGraphics2D/DrawImageBilinear.java b/test/sun/java2d/SunGraphics2D/DrawImageBilinear.java
index ddc4b74e06bb14eeaab1c17734abbb1ddf1a9a37..e2dd1ba2174fafea92cc5683930757491151c741 100644
--- a/test/sun/java2d/SunGraphics2D/DrawImageBilinear.java
+++ b/test/sun/java2d/SunGraphics2D/DrawImageBilinear.java
@@ -56,6 +56,9 @@ public class DrawImageBilinear extends Canvas {
private VolatileImage vimg;
private static volatile BufferedImage capture;
private static void doCapture(Component test) {
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException ex) {}
// Grab the screen region
try {
Robot robot = new Robot();
diff --git a/test/sun/java2d/SunGraphics2D/SourceClippingBlitTest/SourceClippingBlitTest.java b/test/sun/java2d/SunGraphics2D/SourceClippingBlitTest/SourceClippingBlitTest.java
index 97fa82797305690a512d251138abb65bf601bb7a..292af722506e95632cc03761fa8503212d7869cc 100644
--- a/test/sun/java2d/SunGraphics2D/SourceClippingBlitTest/SourceClippingBlitTest.java
+++ b/test/sun/java2d/SunGraphics2D/SourceClippingBlitTest/SourceClippingBlitTest.java
@@ -204,6 +204,9 @@ public class SourceClippingBlitTest extends Canvas {
int w = getWidth();
int h = getHeight();
Toolkit.getDefaultToolkit().sync();
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException ex) {}
Point p = getLocationOnScreen();
grabbedBI = robot.createScreenCapture(new Rectangle(p.x, p.y, w, h));
diff --git a/test/sun/java2d/X11SurfaceData/SharedMemoryPixmapsTest/SharedMemoryPixmapsTest.java b/test/sun/java2d/X11SurfaceData/SharedMemoryPixmapsTest/SharedMemoryPixmapsTest.java
index 21da7948778df8f3ac5597318fa1ce836c5ef5ee..800518e1cad40d2ce358758971652716c9f8638c 100644
--- a/test/sun/java2d/X11SurfaceData/SharedMemoryPixmapsTest/SharedMemoryPixmapsTest.java
+++ b/test/sun/java2d/X11SurfaceData/SharedMemoryPixmapsTest/SharedMemoryPixmapsTest.java
@@ -120,6 +120,9 @@ public class SharedMemoryPixmapsTest {
}
private boolean testRendering() throws RuntimeException {
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException ex) {}
Robot r = null;
try {
r = new Robot();