提交 2f8ccf10 编写于 作者: L lana

Merge

......@@ -903,7 +903,7 @@ public class Dialog extends Window {
if (peer == null) {
addNotify();
}
validate();
validateUnconditionally();
if (visible) {
toFront();
retval = false;
......
......@@ -243,8 +243,10 @@ public abstract class GraphicsDevice {
* a non-client of the input method framework.
* </ul>
* <p>
* Simulated full-screen mode resizes
* the window to the size of the screen and positions it at (0,0).
* The simulated full-screen mode places and resizes the window to the maximum
* possible visible area of the screen. However, the native windowing system
* may modify the requested geometry-related data, so that the {@code Window} object
* is placed and sized in a way that corresponds closely to the desktop settings.
* <p>
* When entering full-screen mode, if the window to be used as a
* full-screen window is not visible, this method will make it visible.
......
......@@ -466,6 +466,10 @@ public abstract class Toolkit {
*/
protected void loadSystemColors(int[] systemColors)
throws HeadlessException {
if (GraphicsEnvironment.isHeadless()){
throw new HeadlessException();
}
}
/**
......@@ -500,6 +504,10 @@ public abstract class Toolkit {
*/
public void setDynamicLayout(boolean dynamic)
throws HeadlessException {
if (GraphicsEnvironment.isHeadless()){
throw new HeadlessException();
}
}
/**
......@@ -523,6 +531,9 @@ public abstract class Toolkit {
*/
protected boolean isDynamicLayoutSet()
throws HeadlessException {
if (GraphicsEnvironment.isHeadless()){
throw new HeadlessException();
}
if (this != Toolkit.getDefaultToolkit()) {
return Toolkit.getDefaultToolkit().isDynamicLayoutSet();
} else {
......@@ -558,6 +569,9 @@ public abstract class Toolkit {
*/
public boolean isDynamicLayoutActive()
throws HeadlessException {
if (GraphicsEnvironment.isHeadless()){
throw new HeadlessException();
}
if (this != Toolkit.getDefaultToolkit()) {
return Toolkit.getDefaultToolkit().isDynamicLayoutActive();
} else {
......@@ -601,6 +615,9 @@ public abstract class Toolkit {
*/
public Insets getScreenInsets(GraphicsConfiguration gc)
throws HeadlessException {
if (GraphicsEnvironment.isHeadless()){
throw new HeadlessException();
}
if (this != Toolkit.getDefaultToolkit()) {
return Toolkit.getDefaultToolkit().getScreenInsets(gc);
} else {
......@@ -1342,6 +1359,9 @@ public abstract class Toolkit {
* @since 1.4
*/
public Clipboard getSystemSelection() throws HeadlessException {
if (GraphicsEnvironment.isHeadless()){
throw new HeadlessException();
}
if (this != Toolkit.getDefaultToolkit()) {
return Toolkit.getDefaultToolkit().getSystemSelection();
} else {
......@@ -1371,6 +1391,10 @@ public abstract class Toolkit {
* @since JDK1.1
*/
public int getMenuShortcutKeyMask() throws HeadlessException {
if (GraphicsEnvironment.isHeadless()){
throw new HeadlessException();
}
return Event.CTRL_MASK;
}
......@@ -1499,6 +1523,9 @@ public abstract class Toolkit {
*/
public Dimension getBestCursorSize(int preferredWidth,
int preferredHeight) throws HeadlessException {
if (GraphicsEnvironment.isHeadless()){
throw new HeadlessException();
}
// Override to implement custom cursor support.
if (this != Toolkit.getDefaultToolkit()) {
return Toolkit.getDefaultToolkit().
......@@ -1526,6 +1553,9 @@ public abstract class Toolkit {
* @since 1.2
*/
public int getMaximumCursorColors() throws HeadlessException {
if (GraphicsEnvironment.isHeadless()){
throw new HeadlessException();
}
// Override to implement custom cursor support.
if (this != Toolkit.getDefaultToolkit()) {
return Toolkit.getDefaultToolkit().getMaximumCursorColors();
......@@ -2561,8 +2591,6 @@ public abstract class Toolkit {
* initialized with {@code true}.
* Changing this value after the {@code Toolkit} class initialization will have no effect.
* <p>
* The current value could be queried by using the
* {@code System.getProperty("sun.awt.enableExtraMouseButtons")} method.
* @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true
* @return {@code true} if events from extra mouse buttons are allowed to be processed and posted;
* {@code false} otherwise
......@@ -2572,6 +2600,9 @@ public abstract class Toolkit {
* @since 1.7
*/
public boolean areExtraMouseButtonsEnabled() throws HeadlessException {
if (GraphicsEnvironment.isHeadless()){
throw new HeadlessException();
}
return Toolkit.getDefaultToolkit().areExtraMouseButtonsEnabled();
}
}
......@@ -870,6 +870,11 @@ public class Window extends Container implements Accessible {
* are automatically enlarged if either is less than
* the minimum size as specified by previous call to
* {@code setMinimumSize}.
* <p>
* The method changes the geometry-related data. Therefore,
* the native windowing system may ignore such requests, or it may modify
* the requested data, so that the {@code Window} object is placed and sized
* in a way that corresponds closely to the desktop settings.
*
* @see #getSize
* @see #setBounds
......@@ -887,6 +892,11 @@ public class Window extends Container implements Accessible {
* are automatically enlarged if either is less than
* the minimum size as specified by previous call to
* {@code setMinimumSize}.
* <p>
* The method changes the geometry-related data. Therefore,
* the native windowing system may ignore such requests, or it may modify
* the requested data, so that the {@code Window} object is placed and sized
* in a way that corresponds closely to the desktop settings.
*
* @see #getSize
* @see #setBounds
......@@ -897,6 +907,32 @@ public class Window extends Container implements Accessible {
super.setSize(width, height);
}
/**
* {@inheritDoc}
* <p>
* The method changes the geometry-related data. Therefore,
* the native windowing system may ignore such requests, or it may modify
* the requested data, so that the {@code Window} object is placed and sized
* in a way that corresponds closely to the desktop settings.
*/
@Override
public void setLocation(int x, int y) {
super.setLocation(x, y);
}
/**
* {@inheritDoc}
* <p>
* The method changes the geometry-related data. Therefore,
* the native windowing system may ignore such requests, or it may modify
* the requested data, so that the {@code Window} object is placed and sized
* in a way that corresponds closely to the desktop settings.
*/
@Override
public void setLocation(Point p) {
super.setLocation(p);
}
/**
* @deprecated As of JDK version 1.1,
* replaced by <code>setBounds(int, int, int, int)</code>.
......@@ -3147,6 +3183,11 @@ public class Window extends Container implements Accessible {
* placed at the left side of the screen. The similar placement
* will occur if both top and bottom edges are out of the screen.
* In that case, the window is placed at the top side of the screen.
* <p>
* The method changes the geometry-related data. Therefore,
* the native windowing system may ignore such requests, or it may modify
* the requested data, so that the {@code Window} object is placed and sized
* in a way that corresponds closely to the desktop settings.
*
* @param c the component in relation to which the window's location
* is determined
......@@ -3395,6 +3436,11 @@ public class Window extends Container implements Accessible {
* are automatically enlarged if either is less than
* the minimum size as specified by previous call to
* {@code setMinimumSize}.
* <p>
* The method changes the geometry-related data. Therefore,
* the native windowing system may ignore such requests, or it may modify
* the requested data, so that the {@code Window} object is placed and sized
* in a way that corresponds closely to the desktop settings.
*
* @see #getBounds
* @see #setLocation(int, int)
......@@ -3424,6 +3470,11 @@ public class Window extends Container implements Accessible {
* will be automatically enlarged if either is less than
* the minimum size as specified by previous call to
* {@code setMinimumSize}.
* <p>
* The method changes the geometry-related data. Therefore,
* the native windowing system may ignore such requests, or it may modify
* the requested data, so that the {@code Window} object is placed and sized
* in a way that corresponds closely to the desktop settings.
*
* @see #getBounds
* @see #setLocation(int, int)
......
......@@ -128,12 +128,12 @@ AWT_OnLoad(JavaVM *vm, void *reserved)
}
}
/* Calculate toolkit name, kind of toolkit (XAWT, Motif) and library to load */
/* Calculate library name to load */
if (AWTIsHeadless()) {
strcpy(p, "/headless/libmawt");
strncpy(p, "/headless/libmawt.so", MAXPATHLEN-len-1);
} else {
/* Default AWT Toolkit on Linux and Solaris is XAWT. */
strcpy(p, "/xawt/libmawt");
strncpy(p, "/xawt/libmawt.so", MAXPATHLEN-len-1);
}
if (toolkit) {
......@@ -143,23 +143,12 @@ AWT_OnLoad(JavaVM *vm, void *reserved)
(*env)->DeleteLocalRef(env, propname);
}
strcat(p, ".so");
JNU_CallStaticMethodByName(env, NULL, "java/lang/System", "load",
"(Ljava/lang/String;)V",
JNU_NewStringPlatform(env, buf));
awtHandle = dlopen(buf, RTLD_LAZY | RTLD_GLOBAL);
/*
if (dlsym(awtHandle, "AWTCharRBearing") == NULL) {
printf("========= AWTCharRBearing not found\n"); fflush(stdout);
}
else {
printf("========= AWTCharRBearing was found\n"); fflush(stdout);
}
*/
return JNI_VERSION_1_2;
}
......
......@@ -136,7 +136,7 @@ awt_mgrsel_select(const char *selname, long extra_mask,
|| per_scr_owners == NULL || mgrsel == NULL)
{
DTRACE_PRINTLN("MG: select: unable to allocate memory");
if (namesbuf != NULL) free(per_scr_atoms);
if (namesbuf != NULL) free(namesbuf);
if (names != NULL) free(names);
if (per_scr_atoms != NULL) free(per_scr_atoms);
if (per_scr_owners != NULL) free(per_scr_owners);
......
......@@ -443,6 +443,8 @@ void gtk2_file_chooser_load()
"gtk_file_chooser_set_current_folder");
fp_gtk_file_chooser_set_filename = dl_symbol(
"gtk_file_chooser_set_filename");
fp_gtk_file_chooser_set_current_name = dl_symbol(
"gtk_file_chooser_set_current_name");
fp_gtk_file_filter_add_custom = dl_symbol("gtk_file_filter_add_custom");
fp_gtk_file_chooser_set_filter = dl_symbol("gtk_file_chooser_set_filter");
fp_gtk_file_chooser_get_type = dl_symbol("gtk_file_chooser_get_type");
......
......@@ -766,6 +766,8 @@ gboolean (*fp_gtk_file_chooser_set_current_folder)(GtkFileChooser *chooser,
const gchar *filename);
gboolean (*fp_gtk_file_chooser_set_filename)(GtkFileChooser *chooser,
const char *filename);
void (*fp_gtk_file_chooser_set_current_name)(GtkFileChooser *chooser,
const gchar *name);
void (*fp_gtk_file_filter_add_custom)(GtkFileFilter *filter,
GtkFileFilterFlags needed, GtkFileFilterFunc func, gpointer data,
GDestroyNotify notify);
......
......@@ -4,6 +4,7 @@
#include <string.h>
#include "gtk2_interface.h"
#include "sun_awt_X11_GtkFileDialogPeer.h"
#include "java_awt_FileDialog.h"
#include "debug_assert.h"
static JavaVM *jvm;
......@@ -220,7 +221,7 @@ Java_sun_awt_X11_GtkFileDialogPeer_run(JNIEnv * env, jobject jpeer,
const char *title = jtitle == NULL? "": (*env)->GetStringUTFChars(env, jtitle, 0);
if (mode == 1) {
if (mode == java_awt_FileDialog_SAVE) {
/* Save action */
dialog = fp_gtk_file_chooser_dialog_new(title, NULL,
GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL,
......@@ -253,7 +254,11 @@ Java_sun_awt_X11_GtkFileDialogPeer_run(JNIEnv * env, jobject jpeer,
/* Set the filename */
if (jfile != NULL) {
const char *filename = (*env)->GetStringUTFChars(env, jfile, 0);
fp_gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), filename);
if (mode == java_awt_FileDialog_SAVE) {
fp_gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), filename);
} else {
fp_gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), filename);
}
(*env)->ReleaseStringUTFChars(env, jfile, filename);
}
......
......@@ -71,12 +71,6 @@ public class Win32GraphicsEnvironment
SurfaceManagerFactory.setInstance(new WindowsSurfaceManagerFactory());
}
/**
* Noop function that just acts as an entry point for someone to force
* a static initialization of this class.
*/
public static void init() {}
/**
* Initializes native components of the graphics environment. This
* includes everything from the native GraphicsDevice elements to
......
......@@ -103,9 +103,6 @@ public class WToolkit extends SunToolkit implements Runnable {
static {
loadLibraries();
// Force Win32GE to load if it is not already loaded; this loads
// various other classes that are required for basic awt functionality
Win32GraphicsEnvironment.init();
initIDs();
// Print out which version of Windows is running
......
......@@ -317,7 +317,9 @@ void AwtButton::_SetLabel(void *param)
badAlloc = 1;
} else {
c->SetText(labelStr);
JNU_ReleaseStringPlatformChars(env, label, labelStr);
if (label != NULL) {
JNU_ReleaseStringPlatformChars(env, label, labelStr);
}
}
}
......
......@@ -384,7 +384,9 @@ void AwtCheckbox::_SetLabel(void *param)
{
c->SetText(labelStr);
c->VerifyState();
JNU_ReleaseStringPlatformChars(env, label, labelStr);
if (label != NULL) {
JNU_ReleaseStringPlatformChars(env, label, labelStr);
}
}
}
......
......@@ -225,7 +225,6 @@ AwtFileDialog::Show(void *p)
{
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
jobject peer;
WCHAR unicodeChar = L' ';
LPTSTR fileBuffer = NULL;
LPTSTR currentDirectory = NULL;
jint mode = 0;
......@@ -263,7 +262,7 @@ AwtFileDialog::Show(void *p)
HWND hwndOwner = awtParent ? awtParent->GetHWnd() : NULL;
if (title == NULL || env->GetStringLength(title)==0) {
title = JNU_NewStringPlatform(env, &unicodeChar);
title = JNU_NewStringPlatform(env, L" ");
}
JavaStringBuffer titleBuffer(env, title);
......
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
@test
@bug 7027013
@summary Dialog.show() should validate the window unconditionally
@author anthony.petrov@oracle.com: area=awt.toplevel
@run main ValidateOnShow
*/
import java.awt.*;
public class ValidateOnShow {
private static Dialog dialog = new Dialog((Frame)null);
private static Panel panel = new Panel() {
@Override
public boolean isValidateRoot() {
return true;
}
};
private static Button button = new Button("Test");
private static void sleep() {
try { Thread.sleep(500); } catch (Exception e) {}
}
private static void test() {
System.out.println("Before showing: panel.isValid=" + panel.isValid() + " dialog.isValid=" + dialog.isValid());
dialog.setVisible(true);
sleep();
System.out.println("After showing: panel.isValid=" + panel.isValid() + " dialog.isValid=" + dialog.isValid());
if (!panel.isValid()) {
dialog.dispose();
throw new RuntimeException("The panel hasn't been validated upon showing the dialog");
}
dialog.setVisible(false);
sleep();
}
public static void main(String[] args) {
// setup
dialog.add(panel);
panel.add(button);
dialog.setBounds(200, 200, 300, 200);
// The first test should always succeed since the dialog is invalid initially
test();
// now invalidate the button and the panel
button.setBounds(1, 1, 30, 30);
sleep();
// since the panel is a validate root, the dialog is still valid
// w/o a fix this would fail
test();
// cleanup
dialog.dispose();
}
}
<html>
<!--
@test
@bug 6260659
@summary File Name set programmatically in FileDialog is overridden during navigation, XToolkit
@author Dmitry.Cherepanov@SUN.COM area=awt.filedialog
@library ../../regtesthelpers
@build Sysout
@run applet/manual=yesno FileNameOverrideTest.html
-->
<head>
<title> FileNameOverrideTest </title>
</head>
<body>
<h1>FileNameOverrideTest<br>Bug ID: 6260659</h1>
<p> See the dialog box (usually in upper left corner) for instructions</p>
<APPLET CODE="FileNameOverrideTest.class" WIDTH=200 HEIGHT=200></APPLET>
</body>
</html>
/*
test
@bug 6260659
@summary File Name set programmatically in FileDialog is overridden during navigation, XToolkit
@author Dmitry.Cherepanov@SUN.COM area=awt.filedialog
@library ../../regtesthelpers
@build Sysout
@run applet/manual=yesno FileNameOverrideTest.html
*/
import test.java.awt.regtesthelpers.Sysout;
import java.applet.Applet;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
public class FileNameOverrideTest extends Applet implements ActionListener {
private final static String fileName = "input";
private final static String clickDirName = "Directory for double click";
private final static String dirPath = ".";
private Button showBtn;
private FileDialog fd;
public void init() {
this.setLayout(new GridLayout(1, 1));
fd = new FileDialog(new Frame(), "Open");
showBtn = new Button("Show File Dialog");
showBtn.addActionListener(this);
add(showBtn);
try {
File tmpFileUp = new File(dirPath + File.separator + fileName);
File tmpDir = new File(dirPath + File.separator + clickDirName);
File tmpFileIn = new File(tmpDir.getAbsolutePath() + File.separator + fileName);
tmpDir.mkdir();
tmpFileUp.createNewFile();
tmpFileIn.createNewFile();
} catch (IOException ex) {
throw new RuntimeException("Cannot create test folder", ex);
}
String[] instructions = {
"1) Click on 'Show File Dialog' button. A file dialog will come up.",
"2) Double-click on '" + clickDirName + "' and click OK.",
"3) See result of the test below"
};
Sysout.createDialogWithInstructions(instructions);
}//End init()
public void start() {
setSize(200, 200);
show();
}// start()
public void actionPerformed(ActionEvent e) {
if (e.getSource() == showBtn) {
fd.setFile(fileName);
fd.setDirectory(dirPath);
fd.setVisible(true);
String output = fd.getFile();
if (fileName.equals(output)) {
Sysout.println("TEST PASSED");
} else {
Sysout.println("TEST FAILED (output file - " + output + ")");
}
}
}
}// class ManualYesNoTest
<html>
<!--
@test
@bug 6998877
@summary After double-click on the folder names, FileNameOverrideTest FAILED
@author Sergey.Bylokhov@oracle.com area=awt.filedialog
@library ../../regtesthelpers
@build Sysout
@run applet/manual=yesno SaveFileNameOverrideTest.html
-->
<head>
<title> SaveFileNameOverrideTest </title>
</head>
<body>
<h1>SaveFileNameOverrideTest<br>Bug ID: 6260659</h1>
<p> See the dialog box (usually in upper left corner) for instructions</p>
<APPLET CODE="SaveFileNameOverrideTest.class" WIDTH=200 HEIGHT=200></APPLET>
</body>
</html>
/*
test
@bug 6998877
@summary After double-click on the folder names, FileNameOverrideTest FAILED
@author Sergey.Bylokhov@oracle.com area=awt.filedialog
@library ../../regtesthelpers
@build Sysout
@run applet/manual=yesno SaveFileNameOverrideTest.html
*/
import test.java.awt.regtesthelpers.Sysout;
import java.applet.Applet;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
public class SaveFileNameOverrideTest extends Applet implements ActionListener {
private final static String clickDirName = "Directory for double click";
private final static String dirPath = ".";
private Button showBtn;
private FileDialog fd;
public void init() {
this.setLayout(new GridLayout(1, 1));
fd = new FileDialog(new Frame(), "Save", FileDialog.SAVE);
showBtn = new Button("Show File Dialog");
showBtn.addActionListener(this);
add(showBtn);
File tmpDir = new File(dirPath + File.separator + clickDirName);
tmpDir.mkdir();
String[] instructions = {
"1) Click on 'Show File Dialog' button. A file dialog will come up.",
"2) Double-click on '" + clickDirName + "' and click OK.",
"3) See result of the test below"
};
Sysout.createDialogWithInstructions(instructions);
}//End init()
public void start() {
setSize(200, 200);
show();
}// start()
public void actionPerformed(ActionEvent e) {
if (e.getSource() == showBtn) {
fd.setFile("input");
fd.setDirectory(dirPath);
fd.setVisible(true);
String output = fd.getFile();
if ("input".equals(output)) {
Sysout.println("TEST PASSED");
} else {
Sysout.println("TEST FAILED (output file - " + output + ")");
}
}
}
}// class ManualYesNoTest
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 7002839
* @summary Static init deadlock Win32GraphicsEnvironment and WToolkit
* @run main GE_init1
*/
import java.awt.Toolkit;
public class GE_init1 {
public static void main(String[] args) {
Toolkit.getDefaultToolkit();
}
}
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 7002839
* @summary Static init deadlock Win32GraphicsEnvironment and WToolkit
* @run main GE_init2
*/
import java.awt.GraphicsEnvironment;
public class GE_init2 {
public static void main(String[] args) {
GraphicsEnvironment.getLocalGraphicsEnvironment();
}
}
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 7002839
* @summary Static init deadlock Win32GraphicsEnvironment and WToolkit
* @run main GE_init3
*/
import java.awt.Frame;
public class GE_init3 {
public static void main(String[] args) {
new Frame("Test3").setVisible(true);
}
}
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 7002839
* @summary Static init deadlock Win32GraphicsEnvironment and WToolkit
* @run main/othervm -Djava.awt.headless=true GE_init4
*/
import java.awt.Toolkit;
public class GE_init4 {
public static void main(String[] args) {
Toolkit.getDefaultToolkit();
}
}
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 7002839
* @summary Static init deadlock Win32GraphicsEnvironment and WToolkit
* @run main/othervm -Djava.awt.headless=true GE_init4
*/
import java.awt.Toolkit;
public class GE_init5 {
public static void main(String[] args) {
GraphicsEnvironment.getLocalGraphicsEnvironment();
}
}
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 7002839
* @summary Static init deadlock Win32GraphicsEnvironment and WToolkit
* @run main/othervm -Djava.awt.headless=true GE_init6
*/
import java.awt.*;
public class GE_init6 {
private static boolean passed = false;
public static void main(String[] args) {
try {
new Frame("Test3").setVisible(true);
} catch (HeadlessException e){
passed = true;
}
if (!passed){
throw new RuntimeException("Should have thrown HE but it either didn't throw any or just passed through.");
}
}
}
......@@ -43,6 +43,7 @@ public class TranslucentJAppletTest {
private static void initAndShowGUI() {
frame = new JFrame();
JApplet applet = new JApplet();
applet.setBackground(new Color(0, 0, 0, 0));
JPanel panel = new JPanel() {
protected void paintComponent(Graphics g) {
paintComponentCalled = true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册