1.1 --- a/make/docs/CORE_PKGS.gmk Mon Jul 06 14:10:31 2009 -0400
1.2 +++ b/make/docs/CORE_PKGS.gmk Thu Jul 09 13:53:05 2009 -0400
1.3 @@ -217,6 +217,7 @@
1.4 javax.swing.plaf.basic \
1.5 javax.swing.plaf.metal \
1.6 javax.swing.plaf.multi \
1.7 + javax.swing.plaf.nimbus \
1.8 javax.swing.plaf.synth \
1.9 javax.tools \
1.10 javax.transaction \
2.1 --- a/make/sun/xawt/mapfile-vers Mon Jul 06 14:10:31 2009 -0400
2.2 +++ b/make/sun/xawt/mapfile-vers Thu Jul 09 13:53:05 2009 -0400
2.3 @@ -125,6 +125,7 @@
2.4 Java_sun_awt_X11_XlibWrapper_XFree;
2.5 Java_sun_awt_X11_XlibWrapper_ServerVendor;
2.6 Java_sun_awt_X11_XlibWrapper_VendorRelease;
2.7 + Java_sun_awt_X11_XlibWrapper_IsXsunKPBehavior;
2.8 Java_sun_awt_X11_XlibWrapper_SetToolkitErrorHandler;
2.9 Java_sun_awt_X11_XlibWrapper_XSetErrorHandler;
2.10 Java_sun_awt_X11_XlibWrapper_CallErrorHandler;
3.1 --- a/src/share/classes/com/sun/java/swing/SwingUtilities3.java Mon Jul 06 14:10:31 2009 -0400
3.2 +++ b/src/share/classes/com/sun/java/swing/SwingUtilities3.java Thu Jul 09 13:53:05 2009 -0400
3.3 @@ -1,5 +1,5 @@
3.4 /*
3.5 - * Copyright 2002-2008 Sun Microsystems, Inc. All Rights Reserved.
3.6 + * Copyright 2002-2009 Sun Microsystems, Inc. All Rights Reserved.
3.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3.8 *
3.9 * This code is free software; you can redistribute it and/or modify it
3.10 @@ -27,13 +27,17 @@
3.11
3.12 import sun.awt.EventQueueDelegate;
3.13 import sun.awt.AppContext;
3.14 +import java.util.Collections;
3.15 import java.util.Map;
3.16 +import java.util.WeakHashMap;
3.17 import java.util.concurrent.Callable;
3.18 import java.awt.AWTEvent;
3.19 import java.awt.EventQueue;
3.20 import java.awt.Component;
3.21 +import java.awt.Container;
3.22 import javax.swing.JComponent;
3.23 import javax.swing.RepaintManager;
3.24 +import javax.swing.SwingUtilities;
3.25
3.26 /**
3.27 * A collection of utility methods for Swing.
3.28 @@ -69,6 +73,43 @@
3.29 repaintManager);
3.30 }
3.31
3.32 + private static final Map<Container, Boolean> vsyncedMap =
3.33 + Collections.synchronizedMap(new WeakHashMap<Container, Boolean>());
3.34 +
3.35 + /**
3.36 + * Sets vsyncRequested state for the {@code rootContainer}. If
3.37 + * {@code isRequested} is {@code true} then vsynced
3.38 + * {@code BufferStrategy} is enabled for this {@code rootContainer}.
3.39 + *
3.40 + * Note: requesting vsynced painting does not guarantee one. The outcome
3.41 + * depends on current RepaintManager's RepaintManager.PaintManager
3.42 + * and on the capabilities of the graphics hardware/software and what not.
3.43 + *
3.44 + * @param rootContainer topmost container. Should be either {@code Window}
3.45 + * or {@code Applet}
3.46 + * @param isRequested the value to set vsyncRequested state to
3.47 + */
3.48 + public static void setVsyncRequested(Container rootContainer,
3.49 + boolean isRequested) {
3.50 + assert SwingUtilities.getRoot(rootContainer) == rootContainer;
3.51 + if (isRequested) {
3.52 + vsyncedMap.put(rootContainer, Boolean.TRUE);
3.53 + } else {
3.54 + vsyncedMap.remove(rootContainer);
3.55 + }
3.56 + }
3.57 +
3.58 + /**
3.59 + * Checks if vsync painting is requested for {@code rootContainer}
3.60 + *
3.61 + * @param rootContainer topmost container. Should be either Window or Applet
3.62 + * @return {@code true} if vsync painting is requested for {@code rootContainer}
3.63 + */
3.64 + public static boolean isVsyncRequested(Container rootContainer) {
3.65 + assert SwingUtilities.getRoot(rootContainer) == rootContainer;
3.66 + return Boolean.TRUE == vsyncedMap.get(rootContainer);
3.67 + }
3.68 +
3.69 /**
3.70 * Returns delegate {@code RepaintManager} for {@code component} hierarchy.
3.71 */
4.1 --- a/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java Mon Jul 06 14:10:31 2009 -0400
4.2 +++ b/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java Thu Jul 09 13:53:05 2009 -0400
4.3 @@ -1,5 +1,5 @@
4.4 /*
4.5 - * Copyright 2002-2008 Sun Microsystems, Inc. All Rights Reserved.
4.6 + * Copyright 2002-2009 Sun Microsystems, Inc. All Rights Reserved.
4.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4.8 *
4.9 * This code is free software; you can redistribute it and/or modify it
4.10 @@ -139,7 +139,7 @@
4.11 });
4.12 isSunDesktop = val.booleanValue();
4.13 }
4.14 - if (isSunDesktop) {
4.15 + if (isSunDesktop && !sun.java2d.SunGraphicsEnvironment.isOpenSolaris) {
4.16 isSunCJK = true;
4.17 }
4.18 }
5.1 --- a/src/share/classes/java/awt/AWTEvent.java Mon Jul 06 14:10:31 2009 -0400
5.2 +++ b/src/share/classes/java/awt/AWTEvent.java Thu Jul 09 13:53:05 2009 -0400
5.3 @@ -32,6 +32,7 @@
5.4 import java.lang.reflect.Field;
5.5 import java.util.logging.Logger;
5.6 import java.util.logging.Level;
5.7 +import sun.awt.AWTAccessor;
5.8
5.9 /**
5.10 * The root event class for all AWT events.
5.11 @@ -230,6 +231,12 @@
5.12 if (!GraphicsEnvironment.isHeadless()) {
5.13 initIDs();
5.14 }
5.15 + AWTAccessor.setAWTEventAccessor(
5.16 + new AWTAccessor.AWTEventAccessor() {
5.17 + public void setPosted(AWTEvent ev) {
5.18 + ev.isPosted = true;
5.19 + }
5.20 + });
5.21 }
5.22
5.23 private static synchronized Field get_InputEvent_CanAccessSystemClipboard() {
6.1 --- a/src/share/classes/java/awt/Component.java Mon Jul 06 14:10:31 2009 -0400
6.2 +++ b/src/share/classes/java/awt/Component.java Thu Jul 09 13:53:05 2009 -0400
6.3 @@ -861,6 +861,17 @@
6.4 public boolean isVisible_NoClientCode(Component comp) {
6.5 return comp.isVisible_NoClientCode();
6.6 }
6.7 + public void setRequestFocusController
6.8 + (RequestFocusController requestController)
6.9 + {
6.10 + Component.setRequestFocusController(requestController);
6.11 + }
6.12 + public AppContext getAppContext(Component comp) {
6.13 + return comp.appContext;
6.14 + }
6.15 + public void setAppContext(Component comp, AppContext appContext) {
6.16 + comp.appContext = appContext;
6.17 + }
6.18 });
6.19 }
6.20
6.21 @@ -9824,31 +9835,6 @@
6.22
6.23 // ****************** END OF MIXING CODE ********************************
6.24
6.25 - private static boolean doesClassImplement(Class cls, String interfaceName) {
6.26 - if (cls == null) return false;
6.27 -
6.28 - for (Class c : cls.getInterfaces()) {
6.29 - if (c.getName().equals(interfaceName)) {
6.30 - return true;
6.31 - }
6.32 - }
6.33 - return doesClassImplement(cls.getSuperclass(), interfaceName);
6.34 - }
6.35 -
6.36 - /**
6.37 - * Checks that the given object implements the given interface.
6.38 - * @param obj Object to be checked
6.39 - * @param interfaceName The name of the interface. Must be fully-qualified interface name.
6.40 - * @return true, if this object implements the given interface,
6.41 - * false, otherwise, or if obj or interfaceName is null
6.42 - */
6.43 - static boolean doesImplement(Object obj, String interfaceName) {
6.44 - if (obj == null) return false;
6.45 - if (interfaceName == null) return false;
6.46 -
6.47 - return doesClassImplement(obj.getClass(), interfaceName);
6.48 - }
6.49 -
6.50 // Note that the method is overriden in the Window class,
6.51 // a window doesn't need to be updated in the Z-order.
6.52 void updateZOrder() {
7.1 --- a/src/share/classes/java/awt/ContainerOrderFocusTraversalPolicy.java Mon Jul 06 14:10:31 2009 -0400
7.2 +++ b/src/share/classes/java/awt/ContainerOrderFocusTraversalPolicy.java Thu Jul 09 13:53:05 2009 -0400
7.3 @@ -425,15 +425,13 @@
7.4 }
7.5 if (log.isLoggable(Level.FINE)) log.fine("### Cycle is " + cycle);
7.6
7.7 - for (int i = 0; i < cycle.size(); i++) {
7.8 - Component comp = cycle.get(i);
7.9 + for (Component comp : cycle) {
7.10 if (accept(comp)) {
7.11 return comp;
7.12 - } else if (comp instanceof Container && comp != aContainer) {
7.13 - Container cont = (Container)comp;
7.14 - if (cont.isFocusTraversalPolicyProvider()) {
7.15 - return cont.getFocusTraversalPolicy().getDefaultComponent(cont);
7.16 - }
7.17 + } else if (comp != aContainer &&
7.18 + (comp = getComponentDownCycle(comp, FORWARD_TRAVERSAL)) != null)
7.19 + {
7.20 + return comp;
7.21 }
7.22 }
7.23 }
8.1 --- a/src/share/classes/java/awt/Dialog.java Mon Jul 06 14:10:31 2009 -0400
8.2 +++ b/src/share/classes/java/awt/Dialog.java Thu Jul 09 13:53:05 2009 -0400
8.3 @@ -262,12 +262,6 @@
8.4 TOOLKIT_EXCLUDE
8.5 };
8.6
8.7 - /**
8.8 - * @since 1.6
8.9 - */
8.10 - private final static ModalExclusionType DEFAULT_MODAL_EXCLUSION_TYPE =
8.11 - ModalExclusionType.APPLICATION_EXCLUDE;
8.12 -
8.13 /* operations with this list should be synchronized on tree lock*/
8.14 transient static IdentityArrayList<Dialog> modalDialogs = new IdentityArrayList<Dialog>();
8.15
9.1 --- a/src/share/classes/java/awt/EventQueue.java Mon Jul 06 14:10:31 2009 -0400
9.2 +++ b/src/share/classes/java/awt/EventQueue.java Thu Jul 09 13:53:05 2009 -0400
9.3 @@ -43,6 +43,7 @@
9.4 import sun.awt.PeerEvent;
9.5 import sun.awt.SunToolkit;
9.6 import sun.awt.EventQueueItem;
9.7 +import sun.awt.AWTAccessor;
9.8
9.9 /**
9.10 * <code>EventQueue</code> is a platform-independent class
9.11 @@ -154,6 +155,18 @@
9.12
9.13 private static final Logger eventLog = Logger.getLogger("java.awt.event.EventQueue");
9.14
9.15 + static {
9.16 + AWTAccessor.setEventQueueAccessor(
9.17 + new AWTAccessor.EventQueueAccessor() {
9.18 + public EventQueue getNextQueue(EventQueue eventQueue) {
9.19 + return eventQueue.nextQueue;
9.20 + }
9.21 + public Thread getDispatchThread(EventQueue eventQueue) {
9.22 + return eventQueue.dispatchThread;
9.23 + }
9.24 + });
9.25 + }
9.26 +
9.27 public EventQueue() {
9.28 for (int i = 0; i < NUM_PRIORITIES; i++) {
9.29 queues[i] = new Queue();
10.1 --- a/src/share/classes/java/awt/MenuComponent.java Mon Jul 06 14:10:31 2009 -0400
10.2 +++ b/src/share/classes/java/awt/MenuComponent.java Thu Jul 09 13:53:05 2009 -0400
10.3 @@ -30,6 +30,7 @@
10.4 import java.io.ObjectInputStream;
10.5 import sun.awt.AppContext;
10.6 import sun.awt.SunToolkit;
10.7 +import sun.awt.AWTAccessor;
10.8 import javax.accessibility.*;
10.9
10.10 /**
10.11 @@ -109,6 +110,22 @@
10.12 */
10.13 private static final long serialVersionUID = -4536902356223894379L;
10.14
10.15 + static {
10.16 + AWTAccessor.setMenuComponentAccessor(
10.17 + new AWTAccessor.MenuComponentAccessor() {
10.18 + public AppContext getAppContext(MenuComponent menuComp) {
10.19 + return menuComp.appContext;
10.20 + }
10.21 + public void setAppContext(MenuComponent menuComp,
10.22 + AppContext appContext) {
10.23 + menuComp.appContext = appContext;
10.24 + }
10.25 + public MenuContainer getParent(MenuComponent menuComp) {
10.26 + return menuComp.parent;
10.27 + }
10.28 + });
10.29 + }
10.30 +
10.31 /**
10.32 * Creates a <code>MenuComponent</code>.
10.33 * @exception HeadlessException if
11.1 --- a/src/share/classes/java/awt/PopupMenu.java Mon Jul 06 14:10:31 2009 -0400
11.2 +++ b/src/share/classes/java/awt/PopupMenu.java Thu Jul 09 13:53:05 2009 -0400
11.3 @@ -28,6 +28,7 @@
11.4 import java.awt.peer.PopupMenuPeer;
11.5 import javax.accessibility.*;
11.6
11.7 +import sun.awt.AWTAccessor;
11.8
11.9 /**
11.10 * A class that implements a menu which can be dynamically popped up
11.11 @@ -48,6 +49,15 @@
11.12
11.13 transient boolean isTrayIconPopup = false;
11.14
11.15 + static {
11.16 + AWTAccessor.setPopupMenuAccessor(
11.17 + new AWTAccessor.PopupMenuAccessor() {
11.18 + public boolean isTrayIconPopup(PopupMenu popupMenu) {
11.19 + return popupMenu.isTrayIconPopup;
11.20 + }
11.21 + });
11.22 + }
11.23 +
11.24 /*
11.25 * JDK 1.1 serialVersionUID
11.26 */
12.1 --- a/src/share/classes/java/awt/Window.java Mon Jul 06 14:10:31 2009 -0400
12.2 +++ b/src/share/classes/java/awt/Window.java Thu Jul 09 13:53:05 2009 -0400
12.3 @@ -3658,7 +3658,7 @@
12.4 private static void setLayersOpaque(Component component, boolean isOpaque) {
12.5 // Shouldn't use instanceof to avoid loading Swing classes
12.6 // if it's a pure AWT application.
12.7 - if (Component.doesImplement(component, "javax.swing.RootPaneContainer")) {
12.8 + if (SunToolkit.isInstanceOf(component, "javax.swing.RootPaneContainer")) {
12.9 javax.swing.RootPaneContainer rpc = (javax.swing.RootPaneContainer)component;
12.10 javax.swing.JRootPane root = rpc.getRootPane();
12.11 javax.swing.JLayeredPane lp = root.getLayeredPane();
12.12 @@ -3797,6 +3797,10 @@
12.13 {
12.14 return window.calculateSecurityWarningPosition(x, y, w, h);
12.15 }
12.16 +
12.17 + public void setLWRequestStatus(Window changed, boolean status) {
12.18 + changed.syncLWRequests = status;
12.19 + }
12.20 }); // WindowAccessor
12.21 } // static
12.22
13.1 --- a/src/share/classes/java/beans/MetaData.java Mon Jul 06 14:10:31 2009 -0400
13.2 +++ b/src/share/classes/java/beans/MetaData.java Thu Jul 09 13:53:05 2009 -0400
13.3 @@ -93,7 +93,7 @@
13.4
13.5 protected Expression instantiate(Object oldInstance, Encoder out) {
13.6 Enum e = (Enum) oldInstance;
13.7 - return new Expression(e, Enum.class, "valueOf", new Object[]{e.getClass(), e.name()});
13.8 + return new Expression(e, Enum.class, "valueOf", new Object[]{e.getDeclaringClass(), e.name()});
13.9 }
13.10 }
13.11
14.1 --- a/src/share/classes/java/text/SimpleDateFormat.java Mon Jul 06 14:10:31 2009 -0400
14.2 +++ b/src/share/classes/java/text/SimpleDateFormat.java Thu Jul 09 13:53:05 2009 -0400
14.3 @@ -1030,9 +1030,9 @@
14.4
14.5 case 1: // 'y' - YEAR
14.6 if (calendar instanceof GregorianCalendar) {
14.7 - if (count >= 4)
14.8 + if (count != 2)
14.9 zeroPaddingNumber(value, count, maxIntCount, buffer);
14.10 - else // count < 4
14.11 + else // count == 2
14.12 zeroPaddingNumber(value, 2, 2, buffer); // clip 1996 to 96
14.13 } else {
14.14 if (current == null) {
15.1 --- a/src/share/classes/javax/swing/BufferStrategyPaintManager.java Mon Jul 06 14:10:31 2009 -0400
15.2 +++ b/src/share/classes/javax/swing/BufferStrategyPaintManager.java Thu Jul 09 13:53:05 2009 -0400
15.3 @@ -1,5 +1,5 @@
15.4 /*
15.5 - * Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved.
15.6 + * Copyright 2005-2009 Sun Microsystems, Inc. All Rights Reserved.
15.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
15.8 *
15.9 * This code is free software; you can redistribute it and/or modify it
15.10 @@ -33,9 +33,14 @@
15.11 import java.security.AccessController;
15.12 import java.util.*;
15.13 import java.util.logging.*;
15.14 +
15.15 +import com.sun.java.swing.SwingUtilities3;
15.16 +
15.17 import sun.awt.SubRegionShowable;
15.18 import sun.java2d.SunGraphics2D;
15.19 import sun.security.action.GetPropertyAction;
15.20 +import sun.java2d.pipe.hw.ExtendedBufferCapabilities;
15.21 +import sun.awt.SunToolkit;
15.22
15.23 /**
15.24 * A PaintManager implementation that uses a BufferStrategy for
15.25 @@ -73,12 +78,6 @@
15.26 private static Method COMPONENT_CREATE_BUFFER_STRATEGY_METHOD;
15.27 private static Method COMPONENT_GET_BUFFER_STRATEGY_METHOD;
15.28
15.29 - /**
15.30 - * Indicates whether or not we should try and get a flip buffer strategy
15.31 - * first, default is false.
15.32 - */
15.33 - private static boolean TRY_FLIP;
15.34 -
15.35 private static final Logger LOGGER = Logger.getLogger(
15.36 "javax.swing.BufferStrategyPaintManager");
15.37
15.38 @@ -151,12 +150,6 @@
15.39 */
15.40 private boolean disposeBufferOnEnd;
15.41
15.42 -
15.43 - static {
15.44 - TRY_FLIP = "true".equals(AccessController.doPrivileged(
15.45 - new GetPropertyAction("swing.useFlipBufferStrategy", "false")));
15.46 - }
15.47 -
15.48 private static Method getGetBufferStrategyMethod() {
15.49 if (COMPONENT_GET_BUFFER_STRATEGY_METHOD == null) {
15.50 getMethods();
15.51 @@ -257,7 +250,7 @@
15.52 try {
15.53 BufferInfo info = getBufferInfo(c);
15.54 BufferStrategy bufferStrategy;
15.55 - if (info != null && !info.usingFlip && info.isInSync() &&
15.56 + if (info != null && info.isInSync() &&
15.57 (bufferStrategy = info.getBufferStrategy(false)) != null) {
15.58 SubRegionShowable bsSubRegion =
15.59 (SubRegionShowable)bufferStrategy;
15.60 @@ -579,8 +572,9 @@
15.61 rootJ = c;
15.62 root = c;
15.63 xOffset = yOffset = 0;
15.64 - while (root != null && (!(root instanceof Window) &&
15.65 - !(root instanceof Applet))) {
15.66 + while (root != null &&
15.67 + (!(root instanceof Window) &&
15.68 + !SunToolkit.isInstanceOf(root, "java.applet.Applet"))) {
15.69 xOffset += root.getX();
15.70 yOffset += root.getY();
15.71 root = root.getParent();
15.72 @@ -685,8 +679,6 @@
15.73 // same reason.
15.74 private WeakReference<BufferStrategy> weakBS;
15.75 private WeakReference<Container> root;
15.76 - // Whether or not we're using flip bs or blit.
15.77 - private boolean usingFlip;
15.78 // Indicates whether or not the backbuffer and display are in sync.
15.79 // This is set to true when a full repaint on the rootpane is done.
15.80 private boolean inSync;
15.81 @@ -764,13 +756,6 @@
15.82 }
15.83
15.84 /**
15.85 - * Returns true if using a flip buffer strategy.
15.86 - */
15.87 - public boolean usingFlip() {
15.88 - return usingFlip;
15.89 - }
15.90 -
15.91 - /**
15.92 * Returns true if the buffer strategy of the component differs
15.93 * from current buffer strategy.
15.94 */
15.95 @@ -814,23 +799,19 @@
15.96 * blit.
15.97 */
15.98 private BufferStrategy createBufferStrategy() {
15.99 - BufferCapabilities caps;
15.100 Container root = getRoot();
15.101 if (root == null) {
15.102 return null;
15.103 }
15.104 BufferStrategy bs = null;
15.105 - if (TRY_FLIP) {
15.106 - bs = createBufferStrategy(root,BufferCapabilities.FlipContents.
15.107 - COPIED);
15.108 - usingFlip = true;
15.109 + if (SwingUtilities3.isVsyncRequested(root)) {
15.110 + bs = createBufferStrategy(root, true);
15.111 if (LOGGER.isLoggable(Level.FINER)) {
15.112 - LOGGER.finer("createBufferStrategy: using flip strategy");
15.113 + LOGGER.finer("createBufferStrategy: using vsynced strategy");
15.114 }
15.115 }
15.116 if (bs == null) {
15.117 - bs = createBufferStrategy(root, null);
15.118 - usingFlip = false;
15.119 + bs = createBufferStrategy(root, false);
15.120 }
15.121 if (!(bs instanceof SubRegionShowable)) {
15.122 // We do this for two reasons:
15.123 @@ -843,17 +824,24 @@
15.124 return bs;
15.125 }
15.126
15.127 - // Creates and returns a buffer strategy of the requested type. If
15.128 + // Creates and returns a buffer strategy. If
15.129 // there is a problem creating the buffer strategy this will
15.130 // eat the exception and return null.
15.131 private BufferStrategy createBufferStrategy(Container root,
15.132 - BufferCapabilities.FlipContents type) {
15.133 - BufferCapabilities caps = new BufferCapabilities(
15.134 - new ImageCapabilities(true),
15.135 - new ImageCapabilities(true),
15.136 - type);
15.137 + boolean isVsynced) {
15.138 + BufferCapabilities caps;
15.139 + if (isVsynced) {
15.140 + caps = new ExtendedBufferCapabilities(
15.141 + new ImageCapabilities(true), new ImageCapabilities(true),
15.142 + BufferCapabilities.FlipContents.COPIED,
15.143 + ExtendedBufferCapabilities.VSyncType.VSYNC_ON);
15.144 + } else {
15.145 + caps = new BufferCapabilities(
15.146 + new ImageCapabilities(true), new ImageCapabilities(true),
15.147 + null);
15.148 + }
15.149 BufferStrategy bs = null;
15.150 - if (root instanceof Applet) {
15.151 + if (SunToolkit.isInstanceOf(root, "java.applet.Applet")) {
15.152 try {
15.153 getCreateBufferStrategyMethod().invoke(root, 2, caps);
15.154 bs = (BufferStrategy)getGetBufferStrategyMethod().
16.1 --- a/src/share/classes/javax/swing/JLayeredPane.java Mon Jul 06 14:10:31 2009 -0400
16.2 +++ b/src/share/classes/javax/swing/JLayeredPane.java Thu Jul 09 13:53:05 2009 -0400
16.3 @@ -30,6 +30,7 @@
16.4 import java.awt.Color;
16.5 import java.awt.Graphics;
16.6 import java.awt.Rectangle;
16.7 +import sun.awt.SunToolkit;
16.8
16.9 import javax.accessibility.*;
16.10
16.11 @@ -195,9 +196,12 @@
16.12
16.13 for (Component c : getComponents()) {
16.14 layer = null;
16.15 - if(c instanceof JInternalFrame || (c instanceof JComponent &&
16.16 - (layer = (Integer)((JComponent)c).getClientProperty(
16.17 - LAYER_PROPERTY)) != null)) {
16.18 +
16.19 + if(SunToolkit.isInstanceOf(c, "javax.swing.JInternalFrame") ||
16.20 + (c instanceof JComponent &&
16.21 + (layer = (Integer)((JComponent)c).
16.22 + getClientProperty(LAYER_PROPERTY)) != null))
16.23 + {
16.24 if(layer != null && layer.equals(FRAME_CONTENT_LAYER))
16.25 continue;
16.26 layeredComponentFound = true;
17.1 --- a/src/share/classes/javax/swing/LayoutFocusTraversalPolicy.java Mon Jul 06 14:10:31 2009 -0400
17.2 +++ b/src/share/classes/javax/swing/LayoutFocusTraversalPolicy.java Thu Jul 09 13:53:05 2009 -0400
17.3 @@ -29,6 +29,7 @@
17.4 import java.awt.ComponentOrientation;
17.5 import java.util.Comparator;
17.6 import java.io.*;
17.7 +import sun.awt.SunToolkit;
17.8
17.9
17.10 /**
17.11 @@ -226,11 +227,11 @@
17.12 protected boolean accept(Component aComponent) {
17.13 if (!super.accept(aComponent)) {
17.14 return false;
17.15 - } else if (aComponent instanceof JTable) {
17.16 + } else if (SunToolkit.isInstanceOf(aComponent, "javax.swing.JTable")) {
17.17 // JTable only has ancestor focus bindings, we thus force it
17.18 // to be focusable by returning true here.
17.19 return true;
17.20 - } else if (aComponent instanceof JComboBox) {
17.21 + } else if (SunToolkit.isInstanceOf(aComponent, "javax.swing.JComboBox")) {
17.22 JComboBox box = (JComboBox)aComponent;
17.23 return box.getUI().isFocusTraversable(box);
17.24 } else if (aComponent instanceof JComponent) {
18.1 --- a/src/share/classes/javax/swing/LookAndFeel.java Mon Jul 06 14:10:31 2009 -0400
18.2 +++ b/src/share/classes/javax/swing/LookAndFeel.java Thu Jul 09 13:53:05 2009 -0400
18.3 @@ -32,6 +32,7 @@
18.4 import java.awt.Component;
18.5 import java.awt.SystemColor;
18.6 import java.awt.Toolkit;
18.7 +import sun.awt.SunToolkit;
18.8
18.9 import javax.swing.text.*;
18.10 import javax.swing.border.*;
18.11 @@ -271,7 +272,7 @@
18.12 // this is a special case because the JPasswordField's ancestor heirarchy
18.13 // includes a class outside of javax.swing, thus we cannot call setUIProperty
18.14 // directly.
18.15 - if (c instanceof JPasswordField) {
18.16 + if (SunToolkit.isInstanceOf(c, "javax.swing.JPasswordField")) {
18.17 if (!((JPasswordField)c).customSetUIProperty(propertyName, propertyValue)) {
18.18 c.setUIProperty(propertyName, propertyValue);
18.19 }
19.1 --- a/src/share/classes/javax/swing/SortingFocusTraversalPolicy.java Mon Jul 06 14:10:31 2009 -0400
19.2 +++ b/src/share/classes/javax/swing/SortingFocusTraversalPolicy.java Thu Jul 09 13:53:05 2009 -0400
19.3 @@ -444,11 +444,10 @@
19.4 for (Component comp : cycle) {
19.5 if (accept(comp)) {
19.6 return comp;
19.7 - } else if (comp instanceof Container && comp != aContainer) {
19.8 - Container cont = (Container)comp;
19.9 - if (cont.isFocusTraversalPolicyProvider()) {
19.10 - return cont.getFocusTraversalPolicy().getDefaultComponent(cont);
19.11 - }
19.12 + } else if (comp != aContainer &&
19.13 + (comp = getComponentDownCycle(comp, FORWARD_TRAVERSAL)) != null)
19.14 + {
19.15 + return comp;
19.16 }
19.17 }
19.18 return null;
20.1 --- a/src/share/classes/javax/swing/TransferHandler.java Mon Jul 06 14:10:31 2009 -0400
20.2 +++ b/src/share/classes/javax/swing/TransferHandler.java Thu Jul 09 13:53:05 2009 -0400
20.3 @@ -40,6 +40,7 @@
20.4 import sun.swing.SwingUtilities2;
20.5 import sun.awt.AppContext;
20.6 import sun.swing.*;
20.7 +import sun.awt.SunToolkit;
20.8
20.9 /**
20.10 * This class is used to handle the transfer of a <code>Transferable</code>
20.11 @@ -283,19 +284,9 @@
20.12 ? ((DropTargetDragEvent)source).getLocation()
20.13 : ((DropTargetDropEvent)source).getLocation();
20.14
20.15 - if (component instanceof JTextComponent) {
20.16 - try {
20.17 - AccessibleMethod method
20.18 - = new AccessibleMethod(JTextComponent.class,
20.19 - "dropLocationForPoint",
20.20 - Point.class);
20.21 -
20.22 - dropLocation =
20.23 - (DropLocation)method.invokeNoChecked(component, p);
20.24 - } catch (NoSuchMethodException e) {
20.25 - throw new AssertionError(
20.26 - "Couldn't locate method JTextComponent.dropLocationForPoint");
20.27 - }
20.28 + if (SunToolkit.isInstanceOf(component, "javax.swing.text.JTextComponent")) {
20.29 + dropLocation = SwingAccessor.getJTextComponentAccessor().
20.30 + dropLocationForPoint((JTextComponent)component, p);
20.31 } else if (component instanceof JComponent) {
20.32 dropLocation = ((JComponent)component).dropLocationForPoint(p);
20.33 }
20.34 @@ -1373,22 +1364,9 @@
20.35 ? null
20.36 : support.getDropLocation();
20.37
20.38 - if (component instanceof JTextComponent) {
20.39 - try {
20.40 - AccessibleMethod method =
20.41 - new AccessibleMethod(JTextComponent.class,
20.42 - "setDropLocation",
20.43 - DropLocation.class,
20.44 - Object.class,
20.45 - Boolean.TYPE);
20.46 -
20.47 - state =
20.48 - method.invokeNoChecked(component, dropLocation,
20.49 - state, forDrop);
20.50 - } catch (NoSuchMethodException e) {
20.51 - throw new AssertionError(
20.52 - "Couldn't locate method JTextComponet.setDropLocation");
20.53 - }
20.54 + if (SunToolkit.isInstanceOf(component, "javax.swing.text.JTextComponent")) {
20.55 + state = SwingAccessor.getJTextComponentAccessor().
20.56 + setDropLocation((JTextComponent)component, dropLocation, state, forDrop);
20.57 } else if (component instanceof JComponent) {
20.58 state = ((JComponent)component).setDropLocation(dropLocation, state, forDrop);
20.59 }
21.1 --- a/src/share/classes/javax/swing/UIManager.java Mon Jul 06 14:10:31 2009 -0400
21.2 +++ b/src/share/classes/javax/swing/UIManager.java Thu Jul 09 13:53:05 2009 -0400
21.3 @@ -60,6 +60,7 @@
21.4 import java.lang.reflect.Method;
21.5 import java.util.HashMap;
21.6 import sun.awt.AppContext;
21.7 +import sun.awt.AWTAccessor;
21.8
21.9
21.10 /**
21.11 @@ -1472,21 +1473,7 @@
21.12 return false;
21.13 }
21.14 });
21.15 - try {
21.16 - Method setRequestFocusControllerM = java.security.AccessController.doPrivileged(
21.17 - new java.security.PrivilegedExceptionAction<Method>() {
21.18 - public Method run() throws Exception {
21.19 - Method method =
21.20 - Component.class.getDeclaredMethod("setRequestFocusController",
21.21 - sun.awt.RequestFocusController.class);
21.22 - method.setAccessible(true);
21.23 - return method;
21.24 - }
21.25 - });
21.26 - setRequestFocusControllerM.invoke(null, JComponent.focusController);
21.27 - } catch (Exception e) {
21.28 - // perhaps we should log this
21.29 - assert false;
21.30 - }
21.31 + AWTAccessor.getComponentAccessor().
21.32 + setRequestFocusController(JComponent.focusController);
21.33 }
21.34 }
22.1 --- a/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameUI.java Mon Jul 06 14:10:31 2009 -0400
22.2 +++ b/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameUI.java Thu Jul 09 13:53:05 2009 -0400
22.3 @@ -1,5 +1,5 @@
22.4 /*
22.5 - * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
22.6 + * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
22.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
22.8 *
22.9 * This code is free software; you can redistribute it and/or modify it
22.10 @@ -683,6 +683,7 @@
22.11 }
22.12 getDesktopManager().endResizingFrame(frame);
22.13 resizing = false;
22.14 + updateFrameCursor();
22.15 }
22.16 _x = 0;
22.17 _y = 0;
23.1 --- a/src/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java Mon Jul 06 14:10:31 2009 -0400
23.2 +++ b/src/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java Thu Jul 09 13:53:05 2009 -0400
23.3 @@ -31,7 +31,6 @@
23.4 import javax.swing.plaf.UIResource;
23.5 import javax.swing.Painter;
23.6 import java.awt.print.PrinterGraphics;
23.7 -import static javax.swing.plaf.nimbus.NimbusLookAndFeel.deriveARGB;
23.8
23.9 /**
23.10 * Convenient base class for defining Painter instances for rendering a
23.11 @@ -347,7 +346,7 @@
23.12 */
23.13 protected final Color decodeColor(Color color1, Color color2,
23.14 float midPoint) {
23.15 - return new Color(deriveARGB(color1, color2, midPoint));
23.16 + return new Color(NimbusLookAndFeel.deriveARGB(color1, color2, midPoint));
23.17 }
23.18
23.19 /**
24.1 --- a/src/share/classes/javax/swing/plaf/nimbus/Defaults.template Mon Jul 06 14:10:31 2009 -0400
24.2 +++ b/src/share/classes/javax/swing/plaf/nimbus/Defaults.template Thu Jul 09 13:53:05 2009 -0400
24.3 @@ -278,7 +278,7 @@
24.4 * offset (if any), and whether it is to be bold, italic, or left in its
24.5 * default form.</p>
24.6 */
24.7 - public static final class DerivedFont implements UIDefaults.ActiveValue {
24.8 + static final class DerivedFont implements UIDefaults.ActiveValue {
24.9 private float sizeOffset;
24.10 private Boolean bold;
24.11 private Boolean italic;
25.1 --- a/src/share/classes/javax/swing/plaf/nimbus/NimbusLookAndFeel.java Mon Jul 06 14:10:31 2009 -0400
25.2 +++ b/src/share/classes/javax/swing/plaf/nimbus/NimbusLookAndFeel.java Thu Jul 09 13:53:05 2009 -0400
25.3 @@ -436,15 +436,13 @@
25.4 */
25.5 static int deriveARGB(Color color1, Color color2, float midPoint) {
25.6 int r = color1.getRed() +
25.7 - (int) ((color2.getRed() - color1.getRed()) * midPoint + 0.5f);
25.8 + Math.round((color2.getRed() - color1.getRed()) * midPoint);
25.9 int g = color1.getGreen() +
25.10 - (int) ((color2.getGreen() - color1.getGreen()) * midPoint +
25.11 - 0.5f);
25.12 + Math.round((color2.getGreen() - color1.getGreen()) * midPoint);
25.13 int b = color1.getBlue() +
25.14 - (int) ((color2.getBlue() - color1.getBlue()) * midPoint + 0.5f);
25.15 + Math.round((color2.getBlue() - color1.getBlue()) * midPoint);
25.16 int a = color1.getAlpha() +
25.17 - (int) ((color2.getAlpha() - color1.getAlpha()) * midPoint +
25.18 - 0.5f);
25.19 + Math.round((color2.getAlpha() - color1.getAlpha()) * midPoint);
25.20 return ((a & 0xFF) << 24) |
25.21 ((r & 0xFF) << 16) |
25.22 ((g & 0xFF) << 8) |
26.1 --- a/src/share/classes/javax/swing/plaf/nimbus/PainterImpl.template Mon Jul 06 14:10:31 2009 -0400
26.2 +++ b/src/share/classes/javax/swing/plaf/nimbus/PainterImpl.template Thu Jul 09 13:53:05 2009 -0400
26.3 @@ -31,7 +31,7 @@
26.4 import javax.swing.Painter;
26.5
26.6
26.7 -public final class ${PAINTER_NAME} extends AbstractRegionPainter {
26.8 +final class ${PAINTER_NAME} extends AbstractRegionPainter {
26.9 //package private integers representing the available states that
26.10 //this painter will paint. These are used when creating a new instance
26.11 //of ${PAINTER_NAME} to determine which region/state is being painted
27.1 --- a/src/share/classes/javax/swing/plaf/nimbus/package.html Mon Jul 06 14:10:31 2009 -0400
27.2 +++ b/src/share/classes/javax/swing/plaf/nimbus/package.html Thu Jul 09 13:53:05 2009 -0400
27.3 @@ -38,7 +38,7 @@
27.4 component states.
27.5
27.6 <p>Nimbus allows customizing many of its properties, including painters, by
27.7 -altering the {@link UIDefaults} table. Here's an example:
27.8 +altering the {@link javax.swing.UIDefaults} table. Here's an example:
27.9 <code><pre>
27.10 UIManager.put("ProgressBar.tileWidth", myTileWidth);
27.11 UIManager.put("ProgressBar[Enabled].backgroundPainter", myBgPainter);
28.1 --- a/src/share/classes/javax/swing/plaf/synth/SynthColorChooserUI.java Mon Jul 06 14:10:31 2009 -0400
28.2 +++ b/src/share/classes/javax/swing/plaf/synth/SynthColorChooserUI.java Thu Jul 09 13:53:05 2009 -0400
28.3 @@ -69,6 +69,7 @@
28.4 }
28.5
28.6 protected void installDefaults() {
28.7 + super.installDefaults();
28.8 updateStyle(chooser);
28.9 }
28.10
29.1 --- a/src/share/classes/javax/swing/table/DefaultTableCellRenderer.java Mon Jul 06 14:10:31 2009 -0400
29.2 +++ b/src/share/classes/javax/swing/table/DefaultTableCellRenderer.java Thu Jul 09 13:53:05 2009 -0400
29.3 @@ -1,5 +1,5 @@
29.4 /*
29.5 - * Copyright 1998-2005 Sun Microsystems, Inc. All Rights Reserved.
29.6 + * Copyright 1998-2009 Sun Microsystems, Inc. All Rights Reserved.
29.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
29.8 *
29.9 * This code is free software; you can redistribute it and/or modify it
29.10 @@ -118,12 +118,12 @@
29.11 if (System.getSecurityManager() != null) {
29.12 if (border != null) return border;
29.13 return SAFE_NO_FOCUS_BORDER;
29.14 - } else {
29.15 + } else if (border != null) {
29.16 if (noFocusBorder == null || noFocusBorder == DEFAULT_NO_FOCUS_BORDER) {
29.17 return border;
29.18 }
29.19 - return noFocusBorder;
29.20 }
29.21 + return noFocusBorder;
29.22 }
29.23
29.24 /**
30.1 --- a/src/share/classes/javax/swing/text/JTextComponent.java Mon Jul 06 14:10:31 2009 -0400
30.2 +++ b/src/share/classes/javax/swing/text/JTextComponent.java Thu Jul 09 13:53:05 2009 -0400
30.3 @@ -76,6 +76,7 @@
30.4 import sun.swing.PrintingStatus;
30.5 import sun.swing.SwingUtilities2;
30.6 import sun.swing.text.TextComponentPrintable;
30.7 +import sun.swing.SwingAccessor;
30.8
30.9 /**
30.10 * <code>JTextComponent</code> is the base class for swing text
30.11 @@ -761,6 +762,23 @@
30.12 return dropMode;
30.13 }
30.14
30.15 + static {
30.16 + SwingAccessor.setJTextComponentAccessor(
30.17 + new SwingAccessor.JTextComponentAccessor() {
30.18 + public TransferHandler.DropLocation dropLocationForPoint(JTextComponent textComp,
30.19 + Point p)
30.20 + {
30.21 + return textComp.dropLocationForPoint(p);
30.22 + }
30.23 + public Object setDropLocation(JTextComponent textComp,
30.24 + TransferHandler.DropLocation location,
30.25 + Object state, boolean forDrop)
30.26 + {
30.27 + return textComp.setDropLocation(location, state, forDrop);
30.28 + }
30.29 + });
30.30 + }
30.31 +
30.32
30.33 /**
30.34 * Calculates a drop location in this component, representing where a
31.1 --- a/src/share/classes/sun/awt/AWTAccessor.java Mon Jul 06 14:10:31 2009 -0400
31.2 +++ b/src/share/classes/sun/awt/AWTAccessor.java Thu Jul 09 13:53:05 2009 -0400
31.3 @@ -30,6 +30,7 @@
31.4 import java.awt.image.BufferedImage;
31.5
31.6 import sun.misc.Unsafe;
31.7 +import java.awt.peer.ComponentPeer;
31.8
31.9 /**
31.10 * The AWTAccessor utility class.
31.11 @@ -98,6 +99,21 @@
31.12 * any client code.
31.13 */
31.14 boolean isVisible_NoClientCode(Component comp);
31.15 +
31.16 + /**
31.17 + * Sets the RequestFocusController.
31.18 + */
31.19 + void setRequestFocusController(RequestFocusController requestController);
31.20 +
31.21 + /**
31.22 + * Returns the appContext of the component.
31.23 + */
31.24 + AppContext getAppContext(Component comp);
31.25 +
31.26 + /**
31.27 + * Sets the appContext of the component.
31.28 + */
31.29 + void setAppContext(Component comp, AppContext appContext);
31.30 }
31.31
31.32 /*
31.33 @@ -153,23 +169,21 @@
31.34 */
31.35 Point2D calculateSecurityWarningPosition(Window window,
31.36 double x, double y, double w, double h);
31.37 +
31.38 + /** Sets the synchronous status of focus requests on lightweight
31.39 + * components in the specified window to the specified value.
31.40 + */
31.41 + void setLWRequestStatus(Window changed, boolean status);
31.42 }
31.43
31.44 /*
31.45 * An accessor for the AWTEvent class.
31.46 */
31.47 public interface AWTEventAccessor {
31.48 - /*
31.49 - *
31.50 - * Sets the flag on this AWTEvent indicating that it was
31.51 - * generated by the system.
31.52 + /**
31.53 + * Marks the event as posted.
31.54 */
31.55 - void setSystemGenerated(AWTEvent ev);
31.56 - /*
31.57 - *
31.58 - * Indicates whether this AWTEvent was generated by the system.
31.59 - */
31.60 - boolean isSystemGenerated(AWTEvent ev);
31.61 + void setPosted(AWTEvent ev);
31.62 }
31.63
31.64 /*
31.65 @@ -216,6 +230,51 @@
31.66 }
31.67
31.68 /*
31.69 + * An accessor for the MenuComponent class.
31.70 + */
31.71 + public interface MenuComponentAccessor {
31.72 + /**
31.73 + * Returns the appContext of the menu component.
31.74 + */
31.75 + AppContext getAppContext(MenuComponent menuComp);
31.76 +
31.77 + /**
31.78 + * Sets the appContext of the menu component.
31.79 + */
31.80 + void setAppContext(MenuComponent menuComp, AppContext appContext);
31.81 +
31.82 + /**
31.83 + * Returns the menu container of the menu component
31.84 + */
31.85 + MenuContainer getParent(MenuComponent menuComp);
31.86 + }
31.87 +
31.88 + /*
31.89 + * An accessor for the EventQueue class
31.90 + */
31.91 + public interface EventQueueAccessor {
31.92 + /*
31.93 + * Gets the next event queue.
31.94 + */
31.95 + EventQueue getNextQueue(EventQueue eventQueue);
31.96 + /*
31.97 + * Gets the event dispatch thread.
31.98 + */
31.99 + Thread getDispatchThread(EventQueue eventQueue);
31.100 + }
31.101 +
31.102 + /*
31.103 + * An accessor for the PopupMenu class
31.104 + */
31.105 + public interface PopupMenuAccessor {
31.106 + /*
31.107 + * Returns whether the popup menu is attached to a tray
31.108 + */
31.109 + boolean isTrayIconPopup(PopupMenu popupMenu);
31.110 + }
31.111 +
31.112 +
31.113 + /*
31.114 * The java.awt.Component class accessor object.
31.115 */
31.116 private static ComponentAccessor componentAccessor;
31.117 @@ -241,6 +300,21 @@
31.118 private static KeyboardFocusManagerAccessor kfmAccessor;
31.119
31.120 /*
31.121 + * The java.awt.MenuComponent class accessor object.
31.122 + */
31.123 + private static MenuComponentAccessor menuComponentAccessor;
31.124 +
31.125 + /*
31.126 + * The java.awt.EventQueue class accessor object.
31.127 + */
31.128 + private static EventQueueAccessor eventQueueAccessor;
31.129 +
31.130 + /*
31.131 + * The java.awt.PopupMenu class accessor object.
31.132 + */
31.133 + private static PopupMenuAccessor popupMenuAccessor;
31.134 +
31.135 + /*
31.136 * Set an accessor object for the java.awt.Component class.
31.137 */
31.138 public static void setComponentAccessor(ComponentAccessor ca) {
31.139 @@ -286,6 +360,9 @@
31.140 * Retrieve the accessor object for the java.awt.AWTEvent class.
31.141 */
31.142 public static AWTEventAccessor getAWTEventAccessor() {
31.143 + if (awtEventAccessor == null) {
31.144 + unsafe.ensureClassInitialized(AWTEvent.class);
31.145 + }
31.146 return awtEventAccessor;
31.147 }
31.148
31.149 @@ -322,4 +399,55 @@
31.150 }
31.151 return kfmAccessor;
31.152 }
31.153 +
31.154 + /*
31.155 + * Set an accessor object for the java.awt.MenuComponent class.
31.156 + */
31.157 + public static void setMenuComponentAccessor(MenuComponentAccessor mca) {
31.158 + menuComponentAccessor = mca;
31.159 + }
31.160 +
31.161 + /*
31.162 + * Retrieve the accessor object for the java.awt.MenuComponent class.
31.163 + */
31.164 + public static MenuComponentAccessor getMenuComponentAccessor() {
31.165 + if (menuComponentAccessor == null) {
31.166 + unsafe.ensureClassInitialized(MenuComponent.class);
31.167 + }
31.168 + return menuComponentAccessor;
31.169 + }
31.170 +
31.171 + /*
31.172 + * Set an accessor object for the java.awt.EventQueue class.
31.173 + */
31.174 + public static void setEventQueueAccessor(EventQueueAccessor eqa) {
31.175 + eventQueueAccessor = eqa;
31.176 + }
31.177 +
31.178 + /*
31.179 + * Retrieve the accessor object for the java.awt.EventQueue class.
31.180 + */
31.181 + public static EventQueueAccessor getEventQueueAccessor() {
31.182 + if (eventQueueAccessor == null) {
31.183 + unsafe.ensureClassInitialized(EventQueue.class);
31.184 + }
31.185 + return eventQueueAccessor;
31.186 + }
31.187 +
31.188 + /*
31.189 + * Set an accessor object for the java.awt.PopupMenu class.
31.190 + */
31.191 + public static void setPopupMenuAccessor(PopupMenuAccessor pma) {
31.192 + popupMenuAccessor = pma;
31.193 + }
31.194 +
31.195 + /*
31.196 + * Retrieve the accessor object for the java.awt.PopupMenu class.
31.197 + */
31.198 + public static PopupMenuAccessor getPopupMenuAccessor() {
31.199 + if (popupMenuAccessor == null) {
31.200 + unsafe.ensureClassInitialized(PopupMenu.class);
31.201 + }
31.202 + return popupMenuAccessor;
31.203 + }
31.204 }
32.1 --- a/src/share/classes/sun/awt/SunToolkit.java Mon Jul 06 14:10:31 2009 -0400
32.2 +++ b/src/share/classes/sun/awt/SunToolkit.java Thu Jul 09 13:53:05 2009 -0400
32.3 @@ -77,14 +77,7 @@
32.4 */
32.5 public static final int GRAB_EVENT_MASK = 0x80000000;
32.6
32.7 - private static Field syncLWRequestsField;
32.8 private static Method wakeupMethod;
32.9 - private static Field componentKeyField;
32.10 - private static Field menuComponentKeyField;
32.11 - private static Field trayIconKeyField;
32.12 - private static Field componentAppContextField;
32.13 - private static Field menuComponentAppContextField;
32.14 - private static Field isPostedField;
32.15 /* The key to put()/get() the PostEventQueue into/from the AppContext.
32.16 */
32.17 private static final String POST_EVENT_QUEUE_KEY = "PostEventQueue";
32.18 @@ -422,32 +415,21 @@
32.19 private static final Map appContextMap =
32.20 Collections.synchronizedMap(new WeakHashMap());
32.21
32.22 -
32.23 /**
32.24 * Sets the appContext field of target. If target is not a Component or
32.25 * MenuComponent, this returns false.
32.26 */
32.27 - private static boolean setAppContext(Object target, AppContext context)
32.28 - {
32.29 - if (!(target instanceof Component) && !(target instanceof MenuComponent)) {
32.30 + private static boolean setAppContext(Object target,
32.31 + AppContext context) {
32.32 + if (target instanceof Component) {
32.33 + AWTAccessor.getComponentAccessor().
32.34 + setAppContext((Component)target, context);
32.35 + } else if (target instanceof MenuComponent) {
32.36 + AWTAccessor.getMenuComponentAccessor().
32.37 + setAppContext((MenuComponent)target, context);
32.38 + } else {
32.39 return false;
32.40 }
32.41 - try{
32.42 - if (target instanceof Component){
32.43 - if (componentAppContextField == null) {
32.44 - componentAppContextField = getField(Component.class, "appContext");
32.45 - }
32.46 - componentAppContextField.set(target, context);
32.47 - } else if (target instanceof MenuComponent) {
32.48 - if (menuComponentAppContextField == null) {
32.49 - menuComponentAppContextField = getField(MenuComponent.class, "appContext");
32.50 - }
32.51 - menuComponentAppContextField.set(target, context);
32.52 - }
32.53 - } catch( IllegalAccessException e){
32.54 - assert false;
32.55 - }
32.56 -
32.57 return true;
32.58 }
32.59
32.60 @@ -456,23 +438,15 @@
32.61 * Component or MenuComponent this returns null.
32.62 */
32.63 private static AppContext getAppContext(Object target) {
32.64 - AppContext retObj = null;
32.65 - try{
32.66 - if (target instanceof Component){
32.67 - if (componentAppContextField == null) {
32.68 - componentAppContextField = getField(Component.class, "appContext");
32.69 - }
32.70 - retObj = (AppContext) componentAppContextField.get(target);
32.71 - } else if (target instanceof MenuComponent) {
32.72 - if (menuComponentAppContextField == null) {
32.73 - menuComponentAppContextField = getField(MenuComponent.class, "appContext");
32.74 - }
32.75 - retObj = (AppContext) menuComponentAppContextField.get(target);
32.76 - }
32.77 - } catch( IllegalAccessException e){
32.78 - assert false;
32.79 + if (target instanceof Component) {
32.80 + return AWTAccessor.getComponentAccessor().
32.81 + getAppContext((Component)target);
32.82 + } else if (target instanceof MenuComponent) {
32.83 + return AWTAccessor.getMenuComponentAccessor().
32.84 + getAppContext((MenuComponent)target);
32.85 + } else {
32.86 + return null;
32.87 }
32.88 - return retObj;
32.89 }
32.90
32.91 /*
32.92 @@ -520,16 +494,7 @@
32.93 */
32.94
32.95 public static void setLWRequestStatus(Window changed,boolean status){
32.96 - if (syncLWRequestsField == null){
32.97 - syncLWRequestsField = getField(Window.class, "syncLWRequests");
32.98 - }
32.99 - try{
32.100 - if (syncLWRequestsField != null){
32.101 - syncLWRequestsField.setBoolean(changed, status);
32.102 - }
32.103 - } catch( IllegalAccessException e){
32.104 - assert false;
32.105 - }
32.106 + AWTAccessor.getWindowAccessor().setLWRequestStatus(changed, status);
32.107 };
32.108
32.109 public static void checkAndSetPolicy(Container cont, boolean isSwingCont)
32.110 @@ -637,18 +602,9 @@
32.111 * Post AWTEvent of high priority.
32.112 */
32.113 public static void postPriorityEvent(final AWTEvent e) {
32.114 - if (isPostedField == null) {
32.115 - isPostedField = getField(AWTEvent.class, "isPosted");
32.116 - }
32.117 PeerEvent pe = new PeerEvent(Toolkit.getDefaultToolkit(), new Runnable() {
32.118 public void run() {
32.119 - try {
32.120 - isPostedField.setBoolean(e, true);
32.121 - } catch (IllegalArgumentException e) {
32.122 - assert(false);
32.123 - } catch (IllegalAccessException e) {
32.124 - assert(false);
32.125 - }
32.126 + AWTAccessor.getAWTEventAccessor().setPosted(e);
32.127 ((Component)e.getSource()).dispatchEvent(e);
32.128 }
32.129 }, PeerEvent.ULTIMATE_PRIORITY_EVENT);
32.130 @@ -757,36 +713,6 @@
32.131 }
32.132
32.133 /*
32.134 - * Returns next queue for the given EventQueue which has private access
32.135 - */
32.136 - private static EventQueue getNextQueue(final Object o) {
32.137 - EventQueue result = null;
32.138 - try{
32.139 - Field nextQueueField = getField(EventQueue.class,
32.140 - "nextQueue");
32.141 - result = (EventQueue)nextQueueField.get(o);
32.142 - } catch( IllegalAccessException e){
32.143 - assert false;
32.144 - }
32.145 - return result;
32.146 - }
32.147 -
32.148 - /*
32.149 - * Returns dispatch thread for the given EventQueue which has private access
32.150 - */
32.151 - private static Thread getDispatchThread(final Object o) {
32.152 - Thread result = null;
32.153 - try{
32.154 - Field dispatchThreadField = getField(EventQueue.class,
32.155 - "dispatchThread");
32.156 - result = (Thread)dispatchThreadField.get(o);
32.157 - } catch( IllegalAccessException e){
32.158 - assert false;
32.159 - }
32.160 - return result;
32.161 - }
32.162 -
32.163 - /*
32.164 * Returns true if the calling thread is the event dispatch thread
32.165 * contained within AppContext which associated with the given target.
32.166 * Use this call to ensure that a given task is being executed
32.167 @@ -796,13 +722,14 @@
32.168 AppContext appContext = targetToAppContext(target);
32.169 EventQueue eq = (EventQueue)appContext.get(AppContext.EVENT_QUEUE_KEY);
32.170
32.171 - EventQueue next = getNextQueue(eq);
32.172 + AWTAccessor.EventQueueAccessor accessor = AWTAccessor.getEventQueueAccessor();
32.173 + EventQueue next = accessor.getNextQueue(eq);
32.174 while (next != null) {
32.175 eq = next;
32.176 - next = getNextQueue(eq);
32.177 + next = accessor.getNextQueue(eq);
32.178 }
32.179
32.180 - return (Thread.currentThread() == getDispatchThread(eq));
32.181 + return (Thread.currentThread() == accessor.getDispatchThread(eq));
32.182 }
32.183
32.184 public Dimension getScreenSize() {
32.185 @@ -1356,22 +1283,7 @@
32.186 return false;
32.187 }
32.188
32.189 - private static Dialog.ModalExclusionType DEFAULT_MODAL_EXCLUSION_TYPE;
32.190 -
32.191 - static {
32.192 - DEFAULT_MODAL_EXCLUSION_TYPE = (Dialog.ModalExclusionType)AccessController.doPrivileged(new PrivilegedAction() {
32.193 - public Object run() {
32.194 - Dialog.ModalExclusionType defaultType = Dialog.ModalExclusionType.NO_EXCLUDE;
32.195 - try {
32.196 - java.lang.reflect.Field f = Dialog.class.getDeclaredField("DEFAULT_MODAL_EXCLUSION_TYPE");
32.197 - f.setAccessible(true);
32.198 - defaultType = (Dialog.ModalExclusionType)f.get(null);
32.199 - } catch (Exception e) {
32.200 - }
32.201 - return defaultType;
32.202 - }
32.203 - });
32.204 - }
32.205 + private static Dialog.ModalExclusionType DEFAULT_MODAL_EXCLUSION_TYPE = null;
32.206
32.207 /**
32.208 * Returns whether the XEmbed server feature is requested by
32.209 @@ -1430,6 +1342,9 @@
32.210 */
32.211 public static void setModalExcluded(Window window)
32.212 {
32.213 + if (DEFAULT_MODAL_EXCLUSION_TYPE == null) {
32.214 + DEFAULT_MODAL_EXCLUSION_TYPE = Dialog.ModalExclusionType.APPLICATION_EXCLUDE;
32.215 + }
32.216 window.setModalExclusionType(DEFAULT_MODAL_EXCLUSION_TYPE);
32.217 }
32.218
32.219 @@ -1451,6 +1366,9 @@
32.220 */
32.221 public static boolean isModalExcluded(Window window)
32.222 {
32.223 + if (DEFAULT_MODAL_EXCLUSION_TYPE == null) {
32.224 + DEFAULT_MODAL_EXCLUSION_TYPE = Dialog.ModalExclusionType.APPLICATION_EXCLUDE;
32.225 + }
32.226 return window.getModalExclusionType().compareTo(DEFAULT_MODAL_EXCLUSION_TYPE) >= 0;
32.227 }
32.228
32.229 @@ -2104,6 +2022,42 @@
32.230 public int getNumberOfButtons(){
32.231 return 3;
32.232 }
32.233 +
32.234 + /**
32.235 + * Checks that the given object implements/extends the given
32.236 + * interface/class.
32.237 + *
32.238 + * Note that using the instanceof operator causes a class to be loaded.
32.239 + * Using this method doesn't load a class and it can be used instead of
32.240 + * the instanceof operator for performance reasons.
32.241 + *
32.242 + * @param obj Object to be checked
32.243 + * @param type The name of the interface/class. Must be
32.244 + * fully-qualified interface/class name.
32.245 + * @return true, if this object implements/extends the given
32.246 + * interface/class, false, otherwise, or if obj or type is null
32.247 + */
32.248 + public static boolean isInstanceOf(Object obj, String type) {
32.249 + if (obj == null) return false;
32.250 + if (type == null) return false;
32.251 +
32.252 + return isInstanceOf(obj.getClass(), type);
32.253 + }
32.254 +
32.255 + private static boolean isInstanceOf(Class cls, String type) {
32.256 + if (cls == null) return false;
32.257 +
32.258 + if (cls.getName().equals(type)) {
32.259 + return true;
32.260 + }
32.261 +
32.262 + for (Class c : cls.getInterfaces()) {
32.263 + if (c.getName().equals(type)) {
32.264 + return true;
32.265 + }
32.266 + }
32.267 + return isInstanceOf(cls.getSuperclass(), type);
32.268 + }
32.269 } // class SunToolkit
32.270
32.271
33.1 --- a/src/share/classes/sun/awt/shell/ShellFolder.java Mon Jul 06 14:10:31 2009 -0400
33.2 +++ b/src/share/classes/sun/awt/shell/ShellFolder.java Thu Jul 09 13:53:05 2009 -0400
33.3 @@ -202,8 +202,16 @@
33.4 private static ShellFolderManager shellFolderManager;
33.5
33.6 static {
33.7 - Class managerClass = (Class)Toolkit.getDefaultToolkit().
33.8 - getDesktopProperty("Shell.shellFolderManager");
33.9 + String managerClassName = (String)Toolkit.getDefaultToolkit().
33.10 + getDesktopProperty("Shell.shellFolderManager");
33.11 + Class managerClass = null;
33.12 + try {
33.13 + managerClass = Class.forName(managerClassName);
33.14 + // swallow the exceptions below and use default shell folder
33.15 + } catch(ClassNotFoundException e) {
33.16 + } catch(NullPointerException e) {
33.17 + }
33.18 +
33.19 if (managerClass == null) {
33.20 managerClass = ShellFolderManager.class;
33.21 }
34.1 --- a/src/share/classes/sun/swing/AccessibleMethod.java Mon Jul 06 14:10:31 2009 -0400
34.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
34.3 @@ -1,136 +0,0 @@
34.4 -/*
34.5 - * Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved.
34.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
34.7 - *
34.8 - * This code is free software; you can redistribute it and/or modify it
34.9 - * under the terms of the GNU General Public License version 2 only, as
34.10 - * published by the Free Software Foundation. Sun designates this
34.11 - * particular file as subject to the "Classpath" exception as provided
34.12 - * by Sun in the LICENSE file that accompanied this code.
34.13 - *
34.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
34.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
34.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
34.17 - * version 2 for more details (a copy is included in the LICENSE file that
34.18 - * accompanied this code).
34.19 - *
34.20 - * You should have received a copy of the GNU General Public License version
34.21 - * 2 along with this work; if not, write to the Free Software Foundation,
34.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
34.23 - *
34.24 - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
34.25 - * CA 95054 USA or visit www.sun.com if you need additional information or
34.26 - * have any questions.
34.27 - */
34.28 -package sun.swing;
34.29 -
34.30 -import java.security.*;
34.31 -import java.lang.reflect.*;
34.32 -
34.33 -/**
34.34 - * A utility for accessing and invoking methods, via reflection,
34.35 - * that would otherwise be unaccessible.
34.36 - *
34.37 - * @author Shannon Hickey
34.38 - */
34.39 -public class AccessibleMethod {
34.40 -
34.41 - private final Method method;
34.42 -
34.43 - /**
34.44 - * Construct an instance for the given params.
34.45 - *
34.46 - * @param klass the class to which the method belongs
34.47 - * @param methodName the name of the method
34.48 - * @param paramTypes the paramater type array
34.49 - * @throws NullPointerException if <code>klass</code>
34.50 - * or <code>name</code> is <code>null</code>
34.51 - * @throws NoSuchMethodException if the method can't be found
34.52 - */
34.53 - public AccessibleMethod(Class klass,
34.54 - String methodName,
34.55 - Class ... paramTypes) throws NoSuchMethodException {
34.56 - try {
34.57 - method = AccessController.doPrivileged(
34.58 - new AccessMethodAction(klass, methodName, paramTypes));
34.59 - } catch (PrivilegedActionException e) {
34.60 - throw (NoSuchMethodException)e.getCause();
34.61 - }
34.62 - }
34.63 -
34.64 - /**
34.65 - * Invoke the method that this object represents.
34.66 - * Has the same behavior and throws the same exceptions as
34.67 - * <code>java.lang.reflect.Method.invoke</code> with one
34.68 - * exception: This method does not throw
34.69 - * <code>IllegalAccessException</code> since the target
34.70 - * method has already been made accessible.
34.71 - *
34.72 - * @param obj the object the underlying method is invoked from
34.73 - * @param args the arguments used for the method call
34.74 - * @return the result of dispatching the method represented by
34.75 - * this object on <code>obj</code> with parameters
34.76 - * <code>args</code>
34.77 - * @see java.lang.reflect.Method#invoke
34.78 - */
34.79 - public Object invoke(Object obj, Object ... args)
34.80 - throws IllegalArgumentException, InvocationTargetException {
34.81 -
34.82 - try {
34.83 - return method.invoke(obj, args);
34.84 - } catch (IllegalAccessException e) {
34.85 - // should never happen since we've made it accessible
34.86 - throw new AssertionError("accessible method inaccessible");
34.87 - }
34.88 - }
34.89 -
34.90 - /**
34.91 - * Invoke the method that this object represents, with the
34.92 - * expectation that the method being called throws no
34.93 - * checked exceptions.
34.94 - * <p>
34.95 - * Simply calls <code>this.invoke(obj, args)</code>
34.96 - * but catches any <code>InvocationTargetException</code>
34.97 - * and returns the cause wrapped in a runtime exception.
34.98 - *
34.99 - * @param obj the object the underlying method is invoked from
34.100 - * @param args the arguments used for the method call
34.101 - * @return the result of dispatching the method represented by
34.102 - * this object on <code>obj</code> with parameters
34.103 - * <code>args</code>
34.104 - * @see #invoke
34.105 - */
34.106 - public Object invokeNoChecked(Object obj, Object ... args) {
34.107 - try {
34.108 - return invoke(obj, args);
34.109 - } catch (InvocationTargetException ex) {
34.110 - if (ex.getCause() instanceof RuntimeException) {
34.111 - throw (RuntimeException)ex.getCause();
34.112 - } else {
34.113 - throw new RuntimeException(ex.getCause());
34.114 - }
34.115 - }
34.116 - }
34.117 -
34.118 - /** The action used to fetch the method and make it accessible */
34.119 - private static class AccessMethodAction implements PrivilegedExceptionAction<Method> {
34.120 - private final Class<?> klass;
34.121 - private final String methodName;
34.122 - private final Class[] paramTypes;
34.123 -
34.124 - public AccessMethodAction(Class klass,
34.125 - String methodName,
34.126 - Class ... paramTypes) {
34.127 -
34.128 - this.klass = klass;
34.129 - this.methodName = methodName;
34.130 - this.paramTypes = paramTypes;
34.131 - }
34.132 -
34.133 - public Method run() throws NoSuchMethodException {
34.134 - Method method = klass.getDeclaredMethod(methodName, paramTypes);
34.135 - method.setAccessible(true);
34.136 - return method;
34.137 - }
34.138 - }
34.139 -}
35.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
35.2 +++ b/src/share/classes/sun/swing/SwingAccessor.java Thu Jul 09 13:53:05 2009 -0400
35.3 @@ -0,0 +1,96 @@
35.4 +/*
35.5 + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
35.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
35.7 + *
35.8 + * This code is free software; you can redistribute it and/or modify it
35.9 + * under the terms of the GNU General Public License version 2 only, as
35.10 + * published by the Free Software Foundation. Sun designates this
35.11 + * particular file as subject to the "Classpath" exception as provided
35.12 + * by Sun in the LICENSE file that accompanied this code.
35.13 + *
35.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
35.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
35.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
35.17 + * version 2 for more details (a copy is included in the LICENSE file that
35.18 + * accompanied this code).
35.19 + *
35.20 + * You should have received a copy of the GNU General Public License version
35.21 + * 2 along with this work; if not, write to the Free Software Foundation,
35.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
35.23 + *
35.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
35.25 + * CA 95054 USA or visit www.sun.com if you need additional information or
35.26 + * have any questions.
35.27 + */
35.28 +
35.29 +package sun.swing;
35.30 +
35.31 +import sun.misc.Unsafe;
35.32 +
35.33 +import java.awt.Point;
35.34 +
35.35 +import javax.swing.text.JTextComponent;
35.36 +import javax.swing.TransferHandler;
35.37 +
35.38 +/**
35.39 + * The SwingAccessor utility class.
35.40 + * The main purpose of this class is to enable accessing
35.41 + * private and package-private fields of classes from
35.42 + * different classes/packages. See sun.misc.SharedSecretes
35.43 + * for another example.
35.44 + */
35.45 +public final class SwingAccessor {
35.46 + private static final Unsafe unsafe = Unsafe.getUnsafe();
35.47 +
35.48 + /**
35.49 + * We don't need any objects of this class.
35.50 + * It's rather a collection of static methods
35.51 + * and interfaces.
35.52 + */
35.53 + private SwingAccessor() {
35.54 + }
35.55 +
35.56 + /**
35.57 + * An accessor for the JTextComponent class.
35.58 + * Note that we intentionally introduce the JTextComponentAccessor,
35.59 + * and not the JComponentAccessor because the needed methods
35.60 + * aren't override methods.
35.61 + */
35.62 + public interface JTextComponentAccessor {
35.63 +
35.64 + /**
35.65 + * Calculates a custom drop location for the text component,
35.66 + * representing where a drop at the given point should insert data.
35.67 + */
35.68 + TransferHandler.DropLocation dropLocationForPoint(JTextComponent textComp, Point p);
35.69 +
35.70 + /**
35.71 + * Called to set or clear the drop location during a DnD operation.
35.72 + */
35.73 + Object setDropLocation(JTextComponent textComp, TransferHandler.DropLocation location,
35.74 + Object state, boolean forDrop);
35.75 + }
35.76 +
35.77 + /**
35.78 + * The javax.swing.text.JTextComponent class accessor object.
35.79 + */
35.80 + private static JTextComponentAccessor jtextComponentAccessor;
35.81 +
35.82 + /**
35.83 + * Set an accessor object for the javax.swing.text.JTextComponent class.
35.84 + */
35.85 + public static void setJTextComponentAccessor(JTextComponentAccessor jtca) {
35.86 + jtextComponentAccessor = jtca;
35.87 + }
35.88 +
35.89 + /**
35.90 + * Retrieve the accessor object for the javax.swing.text.JTextComponent class.
35.91 + */
35.92 + public static JTextComponentAccessor getJTextComponentAccessor() {
35.93 + if (jtextComponentAccessor == null) {
35.94 + unsafe.ensureClassInitialized(JTextComponent.class);
35.95 + }
35.96 +
35.97 + return jtextComponentAccessor;
35.98 + }
35.99 +}
36.1 --- a/src/share/classes/sun/text/normalizer/NormalizerBase.java Mon Jul 06 14:10:31 2009 -0400
36.2 +++ b/src/share/classes/sun/text/normalizer/NormalizerBase.java Thu Jul 09 13:53:05 2009 -0400
36.3 @@ -1598,15 +1598,34 @@
36.4 * @param options the optional features to be enabled.
36.5 */
36.6 public static String normalize(String str, Normalizer.Form form, int options) {
36.7 + int len = str.length();
36.8 + boolean asciiOnly = true;
36.9 + if (len < 80) {
36.10 + for (int i = 0; i < len; i++) {
36.11 + if (str.charAt(i) > 127) {
36.12 + asciiOnly = false;
36.13 + break;
36.14 + }
36.15 + }
36.16 + } else {
36.17 + char[] a = str.toCharArray();
36.18 + for (int i = 0; i < len; i++) {
36.19 + if (a[i] > 127) {
36.20 + asciiOnly = false;
36.21 + break;
36.22 + }
36.23 + }
36.24 + }
36.25 +
36.26 switch (form) {
36.27 case NFC :
36.28 - return NFC.normalize(str, options);
36.29 + return asciiOnly ? str : NFC.normalize(str, options);
36.30 case NFD :
36.31 - return NFD.normalize(str, options);
36.32 + return asciiOnly ? str : NFD.normalize(str, options);
36.33 case NFKC :
36.34 - return NFKC.normalize(str, options);
36.35 + return asciiOnly ? str : NFKC.normalize(str, options);
36.36 case NFKD :
36.37 - return NFKD.normalize(str, options);
36.38 + return asciiOnly ? str : NFKD.normalize(str, options);
36.39 }
36.40
36.41 throw new IllegalArgumentException("Unexpected normalization form: " +
37.1 --- a/src/share/demo/jfc/Font2DTest/RangeMenu.java Mon Jul 06 14:10:31 2009 -0400
37.2 +++ b/src/share/demo/jfc/Font2DTest/RangeMenu.java Thu Jul 09 13:53:05 2009 -0400
37.3 @@ -53,7 +53,7 @@
37.4 public final class RangeMenu extends JComboBox implements ActionListener {
37.5
37.6 /// Painfully extracted from java.lang.Character.UnicodeBlock. Arrrgh!
37.7 - /// Unicode 3.0 data.
37.8 + /// Unicode 5.1.0 data.
37.9
37.10 private final int[][] UNICODE_RANGES = {
37.11 { 0x000000, 0x00007f }, /// BASIC_LATIN
37.12 @@ -63,14 +63,16 @@
37.13 { 0x000250, 0x0002af }, /// IPA_EXTENSIONS
37.14 { 0x0002b0, 0x0002ff }, /// SPACING_MODIFIER_LETTERS
37.15 { 0x000300, 0x00036f }, /// COMBINING_DIACRITICAL_MARKS
37.16 - { 0x000370, 0x0003ff }, /// GREEK
37.17 + { 0x000370, 0x0003ff }, /// GREEK_AND_COPTIC
37.18 { 0x000400, 0x0004ff }, /// CYRILLIC
37.19 { 0x000500, 0x00052f }, /// CYRILLIC_SUPPLEMENTARY
37.20 { 0x000530, 0x00058f }, /// ARMENIAN
37.21 { 0x000590, 0x0005ff }, /// HEBREW
37.22 { 0x000600, 0x0006ff }, /// ARABIC
37.23 { 0x000700, 0x00074f }, /// SYRIAC
37.24 + { 0x000750, 0x00077f }, /// ARABIC_SUPPLEMENT
37.25 { 0x000780, 0x0007bf }, /// THAANA
37.26 + { 0x0007c0, 0x0007ff }, /// NKO
37.27 { 0x000900, 0x00097f }, /// DEVANAGARI
37.28 { 0x000980, 0x0009ff }, /// BENGALI
37.29 { 0x000a00, 0x000a7f }, /// GURMUKHI
37.30 @@ -88,6 +90,7 @@
37.31 { 0x0010a0, 0x0010ff }, /// GEORGIAN
37.32 { 0x001100, 0x0011ff }, /// HANGUL_JAMO
37.33 { 0x001200, 0x00137f }, /// ETHIOPIC
37.34 + { 0x001380, 0x00139f }, /// ETHIOPIC_SUPPLEMENT
37.35 { 0x0013a0, 0x0013ff }, /// CHEROKEE
37.36 { 0x001400, 0x00167f }, /// UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS
37.37 { 0x001680, 0x00169f }, /// OGHAM
37.38 @@ -100,8 +103,16 @@
37.39 { 0x001800, 0x0018af }, /// MONGOLIAN
37.40 { 0x001900, 0x00194f }, /// LIMBU
37.41 { 0x001950, 0x00197f }, /// TAI_LE
37.42 + { 0x001980, 0x0019df }, /// NEW_TAI_LE
37.43 { 0x0019e0, 0x0019ff }, /// KHMER_SYMBOLS
37.44 + { 0x001a00, 0x001a1f }, /// BUGINESE
37.45 + { 0x001b00, 0x001b7f }, /// BALINESE
37.46 + { 0x001b80, 0x001bbf }, /// SUNDANESE
37.47 + { 0x001c00, 0x001c4f }, /// LEPCHA
37.48 + { 0x001c50, 0x001c7f }, /// OL_CHIKI
37.49 { 0x001d00, 0x001d7f }, /// PHONETIC_EXTENSIONS
37.50 + { 0x001d80, 0x001dbf }, /// PHONEITC EXTENSIONS SUPPLEMENT
37.51 + { 0x001dc0, 0x001dff }, /// COMBINING_DIACRITICAL_MAKRS_SUPPLEMENT
37.52 { 0x001e00, 0x001eff }, /// LATIN_EXTENDED_ADDITIONAL
37.53 { 0x001f00, 0x001fff }, /// GREEK_EXTENDED
37.54 { 0x002000, 0x00206f }, /// GENERAL_PUNCTUATION
37.55 @@ -128,6 +139,14 @@
37.56 { 0x002980, 0x0029ff }, /// MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B
37.57 { 0x002a00, 0x002aff }, /// SUPPLEMENTAL_MATHEMATICAL_OPERATORS
37.58 { 0x002b00, 0x002bff }, /// MISCELLANEOUS_SYMBOLS_AND_ARROWS
37.59 + { 0x002c00, 0x002c5f }, /// GLAGOLITIC
37.60 + { 0x002c60, 0x002c7f }, /// LATIN_EXTENDED-C
37.61 + { 0x002c80, 0x002cff }, /// COPTIC
37.62 + { 0x002d00, 0x002d2f }, /// GEORGIAN_SUPPLEMENT
37.63 + { 0x002d30, 0x002d7f }, /// TIFINAGH
37.64 + { 0x002d80, 0x002ddf }, /// ETHIOPIC_EXTENDED
37.65 + { 0x002de0, 0x002dff }, /// CYRILLIC_EXTENDED-A
37.66 + { 0x002e00, 0x002e7f }, /// SUPPLEMENTAL_PUNCTUATION
37.67 { 0x002e80, 0x002eff }, /// CJK_RADICALS_SUPPLEMENT
37.68 { 0x002f00, 0x002fdf }, /// KANGXI_RADICALS
37.69 { 0x002ff0, 0x002fff }, /// IDEOGRAPHIC_DESCRIPTION_CHARACTERS
37.70 @@ -138,6 +157,7 @@
37.71 { 0x003130, 0x00318f }, /// HANGUL_COMPATIBILITY_JAMO
37.72 { 0x003190, 0x00319f }, /// KANBUN
37.73 { 0x0031a0, 0x0031bf }, /// BOPOMOFO_EXTENDED
37.74 + { 0x0031c0, 0x0031ef }, /// CJK_STROKES
37.75 { 0x0031f0, 0x0031ff }, /// KATAKANA_PHONETIC_EXTENSIONS
37.76 { 0x003200, 0x0032ff }, /// ENCLOSED_CJK_LETTERS_AND_MONTHS
37.77 { 0x003300, 0x0033ff }, /// CJK_COMPATIBILITY
37.78 @@ -146,13 +166,26 @@
37.79 { 0x004e00, 0x009fff }, /// CJK_UNIFIED_IDEOGRAPHS
37.80 { 0x00a000, 0x00a48f }, /// YI_SYLLABLES
37.81 { 0x00a490, 0x00a4cf }, /// YI_RADICALS
37.82 + { 0x00a500, 0x00a63f }, /// YAI
37.83 + { 0x00a640, 0x00a69f }, /// CYRILLIC_EXTENDED-B
37.84 + { 0x00a700, 0x00a71f }, /// MODIFIER_TONE_LETTERS
37.85 + { 0x00a720, 0x00a7ff }, /// LATIN_EXTENDED-D
37.86 + { 0x00a800, 0x00a82f }, /// SYLOTI_NAGRI
37.87 + { 0x00a840, 0x00a87f }, /// PHAGS-PA
37.88 + { 0x00a880, 0x00a8df }, /// SAURASHTRA
37.89 + { 0x00a900, 0x00a92f }, /// KAYAH_LI
37.90 + { 0x00a930, 0x00a95f }, /// REJANG
37.91 + { 0x00aa00, 0x00aa5f }, /// CHAM
37.92 { 0x00ac00, 0x00d7af }, /// HANGUL_SYLLABLES
37.93 - { 0x00d800, 0x00dfff }, /// SURROGATES_AREA
37.94 + { 0x00d800, 0x00db7f }, /// HIGH_SURROGATES_AREA
37.95 + { 0x00db80, 0x00dbff }, /// HIGH_PRIVATE_USE_SURROGATES_AREA
37.96 + { 0x00dc00, 0x00dfff }, /// LOW_SURROGATES_AREA
37.97 { 0x00e000, 0x00f8ff }, /// PRIVATE_USE_AREA
37.98 { 0x00f900, 0x00faff }, /// CJK_COMPATIBILITY_IDEOGRAPHS
37.99 { 0x00fb00, 0x00fb4f }, /// ALPHABETIC_PRESENTATION_FORMS
37.100 { 0x00fb50, 0x00fdff }, /// ARABIC_PRESENTATION_FORMS_A
37.101 { 0x00fe00, 0x00fe0f }, /// VARIATION_SELECTORS
37.102 + { 0x00fe10, 0x00fe1f }, /// VERTICAL_FORMS
37.103 { 0x00fe20, 0x00fe2f }, /// COMBINING_HALF_MARKS
37.104 { 0x00fe30, 0x00fe4f }, /// CJK_COMPATIBILITY_FORMS
37.105 { 0x00fe50, 0x00fe6f }, /// SMALL_FORM_VARIANTS
37.106 @@ -162,17 +195,32 @@
37.107 { 0x010000, 0x01007f }, /// LINEAR_B_SYLLABARY
37.108 { 0x010080, 0x0100ff }, /// LINEAR_B_IDEOGRAMS
37.109 { 0x010100, 0x01013f }, /// AEGEAN_NUMBERS
37.110 + { 0x010140, 0x01018f }, /// ANCIENT_GREEK_NUMBERS
37.111 + { 0x010190, 0x0101cf }, /// ANCIENT_SYMBOLS
37.112 + { 0x0101d0, 0x0101ff }, /// PHAISTOS_DISC
37.113 + { 0x010280, 0x01029f }, /// LYCIAN
37.114 + { 0x0102a0, 0x0102df }, /// CARIAN
37.115 { 0x010300, 0x01032f }, /// OLD_ITALIC
37.116 { 0x010330, 0x01034f }, /// GOTHIC
37.117 { 0x010380, 0x01039f }, /// UGARITIC
37.118 + { 0x0103a0, 0x0103df }, /// OLD_PERSIAN
37.119 { 0x010400, 0x01044f }, /// DESERET
37.120 { 0x010450, 0x01047f }, /// SHAVIAN
37.121 { 0x010480, 0x0104af }, /// OSMANYA
37.122 { 0x010800, 0x01083f }, /// CYPRIOT_SYLLABARY
37.123 + { 0x010900, 0x01091f }, /// PHOENICIAN
37.124 + { 0x010920, 0x01093f }, /// LYDIAN
37.125 + { 0x010a00, 0x010a5f }, /// KHAROSHTHI
37.126 + { 0x012000, 0x0123ff }, /// CUNEIFORM
37.127 + { 0x012400, 0x01247f }, /// CUNEIFORM_NUMBERS_AND_PUNCTUATION
37.128 { 0x01d000, 0x01d0ff }, /// BYZANTINE_MUSICAL_SYMBOLS
37.129 { 0x01d100, 0x01d1ff }, /// MUSICAL_SYMBOLS
37.130 + { 0x01d200, 0x01d24f }, /// ANCIENT_GREEK_MUSICAL_NOTATION
37.131 { 0x01d300, 0x01d35f }, /// TAI_XUAN_JING_SYMBOLS
37.132 + { 0x01d360, 0x01d37f }, /// COUNTING_ROD_NUMERALS
37.133 { 0x01d400, 0x01d7ff }, /// MATHEMATICAL_ALPHANUMERIC_SYMBOLS
37.134 + { 0x01f000, 0x01f02f }, /// MAHJONG_TILES
37.135 + { 0x01f030, 0x01f09f }, /// DOMINO_TILES
37.136 { 0x020000, 0x02a6df }, /// CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B
37.137 { 0x02f800, 0x02fa1f }, /// CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT
37.138 { 0x0e0000, 0x0e007f }, /// TAGS
37.139 @@ -190,14 +238,16 @@
37.140 "IPA Extensions",
37.141 "Spacing Modifier Letters",
37.142 "Combining Diacritical Marks",
37.143 - "Greek",
37.144 + "Greek and Coptic",
37.145 "Cyrillic",
37.146 "Cyrillic Supplement",
37.147 "Armenian",
37.148 "Hebrew",
37.149 "Arabic",
37.150 "Syriac",
37.151 + "Arabic Supplement",
37.152 "Thaana",
37.153 + "NKo",
37.154 "Devanagari",
37.155 "Bengali",
37.156 "Gurmukhi",
37.157 @@ -215,6 +265,7 @@
37.158 "Georgian",
37.159 "Hangul Jamo",
37.160 "Ethiopic",
37.161 + "Ethiopic Supplement",
37.162 "Cherokee",
37.163 "Unified Canadian Aboriginal Syllabics",
37.164 "Ogham",
37.165 @@ -227,14 +278,22 @@
37.166 "Mongolian",
37.167 "Limbu",
37.168 "Tai Le",
37.169 + "New Tai Lue",
37.170 "Khmer Symbols",
37.171 + "Buginese",
37.172 + "Balinese",
37.173 + "Sundanese",
37.174 + "Lepcha",
37.175 + "Ol Chiki",
37.176 "Phonetic Extensions",
37.177 + "Phonetic Extensions Supplement",
37.178 + "Combining Diacritical Marks Supplement",
37.179 "Latin Extended Additional",
37.180 "Greek Extended",
37.181 "General Punctuation",
37.182 "Superscripts and Subscripts",
37.183 "Currency Symbols",
37.184 - "Combining Marks for Symbols",
37.185 + "Combining Diacritical Marks for Symbols",
37.186 "Letterlike Symbols",
37.187 "Number Forms",
37.188 "Arrows",
37.189 @@ -255,6 +314,14 @@
37.190 "Miscellaneous Mathematical Symbols-B",
37.191 "Supplemental Mathematical Operators",
37.192 "Miscellaneous Symbols and Arrows",
37.193 + "Glagolitic",
37.194 + "Latin Extended-C",
37.195 + "Coptic",
37.196 + "Georgian Supplement",
37.197 + "Tifinagh",
37.198 + "Ethiopic Extended",
37.199 + "Cyrillic Extended-A",
37.200 + "Supplemental Punctuation",
37.201 "CJK Radicals Supplement",
37.202 "Kangxi Radicals",
37.203 "Ideographic Description Characters",
37.204 @@ -265,6 +332,7 @@
37.205 "Hangul Compatibility Jamo",
37.206 "Kanbun",
37.207 "Bopomofo Extended",
37.208 + "CJK Strokes",
37.209 "Katakana Phonetic Extensions",
37.210 "Enclosed CJK Letters and Months",
37.211 "CJK Compatibility",
37.212 @@ -273,13 +341,26 @@
37.213 "CJK Unified Ideographs",
37.214 "Yi Syllables",
37.215 "Yi Radicals",
37.216 + "Vai",
37.217 + "Cyrillic Extended-B",
37.218 + "Modifier Tone Letters",
37.219 + "Latin Extended-D",
37.220 + "Syloti Nagri",
37.221 + "Phags-pa",
37.222 + "Saurashtra",
37.223 + "Kayah Li",
37.224 + "Rejang",
37.225 + "Cham",
37.226 "Hangul Syllables",
37.227 - "Surrogates Area", // High Surrogates, High Private Use Surrogates, Low Surrogates
37.228 + "High Surrogates",
37.229 + "High Private Use Surrogates",
37.230 + "Low Surrogates",
37.231 "Private Use Area",
37.232 "CJK Compatibility Ideographs",
37.233 "Alphabetic Presentation Forms",
37.234 "Arabic Presentation Forms-A",
37.235 "Variation Selectors",
37.236 + "Vertical Forms",
37.237 "Combining Half Marks",
37.238 "CJK Compatibility Forms",
37.239 "Small Form Variants",
37.240 @@ -289,17 +370,32 @@
37.241 "Linear B Syllabary",
37.242 "Linear B Ideograms",
37.243 "Aegean Numbers",
37.244 + "Ancient Greek Numbers",
37.245 + "Ancient Symbols",
37.246 + "Phaistos Disc",
37.247 + "Lycian",
37.248 + "Carian",
37.249 "Old Italic",
37.250 "Gothic",
37.251 "Ugaritic",
37.252 + "Old Persian",
37.253 "Deseret",
37.254 "Shavian",
37.255 "Osmanya",
37.256 "Cypriot Syllabary",
37.257 + "Phoenician",
37.258 + "Lydian",
37.259 + "Kharoshthi",
37.260 + "Cuneiform",
37.261 + "Cuneiform Numbers and Punctuation",
37.262 "Byzantine Musical Symbols",
37.263 "Musical Symbols",
37.264 + "Ancient Greek Musical Notation",
37.265 "Tai Xuan Jing Symbols",
37.266 + "Counting Rod Numerals",
37.267 "Mathematical Alphanumeric Symbols",
37.268 + "Mahjong Tiles",
37.269 + "Domino Tiles",
37.270 "CJK Unified Ideographs Extension B",
37.271 "CJK Compatibility Ideographs Supplement",
37.272 "Tags",
38.1 --- a/src/solaris/classes/sun/awt/X11/XKeysym.java Mon Jul 06 14:10:31 2009 -0400
38.2 +++ b/src/solaris/classes/sun/awt/X11/XKeysym.java Thu Jul 09 13:53:05 2009 -0400
38.3 @@ -145,7 +145,7 @@
38.4 {
38.5 // Xsun without XKB uses keysymarray[2] keysym to determine if it is KP event.
38.6 // Otherwise, it is [1].
38.7 - int ndx = XToolkit.isXsunServer() &&
38.8 + int ndx = XToolkit.isXsunKPBehavior() &&
38.9 ! XToolkit.isXKBenabled() ? 2 : 1;
38.10 // Even if XKB is enabled, we have another problem: some symbol tables (e.g. cz) force
38.11 // a regular comma instead of KP_comma for a decimal separator. Result is,
38.12 @@ -193,7 +193,7 @@
38.13 private static long getKeypadKeysym( XKeyEvent ev ) {
38.14 int ndx = 0;
38.15 long keysym = XConstants.NoSymbol;
38.16 - if( XToolkit.isXsunServer() &&
38.17 + if( XToolkit.isXsunKPBehavior() &&
38.18 ! XToolkit.isXKBenabled() ) {
38.19 if( (ev.get_state() & XConstants.ShiftMask) != 0 ) { // shift modifier is on
38.20 ndx = 3;
39.1 --- a/src/solaris/classes/sun/awt/X11/XToolkit.java Mon Jul 06 14:10:31 2009 -0400
39.2 +++ b/src/solaris/classes/sun/awt/X11/XToolkit.java Thu Jul 09 13:53:05 2009 -0400
39.3 @@ -1177,6 +1177,7 @@
39.4 awtLock();
39.5 try {
39.6 XlibWrapper.XBell(getDisplay(), 0);
39.7 + XlibWrapper.XFlush(getDisplay());
39.8 } finally {
39.9 awtUnlock();
39.10 }
39.11 @@ -1435,9 +1436,14 @@
39.12 return timeStamp;
39.13 }
39.14 protected void initializeDesktopProperties() {
39.15 - desktopProperties.put("DnD.Autoscroll.initialDelay", Integer.valueOf(50));
39.16 - desktopProperties.put("DnD.Autoscroll.interval", Integer.valueOf(50));
39.17 - desktopProperties.put("DnD.Autoscroll.cursorHysteresis", Integer.valueOf(5));
39.18 + desktopProperties.put("DnD.Autoscroll.initialDelay",
39.19 + Integer.valueOf(50));
39.20 + desktopProperties.put("DnD.Autoscroll.interval",
39.21 + Integer.valueOf(50));
39.22 + desktopProperties.put("DnD.Autoscroll.cursorHysteresis",
39.23 + Integer.valueOf(5));
39.24 + desktopProperties.put("Shell.shellFolderManager",
39.25 + "sun.awt.shell.ShellFolderManager");
39.26 // Don't want to call getMultiClickTime() if we are headless
39.27 if (!GraphicsEnvironment.isHeadless()) {
39.28 desktopProperties.put("awt.multiClickInterval",
39.29 @@ -2124,39 +2130,33 @@
39.30 */
39.31 private static int backingStoreType;
39.32
39.33 - static boolean awt_ServerInquired = false;
39.34 - static boolean awt_IsXsunServer = false;
39.35 + static final int XSUN_KP_BEHAVIOR = 1;
39.36 + static final int XORG_KP_BEHAVIOR = 2;
39.37 +
39.38 + static int awt_IsXsunKPBehavior = 0;
39.39 static boolean awt_UseXKB = false;
39.40 static boolean awt_UseXKB_Calls = false;
39.41 static int awt_XKBBaseEventCode = 0;
39.42 static int awt_XKBEffectiveGroup = 0; // so far, I don't use it leaving all calculations
39.43 // to XkbTranslateKeyCode
39.44 static long awt_XKBDescPtr = 0;
39.45 +
39.46 /**
39.47 - Try to understand if it is Xsun server.
39.48 - By now (2005) Sun is vendor of Xsun and Xorg servers; we only return true if Xsun is running.
39.49 - */
39.50 - static boolean isXsunServer() {
39.51 + * Check for Xsun convention regarding numpad keys.
39.52 + * Xsun and some other servers (i.e. derived from Xsun)
39.53 + * under certain conditions process numpad keys unlike Xorg.
39.54 + */
39.55 + static boolean isXsunKPBehavior() {
39.56 awtLock();
39.57 try {
39.58 - if( awt_ServerInquired ) {
39.59 - return awt_IsXsunServer;
39.60 + if( awt_IsXsunKPBehavior == 0 ) {
39.61 + if( XlibWrapper.IsXsunKPBehavior(getDisplay()) ) {
39.62 + awt_IsXsunKPBehavior = XSUN_KP_BEHAVIOR;
39.63 + }else{
39.64 + awt_IsXsunKPBehavior = XORG_KP_BEHAVIOR;
39.65 + }
39.66 }
39.67 - if( ! XlibWrapper.ServerVendor(getDisplay()).startsWith("Sun Microsystems") ) {
39.68 - awt_ServerInquired = true;
39.69 - awt_IsXsunServer = false;
39.70 - return false;
39.71 - }
39.72 - // Now, it's Sun. It still may be Xorg though, eg on Solaris 10, x86.
39.73 - // Today (2005), VendorRelease of Xorg is a Big Number unlike Xsun.
39.74 - if( XlibWrapper.VendorRelease(getDisplay()) > 10000 ) {
39.75 - awt_ServerInquired = true;
39.76 - awt_IsXsunServer = false;
39.77 - return false;
39.78 - }
39.79 - awt_ServerInquired = true;
39.80 - awt_IsXsunServer = true;
39.81 - return true;
39.82 + return awt_IsXsunKPBehavior == XSUN_KP_BEHAVIOR ? true : false;
39.83 } finally {
39.84 awtUnlock();
39.85 }
40.1 --- a/src/solaris/classes/sun/awt/X11/XlibWrapper.java Mon Jul 06 14:10:31 2009 -0400
40.2 +++ b/src/solaris/classes/sun/awt/X11/XlibWrapper.java Thu Jul 09 13:53:05 2009 -0400
40.3 @@ -352,6 +352,7 @@
40.4 static native int XIconifyWindow(long display, long window, long screenNumber);
40.5 static native String ServerVendor(long display);
40.6 static native int VendorRelease(long display);
40.7 + static native boolean IsXsunKPBehavior(long display);
40.8
40.9 static native void XBell(long display, int percent);
40.10
41.1 --- a/src/solaris/classes/sun/awt/X11/keysym2ucs.h Mon Jul 06 14:10:31 2009 -0400
41.2 +++ b/src/solaris/classes/sun/awt/X11/keysym2ucs.h Thu Jul 09 13:53:05 2009 -0400
41.3 @@ -183,7 +183,7 @@
41.4 tojava {
41.5 tojava // Xsun without XKB uses keysymarray[2] keysym to determine if it is KP event.
41.6 tojava // Otherwise, it is [1].
41.7 -tojava int ndx = XToolkit.isXsunServer() &&
41.8 +tojava int ndx = XToolkit.isXsunKPBehavior() &&
41.9 tojava ! XToolkit.isXKBenabled() ? 2 : 1;
41.10 tojava // Even if XKB is enabled, we have another problem: some symbol tables (e.g. cz) force
41.11 tojava // a regular comma instead of KP_comma for a decimal separator. Result is,
41.12 @@ -231,7 +231,7 @@
41.13 tojava private static long getKeypadKeysym( XKeyEvent ev ) {
41.14 tojava int ndx = 0;
41.15 tojava long keysym = XConstants.NoSymbol;
41.16 -tojava if( XToolkit.isXsunServer() &&
41.17 +tojava if( XToolkit.isXsunKPBehavior() &&
41.18 tojava ! XToolkit.isXKBenabled() ) {
41.19 tojava if( (ev.get_state() & XConstants.ShiftMask) != 0 ) { // shift modifier is on
41.20 tojava ndx = 3;
42.1 --- a/src/solaris/native/sun/xawt/XlibWrapper.c Mon Jul 06 14:10:31 2009 -0400
42.2 +++ b/src/solaris/native/sun/xawt/XlibWrapper.c Thu Jul 09 13:53:05 2009 -0400
42.3 @@ -1181,6 +1181,38 @@
42.4 AWT_CHECK_HAVE_LOCK();
42.5 return VendorRelease((Display*)jlong_to_ptr(display));
42.6 }
42.7 +/*
42.8 + * Class: sun_awt_X11_XlibWrapper
42.9 + * Method: IsXsunKPBehavior
42.10 + * Signature: (J)Z;
42.11 + */
42.12 +JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_IsXsunKPBehavior
42.13 +(JNIEnv *env, jclass clazz, jlong display)
42.14 +{
42.15 + // Xsun without XKB uses keysymarray[2] keysym to determine if it is KP event.
42.16 + // Otherwise, it is [1] or sometimes [0].
42.17 + // This sniffer first tries to determine what is a keycode for XK_KP_7
42.18 + // using XKeysymToKeycode;
42.19 + // second, in which place in the keysymarray is XK_KP_7
42.20 + // using XKeycodeToKeysym.
42.21 + int kc7;
42.22 + AWT_CHECK_HAVE_LOCK();
42.23 + kc7 = XKeysymToKeycode((Display*)jlong_to_ptr(display), XK_KP_7);
42.24 + if( !kc7 ) {
42.25 + // keycode is not defined. Why, it's a reduced keyboard perhaps:
42.26 + // report arbitrarily false.
42.27 + return JNI_FALSE;
42.28 + } else {
42.29 + long ks2 = XKeycodeToKeysym((Display*)jlong_to_ptr(display), kc7, 2);
42.30 + if( ks2 == XK_KP_7 ) {
42.31 + //XXX If some Xorg server would put XK_KP_7 in keysymarray[2] as well,
42.32 + //XXX for yet unknown to me reason, the sniffer would lie.
42.33 + return JNI_TRUE;
42.34 + }else{
42.35 + return JNI_FALSE;
42.36 + }
42.37 + }
42.38 +}
42.39
42.40 JavaVM* jvm = NULL;
42.41 static int ToolkitErrorHandler(Display * dpy, XErrorEvent * event) {
43.1 --- a/src/windows/classes/sun/awt/windows/WComponentPeer.java Mon Jul 06 14:10:31 2009 -0400
43.2 +++ b/src/windows/classes/sun/awt/windows/WComponentPeer.java Thu Jul 09 13:53:05 2009 -0400
43.3 @@ -417,6 +417,15 @@
43.4 replaceSurfaceData(this.numBackBuffers, this.backBufferCaps);
43.5 }
43.6
43.7 + public void createScreenSurface(boolean isResize)
43.8 + {
43.9 + Win32GraphicsConfig gc = (Win32GraphicsConfig)getGraphicsConfiguration();
43.10 + ScreenUpdateManager mgr = ScreenUpdateManager.getInstance();
43.11 +
43.12 + surfaceData = mgr.createScreenSurface(gc, this, numBackBuffers, isResize);
43.13 + }
43.14 +
43.15 +
43.16 /**
43.17 * Multi-buffer version of replaceSurfaceData. This version is called
43.18 * by createBuffers(), which needs to acquire the same locks in the same
43.19 @@ -434,13 +443,10 @@
43.20 return;
43.21 }
43.22 numBackBuffers = newNumBackBuffers;
43.23 - Win32GraphicsConfig gc =
43.24 - (Win32GraphicsConfig)getGraphicsConfiguration();
43.25 ScreenUpdateManager mgr = ScreenUpdateManager.getInstance();
43.26 oldData = surfaceData;
43.27 mgr.dropScreenSurface(oldData);
43.28 - surfaceData =
43.29 - mgr.createScreenSurface(gc, this, numBackBuffers, true);
43.30 + createScreenSurface(true);
43.31 if (oldData != null) {
43.32 oldData.invalidate();
43.33 }
43.34 @@ -449,6 +455,8 @@
43.35 if (numBackBuffers > 0) {
43.36 // set the caps first, they're used when creating the bb
43.37 backBufferCaps = caps;
43.38 + Win32GraphicsConfig gc =
43.39 + (Win32GraphicsConfig)getGraphicsConfiguration();
43.40 backBuffer = gc.createBackBuffer(this);
43.41 } else if (backBuffer != null) {
43.42 backBufferCaps = null;
43.43 @@ -711,11 +719,8 @@
43.44 create(parentPeer);
43.45 // fix for 5088782: check if window object is created successfully
43.46 checkCreation();
43.47 - this.winGraphicsConfig =
43.48 - (Win32GraphicsConfig)getGraphicsConfiguration();
43.49 - ScreenUpdateManager mgr = ScreenUpdateManager.getInstance();
43.50 - this.surfaceData = mgr.createScreenSurface(winGraphicsConfig, this,
43.51 - numBackBuffers, false);
43.52 +
43.53 + createScreenSurface(false);
43.54 initialize();
43.55 start(); // Initialize enable/disable state, turn on callbacks
43.56 }
44.1 --- a/src/windows/classes/sun/awt/windows/WEmbeddedFrame.java Mon Jul 06 14:10:31 2009 -0400
44.2 +++ b/src/windows/classes/sun/awt/windows/WEmbeddedFrame.java Thu Jul 09 13:53:05 2009 -0400
44.3 @@ -211,9 +211,10 @@
44.4 */
44.5 public void notifyModalBlocked(Dialog blocker, boolean blocked) {
44.6 try {
44.7 - notifyModalBlockedImpl((WEmbeddedFramePeer)ComponentAccessor.getPeer(this),
44.8 - (WWindowPeer)ComponentAccessor.getPeer(blocker),
44.9 - blocked);
44.10 + ComponentPeer thisPeer = (ComponentPeer)WToolkit.targetToPeer(this);
44.11 + ComponentPeer blockerPeer = (ComponentPeer)WToolkit.targetToPeer(blocker);
44.12 + notifyModalBlockedImpl((WEmbeddedFramePeer)thisPeer,
44.13 + (WWindowPeer)blockerPeer, blocked);
44.14 } catch (Exception z) {
44.15 z.printStackTrace(System.err);
44.16 }
45.1 --- a/src/windows/classes/sun/awt/windows/WFileDialogPeer.java Mon Jul 06 14:10:31 2009 -0400
45.2 +++ b/src/windows/classes/sun/awt/windows/WFileDialogPeer.java Thu Jul 09 13:53:05 2009 -0400
45.3 @@ -237,4 +237,11 @@
45.4 public void setOpacity(float opacity) {}
45.5 public void setOpaque(boolean isOpaque) {}
45.6 public void updateWindow(java.awt.image.BufferedImage backBuffer) {}
45.7 +
45.8 + // the file/print dialogs are native dialogs and
45.9 + // the native system does their own rendering
45.10 + @Override
45.11 + public void createScreenSurface(boolean isResize) {}
45.12 + @Override
45.13 + public void replaceSurfaceData() {}
45.14 }
46.1 --- a/src/windows/classes/sun/awt/windows/WPopupMenuPeer.java Mon Jul 06 14:10:31 2009 -0400
46.2 +++ b/src/windows/classes/sun/awt/windows/WPopupMenuPeer.java Thu Jul 09 13:53:05 2009 -0400
46.3 @@ -29,33 +29,25 @@
46.4 import java.lang.reflect.Field;
46.5
46.6 import sun.awt.SunToolkit;
46.7 +import sun.awt.AWTAccessor;
46.8
46.9 public class WPopupMenuPeer extends WMenuPeer implements PopupMenuPeer {
46.10 // We can't use target.getParent() for TrayIcon popup
46.11 // because this method should return null for the TrayIcon
46.12 // popup regardless of that whether it has parent or not.
46.13 - private static Field f_parent;
46.14 - private static Field f_isTrayIconPopup;
46.15 -
46.16 - static {
46.17 - f_parent = SunToolkit.getField(MenuComponent.class, "parent");
46.18 - f_isTrayIconPopup = SunToolkit.getField(PopupMenu.class, "isTrayIconPopup");
46.19 - }
46.20
46.21 public WPopupMenuPeer(PopupMenu target) {
46.22 this.target = target;
46.23 MenuContainer parent = null;
46.24 - boolean isTrayIconPopup = false;
46.25 - try {
46.26 - isTrayIconPopup = ((Boolean)f_isTrayIconPopup.get(target)).booleanValue();
46.27 - if (isTrayIconPopup) {
46.28 - parent = (MenuContainer)f_parent.get(target);
46.29 - } else {
46.30 - parent = target.getParent();
46.31 - }
46.32 - } catch (IllegalAccessException iae) {
46.33 - iae.printStackTrace();
46.34 - return;
46.35 +
46.36 + // We can't use target.getParent() for TrayIcon popup
46.37 + // because this method should return null for the TrayIcon
46.38 + // popup regardless of that whether it has parent or not.
46.39 + boolean isTrayIconPopup = AWTAccessor.getPopupMenuAccessor().isTrayIconPopup(target);
46.40 + if (isTrayIconPopup) {
46.41 + parent = AWTAccessor.getMenuComponentAccessor().getParent(target);
46.42 + } else {
46.43 + parent = target.getParent();
46.44 }
46.45
46.46 if (parent instanceof Component) {
47.1 --- a/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java Mon Jul 06 14:10:31 2009 -0400
47.2 +++ b/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java Thu Jul 09 13:53:05 2009 -0400
47.3 @@ -150,4 +150,11 @@
47.4 public void setOpacity(float opacity) {}
47.5 public void setOpaque(boolean isOpaque) {}
47.6 public void updateWindow(java.awt.image.BufferedImage backBuffer) {}
47.7 +
47.8 + // the file/print dialogs are native dialogs and
47.9 + // the native system does their own rendering
47.10 + @Override
47.11 + public void createScreenSurface(boolean isResize) {}
47.12 + @Override
47.13 + public void replaceSurfaceData() {}
47.14 }
48.1 --- a/src/windows/classes/sun/java2d/windows/GDIWindowSurfaceData.java Mon Jul 06 14:10:31 2009 -0400
48.2 +++ b/src/windows/classes/sun/java2d/windows/GDIWindowSurfaceData.java Thu Jul 09 13:53:05 2009 -0400
48.3 @@ -38,8 +38,6 @@
48.4 import sun.awt.Win32GraphicsConfig;
48.5 import sun.awt.Win32GraphicsDevice;
48.6 import sun.awt.windows.WComponentPeer;
48.7 -import sun.awt.windows.WFileDialogPeer;
48.8 -import sun.awt.windows.WPrintDialogPeer;
48.9 import sun.java2d.ScreenUpdateManager;
48.10 import sun.java2d.SunGraphics2D;
48.11 import sun.java2d.SurfaceData;
48.12 @@ -264,17 +262,7 @@
48.13 this.graphicsConfig =
48.14 (Win32GraphicsConfig) peer.getGraphicsConfiguration();
48.15 this.solidloops = graphicsConfig.getSolidLoops(sType);
48.16 - if (peer instanceof WFileDialogPeer ||
48.17 - peer instanceof WPrintDialogPeer )
48.18 - {
48.19 - // REMIND: Awful hack. The right fix for this problem
48.20 - // would be for these type of Peers to not even use a
48.21 - // GDIWindowSurfaceData object since they never do any
48.22 - // rendering. Or they could actually implement the
48.23 - // functionality needed in initOps. But this seems
48.24 - // to work for now. See bug 4391928 for more info.
48.25 - return;
48.26 - }
48.27 +
48.28 Win32GraphicsDevice gd =
48.29 (Win32GraphicsDevice)graphicsConfig.getDevice();
48.30 initOps(peer, depth, rMask, gMask, bMask, gd.getScreen());
49.1 --- a/src/windows/native/sun/windows/awt_Component.cpp Mon Jul 06 14:10:31 2009 -0400
49.2 +++ b/src/windows/native/sun/windows/awt_Component.cpp Thu Jul 09 13:53:05 2009 -0400
49.3 @@ -5975,17 +5975,7 @@
49.4 env->DeleteGlobalRef(self);
49.5
49.6 delete cpps;
49.7 -
49.8 - if (result != NULL)
49.9 - {
49.10 - jintArray resultGlobalRef = (jintArray)env->NewGlobalRef(result);
49.11 - env->DeleteLocalRef(result);
49.12 - return resultGlobalRef;
49.13 - }
49.14 - else
49.15 - {
49.16 - return NULL;
49.17 - }
49.18 + return result; // this reference is global
49.19 }
49.20
49.21 jboolean AwtComponent::_IsObscured(void *param)
50.1 --- a/src/windows/native/sun/windows/awt_Frame.cpp Mon Jul 06 14:10:31 2009 -0400
50.2 +++ b/src/windows/native/sun/windows/awt_Frame.cpp Thu Jul 09 13:53:05 2009 -0400
50.3 @@ -381,19 +381,29 @@
50.4
50.5 void AwtFrame::CreateProxyFocusOwner()
50.6 {
50.7 - DASSERT(m_proxyFocusOwner == NULL);
50.8 - DASSERT(AwtToolkit::MainThread() == ::GetCurrentThreadId());
50.9 + if (AwtToolkit::IsMainThread()) {
50.10 + AwtFrame::_CreateProxyFocusOwner((void *)this);
50.11 + } else {
50.12 + AwtToolkit::GetInstance().InvokeFunction(AwtFrame::_CreateProxyFocusOwner, (void *)this);
50.13 + }
50.14 +}
50.15
50.16 - m_proxyFocusOwner = ::CreateWindow(TEXT("STATIC"),
50.17 - TEXT("ProxyFocusOwner"),
50.18 - WS_CHILD,
50.19 - 0, 0, 0, 0, GetHWnd(), NULL,
50.20 - AwtToolkit::GetInstance().
50.21 - GetModuleHandle(),
50.22 - NULL);
50.23 +void AwtFrame::_CreateProxyFocusOwner(void *param)
50.24 +{
50.25 + DASSERT(AwtToolkit::IsMainThread());
50.26
50.27 - m_proxyDefWindowProc = ComCtl32Util::GetInstance().SubclassHWND(m_proxyFocusOwner, ProxyWindowProc);
50.28 + AwtFrame *f = (AwtFrame *)param;
50.29 + DASSERT(f->m_proxyFocusOwner == NULL);
50.30
50.31 + f->m_proxyFocusOwner = ::CreateWindow(TEXT("STATIC"),
50.32 + TEXT("ProxyFocusOwner"),
50.33 + WS_CHILD,
50.34 + 0, 0, 0, 0, f->GetHWnd(), NULL,
50.35 + AwtToolkit::GetInstance().
50.36 + GetModuleHandle(),
50.37 + NULL);
50.38 +
50.39 + f->m_proxyDefWindowProc = ComCtl32Util::GetInstance().SubclassHWND(f->m_proxyFocusOwner, ProxyWindowProc);
50.40 }
50.41
50.42 void AwtFrame::DestroyProxyFocusOwner()
51.1 --- a/src/windows/native/sun/windows/awt_Frame.h Mon Jul 06 14:10:31 2009 -0400
51.2 +++ b/src/windows/native/sun/windows/awt_Frame.h Thu Jul 09 13:53:05 2009 -0400
51.3 @@ -117,7 +117,6 @@
51.4 INLINE BOOL IsUndecorated() { return m_isUndecorated; }
51.5
51.6 INLINE HWND GetProxyFocusOwner() {
51.7 - DASSERT(AwtToolkit::MainThread() == ::GetCurrentThreadId());
51.8 if (m_proxyFocusOwner == NULL) {
51.9 CreateProxyFocusOwner();
51.10 }
51.11 @@ -165,6 +164,8 @@
51.12 void CreateProxyFocusOwner();
51.13 void DestroyProxyFocusOwner();
51.14
51.15 + /* creates proxy focus owner, called on Toolkit thread */
51.16 + static void _CreateProxyFocusOwner(void *param);
51.17 /* destroys proxy focus owner, called on Toolkit thread */
51.18 static void _DestroyProxyFocusOwner(void *param);
51.19
52.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
52.2 +++ b/test/java/awt/Component/PrintAllXcheckJNI/PrintAllXcheckJNI.java Thu Jul 09 13:53:05 2009 -0400
52.3 @@ -0,0 +1,52 @@
52.4 +/*
52.5 + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
52.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
52.7 + *
52.8 + * This code is free software; you can redistribute it and/or modify it
52.9 + * under the terms of the GNU General Public License version 2 only, as
52.10 + * published by the Free Software Foundation.
52.11 + *
52.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
52.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
52.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
52.15 + * version 2 for more details (a copy is included in the LICENSE file that
52.16 + * accompanied this code).
52.17 + *
52.18 + * You should have received a copy of the GNU General Public License version
52.19 + * 2 along with this work; if not, write to the Free Software Foundation,
52.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
52.21 + *
52.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
52.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
52.24 + * have any questions.
52.25 + */
52.26 +
52.27 +/*
52.28 + @test
52.29 + @bug 6736247
52.30 + @summary Component.printAll Invalid local JNI handle
52.31 + @author Dmitry Cherepanov: area=awt.component
52.32 + @run main/othervm -Xcheck:jni PrintAllXcheckJNI
52.33 +*/
52.34 +
52.35 +import java.awt.*;
52.36 +import java.awt.image.BufferedImage;
52.37 +
52.38 +public class PrintAllXcheckJNI
52.39 +{
52.40 + public static void main(String []s)
52.41 + {
52.42 + Frame frame = new Frame();
52.43 + frame.setVisible(true);
52.44 +
52.45 + BufferedImage img = new BufferedImage(frame.getWidth(),
52.46 + frame.getHeight(),
52.47 + BufferedImage.TYPE_INT_RGB);
52.48 + Graphics2D g = img.createGraphics();
52.49 +
52.50 + frame.printAll(g);
52.51 +
52.52 + g.dispose();
52.53 + img.flush();
52.54 + }
52.55 +}
53.1 --- a/test/java/awt/Focus/FocusTraversalPolicy/DefaultFTPTest.java Mon Jul 06 14:10:31 2009 -0400
53.2 +++ b/test/java/awt/Focus/FocusTraversalPolicy/DefaultFTPTest.java Thu Jul 09 13:53:05 2009 -0400
53.3 @@ -104,7 +104,7 @@
53.4 */
53.5
53.6 public class DefaultFTPTest {
53.7 - final int TESTS_NUMBER = 10;
53.8 + final int TESTS_NUMBER = 11;
53.9
53.10 public static void main(String[] args) {
53.11 DefaultFTPTest app = new DefaultFTPTest();
53.12 @@ -928,3 +928,63 @@
53.13 }
53.14 }
53.15 }
53.16 +
53.17 +/*
53.18 + * frame [ container(root) [...] comp ]
53.19 + * - getDefaultComponent(<frame>) should implicitly down-cycle into the <container>.
53.20 + * - getFirstComponent(<frame>) should implicitly down-cycle into the <container>.
53.21 + */
53.22 +class PolicyTest11 extends AbstractPolicyTest {
53.23 + protected Frame createFrame() {
53.24 + Frame frame = (Frame) registerComponent("frame", new Frame("Test Frame"));
53.25 + frame.setLayout(new FlowLayout());
53.26 +
53.27 + Container cont = (Container)registerComponent("panel", new Panel());
53.28 + cont.add(registerComponent("btn-1", new Button("button")));
53.29 + cont.add(registerComponent("btn-2", new Button("button")));
53.30 +
53.31 + frame.add(cont);
53.32 + frame.add(registerComponent("btn-3", new Button("button")));
53.33 +
53.34 + return frame;
53.35 + }
53.36 +
53.37 + protected void customizeHierarchy() {
53.38 + ((Container)getComponent("frame")).setFocusTraversalPolicy(new DefaultFocusTraversalPolicy());
53.39 + ((Container)getComponent("panel")).setFocusCycleRoot(true);
53.40 + }
53.41 +
53.42 + protected Map<String, String> getForwardOrder() {
53.43 + Map<String, String> order = new HashMap<String, String>();
53.44 + order.put("frame", "btn-1");
53.45 + order.put("btn-1", "btn-2");
53.46 + order.put("btn-2", "btn-1");
53.47 + order.put("btn-3", "btn-1");
53.48 + return order;
53.49 + }
53.50 +
53.51 + protected Map<String, String> getBackwardOrder() {
53.52 + Map<String, String> order = new HashMap<String, String>();
53.53 + order.put("btn-3", "btn-1");
53.54 + order.put("btn-2", "btn-1");
53.55 + order.put("btn-1", "btn-2");
53.56 + order.put("frame", "btn-3");
53.57 + return order;
53.58 + }
53.59 +
53.60 + protected String[] getContainersToTest() {
53.61 + return new String[] {"frame"};
53.62 + }
53.63 +
53.64 + protected String getDefaultComp(String focusCycleRoot_id) {
53.65 + return "btn-1";
53.66 + }
53.67 +
53.68 + protected String getFirstComp(String focusCycleRoot_id) {
53.69 + return "btn-1";
53.70 + }
53.71 +
53.72 + protected String getLastComp(String focusCycleRoot_id) {
53.73 + return "btn-3";
53.74 + }
53.75 +}
54.1 --- a/test/java/awt/Focus/FocusTraversalPolicy/LayoutFTPTest.java Mon Jul 06 14:10:31 2009 -0400
54.2 +++ b/test/java/awt/Focus/FocusTraversalPolicy/LayoutFTPTest.java Thu Jul 09 13:53:05 2009 -0400
54.3 @@ -105,7 +105,7 @@
54.4 */
54.5
54.6 public class LayoutFTPTest {
54.7 - final int TESTS_NUMBER = 10;
54.8 + final int TESTS_NUMBER = 11;
54.9
54.10 public static void main(String[] args) {
54.11 LayoutFTPTest app = new LayoutFTPTest();
54.12 @@ -929,3 +929,63 @@
54.13 }
54.14 }
54.15 }
54.16 +
54.17 +/*
54.18 + * frame [ container(root) [...] comp ]
54.19 + * - getDefaultComponent(<frame>) should implicitly down-cycle into the <container>.
54.20 + * - getFirstComponent(<frame>) should implicitly down-cycle into the <container>.
54.21 + */
54.22 +class PolicyTest11 extends AbstractPolicyTest {
54.23 + protected Frame createFrame() {
54.24 + JFrame jframe = (JFrame) registerComponent("jframe", new JFrame("Test Frame"));
54.25 + jframe.setLayout(new FlowLayout());
54.26 +
54.27 + Container cont = (Container)registerComponent("jpanel", new JPanel());
54.28 + cont.add(registerComponent("btn-1", new JButton("jbutton")));
54.29 + cont.add(registerComponent("btn-2", new JButton("jbutton")));
54.30 +
54.31 + jframe.add(cont);
54.32 + jframe.add(registerComponent("btn-3", new JButton("jbutton")));
54.33 +
54.34 + return jframe;
54.35 + }
54.36 +
54.37 + protected void customizeHierarchy() {
54.38 + ((Container)getComponent("jframe")).setFocusTraversalPolicy(new LayoutFocusTraversalPolicy());
54.39 + ((Container)getComponent("jpanel")).setFocusCycleRoot(true);
54.40 + }
54.41 +
54.42 + protected Map<String, String> getForwardOrder() {
54.43 + Map<String, String> order = new HashMap<String, String>();
54.44 + order.put("jframe", "btn-1");
54.45 + order.put("btn-1", "btn-2");
54.46 + order.put("btn-2", "btn-1");
54.47 + order.put("btn-3", "btn-1");
54.48 + return order;
54.49 + }
54.50 +
54.51 + protected Map<String, String> getBackwardOrder() {
54.52 + Map<String, String> order = new HashMap<String, String>();
54.53 + order.put("btn-3", "btn-1");
54.54 + order.put("btn-2", "btn-1");
54.55 + order.put("btn-1", "btn-2");
54.56 + order.put("jframe", "btn-3");
54.57 + return order;
54.58 + }
54.59 +
54.60 + protected String[] getContainersToTest() {
54.61 + return new String[] {"jframe"};
54.62 + }
54.63 +
54.64 + protected String getDefaultComp(String focusCycleRoot_id) {
54.65 + return "btn-1";
54.66 + }
54.67 +
54.68 + protected String getFirstComp(String focusCycleRoot_id) {
54.69 + return "btn-1";
54.70 + }
54.71 +
54.72 + protected String getLastComp(String focusCycleRoot_id) {
54.73 + return "btn-3";
54.74 + }
54.75 +}
55.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
55.2 +++ b/test/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.html Thu Jul 09 13:53:05 2009 -0400
55.3 @@ -0,0 +1,43 @@
55.4 +<html>
55.5 +<!--
55.6 +
55.7 + Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
55.8 + DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55.9 +
55.10 + This code is free software; you can redistribute it and/or modify it
55.11 + under the terms of the GNU General Public License version 2 only, as
55.12 + published by the Free Software Foundation.
55.13 +
55.14 + This code is distributed in the hope that it will be useful, but WITHOUT
55.15 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
55.16 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
55.17 + version 2 for more details (a copy is included in the LICENSE file that
55.18 + accompanied this code).
55.19 +
55.20 + You should have received a copy of the GNU General Public License version
55.21 + 2 along with this work; if not, write to the Free Software Foundation,
55.22 + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
55.23 +
55.24 + Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
55.25 + CA 95054 USA or visit www.sun.com if you need additional information or
55.26 + have any questions.
55.27 +
55.28 + @test
55.29 + @bug 5004032
55.30 + @summary GridBagConstraints.ipad(x|y) defined in a new way
55.31 + @author dav@sparc.spb.su area=
55.32 + @run applet GridBagLayoutIpadXYTest.html
55.33 + -->
55.34 +<head>
55.35 +<title> </title>
55.36 +</head>
55.37 +<body>
55.38 +
55.39 +<h1>GridBagLayoutIpadXYTest<br>Bug ID: 5004032 </h1>
55.40 +
55.41 +<p> This is an AUTOMATIC test, simply wait for completion </p>
55.42 +
55.43 +<APPLET CODE="GridBagLayoutIpadXYTest.class" WIDTH=200 HEIGHT=200></APPLET>
55.44 +</body>
55.45 +</html>
55.46 +
56.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
56.2 +++ b/test/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java Thu Jul 09 13:53:05 2009 -0400
56.3 @@ -0,0 +1,89 @@
56.4 +/*
56.5 + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
56.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
56.7 + *
56.8 + * This code is free software; you can redistribute it and/or modify it
56.9 + * under the terms of the GNU General Public License version 2 only, as
56.10 + * published by the Free Software Foundation.
56.11 + *
56.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
56.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
56.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
56.15 + * version 2 for more details (a copy is included in the LICENSE file that
56.16 + * accompanied this code).
56.17 + *
56.18 + * You should have received a copy of the GNU General Public License version
56.19 + * 2 along with this work; if not, write to the Free Software Foundation,
56.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
56.21 + *
56.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
56.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
56.24 + * have any questions.
56.25 + */
56.26 +
56.27 +/*
56.28 + test
56.29 + @bug 5004032
56.30 + @summary GridBagConstraints.ipad(x|y) defined in a new way
56.31 + @author dav@sparc.spb.su area=
56.32 + @run applet GridBagLayoutIpadXYTest.html
56.33 +*/
56.34 +
56.35 +import java.applet.Applet;
56.36 +import java.awt.*;
56.37 +
56.38 +public class GridBagLayoutIpadXYTest extends Applet
56.39 +{
56.40 + Frame frame = new Frame();
56.41 + TextField jtf = null;
56.42 + final int customIpadx = 300;
56.43 + final int customIpady = 40;
56.44 +
56.45 + public void init()
56.46 + {
56.47 + this.setLayout (new BorderLayout ());
56.48 +
56.49 + String[] instructions =
56.50 + {
56.51 + "This is an AUTOMATIC test",
56.52 + "simply wait until it is done"
56.53 + };
56.54 + }//End init()
56.55 +
56.56 + public void start ()
56.57 + {
56.58 + validate();
56.59 + frame.setLayout(new GridBagLayout());
56.60 + GridBagConstraints gc = new GridBagConstraints();
56.61 + Insets fieldInsets = new Insets(0,5,5,0);
56.62 +
56.63 + gc.anchor = gc.NORTH;
56.64 + gc.fill = gc.HORIZONTAL;
56.65 + gc.gridx = 1;
56.66 + gc.gridy = 0;
56.67 + gc.weightx = 1;
56.68 + gc.ipadx = customIpadx;
56.69 + gc.ipady = customIpady;
56.70 + gc.insets = fieldInsets;
56.71 + jtf = new TextField();
56.72 + frame.add(jtf, gc);
56.73 +
56.74 + frame.pack();
56.75 + frame.setVisible(true);
56.76 +
56.77 + ((sun.awt.SunToolkit)Toolkit.getDefaultToolkit()).realSync();
56.78 +
56.79 + Dimension minSize = jtf.getMinimumSize();
56.80 + if ( minSize.width + customIpadx != jtf.getSize().width ||
56.81 + minSize.height + customIpady != jtf.getSize().height ){
56.82 + System.out.println("TextField originally has min size = " + jtf.getMinimumSize());
56.83 + System.out.println("TextField supplied with ipadx = 300, ipady =40");
56.84 + System.out.println("Frame size: " + frame.getSize());
56.85 + System.out.println(" Fields's size is "+jtf.getSize());
56.86 +
56.87 + throw new RuntimeException("Test Failed. TextField has incorrect width. ");
56.88 + }
56.89 + System.out.println("Test Passed.");
56.90 +
56.91 + }// start()
56.92 +}
57.1 --- a/test/java/awt/GridLayout/LayoutExtraGaps/LayoutExtraGaps.java Mon Jul 06 14:10:31 2009 -0400
57.2 +++ b/test/java/awt/GridLayout/LayoutExtraGaps/LayoutExtraGaps.java Thu Jul 09 13:53:05 2009 -0400
57.3 @@ -24,7 +24,8 @@
57.4 /*
57.5 @test
57.6 @bug 4370316
57.7 - @summary GridLayout does not fill its Container
57.8 + @summary GridLayout does not centre its component properly
57.9 + (summary was GridLayout does not fill its Container)
57.10 @library ../../regtesthelpers
57.11 @build Util
57.12 @author Andrei Dmitriev : area=awt.layout
57.13 @@ -90,27 +91,99 @@
57.14 setVisible(true);
57.15
57.16 Util.waitForIdle(Util.createRobot());
57.17 - Rectangle r1 = yellowPanel.getComponent(0).getBounds();
57.18 - Rectangle r2 = bluePanel.getComponent(0).getBounds();
57.19 - Rectangle r3 = blackPanel.getComponent(0).getBounds();
57.20 - Rectangle r4 = redPanel.getComponent(0).getBounds();
57.21
57.22 - System.out.println("firstHorizLabel bounds ="+r1);
57.23 - System.out.println("firstVertLabel bounds ="+r2);
57.24 - System.out.println("firstHorizLabel_RTL bounds ="+r3);
57.25 - System.out.println("firstVertLabel_RTL bounds ="+r4);
57.26 - if ((r1.getX() == 0 && r1.getY() == 0) ||
57.27 - (r2.getX() == 0 && r2.getY() == 0) ||
57.28 - (r3.getX() == 0 && r3.getY() == 0) ||
57.29 - // RTL only affects horizontal positioning and components lays out from top right corner
57.30 - (r4.getX() == blackPanel.getWidth() && r4.getY() == 0))
57.31 + if (isComponentCentredLTR(yellowPanel) && isComponentCentredLTR(bluePanel)
57.32 + && isComponentCentredLTR(blackPanel) && isComponentCentredRTL(redPanel))
57.33 {
57.34 + System.out.println("Test passed.");
57.35 + } else {
57.36 throw new RuntimeException("Test failed. GridLayout doesn't center component.");
57.37 - } else {
57.38 - System.out.println("Test passed.");
57.39 }
57.40 }
57.41
57.42 + /**
57.43 + * Checks if the components under Panel p are properly centred (i.e.
57.44 + * opposite borders between the Panel and component are equal). Panel p
57.45 + * must not be affect by RTL orientation (RTL only affects horizontal
57.46 + * positioning and components lay out from top right corner).
57.47 + *
57.48 + * @param p the panel where the components exist and is not affected
57.49 + * by right to left orientation
57.50 + * @return true if components of panel p are properly centre, false
57.51 + * otherwise
57.52 + */
57.53 + public static boolean isComponentCentredLTR(Panel p) {
57.54 + double borderLeft;
57.55 + double borderRight;
57.56 + double borderTop;
57.57 + double borderBottom;
57.58 +
57.59 + //The first component(rectangle) in panel p.
57.60 + Rectangle firstRec = p.getComponent(0).getBounds();
57.61 +
57.62 + //The last component(rectangle) in panel p.
57.63 + Rectangle lastRec = p.getComponent(compCount - 1).getBounds();
57.64 +
57.65 + System.out.println("bounds of the first rectangle in "+ p.getName() + " = " + firstRec);
57.66 + System.out.println("bounds of the last rectangle in "+ p.getName() + " = " + lastRec);
57.67 +
57.68 + borderLeft = firstRec.getX();
57.69 + borderRight = p.getWidth() - lastRec.getWidth() - lastRec.getX();
57.70 + borderTop = firstRec.getY();
57.71 + borderBottom = p.getHeight() - lastRec.getHeight() - lastRec.getY();
57.72 +
57.73 + return areBordersEqual(borderLeft, borderRight) &&
57.74 + areBordersEqual(borderTop, borderBottom);
57.75 + }
57.76 +
57.77 + /**
57.78 + * Checks if the components under Panel p are properly centred (i.e.
57.79 + * opposite borders between the Panel and component are equal). Panel p
57.80 + * must be affect by RTL orientation (RTL only affects horizontal positioning
57.81 + * and components lay out from top right corner).
57.82 + *
57.83 + * @param p the panel where the components exist and is affected by
57.84 + * right to left orientation
57.85 + * @return true if components of panel p are properly centre, false
57.86 + * otherwise
57.87 + */
57.88 + public static boolean isComponentCentredRTL(Panel p) {
57.89 + double borderLeft;
57.90 + double borderRight;
57.91 + double borderTop;
57.92 + double borderBottom;
57.93 +
57.94 + //The first component(rectangle) in panel p.
57.95 + Rectangle firstRec = p.getComponent(0).getBounds();
57.96 +
57.97 + //The last component(rectangle) in panel p.
57.98 + Rectangle lastRec = p.getComponent(compCount - 1).getBounds();
57.99 +
57.100 + System.out.println("bounds of the first rectangle in "+ p.getName() + " = " + firstRec);
57.101 + System.out.println("bounds of the last rectangle in "+ p.getName() + " = " + lastRec);
57.102 +
57.103 + borderLeft = lastRec.getX();
57.104 + borderRight = p.getWidth() - firstRec.getWidth() - firstRec.getX();
57.105 + borderTop = lastRec.getY();
57.106 + borderBottom = p.getHeight() - firstRec.getHeight() - firstRec.getY();
57.107 +
57.108 + return areBordersEqual(borderLeft, borderRight) &&
57.109 + areBordersEqual(borderTop, borderBottom);
57.110 + }
57.111 +
57.112 + /**
57.113 + * Given two borders border1 and border2 check if they are equal.
57.114 + *
57.115 + * @param border1 one of the borders being compared
57.116 + * @param border2 the other border being compared
57.117 + * @return true if border1 and border2 are equal to each other (i.e.
57.118 + * their width/height difference is at most 1, assuming the
57.119 + * smallest pixel is of size 1), false otherwise
57.120 + */
57.121 + public static boolean areBordersEqual(double border1, double border2) {
57.122 + return Math.abs(border1 - border2) <= 1;
57.123 + }
57.124 +
57.125 public static void main(String[] args) {
57.126 new LayoutExtraGaps();
57.127 }
58.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
58.2 +++ b/test/java/beans/XMLEncoder/Test6852574.java Thu Jul 09 13:53:05 2009 -0400
58.3 @@ -0,0 +1,58 @@
58.4 +/*
58.5 + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
58.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
58.7 + *
58.8 + * This code is free software; you can redistribute it and/or modify it
58.9 + * under the terms of the GNU General Public License version 2 only, as
58.10 + * published by the Free Software Foundation.
58.11 + *
58.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
58.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
58.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
58.15 + * version 2 for more details (a copy is included in the LICENSE file that
58.16 + * accompanied this code).
58.17 + *
58.18 + * You should have received a copy of the GNU General Public License version
58.19 + * 2 along with this work; if not, write to the Free Software Foundation,
58.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
58.21 + *
58.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
58.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
58.24 + * have any questions.
58.25 + */
58.26 +
58.27 +/*
58.28 + * @test
58.29 + * @bug 6852574
58.30 + * @summary Tests Enum subclass encoding
58.31 + * @author Sergey Malenkov
58.32 + */
58.33 +
58.34 +public final class Test6852574 extends AbstractTest {
58.35 + public static void main(String[] args) {
58.36 + new Test6852574().test(true);
58.37 + }
58.38 +
58.39 + protected Object getObject() {
58.40 + return Data.FIRST;
58.41 + }
58.42 +
58.43 + protected Object getAnotherObject() {
58.44 + return Data.SECOND;
58.45 + }
58.46 +
58.47 + public enum Data {
58.48 + FIRST {
58.49 + @Override
58.50 + public String toString() {
58.51 + return "1";
58.52 + }
58.53 + },
58.54 + SECOND {
58.55 + @Override
58.56 + public String toString() {
58.57 + return "2";
58.58 + }
58.59 + }
58.60 + }
58.61 +}
59.1 --- a/test/java/text/Bidi/Bug6850113.java Mon Jul 06 14:10:31 2009 -0400
59.2 +++ b/test/java/text/Bidi/Bug6850113.java Thu Jul 09 13:53:05 2009 -0400
59.3 @@ -24,6 +24,7 @@
59.4 * @test
59.5 * @bug 6850113
59.6 * @summary Verify the return value of digit() for some digits.
59.7 + * @compile -XDignore.symbol.file=true Bug6850113.java
59.8 */
59.9
59.10 import sun.text.normalizer.UCharacter;
60.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
60.2 +++ b/test/java/text/Format/DateFormat/Bug6609750.java Thu Jul 09 13:53:05 2009 -0400
60.3 @@ -0,0 +1,81 @@
60.4 +/*
60.5 + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
60.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
60.7 + *
60.8 + * This code is free software; you can redistribute it and/or modify it
60.9 + * under the terms of the GNU General Public License version 2 only, as
60.10 + * published by the Free Software Foundation.
60.11 + *
60.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
60.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
60.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
60.15 + * version 2 for more details (a copy is included in the LICENSE file that
60.16 + * accompanied this code).
60.17 + *
60.18 + * You should have received a copy of the GNU General Public License version
60.19 + * 2 along with this work; if not, write to the Free Software Foundation,
60.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
60.21 + *
60.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
60.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
60.24 + * have any questions.
60.25 + */
60.26 +
60.27 +/**
60.28 + * @test
60.29 + * @bug 6609750
60.30 + * @summary Make sure that SimpleDateFormat.format() formats years correctly.
60.31 + */
60.32 +import java.text.*;
60.33 +import java.util.*;
60.34 +
60.35 +public class Bug6609750 {
60.36 +
60.37 + public static void main(String[] args) {
60.38 + boolean error = false;
60.39 +
60.40 + Locale defaultLocale = Locale.getDefault();
60.41 + Locale.setDefault(Locale.US);
60.42 +
60.43 + Date[] dates = {
60.44 + new Date(9-1900, Calendar.JUNE, 12),
60.45 + new Date(99-1900, Calendar.JUNE, 12),
60.46 + new Date(999-1900, Calendar.JUNE, 12),
60.47 + new Date(2009-1900, Calendar.JUNE, 12),
60.48 + new Date(30009-1900, Calendar.JUNE, 12),
60.49 + };
60.50 +
60.51 + String[] patterns = {
60.52 + "y", "yy", "yyy", "yyyy", "yyyyy", "yyyyyy"
60.53 + };
60.54 + String[][] expectedResults = {
60.55 + {"9", "09", "009", "0009", "00009", "000009"},
60.56 + {"99", "99", "099", "0099", "00099", "000099"},
60.57 + {"999", "99", "999", "0999", "00999", "000999"},
60.58 + {"2009", "09", "2009", "2009", "02009", "002009"},
60.59 + {"30009", "09", "30009", "30009", "30009", "030009"},
60.60 + };
60.61 +
60.62 + SimpleDateFormat sdf = new SimpleDateFormat();
60.63 + for (int dateNo = 0; dateNo < dates.length; dateNo++) {
60.64 + Date date = dates[dateNo];
60.65 + for (int patternNo = 0; patternNo < patterns.length; patternNo++) {
60.66 + sdf.applyPattern(patterns[patternNo]);
60.67 + String got = sdf.format(date);
60.68 + if (!expectedResults[dateNo][patternNo].equals(got)) {
60.69 + error = true;
60.70 + System.err.println("Failed: Unexpected format result: " +
60.71 + "Expected: \"" + expectedResults[dateNo][patternNo] +
60.72 + "\", Got: \"" + got + "\" for date " + date +
60.73 + " with pattern \"" + patterns[patternNo] + "\"");
60.74 + }
60.75 + }
60.76 + }
60.77 +
60.78 + Locale.setDefault(defaultLocale);
60.79 + if (error) {
60.80 + throw new RuntimeException("SimpleDateFormat.format() error.");
60.81 + };
60.82 + }
60.83 +
60.84 +}
61.1 --- a/test/javax/swing/border/Test4856008.java Mon Jul 06 14:10:31 2009 -0400
61.2 +++ b/test/javax/swing/border/Test4856008.java Thu Jul 09 13:53:05 2009 -0400
61.3 @@ -35,6 +35,7 @@
61.4 import java.awt.Font;
61.5 import java.awt.Insets;
61.6
61.7 +import javax.swing.ActionMap;
61.8 import javax.swing.JComponent;
61.9 import javax.swing.JFileChooser;
61.10 import javax.swing.JLabel;
61.11 @@ -51,6 +52,7 @@
61.12 import javax.swing.border.MatteBorder;
61.13 import javax.swing.border.SoftBevelBorder;
61.14 import javax.swing.border.TitledBorder;
61.15 +import javax.swing.plaf.ActionMapUIResource;
61.16 import javax.swing.plaf.BorderUIResource;
61.17 import javax.swing.plaf.synth.SynthLookAndFeel;
61.18 import javax.swing.plaf.basic.BasicBorders;
61.19 @@ -59,7 +61,6 @@
61.20 import javax.swing.plaf.metal.MetalComboBoxEditor;
61.21
61.22 import sun.swing.plaf.synth.SynthFileChooserUI;
61.23 -import sun.tools.jconsole.BorderedComponent;
61.24
61.25 public class Test4856008 {
61.26 private static final JLabel LABEL = new JLabel();
61.27 @@ -133,11 +134,6 @@
61.28
61.29 //+ SynthFileChooserUI.UIBorder:
61.30 new SynthFileChooser().getUIBorder(),
61.31 -
61.32 - //+ BorderedComponent.FocusBorder:
61.33 - getBorder(false),
61.34 - //+ BorderedComponent.LabeledBorder:
61.35 - getBorder(true),
61.36 };
61.37
61.38 public static void main(String[] args) {
61.39 @@ -182,15 +178,6 @@
61.40 return LABEL;
61.41 }
61.42
61.43 - // This method is used to get the border from BorderedComponent
61.44 - private static Border getBorder(boolean labeled) {
61.45 - JComponent component = new BorderedComponent("4856008", null, true);
61.46 - CompoundBorder border = (CompoundBorder) component.getBorder();
61.47 - return labeled
61.48 - ? border.getInsideBorder()
61.49 - : border.getOutsideBorder();
61.50 - }
61.51 -
61.52 // This class is used to get the instance of BasicBorders.RolloverMarginBorder
61.53 private static class ToolBar extends BasicToolBarUI {
61.54 private Border getRolloverMarginBorder() {
61.55 @@ -224,6 +211,11 @@
61.56 }
61.57
61.58 @Override
61.59 + protected ActionMap createActionMap() {
61.60 + return new ActionMapUIResource();
61.61 + }
61.62 +
61.63 + @Override
61.64 public String getFileName() {
61.65 return this.name;
61.66 }
62.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
62.2 +++ b/test/javax/swing/plaf/nimbus/Test6849805.java Thu Jul 09 13:53:05 2009 -0400
62.3 @@ -0,0 +1,73 @@
62.4 +/*
62.5 + * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
62.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
62.7 + *
62.8 + * This code is free software; you can redistribute it and/or modify it
62.9 + * under the terms of the GNU General Public License version 2 only, as
62.10 + * published by the Free Software Foundation.
62.11 + *
62.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
62.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
62.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
62.15 + * version 2 for more details (a copy is included in the LICENSE file that
62.16 + * accompanied this code).
62.17 + *
62.18 + * You should have received a copy of the GNU General Public License version
62.19 + * 2 along with this work; if not, write to the Free Software Foundation,
62.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
62.21 + *
62.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
62.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
62.24 + * have any questions.
62.25 + */
62.26 +
62.27 +/* @test
62.28 + @bug 6849805
62.29 + @summary Tests NimbusLookAndFeel.deriveColor()
62.30 + @author Peter Zhelezniakov
62.31 + @run main Test6849805
62.32 +*/
62.33 +
62.34 +import java.awt.Color;
62.35 +
62.36 +
62.37 +public class Test6849805 {
62.38 +
62.39 + static boolean pass = true;
62.40 +
62.41 + static class Minimbus extends javax.swing.plaf.nimbus.NimbusLookAndFeel {
62.42 +
62.43 + public void test(Color c1, Color c2, float f) {
62.44 + Color r = getDerivedColor(c1, c2, f);
62.45 + Color test = (f > 0 ? c2 : c1);
62.46 + System.out.printf("Got %s, need %s ", r, test);
62.47 +
62.48 + if (r.getRGB() == test.getRGB() &&
62.49 + r.getAlpha() == test.getAlpha()) {
62.50 +
62.51 + System.out.println("Ok");
62.52 + } else {
62.53 + System.out.println("FAIL");
62.54 + pass = false;
62.55 + }
62.56 + }
62.57 + }
62.58 +
62.59 + public static void main(String[] args) {
62.60 + Minimbus laf = new Minimbus();
62.61 + laf.test(Color.WHITE, Color.BLACK, 0f);
62.62 + laf.test(Color.WHITE, Color.BLACK, 1f);
62.63 + laf.test(Color.BLACK, Color.WHITE, 0f);
62.64 + laf.test(Color.BLACK, Color.WHITE, 1f);
62.65 + laf.test(Color.RED, Color.GREEN, 0f);
62.66 + laf.test(Color.RED, Color.GREEN, 1f);
62.67 + laf.test(new Color(127, 127, 127), new Color(51, 151, 212), 0f);
62.68 + laf.test(new Color(127, 127, 127), new Color(51, 151, 212), 1f);
62.69 + laf.test(new Color(221, 63, 189), new Color(112, 200, 89), 0f);
62.70 + laf.test(new Color(221, 63, 189), new Color(112, 200, 89), 1f);
62.71 +
62.72 + if (! pass) {
62.73 + throw new RuntimeException("Some testcases failed, see above");
62.74 + }
62.75 + }
62.76 +}