--- a/jdk/make/common/Release-embedded.gmk Wed Jul 05 18:01:24 2017 +0200
+++ b/jdk/make/common/Release-embedded.gmk Sat Jan 28 22:21:54 2012 -0800
@@ -189,7 +189,7 @@
$(RM) -r $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/audio
$(RM) -fr $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/applet
$(RM) $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/$(LIBARCH)/awt_robot
- $(RM) -r $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/$(LIBARCH)/xawt
+ $(RM) $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/$(LIBARCH)/libawt_xawt.so
$(RM) -r $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/$(LIBARCH)/libsplashscreen.so
@# Remove oblique fonts and reduce font support to LucidaSansRegular only
$(RM) -fr $(JRE_REDUCED_HEADLESS_IMAGE_DIR)/lib/oblique-fonts
--- a/jdk/make/sun/font/Makefile Wed Jul 05 18:01:24 2017 +0200
+++ b/jdk/make/sun/font/Makefile Sat Jan 28 22:21:54 2012 -0800
@@ -175,7 +175,7 @@
ifeq ($(PLATFORM), solaris)
# Note that on Solaris, fontmanager is built against the headless library.
LDFLAGS += -L$(LIBDIR)/$(LIBARCH)/headless
- OTHER_LDLIBS += -lawt -L$(LIBDIR)/$(LIBARCH)/xawt -lmawt -lc $(LIBM) $(LIBCXX)
+ OTHER_LDLIBS += -lawt -lawt_xawt -lc $(LIBM) $(LIBCXX)
else # PLATFORM is linux
OTHER_LDLIBS += -lawt $(LIBM) $(LIBCXX)
ifeq ("$(CC_VER_MAJOR)", "3")
--- a/jdk/make/sun/font/t2k/Makefile Wed Jul 05 18:01:24 2017 +0200
+++ b/jdk/make/sun/font/t2k/Makefile Sat Jan 28 22:21:54 2012 -0800
@@ -99,7 +99,7 @@
endif
else
ifeq ($(PLATFORM), solaris)
- OTHER_LDLIBS += -lawt -L$(LIBDIR)/$(LIBARCH)/xawt -lmawt
+ OTHER_LDLIBS += -lawt -lawt_xawt
endif
endif
endif
--- a/jdk/make/sun/headless/Makefile Wed Jul 05 18:01:24 2017 +0200
+++ b/jdk/make/sun/headless/Makefile Sat Jan 28 22:21:54 2012 -0800
@@ -28,11 +28,9 @@
NO_ROBOT = true
MOTIF_VERSION = none
MOTIF_VERSION_STRING=none
-LIB_LOCATION = $(LIBDIR)/$(LIBARCH)/headless
PACKAGE = sun.awt
-LIBRARY = mawt
-LIBRARY_OUTPUT = headless
+LIBRARY = awt_headless
PRODUCT = sun
include $(BUILDDIR)/common/Defs.gmk
--- a/jdk/make/sun/jawt/Makefile Wed Jul 05 18:01:24 2017 +0200
+++ b/jdk/make/sun/jawt/Makefile Sat Jan 28 22:21:54 2012 -0800
@@ -113,17 +113,17 @@
#
ifeq ($(PLATFORM), solaris)
ifndef BUILD_HEADLESS_ONLY
- OTHER_LDLIBS = -L$(LIBDIR)/$(LIBARCH) -L$(OPENWIN_LIB) -L$(LIBDIR)/$(LIBARCH)/xawt -lmawt -L/usr/openwin/sfw/lib$(ISA_DIR) -lXrender
+ OTHER_LDLIBS = -L$(LIBDIR)/$(LIBARCH) -L$(OPENWIN_LIB) -lawt_xawt -L/usr/openwin/sfw/lib$(ISA_DIR) -lXrender
else
- OTHER_LDLIBS = -L$(LIBDIR)/$(LIBARCH) -L$(OPENWIN_LIB) -L$(LIBDIR)/$(LIBARCH)/headless -lmawt -L/usr/openwin/sfw/lib$(ISA_DIR) -lXrender
+ OTHER_LDLIBS = -L$(LIBDIR)/$(LIBARCH) -L$(OPENWIN_LIB) -lawt_headless -L/usr/openwin/sfw/lib$(ISA_DIR) -lXrender
endif
endif # PLATFORM
ifeq ($(PLATFORM), linux)
ifndef BUILD_HEADLESS_ONLY
- OTHER_LDLIBS = -L$(LIBDIR)/$(LIBARCH) -lawt -L$(LIBDIR)/$(LIBARCH)/xawt -lmawt
+ OTHER_LDLIBS = -L$(LIBDIR)/$(LIBARCH) -lawt -lawt_xawt
else
- OTHER_LDLIBS = -L$(LIBDIR)/$(LIBARCH) -lawt -L$(LIBDIR)/$(LIBARCH)/headless -lmawt
+ OTHER_LDLIBS = -L$(LIBDIR)/$(LIBARCH) -lawt -lawt_headless
CFLAGS += -DHEADLESS
endif
endif # PLATFORM
--- a/jdk/make/sun/xawt/Makefile Wed Jul 05 18:01:24 2017 +0200
+++ b/jdk/make/sun/xawt/Makefile Sat Jan 28 22:21:54 2012 -0800
@@ -25,9 +25,7 @@
BUILDDIR = ../..
PACKAGE = sun.awt.X11
-LIBRARY = mawt
-LIBRARY_OUTPUT = xawt
-LIB_LOCATION = $(LIBDIR)/$(LIBARCH)/xawt
+LIBRARY = awt_xawt
PRODUCT = sun
include $(BUILDDIR)/common/Defs.gmk
--- a/jdk/src/share/classes/java/awt/datatransfer/MimeType.java Wed Jul 05 18:01:24 2017 +0200
+++ b/jdk/src/share/classes/java/awt/datatransfer/MimeType.java Sat Jan 28 22:21:54 2012 -0800
@@ -30,6 +30,7 @@
import java.io.ObjectInput;
import java.io.IOException;
import java.util.Enumeration;
+import java.util.Locale;
/**
@@ -93,14 +94,14 @@
MimeTypeParseException {
// check to see if primary is valid
if(isValidToken(primary)) {
- primaryType = primary.toLowerCase();
+ primaryType = primary.toLowerCase(Locale.ENGLISH);
} else {
throw new MimeTypeParseException("Primary type is invalid.");
}
// check to see if sub is valid
if(isValidToken(sub)) {
- subType = sub.toLowerCase();
+ subType = sub.toLowerCase(Locale.ENGLISH);
} else {
throw new MimeTypeParseException("Sub type is invalid.");
}
@@ -158,17 +159,17 @@
throw new MimeTypeParseException("Unable to find a sub type.");
} else if((slashIndex >= 0) && (semIndex < 0)) {
// we have a primary and sub type but no parameter list
- primaryType = rawdata.substring(0,
-slashIndex).trim().toLowerCase();
- subType = rawdata.substring(slashIndex +
-1).trim().toLowerCase();
+ primaryType = rawdata.substring(0,slashIndex).
+ trim().toLowerCase(Locale.ENGLISH);
+ subType = rawdata.substring(slashIndex + 1).
+ trim().toLowerCase(Locale.ENGLISH);
parameters = new MimeTypeParameterList();
} else if (slashIndex < semIndex) {
// we have all three items in the proper sequence
- primaryType = rawdata.substring(0,
-slashIndex).trim().toLowerCase();
+ primaryType = rawdata.substring(0, slashIndex).
+ trim().toLowerCase(Locale.ENGLISH);
subType = rawdata.substring(slashIndex + 1,
-semIndex).trim().toLowerCase();
+ semIndex).trim().toLowerCase(Locale.ENGLISH);
parameters = new
MimeTypeParameterList(rawdata.substring(semIndex));
} else {
--- a/jdk/src/share/classes/java/awt/event/MouseEvent.java Wed Jul 05 18:01:24 2017 +0200
+++ b/jdk/src/share/classes/java/awt/event/MouseEvent.java Sat Jan 28 22:21:54 2012 -0800
@@ -758,7 +758,6 @@
if (getModifiersEx() != 0) { //There is at least one more button in a pressed state.
if (id == MouseEvent.MOUSE_RELEASED || id == MouseEvent.MOUSE_CLICKED){
- System.out.println("MEvent. CASE!");
shouldExcludeButtonFromExtModifiers = true;
}
}
--- a/jdk/src/share/classes/java/beans/BeanInfo.java Wed Jul 05 18:01:24 2017 +0200
+++ b/jdk/src/share/classes/java/beans/BeanInfo.java Sat Jan 28 22:21:54 2012 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2012, 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
@@ -25,134 +25,134 @@
package java.beans;
+import java.awt.Image;
+
/**
- * A bean implementor who wishes to provide explicit information about
- * their bean may provide a BeanInfo class that implements this BeanInfo
- * interface and provides explicit information about the methods,
- * properties, events, etc, of their bean.
- * <p>
- * A bean implementor doesn't need to provide a complete set of
- * explicit information. You can pick and choose which information
- * you want to provide and the rest will be obtained by automatic
- * analysis using low-level reflection of the bean classes' methods
- * and applying standard design patterns.
+ * Use the {@code BeanInfo} interface
+ * to create a {@code BeanInfo} class
+ * and provide explicit information about the methods,
+ * properties, events, and other features of your beans.
* <p>
- * You get the opportunity to provide lots and lots of different
- * information as part of the various XyZDescriptor classes. But
- * don't panic, you only really need to provide the minimal core
- * information required by the various constructors.
- * <P>
- * See also the SimpleBeanInfo class which provides a convenient
- * "noop" base class for BeanInfo classes, which you can override
- * for those specific places where you want to return explicit info.
- * <P>
- * To learn about all the behaviour of a bean see the Introspector class.
+ * When developing your bean, you can implement
+ * the bean features required for your application task
+ * omitting the rest of the {@code BeanInfo} features.
+ * They will be obtained through the automatic analysis
+ * by using the low-level reflection of the bean methods
+ * and applying standard design patterns.
+ * You have an opportunity to provide additional bean information
+ * through various descriptor classes.
+ * <p>
+ * See the {@link SimpleBeanInfo} class that is
+ * a convenient basic class for {@code BeanInfo} classes.
+ * You can override the methods and properties of
+ * the {@code SimpleBeanInfo} class to define specific information.
+ * <p>
+ * See also the {@link Introspector} class to learn more about bean behavior.
*/
-
public interface BeanInfo {
/**
- * Gets the beans <code>BeanDescriptor</code>.
+ * Returns the bean descriptor
+ * that provides overall information about the bean,
+ * such as its display name or its customizer.
*
- * @return A BeanDescriptor providing overall information about
- * the bean, such as its displayName, its customizer, etc. May
- * return null if the information should be obtained by automatic
- * analysis.
+ * @return a {@link BeanDescriptor} object,
+ * or {@code null} if the information is to
+ * be obtained through the automatic analysis
*/
BeanDescriptor getBeanDescriptor();
/**
- * Gets the beans <code>EventSetDescriptor</code>s.
+ * Returns the event descriptors of the bean
+ * that define the types of events fired by this bean.
*
- * @return An array of EventSetDescriptors describing the kinds of
- * events fired by this bean. May return null if the information
- * should be obtained by automatic analysis.
+ * @return an array of {@link EventSetDescriptor} objects,
+ * or {@code null} if the information is to
+ * be obtained through the automatic analysis
*/
EventSetDescriptor[] getEventSetDescriptors();
/**
- * A bean may have a "default" event that is the event that will
- * mostly commonly be used by humans when using the bean.
- * @return Index of default event in the EventSetDescriptor array
- * returned by getEventSetDescriptors.
- * <P> Returns -1 if there is no default event.
+ * A bean may have a default event typically applied when this bean is used.
+ *
+ * @return index of the default event in the {@code EventSetDescriptor} array
+ * returned by the {@code getEventSetDescriptors} method,
+ * or -1 if there is no default event
*/
int getDefaultEventIndex();
/**
* Returns descriptors for all properties of the bean.
- * May return {@code null} if the information
- * should be obtained by automatic analysis.
* <p>
* If a property is indexed, then its entry in the result array
- * will belong to the {@link IndexedPropertyDescriptor} subclass
+ * belongs to the {@link IndexedPropertyDescriptor} subclass
* of the {@link PropertyDescriptor} class.
* A client of the {@code getPropertyDescriptors} method
- * can use "{@code instanceof}" to check
+ * can use the {@code instanceof} operator to check
* whether a given {@code PropertyDescriptor}
* is an {@code IndexedPropertyDescriptor}.
*
- * @return an array of {@code PropertyDescriptor}s
- * describing all properties supported by the bean
- * or {@code null}
+ * @return an array of {@code PropertyDescriptor} objects,
+ * or {@code null} if the information is to
+ * be obtained through the automatic analysis
*/
PropertyDescriptor[] getPropertyDescriptors();
/**
- * A bean may have a "default" property that is the property that will
- * mostly commonly be initially chosen for update by human's who are
- * customizing the bean.
- * @return Index of default property in the PropertyDescriptor array
- * returned by getPropertyDescriptors.
- * <P> Returns -1 if there is no default property.
+ * A bean may have a default property commonly updated when this bean is customized.
+ *
+ * @return index of the default property in the {@code PropertyDescriptor} array
+ * returned by the {@code getPropertyDescriptors} method,
+ * or -1 if there is no default property
*/
int getDefaultPropertyIndex();
/**
- * Gets the beans <code>MethodDescriptor</code>s.
+ * Returns the method descriptors of the bean
+ * that define the externally visible methods supported by this bean.
*
- * @return An array of MethodDescriptors describing the externally
- * visible methods supported by this bean. May return null if
- * the information should be obtained by automatic analysis.
+ * @return an array of {@link MethodDescriptor} objects,
+ * or {@code null} if the information is to
+ * be obtained through the automatic analysis
*/
MethodDescriptor[] getMethodDescriptors();
/**
- * This method allows a BeanInfo object to return an arbitrary collection
- * of other BeanInfo objects that provide additional information on the
- * current bean.
- * <P>
- * If there are conflicts or overlaps between the information provided
- * by different BeanInfo objects, then the current BeanInfo takes precedence
- * over the getAdditionalBeanInfo objects, and later elements in the array
- * take precedence over earlier ones.
+ * This method enables the current {@code BeanInfo} object
+ * to return an arbitrary collection of other {@code BeanInfo} objects
+ * that provide additional information about the current bean.
+ * <p>
+ * If there are conflicts or overlaps between the information
+ * provided by different {@code BeanInfo} objects,
+ * the current {@code BeanInfo} object takes priority
+ * over the additional {@code BeanInfo} objects.
+ * Array elements with higher indices take priority
+ * over the elements with lower indices.
*
- * @return an array of BeanInfo objects. May return null.
+ * @return an array of {@code BeanInfo} objects,
+ * or {@code null} if there are no additional {@code BeanInfo} objects
*/
BeanInfo[] getAdditionalBeanInfo();
/**
- * This method returns an image object that can be used to
- * represent the bean in toolboxes, toolbars, etc. Icon images
- * will typically be GIFs, but may in future include other formats.
- * <p>
- * Beans aren't required to provide icons and may return null from
- * this method.
- * <p>
- * There are four possible flavors of icons (16x16 color,
- * 32x32 color, 16x16 mono, 32x32 mono). If a bean choses to only
- * support a single icon we recommend supporting 16x16 color.
+ * Returns an image that can be used to represent the bean in toolboxes or toolbars.
* <p>
- * We recommend that icons have a "transparent" background
- * so they can be rendered onto an existing background.
+ * There are four possible types of icons:
+ * 16 x 16 color, 32 x 32 color, 16 x 16 mono, and 32 x 32 mono.
+ * If you implement a bean so that it supports a single icon,
+ * it is recommended to use 16 x 16 color.
+ * Another recommendation is to set a transparent background for the icons.
*
- * @param iconKind The kind of icon requested. This should be
- * one of the constant values ICON_COLOR_16x16, ICON_COLOR_32x32,
- * ICON_MONO_16x16, or ICON_MONO_32x32.
- * @return An image object representing the requested icon. May
- * return null if no suitable icon is available.
+ * @param iconKind the kind of icon requested
+ * @return an image object representing the requested icon,
+ * or {@code null} if no suitable icon is available
+ *
+ * @see #ICON_COLOR_16x16
+ * @see #ICON_COLOR_32x32
+ * @see #ICON_MONO_16x16
+ * @see #ICON_MONO_32x32
*/
- java.awt.Image getIcon(int iconKind);
+ Image getIcon(int iconKind);
/**
* Constant to indicate a 16 x 16 color icon.
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java Wed Jul 05 18:01:24 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java Sat Jan 28 22:21:54 2012 -0800
@@ -1115,9 +1115,8 @@
protected int getTabLabelShiftY(int tabPlacement, int tabIndex, boolean isSelected) {
Rectangle tabRect = rects[tabIndex];
- String propKey = (isSelected ? "selectedLabelShift" : "labelShift");
- int nudge = DefaultLookup.getInt(
- tabPane, this, "TabbedPane." + propKey, 1);
+ int nudge = (isSelected ? DefaultLookup.getInt(tabPane, this, "TabbedPane.selectedLabelShift", -1) :
+ DefaultLookup.getInt(tabPane, this, "TabbedPane.labelShift", 1));
switch (tabPlacement) {
case BOTTOM:
--- a/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java Wed Jul 05 18:01:24 2017 +0200
+++ b/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java Sat Jan 28 22:21:54 2012 -0800
@@ -255,6 +255,21 @@
}
}
+ if (owner != null || isSimpleWindow()) {
+ XNETProtocol protocol = XWM.getWM().getNETProtocol();
+ if (protocol != null && protocol.active()) {
+ XToolkit.awtLock();
+ try {
+ XAtomList net_wm_state = getNETWMState();
+ net_wm_state.add(protocol.XA_NET_WM_STATE_SKIP_TASKBAR);
+ setNETWMState(net_wm_state);
+ } finally {
+ XToolkit.awtUnlock();
+ }
+
+ }
+ }
+
// Init warning window(for applets)
if (((Window)target).getWarningString() != null) {
// accessSystemTray permission allows to display TrayIcon, TrayIcon tooltip
@@ -480,14 +495,6 @@
bounds.x, bounds.y, bounds.width, bounds.height);
XWM.setMotifDecor(this, false, 0, 0);
- XNETProtocol protocol = XWM.getWM().getNETProtocol();
- if (protocol != null && protocol.active()) {
- XAtomList net_wm_state = getNETWMState();
- net_wm_state.add(protocol.XA_NET_WM_STATE_SKIP_TASKBAR);
- setNETWMState(net_wm_state);
- }
-
-
boolean isResized = !bounds.getSize().equals(oldBounds.getSize());
boolean isMoved = !bounds.getLocation().equals(oldBounds.getLocation());
if (isMoved || isResized) {
--- a/jdk/src/solaris/native/java/lang/java_props_md.c Wed Jul 05 18:01:24 2017 +0200
+++ b/jdk/src/solaris/native/java/lang/java_props_md.c Sat Jan 28 22:21:54 2012 -0800
@@ -310,7 +310,7 @@
}
#ifdef JAVASE_EMBEDDED
-/* Determine the default embedded toolkit based on whether lib/xawt/
+/* Determine the default embedded toolkit based on whether libawt_xawt
* exists in the JRE. This can still be overridden by -Dawt.toolkit=XXX
*/
static char* getEmbeddedToolkit() {
@@ -325,8 +325,8 @@
realpath((char *)dlinfo.dli_fname, buf);
len = strlen(buf);
p = strrchr(buf, '/');
- /* Default AWT Toolkit on Linux and Solaris is XAWT. */
- strncpy(p, "/xawt/", MAXPATHLEN-len-1);
+ /* Default AWT Toolkit on Linux and Solaris is XAWT (libawt_xawt.so). */
+ strncpy(p, "/libawt_xawt.so", MAXPATHLEN-len-1);
/* Check if it exists */
if (stat(buf, &statbuf) == -1 && errno == ENOENT) {
/* No - this is a reduced-headless-jre so use special HToolkit */
--- a/jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c Wed Jul 05 18:01:24 2017 +0200
+++ b/jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c Sat Jan 28 22:21:54 2012 -0800
@@ -105,7 +105,7 @@
/*
* The code below is responsible for:
- * 1. Loading appropriate awt library, i.e. xawt/libmawt or headless/libwawt
+ * 1. Loading appropriate awt library, i.e. libawt_xawt or libawt_headless
* 2. Setting "awt.toolkit" system property to use the appropriate Java toolkit class,
* (if user has specified the toolkit in env varialble)
*/
@@ -130,10 +130,10 @@
/* Calculate library name to load */
if (AWTIsHeadless()) {
- strncpy(p, "/headless/libmawt.so", MAXPATHLEN-len-1);
+ strncpy(p, "/libawt_headless.so", MAXPATHLEN-len-1);
} else {
/* Default AWT Toolkit on Linux and Solaris is XAWT. */
- strncpy(p, "/xawt/libmawt.so", MAXPATHLEN-len-1);
+ strncpy(p, "/libawt_xawt.so", MAXPATHLEN-len-1);
}
if (toolkit) {
@@ -161,7 +161,7 @@
/*
* This entry point must remain in libawt.so as part of a contract
* with the CDE variant of Java Media Framework. (sdtjmplay)
- * Reflect this call over to the correct libmawt.so.
+ * Reflect this call over to the correct libawt_<toolkit>.so.
*/
JNIEXPORT void JNICALL
Java_sun_awt_motif_XsessionWMcommand(JNIEnv *env, jobject this,
@@ -191,7 +191,7 @@
/*
* This entry point must remain in libawt.so as part of a contract
* with the CDE variant of Java Media Framework. (sdtjmplay)
- * Reflect this call over to the correct libmawt.so.
+ * Reflect this call over to the correct libawt_<toolkit>.so.
*/
JNIEXPORT void JNICALL
Java_sun_awt_motif_XsessionWMcommand_New(JNIEnv *env, jobjectArray jargv)
@@ -250,7 +250,7 @@
/*
* These entry point must remain in libawt.so ***for Java Plugin ONLY***
- * Reflect this call over to the correct libmawt.so.
+ * Reflect this call over to the correct libawt_<toolkit>.so.
*/
REFLECT_VOID_FUNCTION(getAwtLockFunctions,
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JList/6462008/bug6462008.java Sat Jan 28 22:21:54 2012 -0800
@@ -0,0 +1,415 @@
+/*
+ * Copyright (c) 2011, 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 6462008
+ * @summary Tests that mouse/keyboard work properly on JList with lead < 0 or > list.getModel().getSize()
+ * @author Shannon Hickey
+ * @run main bug6462008
+ */
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import java.util.*;
+import sun.awt.SunToolkit;
+
+public class bug6462008 {
+
+ private static final int DONT_CARE = -2;
+ private static int anchorLead;
+ private static boolean isAquaLAF;
+ private static int controlKey;
+ private static JList list;
+ private static SunToolkit toolkit;
+ private static Robot robot;
+
+ public static void main(String[] args) throws Exception {
+ toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+ robot = new Robot();
+ robot.setAutoDelay(100);
+
+ isAquaLAF = "Aqua".equals(UIManager.getLookAndFeel().getID());
+ controlKey = isAquaLAF ? KeyEvent.VK_META : KeyEvent.VK_CONTROL;
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ createAndShowGUI();
+ }
+ });
+
+ toolkit.realSync();
+
+ setAnchorLead(-1);
+ toolkit.realSync();
+
+ testListSelection();
+
+ setAnchorLead(100);
+ toolkit.realSync();
+
+ testListSelection();
+ }
+
+ public static void testListSelection() throws Exception {
+
+ // Space
+ robot.keyPress(KeyEvent.VK_SPACE);
+ robot.keyRelease(KeyEvent.VK_SPACE);
+
+ toolkit.realSync();
+ checkSelection();
+ resetList();
+ toolkit.realSync();
+
+ // Control + Space
+ robot.keyPress(KeyEvent.VK_CONTROL);
+ robot.keyPress(KeyEvent.VK_SPACE);
+ robot.keyRelease(KeyEvent.VK_SPACE);
+ robot.keyRelease(KeyEvent.VK_CONTROL);
+
+ toolkit.realSync();
+ checkSelection();
+ resetList();
+ toolkit.realSync();
+
+ // Shift + Space
+ robot.keyPress(KeyEvent.VK_SHIFT);
+ robot.keyPress(KeyEvent.VK_SPACE);
+ robot.keyRelease(KeyEvent.VK_SPACE);
+ robot.keyRelease(KeyEvent.VK_SHIFT);
+
+ toolkit.realSync();
+ checkSelection();
+ resetList();
+ toolkit.realSync();
+
+ // Control + Shift + Space
+ robot.keyPress(KeyEvent.VK_CONTROL);
+ robot.keyPress(KeyEvent.VK_SHIFT);
+ robot.keyPress(KeyEvent.VK_SPACE);
+ robot.keyRelease(KeyEvent.VK_SPACE);
+ robot.keyRelease(KeyEvent.VK_SHIFT);
+ robot.keyRelease(KeyEvent.VK_CONTROL);
+
+ toolkit.realSync();
+ checkSelection();
+ resetList();
+ toolkit.realSync();
+
+
+ // Control + A Multiple Selection
+
+ robot.keyPress(controlKey);
+ robot.keyPress(KeyEvent.VK_A);
+ robot.keyRelease(KeyEvent.VK_A);
+ robot.keyRelease(controlKey);
+
+ toolkit.realSync();
+ checkSelectionAL(-1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
+ resetList();
+ setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ toolkit.realSync();
+
+ // Control + A Single Selection
+ robot.keyPress(controlKey);
+ robot.keyPress(KeyEvent.VK_A);
+ robot.keyRelease(KeyEvent.VK_A);
+ robot.keyRelease(controlKey);
+
+ toolkit.realSync();
+ checkSelectionAL(0, 0, 0);
+ resetList();
+ setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ setSelectionInterval(5, 5);
+ toolkit.realSync();
+
+
+ // Control + A Selection interval (5, 5)
+ robot.keyPress(controlKey);
+ robot.keyPress(KeyEvent.VK_A);
+ robot.keyRelease(KeyEvent.VK_A);
+ robot.keyRelease(controlKey);
+
+ toolkit.realSync();
+ checkSelection(5);
+ resetList();
+ toolkit.realSync();
+
+ // Page Down
+ // Not applicable for the Aqua L&F
+ if (!isAquaLAF) {
+ robot.keyPress(KeyEvent.VK_PAGE_DOWN);
+ robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
+
+ toolkit.realSync();
+ checkSelection(9, 9, 9);
+ resetList();
+ toolkit.realSync();
+ }
+
+ // Shift + Page Down
+ /*
+ * We really want to use robot here, but there seems to be a bug in AWT's
+ * robot implementation (see 6463168). For now, we'll invoke the action
+ * directly instead. When the bug is fixed, we'll use the following four
+ * lines instead:
+ * robot.keyPress(KeyEvent.VK_SHIFT);
+ * robot.keyPress(KeyEvent.VK_PAGE_DOWN);
+ * robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
+ * robot.keyRelease(KeyEvent.VK_SHIFT);
+ */
+
+ scrollDownExtendSelection();
+
+ toolkit.realSync();
+ checkSelection(0, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
+ resetList();
+ toolkit.realSync();
+
+ // Down
+ robot.keyPress(KeyEvent.VK_DOWN);
+ robot.keyRelease(KeyEvent.VK_DOWN);
+
+ toolkit.realSync();
+ checkSelectionAL(0, 0, 0);
+ resetList();
+ toolkit.realSync();
+
+ // L
+ robot.keyPress(KeyEvent.VK_L);
+ robot.keyRelease(KeyEvent.VK_L);
+
+ toolkit.realSync();
+ checkSelectionAL(0, 0, 0);
+ resetList();
+ toolkit.realSync();
+
+ // Click item 4
+ Point p = clickItem4();
+ robot.mouseMove(p.x, p.y);
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+
+ toolkit.realSync();
+ checkSelectionAL(4, 4, 4);
+ resetList();
+ toolkit.realSync();
+
+
+ // Control + Click item 4
+ robot.keyPress(controlKey);
+ p = clickItem4();
+ robot.mouseMove(p.x, p.y);
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+ robot.keyRelease(controlKey);
+
+
+ toolkit.realSync();
+ checkSelectionAL(4, 4, 4);
+ resetList();
+ toolkit.realSync();
+
+ // Shift + Click item 4
+ robot.keyPress(KeyEvent.VK_SHIFT);
+ p = clickItem4();
+ robot.mouseMove(p.x, p.y);
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+ robot.keyRelease(KeyEvent.VK_SHIFT);
+
+
+ toolkit.realSync();
+ checkSelectionAL(0, 4, 0, 1, 2, 3, 4);
+ resetList();
+ toolkit.realSync();
+
+
+ // Control + Shift + Click item 4
+ robot.keyPress(controlKey);
+ robot.keyPress(KeyEvent.VK_SHIFT);
+ p = clickItem4();
+ robot.mouseMove(p.x, p.y);
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+ robot.keyRelease(KeyEvent.VK_SHIFT);
+ robot.keyRelease(controlKey);
+
+ toolkit.realSync();
+ checkSelectionAL(0, 4);
+ resetList();
+ toolkit.realSync();
+ }
+
+ private static DefaultListModel getModel() {
+ DefaultListModel listModel = new DefaultListModel();
+ for (int i = 0; i < 10; i++) {
+ listModel.addElement("List Item " + i);
+ }
+ return listModel;
+ }
+
+ private static Point clickItem4() throws Exception {
+
+ final Point[] result = new Point[1];
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ Rectangle r = list.getCellBounds(4, 4);
+ Point p = new Point(r.x + r.width / 2, r.y + r.height / 2);
+ SwingUtilities.convertPointToScreen(p, list);
+ result[0] = p;
+ }
+ });
+
+ return result[0];
+ }
+
+ private static void resetList() throws Exception {
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ list.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
+ list.getSelectionModel().clearSelection();
+ setAnchorLeadNonThreadSafe();
+ }
+ });
+ }
+
+ private static void scrollDownExtendSelection() throws Exception {
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ list.getActionMap().get("scrollDownExtendSelection").
+ actionPerformed(new ActionEvent(list,
+ ActionEvent.ACTION_PERFORMED, null));
+ }
+ });
+ }
+
+ private static void setSelectionMode(final int selectionMode) throws Exception {
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ list.getSelectionModel().setSelectionMode(selectionMode);
+ setAnchorLeadNonThreadSafe();
+ }
+ });
+ }
+
+ private static void setSelectionInterval(final int index0, final int index1) throws Exception {
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ list.getSelectionModel().setSelectionInterval(index0, index1);
+ setAnchorLeadNonThreadSafe();
+ }
+ });
+ }
+
+ private static void setAnchorLead(final int anchorLeadValue) throws Exception {
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ anchorLead = anchorLeadValue;
+ setAnchorLeadNonThreadSafe();
+ }
+ });
+ }
+
+ private static void setAnchorLeadNonThreadSafe() {
+ list.getSelectionModel().setAnchorSelectionIndex(anchorLead);
+ ((DefaultListSelectionModel) list.getSelectionModel()).moveLeadSelectionIndex(anchorLead);
+ }
+
+ private static void createAndShowGUI() {
+ JFrame frame = new JFrame("bug6462008");
+ frame.setSize(200, 500);
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+ list = new JList(getModel());
+ JPanel panel = new JPanel(new BorderLayout());
+ panel.add(list);
+ frame.getContentPane().add(panel);
+
+ frame.setVisible(true);
+ }
+
+ private static void checkSelection(int... sels) throws Exception {
+ checkSelectionAL(DONT_CARE, DONT_CARE, sels);
+ }
+
+ private static void checkSelectionAL(final int anchor, final int lead, final int... sels) throws Exception {
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ checkSelectionNonThreadSafe(anchor, lead, sels);
+ }
+ });
+ }
+
+ private static void checkSelectionNonThreadSafe(int anchor, int lead, int... sels) {
+ ListSelectionModel lsm = list.getSelectionModel();
+
+ int actualAnchor = lsm.getAnchorSelectionIndex();
+ int actualLead = lsm.getLeadSelectionIndex();
+
+ if (anchor != DONT_CARE && actualAnchor != anchor) {
+ throw new RuntimeException("anchor is " + actualAnchor + ", should be " + anchor);
+ }
+
+ if (lead != DONT_CARE && actualLead != lead) {
+ throw new RuntimeException("lead is " + actualLead + ", should be " + lead);
+ }
+
+ Arrays.sort(sels);
+ boolean[] checks = new boolean[list.getModel().getSize()];
+ for (int i : sels) {
+ checks[i] = true;
+ }
+
+ int index0 = Math.min(lsm.getMinSelectionIndex(), 0);
+ int index1 = Math.max(lsm.getMaxSelectionIndex(), list.getModel().getSize() - 1);
+
+ for (int i = index0; i <= index1; i++) {
+ if (lsm.isSelectedIndex(i)) {
+ if (i < 0 || i >= list.getModel().getSize() || !checks[i]) {
+ throw new RuntimeException(i + " is selected when it should not be");
+ }
+ } else if (i >= 0 && i < list.getModel().getSize() && checks[i]) {
+ throw new RuntimeException(i + " is supposed to be selected");
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JPopupMenu/4966112/bug4966112.java Sat Jan 28 22:21:54 2012 -0800
@@ -0,0 +1,312 @@
+/*
+ * Copyright (c) 2011, 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 4966112
+ * @summary Some Composite components does not show the Context Popup.
+ * @library ../../regtesthelpers
+ * @build Util
+ * @author Alexander Zuev
+ * @run main bug4966112
+ */
+import javax.swing.*;
+import javax.swing.event.PopupMenuListener;
+import javax.swing.event.PopupMenuEvent;
+import java.awt.*;
+import java.awt.event.*;
+import sun.awt.SunToolkit;
+
+public class bug4966112 {
+
+ private static final int NO_MOUSE_BUTTON = -1;
+ private static volatile boolean shown = false;
+ private static volatile int popupButton = NO_MOUSE_BUTTON;
+ private static volatile JButton testButton;
+ private static volatile JSplitPane jsp;
+ private static volatile JSpinner spin;
+ private static volatile JFileChooser filec;
+ private static int buttonMask;
+ private static Robot robot;
+
+ public static void main(String[] args) throws Exception {
+ SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+ robot = new Robot();
+ robot.setAutoDelay(100);
+
+ createAndShowButton();
+ toolkit.realSync();
+
+ setClickPoint(testButton);
+ clickMouse(InputEvent.BUTTON1_MASK);
+ clickMouse(InputEvent.BUTTON2_MASK);
+ clickMouse(InputEvent.BUTTON3_MASK);
+
+ toolkit.realSync();
+ closeFrame();
+
+ if (popupButton == NO_MOUSE_BUTTON) {
+ System.out.println("Test can't identify the popup trigger button. Test skipped");
+ return;
+ }
+
+ setButtonMask();
+
+ // Test Split Pane
+ createAndShowSplitPane();
+ toolkit.realSync();
+
+ clickMouse(jsp);
+ toolkit.realSync();
+ closeFrame();
+
+ if (!shown) {
+ throw new RuntimeException("Popup was not shown on splitpane");
+ }
+
+ // Test Spinner
+ createAndShowSpinner();
+ toolkit.realSync();
+
+ clickMouse(spin);
+ toolkit.realSync();
+ closeFrame();
+
+ if (!shown) {
+ throw new RuntimeException("Popup was not shown on spinner");
+ }
+
+ // Test File Chooser
+ createAndShowFileChooser();
+ toolkit.realSync();
+
+ clickMouse(filec);
+ toolkit.realSync();
+
+ Util.hitKeys(robot, KeyEvent.VK_ESCAPE);
+ toolkit.realSync();
+
+ Util.hitKeys(robot, KeyEvent.VK_ESCAPE);
+ toolkit.realSync();
+ closeFrame();
+
+ if (!shown) {
+ throw new RuntimeException("Popup was not shown on filechooser");
+ }
+ }
+
+ private static void clickMouse(JComponent c) throws Exception {
+ setClickPoint(c);
+ clickMouse(buttonMask);
+ }
+
+ private static void clickMouse(int buttons) {
+ robot.mousePress(buttons);
+ robot.mouseRelease(buttons);
+ }
+
+ private static void setButtonMask() {
+ switch (popupButton) {
+ case MouseEvent.BUTTON1:
+ buttonMask = InputEvent.BUTTON1_MASK;
+ break;
+ case MouseEvent.BUTTON2:
+ buttonMask = InputEvent.BUTTON2_MASK;
+ break;
+ case MouseEvent.BUTTON3:
+ buttonMask = InputEvent.BUTTON3_MASK;
+ break;
+ }
+ }
+
+ private static void setClickPoint(final JComponent c) throws Exception {
+ final Point[] result = new Point[1];
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ Point p = c.getLocationOnScreen();
+ Dimension size = c.getSize();
+ result[0] = new Point(p.x + size.width / 2, p.y + size.height / 2);
+ }
+ });
+
+ robot.mouseMove(result[0].x, result[0].y);
+ }
+
+ private static JPopupMenu createJPopupMenu() {
+ JPopupMenu jpm = new JPopupMenu();
+ jpm.add("One");
+ jpm.add("Two");
+ jpm.add("Three");
+ jpm.addPopupMenuListener(new PopupMenuListener() {
+
+ public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
+ shown = true;
+ }
+
+ public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
+ }
+
+ public void popupMenuCanceled(PopupMenuEvent e) {
+ }
+ });
+
+ AutoClosable.INSTANCE.setPopup(jpm);
+ return jpm;
+ }
+
+ private static void createAndShowButton() throws Exception {
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ JFrame frame = new JFrame("Button Frame");
+ frame.setLayout(new BorderLayout());
+ testButton = new JButton("Popup Tester");
+
+ testButton.addMouseListener(new MouseAdapter() {
+
+ void setPopupTrigger(MouseEvent e) {
+ if (e.isPopupTrigger()) {
+ popupButton = e.getButton();
+ }
+ }
+
+ public void mouseClicked(MouseEvent e) {
+ setPopupTrigger(e);
+ }
+
+ public void mousePressed(MouseEvent e) {
+ setPopupTrigger(e);
+ }
+
+ public void mouseReleased(MouseEvent e) {
+ setPopupTrigger(e);
+ }
+ });
+
+ frame.add(testButton, BorderLayout.CENTER);
+ frame.pack();
+ frame.setVisible(true);
+ AutoClosable.INSTANCE.setFrame(frame);
+ }
+ });
+ }
+
+ private static void createAndShowSplitPane() throws Exception {
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ JFrame frame = new JFrame("Test SplitPane");
+ frame.setSize(250, 200);
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ frame.setLayout(new BorderLayout());
+
+ shown = false;
+ jsp = new JSplitPane();
+ jsp.setRightComponent(new JPanel());
+ jsp.setLeftComponent(new JPanel());
+ jsp.setComponentPopupMenu(createJPopupMenu());
+
+ frame.add(jsp, BorderLayout.CENTER);
+
+ jsp.setDividerLocation(150);
+
+ frame.setLocation(400, 300);
+ frame.setVisible(true);
+ AutoClosable.INSTANCE.setFrame(frame);
+ }
+ });
+ }
+
+ private static void createAndShowSpinner() throws Exception {
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ JFrame frame = new JFrame("JSpinner Test");
+ frame.setLayout(new BorderLayout());
+ frame.setSize(200, 100);
+ shown = false;
+ spin = new JSpinner();
+ spin.setComponentPopupMenu(createJPopupMenu());
+ frame.add(spin, BorderLayout.CENTER);
+ frame.setVisible(true);
+ AutoClosable.INSTANCE.setFrame(frame);
+ }
+ });
+ }
+
+ private static void createAndShowFileChooser() throws Exception {
+ SwingUtilities.invokeLater(new Runnable() {
+
+ @Override
+ public void run() {
+ JFrame frame = new JFrame("FileChooser test dialog");
+ frame.setSize(100, 100);
+
+ shown = false;
+ filec = new JFileChooser();
+ filec.setComponentPopupMenu(createJPopupMenu());
+ filec.showOpenDialog(frame);
+
+ frame.setVisible(true);
+ AutoClosable.INSTANCE.setFrame(frame);
+ }
+ });
+ }
+
+ private static void closeFrame() {
+ SwingUtilities.invokeLater(new Runnable() {
+
+ @Override
+ public void run() {
+ AutoClosable.INSTANCE.close();
+ }
+ });
+ }
+
+ private static class AutoClosable {
+
+ static final AutoClosable INSTANCE = new AutoClosable();
+ private JFrame frame;
+ private JPopupMenu popup;
+
+ public void setFrame(JFrame frame) {
+ this.frame = frame;
+ }
+
+ public void setPopup(JPopupMenu popup) {
+ this.popup = popup;
+ }
+
+ public void close() {
+ frame.dispose();
+ if (popup != null) {
+ popup.setVisible(false);
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JPopupMenu/6827786/bug6827786.java Sat Jan 28 22:21:54 2012 -0800
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2007, 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 6827786
+ * @summary Tests duplicate mnemonics
+ * @author Peter Zhelezniakov
+ * @library ../../regtesthelpers
+ * @build Util
+ * @run main bug6827786
+ */
+import java.awt.*;
+import java.awt.event.KeyEvent;
+import javax.swing.*;
+import sun.awt.SunToolkit;
+
+public class bug6827786 {
+
+ private static JMenu menu;
+ private static Component focusable;
+
+ public static void main(String[] args) throws Exception {
+ SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+ Robot robot = new Robot();
+ robot.setAutoDelay(50);
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ public void run() {
+ createAndShowGUI();
+ }
+ });
+
+ toolkit.realSync();
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ public void run() {
+ focusable.requestFocus();
+ }
+ });
+
+ toolkit.realSync();
+ checkfocus();
+
+ // select menu
+ Util.hitKeys(robot, KeyEvent.VK_ALT, KeyEvent.VK_F);
+ // select submenu
+ Util.hitKeys(robot, KeyEvent.VK_S);
+ toolkit.realSync();
+ // verify submenu is selected
+ verify(1);
+
+ Util.hitKeys(robot, KeyEvent.VK_S);
+ toolkit.realSync();
+ // verify last item is selected
+ verify(2);
+
+ Util.hitKeys(robot, KeyEvent.VK_S);
+ toolkit.realSync();
+ // selection should wrap to first item
+ verify(0);
+
+ System.out.println("PASSED");
+
+ }
+
+ private static void checkfocus() throws Exception {
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ public void run() {
+ if (!focusable.isFocusOwner()) {
+ throw new RuntimeException("Button is not the focus owner.");
+ }
+ }
+ });
+ }
+
+ private static void verify(final int index) throws Exception {
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ MenuElement[] path =
+ MenuSelectionManager.defaultManager().getSelectedPath();
+ MenuElement item = path[3];
+ if (item != menu.getMenuComponent(index)) {
+ System.err.println("Selected: " + item);
+ System.err.println("Should be: "
+ + menu.getMenuComponent(index));
+ throw new RuntimeException("Test Failed");
+ }
+ }
+ });
+ }
+
+ private static JMenuBar createMenuBar() {
+ menu = new JMenu("File");
+ menu.setMnemonic('F');
+
+ menu.add(new JMenuItem("Save", 'S'));
+
+ JMenu sub = new JMenu("Submenu");
+ sub.setMnemonic('S');
+ sub.add(new JMenuItem("Sub Item"));
+ menu.add(sub);
+
+ menu.add(new JMenuItem("Special", 'S'));
+
+ JMenuBar bar = new JMenuBar();
+ bar.add(menu);
+ return bar;
+ }
+
+ private static void createAndShowGUI() {
+ JFrame frame = new JFrame("bug6827786");
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ frame.setJMenuBar(createMenuBar());
+ focusable = new JButton("Set Focus Here");
+ frame.add(focusable);
+ frame.pack();
+ frame.setVisible(true);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTabbedPane/7010561/bug7010561.java Sat Jan 28 22:21:54 2012 -0800
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2012, 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.
+ */
+
+import javax.swing.*;
+import javax.swing.plaf.basic.BasicTabbedPaneUI;
+import javax.swing.plaf.synth.SynthLookAndFeel;
+import java.lang.reflect.Method;
+
+/* @test
+ @bug 7010561
+ @summary Tab text position with Synth based LaF is different to Java 5/6
+ @author Pavel Porvatov
+*/
+public class bug7010561 {
+ private static int[] TAB_PLACEMENT = {
+ SwingConstants.BOTTOM,
+ SwingConstants.BOTTOM,
+ SwingConstants.TOP,
+ SwingConstants.TOP,
+
+ };
+
+ private static boolean[] IS_SELECTED = {
+ false,
+ true,
+ false,
+ true
+ };
+
+ private static int[] RETURN_VALUE = {
+ -1,
+ 1,
+ 1,
+ -1
+ };
+
+ public static void main(String[] args) throws Exception {
+ UIManager.setLookAndFeel(new SynthLookAndFeel());
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ JTabbedPane tabbedPane = new JTabbedPane();
+
+ tabbedPane.addTab("Tab 1", new JLabel("Tab 1"));
+
+ // Ensure internal TabbedPane fields are initialized
+ tabbedPane.doLayout();
+
+ BasicTabbedPaneUI basicTabbedPaneUI = (BasicTabbedPaneUI) tabbedPane.getUI();
+
+ try {
+ Method method = BasicTabbedPaneUI.class.getDeclaredMethod("getTabLabelShiftY", int.class,
+ int.class, boolean.class);
+
+ method.setAccessible(true);
+
+ for (int i = 0; i < 4; i++) {
+ int res = ((Integer) method.invoke(basicTabbedPaneUI, TAB_PLACEMENT[i], 0,
+ IS_SELECTED[i])).intValue();
+
+ if (res != RETURN_VALUE[i]) {
+ throw new RuntimeException("Test bug7010561 failed on index " + i);
+ }
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
+ System.out.println("Test bug7010561 passed");
+ }
+ });
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTree/6263446/bug6263446.java Sat Jan 28 22:21:54 2012 -0800
@@ -0,0 +1,272 @@
+/*
+ * Copyright (c) 2011, 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 6263446
+ * @summary Tests that double-clicking to edit a cell doesn't select the content.
+ * @author Shannon Hickey
+ * @run main bug6263446
+ */
+import java.awt.*;
+import java.awt.event.InputEvent;
+import java.lang.reflect.Field;
+import javax.swing.*;
+import javax.swing.tree.*;
+import sun.awt.SunToolkit;
+
+public class bug6263446 {
+
+ private static final String FIRST = "AAAAAAAAAAA";
+ private static final String SECOND = "BB";
+ private static final String ALL = FIRST + " " + SECOND;
+ private static JTree tree;
+ private static Robot robot;
+ private static SunToolkit toolkit;
+
+ public static void main(String[] args) throws Exception {
+ toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+ robot = new Robot();
+ robot.setAutoDelay(50);
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ public void run() {
+ createAndShowGUI();
+ }
+ });
+
+ toolkit.realSync();
+
+ Point point = getClickPoint();
+ robot.mouseMove(point.x, point.y);
+
+ // click count 3
+ click(1);
+ assertNotEditing();
+
+ click(2);
+ assertNotEditing();
+
+ click(3);
+ assertEditing();
+ cancelCellEditing();
+ assertNotEditing();
+
+ click(4);
+ checkSelectedText(FIRST);
+
+ click(5);
+ checkSelectedText(ALL);
+
+ // click count 4
+ setClickCountToStart(4);
+
+ click(1);
+ assertNotEditing();
+
+ click(2);
+ assertNotEditing();
+
+ click(3);
+ assertNotEditing();
+
+ click(4);
+ assertEditing();
+ cancelCellEditing();
+ assertNotEditing();
+
+ click(5);
+ checkSelectedText(FIRST);
+
+ click(6);
+ checkSelectedText(ALL);
+
+ // start path editing
+ startPathEditing();
+ assertEditing();
+
+ click(1);
+ checkSelection(null);
+
+ click(2);
+ checkSelection(FIRST);
+
+ click(3);
+ checkSelection(ALL);
+ }
+
+ private static void click(int times) {
+ robot.delay(500);
+ for (int i = 0; i < times; i++) {
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+ }
+ }
+
+ private static Point getClickPoint() throws Exception {
+ final Point[] result = new Point[1];
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ Rectangle rect = tree.getRowBounds(0);
+ // UPDATE !!!
+ Point p = new Point(rect.x + rect.width / 2, rect.y + 2);
+ SwingUtilities.convertPointToScreen(p, tree);
+ result[0] = p;
+
+ }
+ });
+
+ return result[0];
+ }
+
+ private static TreeModel createTreeModel() {
+ return new DefaultTreeModel(new DefaultMutableTreeNode(ALL));
+ }
+
+ private static void createAndShowGUI() {
+
+ JFrame frame = new JFrame();
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+ tree = new JTree(createTreeModel());
+ tree.setRootVisible(true);
+ tree.setEditable(true);
+
+
+ frame.getContentPane().add(tree);
+ frame.pack();
+ frame.setVisible(true);
+ }
+
+ private static void setClickCountToStart(final int clicks) throws Exception {
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ try {
+ DefaultTreeCellEditor editor =
+ (DefaultTreeCellEditor) tree.getCellEditor();
+ Field field = DefaultTreeCellEditor.class.getDeclaredField("realEditor");
+ field.setAccessible(true);
+ DefaultCellEditor ce = (DefaultCellEditor) field.get(editor);
+ ce.setClickCountToStart(clicks);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ } catch (NoSuchFieldException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ });
+
+ toolkit.realSync();
+
+ }
+
+ private static void startPathEditing() throws Exception {
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ tree.startEditingAtPath(tree.getPathForRow(0));
+ }
+ });
+ }
+
+ private static void cancelCellEditing() throws Exception {
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ tree.getCellEditor().cancelCellEditing();
+ }
+ });
+ }
+
+ private static void checkSelection(final String sel) throws Exception {
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ try {
+ DefaultTreeCellEditor editor =
+ (DefaultTreeCellEditor) tree.getCellEditor();
+ Field field = DefaultTreeCellEditor.class.getDeclaredField("realEditor");
+ field.setAccessible(true);
+ DefaultCellEditor ce = (DefaultCellEditor) field.get(editor);
+ JTextField tf = (JTextField) ce.getComponent();
+ String text = tf.getSelectedText();
+
+ if (sel == null) {
+ if (text != null && text.length() != 0) {
+ throw new RuntimeException("Nothing should be selected, but \"" + text + "\" is selected.");
+ }
+ } else if (!sel.equals(text)) {
+ throw new RuntimeException("\"" + sel + "\" should be selected, but \"" + text + "\" is selected.");
+ }
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ } catch (NoSuchFieldException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ });
+ }
+
+ private static void checkSelectedText(String sel) throws Exception {
+ assertEditing();
+ checkSelection(sel);
+ cancelCellEditing();
+ assertNotEditing();
+ }
+
+ private static void assertEditing() throws Exception {
+ assertEditingNoTreeLock(true);
+ }
+
+ private static void assertNotEditing() throws Exception {
+ assertEditingNoTreeLock(false);
+ }
+
+ private static void assertEditingNoTreeLock(final boolean editing) throws Exception {
+ toolkit.realSync();
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ if (editing && !tree.isEditing()) {
+ throw new RuntimeException("Tree should be editing");
+ }
+ if (!editing && tree.isEditing()) {
+ throw new RuntimeException("Tree should not be editing");
+ }
+ }
+ });
+
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/SwingUtilities/4917669/bug4917669.java Sat Jan 28 22:21:54 2012 -0800
@@ -0,0 +1,106 @@
+
+/*
+ * Copyright (c) 2008, 2012, 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 4917669
+ * @summary 1.4 REGRESSION: MenuItem accelerator doesn't work if parent menu is in JDialog
+ * @author Alexander Zuev
+ * @library ../../regtesthelpers
+ * @run main bug4917669
+ */
+
+import javax.swing.*;
+import java.awt.event.*;
+import java.awt.*;
+import sun.awt.SunToolkit;
+
+public class bug4917669 {
+
+ private static volatile boolean passed = false;
+ private static JFrame mainFrame;
+
+ public static void main(String[] args) throws Exception {
+ SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+ Robot robot = new Robot();
+ robot.setAutoDelay(500);
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ createAndShowGUI();
+ }
+ });
+
+ toolkit.realSync();
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ createAndShowDialog();
+ }
+ });
+
+ toolkit.realSync();
+
+ Util.hitKeys(robot, KeyEvent.VK_CONTROL, KeyEvent.VK_O);
+ toolkit.realSync();
+
+ if (!passed) {
+ throw new RuntimeException("Action did not received by menu item.");
+ }
+ }
+
+ private static void createAndShowDialog() {
+ JDialog dialog = new JDialog(mainFrame, "Test Dialog", false);
+ JMenuBar mb = new JMenuBar();
+ JMenu file = new JMenu("File");
+ JMenuItem menuItem = new JMenuItem("Open");
+ menuItem.setAccelerator(KeyStroke.getKeyStroke("control O"));
+ menuItem.addActionListener(new ActionListener() {
+
+ public void actionPerformed(ActionEvent e) {
+ passed = true;
+ }
+ });
+ file.add(menuItem);
+ mb.add(file);
+ dialog.setJMenuBar(mb);
+
+ dialog.setSize(100, 100);
+ dialog.setLocation(200, 200);
+ dialog.setVisible(true);
+ }
+
+ private static void createAndShowGUI() {
+ mainFrame = new JFrame("Bug4917669");
+ mainFrame.setLayout(new BorderLayout());
+ mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ mainFrame.setSize(50, 50);
+ mainFrame.setVisible(true);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/plaf/basic/BasicHTML/4251579/bug4251579.java Sat Jan 28 22:21:54 2012 -0800
@@ -0,0 +1,100 @@
+
+/*
+ * Copyright (c) 2008, 2012, 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 4251579
+ * @summary Tests if style sheets are working in JLabel
+ * @author Denis Sharypov
+ * @run main bug4251579
+ */
+import java.awt.*;
+import javax.swing.*;
+
+import sun.awt.SunToolkit;
+
+public class bug4251579 {
+
+ private static JLabel htmlComponent;
+
+ public static void main(String[] args) throws Exception {
+ SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+ final Robot robot = new Robot();
+ robot.setAutoDelay(50);
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ createAndShowGUI();
+ }
+ });
+
+ toolkit.realSync();
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ boolean passed = false;
+
+ Point p = htmlComponent.getLocationOnScreen();
+ Dimension d = htmlComponent.getSize();
+ int x0 = p.x;
+ int y = p.y + d.height / 2;
+
+ for (int x = x0; x < x0 + d.width; x++) {
+ if (robot.getPixelColor(x, y).equals(Color.blue)) {
+ passed = true;
+ break;
+ }
+ }
+
+ if (!passed) {
+ throw new RuntimeException("Test failed.");
+ }
+
+ }
+ });
+ }
+
+ private static void createAndShowGUI() {
+
+ String htmlText =
+ "<html>"
+ + "<head><style> .blue{ color:blue; } </style></head>"
+ + "<body"
+ + "<P class=\"blue\"> should be rendered with BLUE class definition</P>"
+ + "</body>";
+
+ JFrame mainFrame = new JFrame("bug4251579");
+ mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+ htmlComponent = new JLabel(htmlText);
+ mainFrame.getContentPane().add(htmlComponent);
+
+ mainFrame.pack();
+ mainFrame.setVisible(true);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/text/html/CSS/4530474/bug4530474.java Sat Jan 28 22:21:54 2012 -0800
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2008, 2012, 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 4530474
+ * @summary Tests if background-color CSS attribute in HTML font tag in class attribute
+ * @author Denis Sharypov
+ * @run main bug4530474
+ */
+
+import java.awt.*;
+import javax.swing.*;
+
+import java.io.*;
+
+import sun.awt.SunToolkit;
+
+public class bug4530474 {
+
+ private static final Color TEST_COLOR = Color.BLUE;
+ private static JEditorPane jep;
+
+ public static void main(String args[]) throws Exception {
+
+ SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+ final Robot robot = new Robot();
+ robot.setAutoDelay(50);
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ createAndShowGUI();
+ }
+ });
+
+ toolkit.realSync();
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+
+ boolean passed = false;
+
+ Point p = jep.getLocationOnScreen();
+ Dimension d = jep.getSize();
+ int x0 = p.x;
+ int y = p.y + d.height / 3;
+
+ StringBuilder builder = new StringBuilder("Test color: ");
+ builder.append(TEST_COLOR.toString());
+ builder.append(" resut colors: ");
+
+ for (int x = x0; x < x0 + d.width; x++) {
+ Color color = robot.getPixelColor(x, y);
+ builder.append(color);
+
+ if (TEST_COLOR.equals(color)) {
+ passed = true;
+ break;
+ }
+ }
+
+ if (!passed) {
+ throw new RuntimeException("Test Fail. " + builder.toString());
+ }
+ }
+ });
+
+ }
+
+ private static void createAndShowGUI() {
+
+ JFrame mainFrame = new JFrame("bug4530474");
+ mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ jep = new JEditorPane();
+
+ try {
+ File file = new File(System.getProperty("test.src", "."), "test.html");
+ jep.setPage(file.toURL());
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
+ mainFrame.getContentPane().add(jep);
+
+ mainFrame.pack();
+ mainFrame.setVisible(true);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/text/html/CSS/4530474/test.css Sat Jan 28 22:21:54 2012 -0800
@@ -0,0 +1,4 @@
+font.blackwhite {
+ background-color: blue;
+ color: #FFFFFF;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/text/html/CSS/4530474/test.html Sat Jan 28 22:21:54 2012 -0800
@@ -0,0 +1,7 @@
+<html>
+<head>
+<LINK REL="StyleSheet" type="text/css" HREF=test.css>
+<body>
+ <font class="blackwhite">www</font>
+</body>
+</html>