提交 3304a305 编写于 作者: L lana

Merge

......@@ -224,3 +224,5 @@ c4908732fef5235f1b98cafe0ce507771ef7892c jdk8-b98
5be9c5bfcfe9b2a40412b4fb364377d49de014eb jdk8-b100
6901612328239fbd471d20823113c1cf3fdaebee jdk8-b101
8ed8e2b4b90e0ac9aa5b3efef51cd576a9db96a9 jdk8-b102
e0f6039c0290b7381042a6fec3100a69a5a67e37 jdk8-b103
f1d8d15bfcb5ada858a942f8a31f6598f23214d1 jdk8-b104
......@@ -296,7 +296,7 @@ static unichar AWTKeyToMacShortcut(jint awtKey, BOOL doShift) {
case java_awt_event_KeyEvent_VK_HELP : macKey = NSHelpFunctionKey; break;
case java_awt_event_KeyEvent_VK_TAB : macKey = NSTabCharacter; break;
case java_awt_event_KeyEvent_VK_ENTER : macKey = NSCarriageReturnCharacter; break;
case java_awt_event_KeyEvent_VK_ENTER : macKey = NSNewlineCharacter; break;
case java_awt_event_KeyEvent_VK_BACK_SPACE : macKey = NSBackspaceCharacter; break;
case java_awt_event_KeyEvent_VK_DELETE : macKey = NSDeleteCharacter; break;
case java_awt_event_KeyEvent_VK_CLEAR : macKey = NSClearDisplayFunctionKey; break;
......
......@@ -25,6 +25,8 @@
package com.sun.media.sound;
import java.util.Arrays;
import javax.sound.sampled.*;
/**
......@@ -46,11 +48,11 @@ public final class DataPusher implements Runnable {
private final AudioFormat format;
// stream as source data
private AudioInputStream ais = null;
private final AudioInputStream ais;
// byte array as source data
private byte[] audioData = null;
private int audioDataByteLength = 0;
private final byte[] audioData;
private final int audioDataByteLength;
private int pos;
private int newPos = -1;
private boolean looping;
......@@ -67,16 +69,22 @@ public final class DataPusher implements Runnable {
private final int BUFFER_SIZE = 16384;
public DataPusher(SourceDataLine sourceLine, AudioFormat format, byte[] audioData, int byteLength) {
this.audioData = audioData;
this.audioDataByteLength = byteLength;
this.format = format;
this.source = sourceLine;
this(sourceLine, format, null, audioData, byteLength);
}
public DataPusher(SourceDataLine sourceLine, AudioInputStream ais) {
this(sourceLine, ais.getFormat(), ais, null, 0);
}
private DataPusher(final SourceDataLine source, final AudioFormat format,
final AudioInputStream ais, final byte[] audioData,
final int audioDataByteLength) {
this.source = source;
this.format = format;
this.ais = ais;
this.format = ais.getFormat();
this.source = sourceLine;
this.audioDataByteLength = audioDataByteLength;
this.audioData = audioData == null ? null : Arrays.copyOf(audioData,
audioData.length);
}
public synchronized void start() {
......
......@@ -24,6 +24,8 @@
*/
package com.sun.media.sound;
import java.util.Arrays;
/**
* A standard director who chooses performers
* by there keyfrom,keyto,velfrom,velto properties.
......@@ -32,17 +34,16 @@ package com.sun.media.sound;
*/
public final class ModelStandardDirector implements ModelDirector {
ModelPerformer[] performers;
ModelDirectedPlayer player;
boolean noteOnUsed = false;
boolean noteOffUsed = false;
private final ModelPerformer[] performers;
private final ModelDirectedPlayer player;
private boolean noteOnUsed = false;
private boolean noteOffUsed = false;
public ModelStandardDirector(ModelPerformer[] performers,
ModelDirectedPlayer player) {
this.performers = performers;
public ModelStandardDirector(final ModelPerformer[] performers,
final ModelDirectedPlayer player) {
this.performers = Arrays.copyOf(performers, performers.length);
this.player = player;
for (int i = 0; i < performers.length; i++) {
ModelPerformer p = performers[i];
for (final ModelPerformer p : this.performers) {
if (p.isReleaseTriggered()) {
noteOffUsed = true;
} else {
......
......@@ -24,6 +24,8 @@
*/
package com.sun.media.sound;
import java.util.Arrays;
/**
* A standard indexed director who chooses performers
* by there keyfrom,keyto,velfrom,velto properties.
......@@ -32,22 +34,21 @@ package com.sun.media.sound;
*/
public final class ModelStandardIndexedDirector implements ModelDirector {
ModelPerformer[] performers;
ModelDirectedPlayer player;
boolean noteOnUsed = false;
boolean noteOffUsed = false;
private final ModelPerformer[] performers;
private final ModelDirectedPlayer player;
private boolean noteOnUsed = false;
private boolean noteOffUsed = false;
// Variables needed for index
byte[][] trantables;
int[] counters;
int[][] mat;
private byte[][] trantables;
private int[] counters;
private int[][] mat;
public ModelStandardIndexedDirector(ModelPerformer[] performers,
ModelDirectedPlayer player) {
this.performers = performers;
public ModelStandardIndexedDirector(final ModelPerformer[] performers,
final ModelDirectedPlayer player) {
this.performers = Arrays.copyOf(performers, performers.length);
this.player = player;
for (int i = 0; i < performers.length; i++) {
ModelPerformer p = performers[i];
for (final ModelPerformer p : this.performers) {
if (p.isReleaseTriggered()) {
noteOffUsed = true;
} else {
......
......@@ -38,7 +38,7 @@ import javax.sound.sampled.LineEvent;
import javax.sound.sampled.LineUnavailableException;
/**
* Clip implemention for the SoftMixingMixer.
* Clip implementation for the SoftMixingMixer.
*
* @author Karl Helgason
*/
......@@ -357,7 +357,9 @@ public final class SoftMixingClip extends SoftMixingDataLine implements Clip {
throw new IllegalArgumentException(
"Buffer size does not represent an integral number of sample frames!");
this.data = data;
if (data != null) {
this.data = Arrays.copyOf(data, data.length);
}
this.offset = offset;
this.bufferSize = bufferSize;
this.format = format;
......
......@@ -2426,7 +2426,8 @@ public abstract class KeyboardFocusManager
focusLog.finest("Request {0}", String.valueOf(hwFocusRequest));
}
if (hwFocusRequest == null &&
heavyweight == nativeFocusOwner)
heavyweight == nativeFocusOwner &&
heavyweight.getContainingWindow() == nativeFocusedWindow)
{
if (descendant == currentFocusOwner) {
// Redundant request.
......
......@@ -25,6 +25,8 @@
package javax.sound.sampled;
import java.util.Arrays;
/**
* <code>DataLine</code> adds media-related functionality to its
* superinterface, <code>{@link Line}</code>. This functionality includes
......@@ -282,9 +284,9 @@ public interface DataLine extends Line {
*/
public static class Info extends Line.Info {
private AudioFormat[] formats;
private int minBufferSize;
private int maxBufferSize;
private final AudioFormat[] formats;
private final int minBufferSize;
private final int maxBufferSize;
/**
* Constructs a data line's info object from the specified information,
......@@ -304,7 +306,7 @@ public interface DataLine extends Line {
if (formats == null) {
this.formats = new AudioFormat[0];
} else {
this.formats = formats;
this.formats = Arrays.copyOf(formats, formats.length);
}
this.minBufferSize = minBufferSize;
......@@ -329,8 +331,7 @@ public interface DataLine extends Line {
if (format == null) {
this.formats = new AudioFormat[0];
} else {
AudioFormat[] formats = { format };
this.formats = formats;
this.formats = new AudioFormat[]{format};
}
this.minBufferSize = bufferSize;
......@@ -373,10 +374,7 @@ public interface DataLine extends Line {
* @see #isFormatSupported(AudioFormat)
*/
public AudioFormat[] getFormats() {
AudioFormat[] returnedArray = new AudioFormat[formats.length];
System.arraycopy(formats, 0, returnedArray, 0, formats.length);
return returnedArray;
return Arrays.copyOf(formats, formats.length);
}
/**
......
......@@ -1185,14 +1185,13 @@ public class JLabel extends JComponent implements SwingConstants, Accessible
}
/**
* Determine the bounding box of the character at the given
* index into the string. The bounds are returned in local
* coordinates. If the index is invalid an empty rectangle is
* returned.
* Returns the bounding box of the character at the given
* index in the string. The bounds are returned in local
* coordinates. If the index is invalid, <code>null</code> is returned.
*
* @param i the index into the String
* @return the screen coordinates of the character's the bounding box,
* if index is invalid returns an empty rectangle.
* @return the screen coordinates of the character's bounding box.
* If the index is invalid, <code>null</code> is returned.
* @since 1.3
*/
public Rectangle getCharacterBounds(int i) {
......
......@@ -26,6 +26,8 @@
package sun.audio;
import java.io.*;
import java.util.Arrays;
import javax.sound.sampled.*;
......@@ -65,12 +67,11 @@ public final class AudioData {
/**
* Constructor
*/
public AudioData(byte buffer[]) {
this.buffer = buffer;
// if we cannot extract valid format information, we resort to assuming the data will be 8k mono u-law
// in order to provide maximal backwards compatibility....
this.format = DEFAULT_FORMAT;
public AudioData(final byte[] buffer) {
// if we cannot extract valid format information, we resort to assuming
// the data will be 8k mono u-law in order to provide maximal backwards
// compatibility....
this(DEFAULT_FORMAT, buffer);
// okay, we need to extract the format and the byte buffer of data
try {
......@@ -90,9 +91,10 @@ public final class AudioData {
* Non-public constructor; this is the one we use in ADS and CADS
* constructors.
*/
AudioData(AudioFormat format, byte[] buffer) {
AudioData(final AudioFormat format, final byte[] buffer) {
this.format = format;
this.buffer = buffer;
if (buffer != null) {
this.buffer = Arrays.copyOf(buffer, buffer.length);
}
}
}
......@@ -98,8 +98,7 @@ public class ClipboardTransferable implements Transferable {
}
flavors = DataTransferer.getInstance().
setToSortedDataFlavorArray(flavorsToData.keySet(),
flavorsForFormats);
setToSortedDataFlavorArray(flavorsToData.keySet());
}
} finally {
clipboard.closeClipboard();
......
......@@ -2405,15 +2405,6 @@ search:
return retval;
}
/**
* Helper function to reduce a Map with DataFlavor keys to a DataFlavor
* array. The array will be sorted according to
* <code>DataFlavorComparator</code>.
*/
public static DataFlavor[] keysToDataFlavorArray(Map map) {
return setToSortedDataFlavorArray(map.keySet(), map);
}
/**
* Helper function to convert a Set of DataFlavors to a sorted array.
* The array will be sorted according to <code>DataFlavorComparator</code>.
......@@ -2427,24 +2418,6 @@ search:
return flavors;
}
/**
* Helper function to convert a Set of DataFlavors to a sorted array.
* The array will be sorted according to a
* <code>DataFlavorComparator</code> created with the specified
* flavor-to-native map as an argument.
*/
public static DataFlavor[] setToSortedDataFlavorArray
(Set flavorsSet, Map flavorToNativeMap)
{
DataFlavor[] flavors = new DataFlavor[flavorsSet.size()];
flavorsSet.toArray(flavors);
Comparator comparator =
new DataFlavorComparator(flavorToNativeMap,
IndexedComparator.SELECT_WORST);
Arrays.sort(flavors, comparator);
return flavors;
}
/**
* Helper function to convert an InputStream to a byte[] array.
*/
......@@ -2724,11 +2697,9 @@ search:
* application/x-java-* MIME types. Unknown application types are preferred
* because if the user provides his own data flavor, it will likely be the
* most descriptive one. For flavors which are otherwise equal, the
* flavors' native formats are compared, with greater long values
* taking precedence.
* flavors' string representation are compared in the alphabetical order.
*/
public static class DataFlavorComparator extends IndexedComparator {
protected final Map flavorToFormatMap;
private final CharsetComparator charsetComparator;
......@@ -2864,20 +2835,6 @@ search:
super(order);
charsetComparator = new CharsetComparator(order);
flavorToFormatMap = Collections.EMPTY_MAP;
}
public DataFlavorComparator(Map map) {
this(map, SELECT_BEST);
}
public DataFlavorComparator(Map map, boolean order) {
super(order);
charsetComparator = new CharsetComparator(order);
HashMap hashMap = new HashMap(map.size());
hashMap.putAll(map);
flavorToFormatMap = Collections.unmodifiableMap(hashMap);
}
public int compare(Object obj1, Object obj2) {
......@@ -2973,10 +2930,9 @@ search:
}
}
// As a last resort, take the DataFlavor with the greater integer
// format.
return compareLongs(flavorToFormatMap, flavor1, flavor2,
UNKNOWN_OBJECT_LOSES_L);
// The flavours are not equal but still not distinguishable.
// Compare String representations in alphabetical order
return flavor1.getMimeType().compareTo(flavor2.getMimeType());
}
}
......
......@@ -339,6 +339,8 @@ public class PSPrinterJob extends RasterPrinterJob {
*/
private static Properties mFontProps = null;
private static boolean isMac;
/* Class static initialiser block */
static {
//enable priviledges so initProps can access system properties,
......@@ -347,6 +349,8 @@ public class PSPrinterJob extends RasterPrinterJob {
new java.security.PrivilegedAction() {
public Object run() {
mFontProps = initProps();
String osName = System.getProperty("os.name");
isMac = osName.startsWith("Mac");
return null;
}
});
......@@ -473,6 +477,12 @@ public class PSPrinterJob extends RasterPrinterJob {
PrintService pServ = getPrintService();
if (pServ != null) {
mDestination = pServ.getName();
if (isMac) {
PrintServiceAttributeSet psaSet = pServ.getAttributes() ;
if (psaSet != null) {
mDestination = psaSet.get(PrinterName.class).toString();
}
}
}
}
}
......@@ -771,6 +781,12 @@ public class PSPrinterJob extends RasterPrinterJob {
PrintService pServ = getPrintService();
if (pServ != null) {
mDestination = pServ.getName();
if (isMac) {
PrintServiceAttributeSet psaSet = pServ.getAttributes();
if (psaSet != null) {
mDestination = psaSet.get(PrinterName.class).toString() ;
}
}
}
PrinterSpooler spooler = new PrinterSpooler();
java.security.AccessController.doPrivileged(spooler);
......
......@@ -71,13 +71,17 @@ JNIEXPORT jlong JNICALL Java_sun_font_NullFontScaler_getGlyphImage
void initLCDGammaTables();
/* placeholder for extern variable */
static int initialisedFontIDs = 0;
FontManagerNativeIDs sunFontIDs;
JNIEXPORT void JNICALL
Java_sun_font_SunFontManager_initIDs
(JNIEnv *env, jclass cls) {
static void initFontIDs(JNIEnv *env) {
jclass tmpClass;
jclass tmpClass = (*env)->FindClass(env, "sun/font/TrueTypeFont");
if (initialisedFontIDs) {
return;
}
tmpClass = (*env)->FindClass(env, "sun/font/TrueTypeFont");
sunFontIDs.ttReadBlockMID =
(*env)->GetMethodID(env, tmpClass, "readBlock",
"(Ljava/nio/ByteBuffer;II)I");
......@@ -173,9 +177,20 @@ Java_sun_font_SunFontManager_initIDs
(*env)->GetFieldID(env, tmpClass, "lcdSubPixPos", "Z");
initLCDGammaTables();
initialisedFontIDs = 1;
}
JNIEXPORT FontManagerNativeIDs getSunFontIDs() {
JNIEXPORT void JNICALL
Java_sun_font_SunFontManager_initIDs
(JNIEnv *env, jclass cls) {
initFontIDs(env);
}
JNIEXPORT FontManagerNativeIDs getSunFontIDs(JNIEnv *env) {
initFontIDs(env);
return sunFontIDs;
}
......
......@@ -84,7 +84,7 @@ typedef struct FontManagerNativeIDs {
/* Note: we share variable in the context of fontmanager lib
but we need access method to use it from separate rasterizer lib */
extern FontManagerNativeIDs sunFontIDs;
JNIEXPORT FontManagerNativeIDs getSunFontIDs();
JNIEXPORT FontManagerNativeIDs getSunFontIDs(JNIEnv* env);
#ifdef __cplusplus
}
......
......@@ -245,7 +245,7 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
continue;
}
if ((defaultPrintService != null)
&& printers[p].equals(defaultPrintService.getName())) {
&& printers[p].equals(getPrinterDestName(defaultPrintService))) {
printerList.add(defaultPrintService);
defaultIndex = printerList.size() - 1;
} else {
......@@ -270,11 +270,12 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
} else {
int j;
for (j=0; j<printServices.length; j++) {
if ((printServices[j] != null) &&
(printers[p].equals(printServices[j].getName()))) {
printerList.add(printServices[j]);
printServices[j] = null;
break;
if (printServices[j] != null) {
if (printers[p].equals(getPrinterDestName(printServices[j]))) {
printerList.add(printServices[j]);
printServices[j] = null;
break;
}
}
}
......@@ -360,6 +361,17 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
return true;
}
/*
* Gets the printer name compatible with the list of printers returned by
* the system when we query default or all the available printers.
*/
private String getPrinterDestName(PrintService ps) {
if (isMac()) {
return ((IPPPrintService)ps).getDest();
}
return ps.getName();
}
/* On a network with many (hundreds) of network printers, it
* can save several seconds if you know all you want is a particular
* printer, to ask for that printer rather than retrieving all printers.
......@@ -369,10 +381,12 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
if (name == null || name.equals("") || !checkPrinterName(name)) {
return null;
}
/* check is all printers are already available */
/* check if all printers are already available */
if (printServices != null) {
for (PrintService printService : printServices) {
if (printService.getName().equals(name)) {
PrinterName printerName =
(PrinterName)printService.getAttribute(PrinterName.class);
if (printerName.getValue().equals(name)) {
return printService;
}
}
......@@ -567,7 +581,7 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
defaultPrintService = null;
if (printServices != null) {
for (int j=0; j<printServices.length; j++) {
if (defaultPrinter.equals(printServices[j].getName())) {
if (defaultPrinter.equals(getPrinterDestName(printServices[j]))) {
defaultPrintService = printServices[j];
break;
}
......
/*
* Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2013, 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
......@@ -346,13 +346,19 @@ JNIEXPORT jobject JNICALL
awt_GetComponent(JNIEnv* env, void* platformInfo)
{
Window window = (Window)platformInfo;
Widget widget = NULL;
jobject peer = NULL;
jobject target = NULL;
AWT_LOCK();
target = (*env)->GetObjectField(env, peer, targetID);
if (window != None) {
peer = JNU_CallStaticMethodByName(env, NULL, "sun/awt/X11/XToolkit",
"windowToXWindow", "(J)Lsun/awt/X11/XBaseWindow;", (jlong)window).l;
}
if ((peer != NULL) &&
(JNU_IsInstanceOfByName(env, peer, "sun/awt/X11/XWindow") == 1)) {
target = (*env)->GetObjectField(env, peer, targetID);
}
if (target == NULL) {
JNU_ThrowNullPointerException(env, "NullPointerException");
......@@ -360,7 +366,6 @@ JNIEXPORT jobject JNICALL
return (jobject)NULL;
}
AWT_UNLOCK();
return target;
......
......@@ -67,14 +67,15 @@ Java_sun_java2d_opengl_WGLSurfaceData_initOps(JNIEnv *env, jobject wglsd,
J2dTraceLn(J2D_TRACE_INFO, "WGLSurfaceData_initOps");
if (oglsdo == NULL) {
JNU_ThrowOutOfMemoryError(env, "Initialization of SurfaceData failed.");
return;
}
if (wglsdo == NULL) {
JNU_ThrowOutOfMemoryError(env, "creating native wgl ops");
return;
}
if (oglsdo == NULL) {
free(wglsdo);
JNU_ThrowOutOfMemoryError(env, "Initialization of SurfaceData failed.");
return;
}
oglsdo->privOps = wglsdo;
......
......@@ -391,9 +391,16 @@ Java_sun_awt_windows_WCustomCursor_createCursorIndirect(
DASSERT(hCursor);
AwtCursor::setPData(self, ptr_to_jlong(new AwtCursor(env, hCursor, self, xHotSpot,
yHotSpot, nW, nH, nSS, cols,
(BYTE *)andMaskPtr)));
try {
AwtCursor::setPData(self, ptr_to_jlong(new AwtCursor(env, hCursor, self, xHotSpot,
yHotSpot, nW, nH, nSS, cols,
(BYTE *)andMaskPtr)));
} catch (...) {
if (cols) {
delete[] cols;
}
throw;
}
CATCH_BAD_ALLOC;
}
......
......@@ -510,6 +510,11 @@ void AwtFont::LoadMetrics(JNIEnv *env, jobject fontMetrics)
jobject font = env->GetObjectField(fontMetrics, AwtFont::fontID);
AwtFont* awtFont = AwtFont::GetFont(env, font);
if (!awtFont) {
/* failed to get font */
return;
}
HDC hDC = ::GetDC(0);
DASSERT(hDC != NULL);
......
/*
* Copyright (c) 2013, 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 8013611
@summary Tests showing a modal dialog with requesting focus in frame.
@author Anton.Tarasov: area=awt.focus
@library ../../regtesthelpers
@build Util
@run main JDK8013611
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import test.java.awt.regtesthelpers.Util;
import java.awt.*;
public class JDK8013611 extends JFrame {
static JTextField textField = new JTextField("text");
static JButton button1 = new JButton("button1");
static JButton button2 = new JButton("button2");
static Robot robot;
static JDialog dialog;
static JButton button3 = new JButton("button3");
public static void main(String[] args) {
robot = Util.createRobot();
JDK8013611 frame = new JDK8013611();
frame.setLayout(new FlowLayout());
frame.add(textField);
frame.add(button1);
frame.add(button2);
frame.pack();
dialog = new JDialog(frame, true);
dialog.add(button3);
dialog.pack();
textField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
dialog.setVisible(true);
}
});
button1.addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
button2.requestFocusInWindow();
}
});
frame.setVisible(true);
frame.test();
}
public void test() {
if (!testFocused(textField)) {
Util.clickOnComp(textField, robot);
if (!testFocused(textField)) {
throw new RuntimeException("Error: couldn't focus " + textField);
}
}
robot.keyPress(KeyEvent.VK_TAB);
robot.delay(50);
robot.keyRelease(KeyEvent.VK_TAB);
if (!testFocused(button3)) {
throw new RuntimeException("Test failed: dialog didn't get focus!");
}
System.out.println("Test passed.");
}
boolean testFocused(Component c) {
for (int i=0; i<10; i++) {
if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() == c) {
return true;
}
Util.waitForIdle(robot);
}
return false;
}
}
......@@ -37,7 +37,7 @@ import sun.java2d.SunGraphics2D;
*/
public final class Test8004859 {
private static Shape[] clips = {new Rectangle(0, 0, 1, 1), new Rectangle(
private static Shape[] clips = {new Rectangle(0, 0, -1, -1), new Rectangle(
100, 100, -100, -100)};
private static boolean status = true;
......
......@@ -35,11 +35,12 @@ import java.awt.event.*;
import javax.swing.*;
public class ActionListenerCalledTwiceTest {
static String menuItems[] = { "Item1", "Item2", "Item3" };
static String menuItems[] = { "Item1", "Item2", "Item3", "Item4" };
static KeyStroke keyStrokes[] = {
KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.META_MASK),
KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0),
KeyStroke.getKeyStroke(KeyEvent.VK_UP, InputEvent.SHIFT_MASK),
KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.META_MASK)
};
static volatile int listenerCallCounter = 0;
......
/*
* Copyright (c) 2013, 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 7173464
@summary Clipboard.getAvailableDataFlavors: Comparison method violates contract
@author Petr Pchelko
@run main DataFlavorComparatorTest
*/
import sun.awt.datatransfer.DataTransferer;
import java.awt.datatransfer.DataFlavor;
public class DataFlavorComparatorTest {
public static void main(String[] args) {
DataTransferer.DataFlavorComparator comparator = new DataTransferer.DataFlavorComparator();
DataFlavor flavor1 = DataFlavor.imageFlavor;
DataFlavor flavor2 = DataFlavor.selectionHtmlFlavor;
if (comparator.compare(flavor1, flavor2) == 0) {
throw new RuntimeException(flavor1.getMimeType() + " and " + flavor2.getMimeType() +
" should not be equal");
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册