--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m Mon Nov 09 17:15:07 2015 +0100
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m Mon Nov 09 09:05:20 2015 -0800
@@ -42,6 +42,7 @@
-(void) deliverResize: (NSRect) rect;
-(void) resetTrackingArea;
-(void) deliverJavaKeyEventHelper: (NSEvent*) event;
+-(BOOL) isCodePointInUnicodeBlockNeedingIMEvent: (unichar) codePoint;
@end
// Uncomment this line to see fprintfs of each InputMethod API being called on this View
@@ -509,6 +510,14 @@
}
}
+-(BOOL) isCodePointInUnicodeBlockNeedingIMEvent: (unichar) codePoint {
+ if ((codePoint >= 0x3000) && (codePoint <= 0x303F)) {
+ // Code point is in 'CJK Symbols and Punctuation' Unicode block.
+ return YES;
+ }
+ return NO;
+}
+
// NSAccessibility support
- (jobject)awtComponent:(JNIEnv*)env
{
@@ -889,8 +898,14 @@
// (i.e., when the user uses the Character palette or Inkwell), or when the string to insert is a complex
// Unicode value.
NSUInteger utf16Length = [aString lengthOfBytesUsingEncoding:NSUTF16StringEncoding];
+ NSUInteger utf8Length = [aString lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
+ BOOL aStringIsComplex = NO;
+ if ((utf16Length > 2) ||
+ ((utf8Length > 1) && [self isCodePointInUnicodeBlockNeedingIMEvent:[aString characterAtIndex:0]])) {
+ aStringIsComplex = YES;
+ }
- if ([self hasMarkedText] || !fProcessingKeystroke || (utf16Length > 2)) {
+ if ([self hasMarkedText] || !fProcessingKeystroke || aStringIsComplex) {
JNIEnv *env = [ThreadUtilities getJNIEnv];
static JNF_MEMBER_CACHE(jm_selectPreviousGlyph, jc_CInputMethod, "selectPreviousGlyph", "()V");
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/AWTFont.m Mon Nov 09 17:15:07 2015 +0100
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/font/AWTFont.m Mon Nov 09 09:05:20 2015 -0800
@@ -307,6 +307,8 @@
JNFCallVoidMethod(env, jthis,
jm_registerFont, jFontName, jFontFamilyName);
+ (*env)->DeleteLocalRef(env, jFontName);
+ (*env)->DeleteLocalRef(env, jFontFamilyName);
}
JNF_COCOA_EXIT(env);
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftSynthesizer.java Mon Nov 09 17:15:07 2015 +0100
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftSynthesizer.java Mon Nov 09 09:05:20 2015 -0800
@@ -671,6 +671,40 @@
actions.add(new PrivilegedAction<InputStream>() {
public InputStream run() {
if (System.getProperties().getProperty("os.name")
+ .startsWith("Linux")) {
+
+ File[] systemSoundFontsDir = new File[] {
+ /* Arch, Fedora, Mageia */
+ new File("/usr/share/soundfonts/"),
+ new File("/usr/local/share/soundfonts/"),
+ /* Debian, Gentoo, OpenSUSE, Ubuntu */
+ new File("/usr/share/sounds/sf2/"),
+ new File("/usr/local/share/sounds/sf2/"),
+ };
+
+ /*
+ * Look for a default.sf2
+ */
+ for (File systemSoundFontDir : systemSoundFontsDir) {
+ if (systemSoundFontDir.exists()) {
+ File defaultSoundFont = new File(systemSoundFontDir, "default.sf2");
+ if (defaultSoundFont.exists()) {
+ try {
+ return new FileInputStream(defaultSoundFont);
+ } catch (IOException e) {
+ // continue with lookup
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+ });
+
+ actions.add(new PrivilegedAction<InputStream>() {
+ public InputStream run() {
+ if (System.getProperties().getProperty("os.name")
.startsWith("Windows")) {
File gm_dls = new File(System.getenv("SystemRoot")
+ "\\system32\\drivers\\gm.dls");
--- a/jdk/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java Mon Nov 09 17:15:07 2015 +0100
+++ b/jdk/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java Mon Nov 09 09:05:20 2015 -0800
@@ -325,23 +325,6 @@
};
/**
- * The default strokes for initializing the default focus traversal keys.
- */
- private static final AWTKeyStroke[][] defaultFocusTraversalKeyStrokes = {
- {
- AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB, 0, false),
- AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB, InputEvent.CTRL_DOWN_MASK | InputEvent.CTRL_MASK, false),
- },
- {
- AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB, InputEvent.SHIFT_DOWN_MASK | InputEvent.SHIFT_MASK, false),
- AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB,
- InputEvent.SHIFT_DOWN_MASK | InputEvent.SHIFT_MASK | InputEvent.CTRL_DOWN_MASK | InputEvent.CTRL_MASK,
- false),
- },
- {},
- {},
- };
- /**
* The default focus traversal keys. Each array of traversal keys will be
* in effect on all Windows that have no such array of their own explicitly
* set. Each array will also be inherited, recursively, by any child
@@ -431,6 +414,27 @@
* Initializes a KeyboardFocusManager.
*/
public KeyboardFocusManager() {
+ AWTKeyStroke[][] defaultFocusTraversalKeyStrokes = {
+ {
+ AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB, 0, false),
+ AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB,
+ InputEvent.CTRL_DOWN_MASK |
+ InputEvent.CTRL_MASK, false),
+ },
+ {
+ AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB,
+ InputEvent.SHIFT_DOWN_MASK |
+ InputEvent.SHIFT_MASK, false),
+ AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB,
+ InputEvent.SHIFT_DOWN_MASK |
+ InputEvent.SHIFT_MASK |
+ InputEvent.CTRL_DOWN_MASK |
+ InputEvent.CTRL_MASK,
+ false),
+ },
+ {},
+ {},
+ };
for (int i = 0; i < TRAVERSAL_KEY_LENGTH; i++) {
Set<AWTKeyStroke> work_set = new HashSet<>();
for (int j = 0; j < defaultFocusTraversalKeyStrokes[i].length; j++) {
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java Mon Nov 09 17:15:07 2015 +0100
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java Mon Nov 09 09:05:20 2015 -0800
@@ -640,10 +640,6 @@
// check if we can scale to the requested size
Dimension canvas = ctx.canvasSize;
Insets insets = ctx.stretchingInsets;
- if (insets.left + insets.right > w || insets.top + insets.bottom > h) {
- return;
- }
-
if (w <= (canvas.width * ctx.maxHorizontalScaleFactor) && h <= (canvas.height * ctx.maxVerticalScaleFactor)) {
// get image at canvas size
VolatileImage img = getImage(g.getDeviceConfiguration(), c, canvas.width, canvas.height, extendedCacheKeys);
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/nimbus/skin.laf Mon Nov 09 17:15:07 2015 +0100
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/nimbus/skin.laf Mon Nov 09 09:05:20 2015 -0800
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
@@ -16195,6 +16195,10 @@
<dimension width="150" height="19"/>
</uiProperty>
<uiProperty name="cycleTime" type="INT" value="250"/>
+ <uiProperty name="minBarSize" type="DIMENSION">
+ <dimension width="6" height="6"/>
+ </uiProperty>
+ <uiProperty name="glowWidth" type="INT" value="2"/>
</uiproperties>
</style>
<backgroundStates>
@@ -16351,7 +16355,7 @@
<canvas>
<size width="27" height="19"/>
<nextLayerNameIndex>2</nextLayerNameIndex>
- <stretchingInsets top="5" bottom="5" left="5" right="5"/>
+ <stretchingInsets top="3" bottom="3" left="3" right="3"/>
<layer name="Layer 1">
<opacity>1.0</opacity>
<fillOpacity>1.0</fillOpacity>
@@ -16444,7 +16448,7 @@
<canvas>
<size width="27" height="19"/>
<nextLayerNameIndex>2</nextLayerNameIndex>
- <stretchingInsets top="5" bottom="5" left="5" right="5"/>
+ <stretchingInsets top="3" bottom="3" left="3" right="3"/>
<layer name="Layer 1">
<opacity>1.0</opacity>
<fillOpacity>1.0</fillOpacity>
@@ -16528,7 +16532,7 @@
<canvas>
<size width="30" height="13"/>
<nextLayerNameIndex>2</nextLayerNameIndex>
- <stretchingInsets top="5" bottom="5" left="5" right="5"/>
+ <stretchingInsets top="3" bottom="3" left="3" right="3"/>
<layer name="Layer 1">
<opacity>1.0</opacity>
<fillOpacity>1.0</fillOpacity>
@@ -16619,7 +16623,7 @@
<canvas>
<size width="27" height="19"/>
<nextLayerNameIndex>2</nextLayerNameIndex>
- <stretchingInsets top="5" bottom="5" left="5" right="5"/>
+ <stretchingInsets top="3" bottom="3" left="3" right="3"/>
<layer name="Layer 1">
<opacity>1.0</opacity>
<fillOpacity>1.0</fillOpacity>
@@ -16701,7 +16705,7 @@
<canvas>
<size width="27" height="19"/>
<nextLayerNameIndex>2</nextLayerNameIndex>
- <stretchingInsets top="5" bottom="5" left="5" right="5"/>
+ <stretchingInsets top="3" bottom="3" left="3" right="3"/>
<layer name="Layer 1">
<opacity>1.0</opacity>
<fillOpacity>1.0</fillOpacity>
@@ -16785,7 +16789,7 @@
<canvas>
<size width="30" height="13"/>
<nextLayerNameIndex>2</nextLayerNameIndex>
- <stretchingInsets top="5" bottom="5" left="5" right="5"/>
+ <stretchingInsets top="3" bottom="3" left="3" right="3"/>
<layer name="Layer 1">
<opacity>1.0</opacity>
<fillOpacity>1.0</fillOpacity>
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java Mon Nov 09 17:15:07 2015 +0100
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java Mon Nov 09 09:05:20 2015 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -49,6 +49,8 @@
private boolean paintOutsideClip;
private boolean tileWhenIndeterminate; //whether to tile indeterminate painting
private int tileWidth; //the width of each tile
+ private Dimension minBarSize; // minimal visible bar size
+ private int glowWidth; // Glow around the bar foreground
/**
* Creates a new UI object for the given component.
@@ -114,6 +116,8 @@
tileWidth *= 0.784;
}
}
+ minBarSize = (Dimension)style.get(context, "ProgressBar.minBarSize");
+ glowWidth = style.getInt(context, "ProgressBar.glowWidth", 0);
context.dispose();
}
@@ -258,7 +262,7 @@
if (!SynthLookAndFeel.isLeftToRight(pBar)) {
x = pBar.getWidth() - pBarInsets.right - width
- - progressPadding;
+ - progressPadding - glowWidth;
}
} else { // JProgressBar.VERTICAL
x = pBarInsets.left + progressPadding;
@@ -271,9 +275,9 @@
y = pBar.getHeight() - pBarInsets.bottom - height
- progressPadding;
- // When the progress bar is vertical we always paint
- // from bottom to top, not matter what the component
- // orientation is.
+ if (SynthLookAndFeel.isLeftToRight(pBar)) {
+ y -= glowWidth;
+ }
}
}
} else {
@@ -307,8 +311,11 @@
}
g.setClip(clip);
} else {
- context.getPainter().paintProgressBarForeground(context, g,
- x, y, width, height, pBar.getOrientation());
+ if (minBarSize == null || (width >= minBarSize.width
+ && height >= minBarSize.height)) {
+ context.getPainter().paintProgressBarForeground(context, g,
+ x, y, width, height, pBar.getOrientation());
+ }
}
if (pBar.isStringPainted()) {
--- a/jdk/src/java.desktop/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java Mon Nov 09 17:15:07 2015 +0100
+++ b/jdk/src/java.desktop/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java Mon Nov 09 09:05:20 2015 -0800
@@ -42,8 +42,10 @@
private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.awt.focus.KeyboardFocusManagerPeerImpl");
- private static AWTAccessor.KeyboardFocusManagerAccessor kfmAccessor =
- AWTAccessor.getKeyboardFocusManagerAccessor();
+ private static class KfmAccessor {
+ private static AWTAccessor.KeyboardFocusManagerAccessor instance =
+ AWTAccessor.getKeyboardFocusManagerAccessor();
+ }
// The constants are copied from java.awt.KeyboardFocusManager
public static final int SNFH_FAILURE = 0;
@@ -152,12 +154,13 @@
long time,
CausedFocusEvent.Cause cause)
{
- return kfmAccessor.shouldNativelyFocusHeavyweight(
- heavyweight, descendant, temporary, focusedWindowChangeAllowed, time, cause);
+ return KfmAccessor.instance.shouldNativelyFocusHeavyweight(
+ heavyweight, descendant, temporary, focusedWindowChangeAllowed,
+ time, cause);
}
public static void removeLastFocusRequest(Component heavyweight) {
- kfmAccessor.removeLastFocusRequest(heavyweight);
+ KfmAccessor.instance.removeLastFocusRequest(heavyweight);
}
// WARNING: Don't call it on the Toolkit thread.
@@ -167,7 +170,8 @@
boolean focusedWindowChangeAllowed,
long time)
{
- return kfmAccessor.processSynchronousLightweightTransfer(
- heavyweight, descendant, temporary, focusedWindowChangeAllowed, time);
+ return KfmAccessor.instance.processSynchronousLightweightTransfer(
+ heavyweight, descendant, temporary, focusedWindowChangeAllowed,
+ time);
}
}
--- a/jdk/src/java.desktop/share/classes/sun/awt/OSInfo.java Mon Nov 09 17:15:07 2015 +0100
+++ b/jdk/src/java.desktop/share/classes/sun/awt/OSInfo.java Mon Nov 09 09:05:20 2015 -0800
@@ -71,7 +71,7 @@
windowsVersionMap.put(WINDOWS_XP.toString(), WINDOWS_XP);
windowsVersionMap.put(WINDOWS_2003.toString(), WINDOWS_2003);
windowsVersionMap.put(WINDOWS_VISTA.toString(), WINDOWS_VISTA);
- windowsVersionMap.put(WINDOWS_VISTA.toString(), WINDOWS_7);
+ windowsVersionMap.put(WINDOWS_7.toString(), WINDOWS_7);
}
private static final PrivilegedAction<OSType> osTypeAction = new PrivilegedAction<OSType>() {
--- a/jdk/src/java.desktop/share/classes/sun/print/PrintJob2D.java Mon Nov 09 17:15:07 2015 +0100
+++ b/jdk/src/java.desktop/share/classes/sun/print/PrintJob2D.java Mon Nov 09 09:05:20 2015 -0800
@@ -631,7 +631,7 @@
String printerName = jobAttributes.getPrinter();
if (printerName != null && printerName != ""
- && !printerName.equals(pServ.getName())) {
+ && pServ != null && !printerName.equals(pServ.getName())) {
// Search for the given printerName in the list of PrintServices
PrintService []services = PrinterJob.lookupPrintServices();
@@ -648,7 +648,7 @@
}
DestinationType dest = jobAttributes.getDestination();
- if (dest == DestinationType.FILE &&
+ if (dest == DestinationType.FILE && pServ != null &&
pServ.isAttributeCategorySupported(Destination.class)) {
String fileName = jobAttributes.getFileName();
--- a/jdk/src/java.desktop/share/native/libfontmanager/freetypeScaler.c Mon Nov 09 17:15:07 2015 +0100
+++ b/jdk/src/java.desktop/share/native/libfontmanager/freetypeScaler.c Mon Nov 09 09:05:20 2015 -0800
@@ -103,7 +103,6 @@
}
static void freeNativeResources(JNIEnv *env, FTScalerInfo* scalerInfo) {
- void *stream;
if (scalerInfo == NULL)
return;
--- a/jdk/src/java.desktop/unix/classes/sun/print/IPPPrintService.java Mon Nov 09 17:15:07 2015 +0100
+++ b/jdk/src/java.desktop/unix/classes/sun/print/IPPPrintService.java Mon Nov 09 09:05:20 2015 -0800
@@ -321,7 +321,11 @@
if ((name == null) || (url == null)){
throw new IllegalArgumentException("null uri or printer name");
}
- printer = name;
+ try {
+ printer = java.net.URLDecoder.decode(name, "UTF-8");
+ } catch (java.io.UnsupportedEncodingException e) {
+ printer = name;
+ }
supportedDocFlavors = null;
supportedCats = null;
mediaSizeNames = null;
@@ -351,7 +355,11 @@
if ((name == null) || (uriStr == null)){
throw new IllegalArgumentException("null uri or printer name");
}
- printer = name;
+ try {
+ printer = java.net.URLDecoder.decode(name, "UTF-8");
+ } catch (java.io.UnsupportedEncodingException e) {
+ printer = name;
+ }
supportedDocFlavors = null;
supportedCats = null;
mediaSizeNames = null;
--- a/jdk/src/java.desktop/unix/native/common/awt/fontpath.c Mon Nov 09 17:15:07 2015 +0100
+++ b/jdk/src/java.desktop/unix/native/common/awt/fontpath.c Mon Nov 09 09:05:20 2015 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -178,6 +178,7 @@
"()Z");
JNU_CHECK_EXCEPTION_RETURN(env, JNI_FALSE);
isLocal = (*env)->CallBooleanMethod(env, ge, isDisplayLocal);
+ JNU_CHECK_EXCEPTION_RETURN(env, JNI_FALSE);
} else {
isLocal = True;
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/PrintJob/PrinterException.java Mon Nov 09 09:05:20 2015 -0800
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * @test
+ * @bug 7161283
+ * @summary Toolkit.getPrintJob throws NPE if no printer available
+ * @run main PrinterException
+ */
+import java.awt.Frame;
+import java.awt.JobAttributes;
+import java.awt.PrintJob;
+import java.awt.Toolkit;
+
+public class PrinterException {
+ public static void main(String[] args) {
+ Toolkit tk = Toolkit.getDefaultToolkit();
+ PrintJob pj = null;
+
+ int[][] pageRange = new int[][]{new int[]{1,1}};
+ JobAttributes ja = new JobAttributes(1,
+ java.awt.JobAttributes.DefaultSelectionType.ALL,
+ JobAttributes.DestinationType.FILE, JobAttributes.DialogType.NATIVE,
+ "", Integer.MAX_VALUE, 1,
+ JobAttributes.MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES,
+ pageRange, "", JobAttributes.SidesType.ONE_SIDED);
+ Frame testFrame = new Frame("print");
+ if (tk != null) {
+ pj = tk.getPrintJob(testFrame, null, ja, null);
+ }
+ }
+}
--- a/jdk/test/java/awt/applet/Applet/AppletFlipBuffer.java Mon Nov 09 17:15:07 2015 +0100
+++ b/jdk/test/java/awt/applet/Applet/AppletFlipBuffer.java Mon Nov 09 09:05:20 2015 -0800
@@ -21,35 +21,72 @@
* questions.
*/
-/* @test
- @bug 8130390
- @summary Applet fails to launch on virtual desktop
- @author Semyon Sadetsky
- */
+import java.applet.Applet;
+import java.awt.AWTException;
+import java.awt.BufferCapabilities;
+import java.awt.BufferCapabilities.FlipContents;
+import java.awt.Frame;
+import java.awt.ImageCapabilities;
+import java.util.HashSet;
+import java.util.Set;
import sun.awt.AWTAccessor;
+import sun.awt.AWTAccessor.ComponentAccessor;
-import java.applet.Applet;
-import java.awt.*;
+import static java.awt.BufferCapabilities.FlipContents.BACKGROUND;
+import static java.awt.BufferCapabilities.FlipContents.COPIED;
+import static java.awt.BufferCapabilities.FlipContents.PRIOR;
+import static java.awt.BufferCapabilities.FlipContents.UNDEFINED;
+
+/**
+ * @test
+ * @bug 8130390 8134732
+ * @summary Applet fails to launch on virtual desktop
+ * @modules java.desktop/sun.awt
+ * @author Semyon Sadetsky
+ */
+public final class AppletFlipBuffer {
-public class AppletFlipBuffer {
- public static void main(String[] args) throws Exception {
+ static final ImageCapabilities[] ics = {new ImageCapabilities(true),
+ new ImageCapabilities(false)};
+ static final FlipContents[] cntx = {UNDEFINED, BACKGROUND, PRIOR, COPIED};
+ static final Set<BufferCapabilities> bcs = new HashSet<>();
+
+ static {
+ for (final ImageCapabilities icFront : ics) {
+ for (final ImageCapabilities icBack : ics) {
+ for (final FlipContents cnt : cntx) {
+ bcs.add(new BufferCapabilities(icFront, icBack, cnt));
+ }
+ }
+ }
+ }
+
+ public static void main(final String[] args) throws Exception {
Applet applet = new Applet();
- AWTAccessor.ComponentAccessor componentAccessor
- = AWTAccessor.getComponentAccessor();
- BufferCapabilities caps = new BufferCapabilities(
- new ImageCapabilities(true), new ImageCapabilities(true),
- BufferCapabilities.FlipContents.BACKGROUND);
Frame frame = new Frame();
try {
+ frame.setSize(10, 10);
frame.add(applet);
frame.setUndecorated(true);
frame.setVisible(true);
- componentAccessor.createBufferStrategy(applet, 2, caps);
+ test(applet);
System.out.println("ok");
- }
- finally {
+ } finally {
frame.dispose();
}
}
+
+ private static void test(final Applet applet) {
+ ComponentAccessor acc = AWTAccessor.getComponentAccessor();
+ for (int i = 1; i < 10; ++i) {
+ for (final BufferCapabilities caps : bcs) {
+ try {
+ acc.createBufferStrategy(applet, i, caps);
+ } catch (final AWTException ignored) {
+ // this kind of buffer strategy is not supported
+ }
+ }
+ }
+ }
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/font/JNICheck/JNICheck.java Mon Nov 09 09:05:20 2015 -0800
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+
+public class JNICheck {
+ public static void main(String[] args) throws Exception {
+ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/font/JNICheck/JNICheck.sh Mon Nov 09 09:05:20 2015 -0800
@@ -0,0 +1,61 @@
+#!/bin/ksh -p
+#
+# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+#
+# @test
+# @bug 6430247 8130507 8020448
+# @summary Tests that there are no JNI warnings.
+# @compile JNICheck.java
+# @run shell/timeout=300 JNICheck.sh
+#
+OS=`uname`
+
+# pick up the compiled class files.
+if [ -z "${TESTCLASSES}" ]; then
+ CP="."
+else
+ CP="${TESTCLASSES}"
+fi
+
+if [ $OS != SunOS -a $OS != Linux ]
+then
+ exit 0
+fi
+
+if [ -z "${TESTJAVA}" ] ; then
+ JAVA_HOME=../../../../../build/solaris-sparc
+else
+ JAVA_HOME=$TESTJAVA
+fi
+
+$JAVA_HOME/bin/java ${TESTVMOPTS} \
+ -cp "${CP}" -Xcheck:jni JNICheck > "${CP}"/log.txt
+
+# any messages logged may indicate a failure.
+if [ -s "${CP}"/log.txt ]; then
+ echo "Test failed"
+ exit 1
+fi
+
+echo "Test passed"
+exit 0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/font/JNICheck/LoadFontsJNICheck.java Mon Nov 09 09:05:20 2015 -0800
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+public class LoadFontsJNICheck {
+ public static void main(String[] args) throws Exception {
+ java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/font/JNICheck/LoadFontsJNICheck.sh Mon Nov 09 09:05:20 2015 -0800
@@ -0,0 +1,62 @@
+#!/bin/sh
+#
+# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+
+#
+# @test
+# @bug 8138817
+# @summary Tests that there are no JNI warnings about local references.
+# @compile LoadFontsJNICheck.java
+# @run shell/timeout=300 LoadFontsJNICheck.sh
+#
+OS=`uname`
+
+# pick up the compiled class files.
+if [ -z "${TESTCLASSES}" ]; then
+ CP="."
+else
+ CP="${TESTCLASSES}"
+fi
+
+if [ $OS != Darwin ]
+then
+ exit 0
+fi
+
+if [ -z "${TESTJAVA}" ] ; then
+ JAVACMD=java
+else
+ JAVACMD=$TESTJAVA/bin/java
+fi
+
+$JAVACMD ${TESTVMOPTS} \
+ -cp "${CP}" -Xcheck:jni LoadFontsJNICheck | grep "local refs" > "${CP}"/log.txt
+
+# any messages logged may indicate a failure.
+if [ -s "${CP}"/log.txt ]; then
+ echo "Test failed"
+ cat "${CP}"/log.txt
+ exit 1
+fi
+
+echo "Test passed"
+exit 0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/im/8132503/bug8132503.html Mon Nov 09 09:05:20 2015 -0800
@@ -0,0 +1,38 @@
+<!--
+ Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<html>
+<body>
+Verify that Chinese full stop symbol can be entered in JTextArea with Pinyin input method (IM).
+
+This test is for OS X only. For other platforms please simply press "Pass".
+
+1. Go to "System Preferences -> Keyboard -> Input Sources" and add "Pinyin – Traditional" or "Pinyin – Simplified" IM from Chinese language group.
+2. Set current IM to "Pinyin".
+3. Set focus to the text area of the test and press "dot" character on the keyboard.
+4. Set current IM to the IM used before "Pinyin" was set.
+5. If "。" character is displayed in the text area, press "Pass", if "." character is displayed, press "Fail".
+
+<applet code="bug8132503.class" width=400 height=400></applet>
+</body>
+</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/im/8132503/bug8132503.java Mon Nov 09 09:05:20 2015 -0800
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ @bug 8132503
+ @summary [macosx] Chinese full stop symbol cannot be entered with Pinyin IM on OS X
+ @author Anton Litvinov
+ @run applet/manual=yesno bug8132503.html
+ */
+
+import javax.swing.JApplet;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+
+public class bug8132503 extends JApplet {
+ @Override
+ public void init() {
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ JTextArea textArea = new JTextArea("Text area of the test.", 40, 40);
+ add(new JScrollPane(textArea));
+ }
+ });
+ }
+}
--- a/jdk/test/java/awt/print/PrinterJob/PaintText.java Mon Nov 09 17:15:07 2015 +0100
+++ b/jdk/test/java/awt/print/PrinterJob/PaintText.java Mon Nov 09 09:05:20 2015 -0800
@@ -75,8 +75,8 @@
f.show();
/* Non-jtreg execution will display the dialog */
- if (System.getProperty("test.java") == null) {
- if (!pjob.printDialog()) {
+ if (System.getProperty("test.jdk") == null) {
+ if (!pjob.printDialog()) {
return;
}
}
@@ -84,6 +84,8 @@
pjob.print();
} catch (PrinterException e) {
throw new RuntimeException(e.getMessage());
+ } finally {
+ f.dispose();
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/LookAndFeel/8138881/TestOSVersion.java Mon Nov 09 09:05:20 2015 -0800
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8138881
+ * @summary typo in OSInfo.java
+ * @modules java.desktop/sun.awt
+ * @requires (os.family == "windows")
+ * @run main TestOSVersion
+ */
+
+import sun.awt.OSInfo;
+
+public class TestOSVersion {
+
+ private static final String WIN_VISTA_VERSION = "6.0";
+
+ public static void main(String[] arg) {
+
+ String oSVersion = System.getProperty("os.version");
+ if (WIN_VISTA_VERSION.equals(oSVersion)) {
+ if (OSInfo.getWindowsVersion().toString().equals("6.1") ) {
+ throw new RuntimeException("Incorrect Windows VISTA OS version "
+ + "in OSInfo");
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/plaf/metal/MetalUtils/bug6190373.java Mon Nov 09 09:05:20 2015 -0800
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Graphics;
+import java.awt.image.BufferedImage;
+import java.util.concurrent.CyclicBarrier;
+
+import javax.swing.JButton;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
+
+import sun.awt.AppContext;
+import sun.awt.SunToolkit;
+
+import static javax.swing.UIManager.getInstalledLookAndFeels;
+
+/**
+ * @test
+ * @bug 6190373
+ * @summary Tests 6190373
+ * @author Scott Violet
+ * @modules java.desktop/sun.awt
+ */
+public final class bug6190373 {
+
+ private static AppContext app1;
+ private static AppContext app2;
+ private static final int LOOP_COUNT = 10000;
+ private static final CyclicBarrier barrier = new CyclicBarrier(2);
+
+ public static void main(final String[] args) throws Exception {
+ final Thread t1 = new Thread(new ThreadGroup("firstGroup"), () -> {
+ app1 = SunToolkit.createNewAppContext();
+ test(true);
+ });
+ final Thread t2 = new Thread(new ThreadGroup("secondGroup"), () -> {
+ app2 = SunToolkit.createNewAppContext();
+ test(false);
+ });
+
+ t1.start();
+ t2.start();
+ t1.join();
+ t2.join();
+ app1.dispose();
+ app2.dispose();
+ }
+
+ private static void test(final boolean lock) {
+ for (final UIManager.LookAndFeelInfo laf : getInstalledLookAndFeels()) {
+ try {
+ SwingUtilities.invokeAndWait(() -> setLookAndFeel(laf));
+ barrier.await();
+ SwingUtilities.invokeAndWait(() -> slam(lock));
+ barrier.await();
+ } catch (final Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ private static void slam(final boolean lock) {
+ JButton button = new JButton("HI");
+ button.setSize(100, 100);
+ BufferedImage image = new BufferedImage(100, 100,
+ BufferedImage.TYPE_INT_RGB);
+ for (int i = 0; i < LOOP_COUNT; i++) {
+ Graphics g = image.getGraphics();
+ if (lock) {
+ synchronized (button.getTreeLock()) {
+ button.paint(g);
+ }
+ } else {
+ button.paint(g);
+ }
+ g.dispose();
+ }
+ }
+
+ private static void setLookAndFeel(final UIManager.LookAndFeelInfo laf) {
+ try {
+ UIManager.setLookAndFeel(laf.getClassName());
+ System.out.println("LookAndFeel: " + laf.getClassName());
+ } catch (ClassNotFoundException | InstantiationException |
+ UnsupportedLookAndFeelException | IllegalAccessException e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/plaf/nimbus/8041642/ScrollBarThumbVisibleTest.java Mon Nov 09 09:05:20 2015 -0800
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ @bug 8134828
+ @summary Scrollbar thumb disappears with Nimbus L&F
+ @author Semyon Sadetsky
+*/
+
+import javax.swing.*;
+import java.awt.*;
+
+public class ScrollBarThumbVisibleTest
+{
+ private static JFrame frame;
+ private static Point point;
+ private static JScrollBar bar;
+
+ public static void main(String[] args) throws Exception {
+ for (UIManager.LookAndFeelInfo info : UIManager
+ .getInstalledLookAndFeels()) {
+ if ("Nimbus".equals(info.getName())) {
+ try {
+ UIManager.setLookAndFeel(info.getClassName());
+ } catch (Exception ex) {
+ }
+ break;
+ }
+ }
+ try {
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame = new JFrame();
+ frame.setUndecorated(true);
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ setup(frame);
+ }
+ });
+ final Robot robot = new Robot();
+ robot.delay(200);
+ robot.waitForIdle();
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ point = bar.getLocationOnScreen();
+ }
+ });
+ Color color1 = robot.getPixelColor(point.x + 48, point.y + 55);
+ Color color2 = robot.getPixelColor(point.x + 48, point.y + 125);
+ System.out.println(color1);
+ System.out.println(color2);
+ if (color1.equals(color2)) {
+ throw new RuntimeException("Thump is not visible");
+ }
+ } finally {
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ frame.dispose();
+ }
+ });
+ }
+ System.out.println("ok");
+ }
+
+ static void setup(JFrame frame) {
+ bar = new JScrollBar(Adjustable.VERTICAL, 500, 0, 0, 1000);
+ frame.getContentPane().add(bar);
+ frame.setSize(50, 250);
+ frame.setLocation(100, 100);
+ frame.setVisible(true);
+ }
+}