8047180: Move functional tests AWT_Headless/Automated to OpenJDK repository
Reviewed-by: pchelko, alexsch
Contributed-by: Dmitriy Ermashov <dmitriy.ermashov@oracle.com>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/AlphaComposite/HeadlessAlphaComposite.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+import java.awt.image.ColorModel;
+
+/*
+ * @test
+ * @summary Check no exception occurrence when running AlphaComposite getInstance(),
+ * createContext(), getAlpha(), getRule(), hashCode() methods in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessAlphaComposite
+ */
+
+public class HeadlessAlphaComposite {
+
+ public static void main(String args[]) {
+ AlphaComposite ac;
+ ac = AlphaComposite.getInstance(AlphaComposite.CLEAR);
+ ac = AlphaComposite.getInstance(AlphaComposite.DST_IN);
+ ac = AlphaComposite.getInstance(AlphaComposite.DST_OUT);
+ ac = AlphaComposite.getInstance(AlphaComposite.DST_OVER);
+ ac = AlphaComposite.getInstance(AlphaComposite.SRC);
+ ac = AlphaComposite.getInstance(AlphaComposite.SRC_IN);
+ ac = AlphaComposite.getInstance(AlphaComposite.SRC_OUT);
+ ac = AlphaComposite.getInstance(AlphaComposite.DST_IN);
+ ac = AlphaComposite.getInstance(AlphaComposite.SRC, (float) 0.5);
+
+ ac = AlphaComposite.getInstance(AlphaComposite.SRC, (float) 0.5);
+ CompositeContext cc = ac.createContext(ColorModel.getRGBdefault(),
+ ColorModel.getRGBdefault(),
+ new RenderingHints(RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_ON));
+
+ ac = AlphaComposite.getInstance(AlphaComposite.SRC, (float) 0.5);
+ float alpha = ac.getAlpha();
+
+ ac = AlphaComposite.getInstance(AlphaComposite.SRC, (float) 0.5);
+ int rule = ac.getRule();
+
+ ac = AlphaComposite.getInstance(AlphaComposite.SRC, (float) 0.5);
+ int hc = ac.hashCode();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Color/HeadlessColor.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,225 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+import java.awt.color.ColorSpace;
+
+/*
+ * @test
+ * @summary Check Color constructors and methods works correctly in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessColor
+ */
+
+public class HeadlessColor {
+ public static void main(String args[]) {
+ Color c;
+
+ // Constructors without exceptions
+ c = new Color(1, 2, 3);
+ c = new Color(1, 2, 3, 4);
+ c = new Color((1 << 16) | (2 << 8) | (3));
+ c = new Color((1 << 24) | (1 << 16) | (2 << 8) | (3));
+ c = new Color((1 << 24) | (2 << 16) | (3 << 8) | (4), true);
+ c = new Color((2 << 16) | (3 << 8) | (4), false);
+ c = new Color(0.8f, 0.8f, 0.3f);
+ c = new Color(0.999f, 0.8f, 0.8f, 0.3f);
+ c = new Color(ColorSpace.getInstance(ColorSpace.CS_sRGB),
+ new float[]{0.8f, 0.8f, 0.3f}, 1f);
+
+ // Constructors with exceptions
+ boolean exceptions = false;
+ try {
+ c = new Color(409, 400, 400);
+ } catch (IllegalArgumentException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("Constructor did not throw IllegalArgumentException " +
+ "when expected in headless mode");
+
+ exceptions = false;
+ try {
+ c = new Color(400, 3003, 400, 400);
+ } catch (IllegalArgumentException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("Constructor did not throw IllegalArgumentException " +
+ "when expected in headless mode");
+
+ exceptions = false;
+ try {
+ c = new Color(8f, 8f, 3f);
+ } catch (IllegalArgumentException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("Constructor did not throw IllegalArgumentException " +
+ "when expected in headless mode");
+
+ exceptions = false;
+ try {
+ c = new Color(-8f, -8f, -3f);
+ } catch (IllegalArgumentException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("Constructor did not throw IllegalArgumentException " +
+ "when expected in headless mode");
+
+ exceptions = false;
+ try {
+ c = new Color(0.999f, 8f, 8f, 3f);
+ } catch (IllegalArgumentException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("Constructor did not throw IllegalArgumentException " +
+ "when expected in headless mode");
+
+ exceptions = false;
+ try {
+ c = new Color(20f, 8f, 8f, 3f);
+ } catch (IllegalArgumentException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("Constructor did not throw IllegalArgumentException " +
+ "when expected in headless mode");
+
+ exceptions = false;
+ try {
+ c = new Color(-20f, -8f, -8f, -3f);
+ } catch (IllegalArgumentException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("Constructor did not throw IllegalArgumentException " +
+ "when expected in headless mode");
+
+ exceptions = false;
+ try {
+ c = new Color(ColorSpace.getInstance(ColorSpace.CS_sRGB),
+ new float[]{-8f, -8f, -3f}, 1f);
+ } catch (IllegalArgumentException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("Constructor did not throw IllegalArgumentException " +
+ "when expected in headless mode");
+
+ exceptions = false;
+ try {
+ c = new Color(ColorSpace.getInstance(ColorSpace.CS_sRGB),
+ new float[]{-8f, -8f, -3f}, -1f);
+ } catch (IllegalArgumentException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("Constructor did not throw IllegalArgumentException " +
+ "when expected in headless mode");
+
+
+ c = new Color(1, 2, 3);
+ c.hashCode();
+ c.toString();
+ if (c.getRed() != 1)
+ throw new RuntimeException("Incorrect red value");
+ if (c.getGreen() != 2)
+ throw new RuntimeException("Incorrect green value");
+ if (c.getBlue() != 3)
+ throw new RuntimeException("Incorrect bluevalue");
+ if (c.getAlpha() != 255)
+ throw new RuntimeException("Incorrect alpha value");
+ if (c.getRGB() != ((255 << 24) | (1 << 16) | (2 << 8) | (3)))
+ throw new RuntimeException("Incorrect rgb value");
+
+ int rgb = c.getRGB();
+ c.brighter();
+ if (rgb != c.getRGB())
+ throw new RuntimeException("Color object changed RGB value after brighter() called");
+
+ rgb = c.getRGB();
+ c.darker();
+ if (rgb != c.getRGB())
+ throw new RuntimeException("Color object changed RGB value after brighter() called");
+
+ c = new Color(1, 2, 3, 4);
+ c.hashCode();
+ c.toString();
+ if (c.getRed() != 1)
+ throw new RuntimeException("Incorrect red value");
+ if (c.getGreen() != 2)
+ throw new RuntimeException("Incorrect green value");
+ if (c.getBlue() != 3)
+ throw new RuntimeException("Incorrect bluevalue");
+ if (c.getAlpha() != 4)
+ throw new RuntimeException("Incorrect alpha value");
+ if (c.getRGB() != ((4 << 24) | (1 << 16) | (2 << 8) | (3)))
+ throw new RuntimeException("Incorrect rgb value");
+
+ rgb = c.getRGB();
+ c.brighter();
+ if (rgb != c.getRGB())
+ throw new RuntimeException("Color object changed RGB value after brighter() called");
+
+ rgb = c.getRGB();
+ c.darker();
+ if (rgb != c.getRGB())
+ throw new RuntimeException("Color object changed RGB value after brighter() called");
+
+
+ if (!(new Color(1, 2, 3).equals(new Color(1, 2, 3))))
+ throw new RuntimeException("Inequality in colors when equality expected");
+ if (new Color(1, 2, 3).equals(new Color(3, 2, 1)))
+ throw new RuntimeException("Equality in colors when NO equality expected");
+
+ if (!(new Color(1, 2, 3, 4).equals(new Color(1, 2, 3, 4))))
+ throw new RuntimeException("Inequality in colors when equality expected");
+ if (new Color(1, 2, 3, 4).equals(new Color(4, 3, 2, 1)))
+ throw new RuntimeException("Equality in colors when NO equality expected");
+
+ c = Color.decode("0xffffff");
+ c = Color.getColor("65535");
+ c = Color.getColor("65535", Color.black);
+ c = Color.getColor("65535", 0xffffff);
+
+ int hsb_value = Color.HSBtoRGB(0.1f, 0.2f, 0.3f);
+ float[] rgb_value = Color.RGBtoHSB(1, 2, 3, null);
+
+ c = Color.getHSBColor(0.3f, 0.4f, 0.6f);
+ c = Color.getHSBColor(-0.3f, -0.4f, -0.6f);
+ c = Color.getHSBColor(30, 40, 60);
+
+ float[] comps;
+ comps = Color.black.getRGBComponents(null);
+ comps = Color.black.getRGBColorComponents(null);
+ comps = Color.black.getComponents(null);
+ comps = Color.black.getColorComponents(null);
+ comps = Color.black.getComponents(ColorSpace.getInstance(ColorSpace.CS_sRGB), null);
+ comps = Color.black.getColorComponents(ColorSpace.getInstance(ColorSpace.CS_sRGB), null);
+
+ Color.black.getColorSpace();
+ Color.black.getTransparency();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Component/Headless/HeadlessButton.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check whether Button constructors throw HeadlessException in
+ * headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessButton
+ */
+
+public class HeadlessButton {
+
+ public static void main(String args[]) {
+ Button b;
+
+ boolean exceptions = false;
+ try {
+ b = new Button();
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("Constructor did not throw HeadlessException");
+
+
+ exceptions = false;
+ try {
+ b = new Button("Press me");
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("Constructor did not throw HeadlessException");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Component/Headless/HeadlessCanvas.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check whether Canvas constructor does not throw exceptions
+ * in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessCanvas
+ */
+
+public class HeadlessCanvas {
+ public static void main(String args[]) {
+ Canvas c = new Canvas();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Component/Headless/HeadlessCheckbox.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that Checkbox constructors trow HeadlessException in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessCheckbox
+ */
+
+public class HeadlessCheckbox {
+ public static void main(String args[]) {
+ Checkbox b;
+
+ boolean exceptions = false;
+ try {
+ b = new Checkbox();
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("Constructor did not throw HeadlessException");
+
+ exceptions = false;
+ try {
+ b = new Checkbox("Hey, check it out!");
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("Constructor did not throw HeadlessException");
+
+ exceptions = false;
+ try {
+ b = new Checkbox("Hey, check it out!", true);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("Constructor did not throw HeadlessException");
+
+ exceptions = false;
+ try {
+ b = new Checkbox("Hey, check it out!", false);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("Constructor did not throw HeadlessException");
+
+ CheckboxGroup cbg = new CheckboxGroup();
+
+ exceptions = false;
+ try {
+ b = new Checkbox("Hey, check it out!", true, cbg);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("Constructor did not throw HeadlessException");
+
+ exceptions = false;
+ try {
+ b = new Checkbox("Hey, check it out!", false, cbg);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("Constructor did not throw HeadlessException");
+
+ exceptions = false;
+ try {
+ b = new Checkbox("Hey, check it out!", cbg, true);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("Constructor did not throw HeadlessException");
+
+ exceptions = false;
+ try {
+ b = new Checkbox("Hey, check it out!", cbg, false);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("Constructor did not throw HeadlessException");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Component/Headless/HeadlessChoice.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that Choice constructor throws HeadlessException in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessChoice
+ */
+
+public class HeadlessChoice {
+
+ public static void main(String args[]) {
+ boolean exceptions = false;
+ try {
+ Choice c = new Choice();
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("Constructor did not throw HeadlessException");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Component/Headless/HeadlessComponent.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,199 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+import java.awt.event.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that Component methods do not throw unexpected exceptions
+ * in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessComponent
+ */
+
+public class HeadlessComponent {
+ public static void main(String args[]) {
+ Component comp = new Component(){};
+ comp.addComponentListener(new ComponentAdapter() {});
+ comp.addFocusListener(new FocusAdapter(){});
+ comp.addHierarchyBoundsListener(new HierarchyBoundsAdapter(){});
+ comp.addHierarchyListener(e -> {});
+ comp.addInputMethodListener(new InputMethodListener() {
+ public void inputMethodTextChanged(InputMethodEvent event) {}
+ public void caretPositionChanged(InputMethodEvent event) {}
+ });
+ comp.addKeyListener(new KeyAdapter() {});
+ comp.addMouseListener(new MouseAdapter() {});
+ comp.addMouseMotionListener(new MouseMotionAdapter() {});
+ comp.addMouseWheelListener(e -> {});
+ comp.addPropertyChangeListener(e -> {});
+ comp.addNotify();
+ comp.getName();
+ comp.setName("goober");
+ comp.getParent();
+ comp.getPeer();
+ comp.getGraphicsConfiguration();
+ comp.getTreeLock();
+ comp.getToolkit();
+ comp.isValid();
+ comp.isDisplayable();
+ comp.isVisible();
+ comp.isShowing();
+ comp.isEnabled();
+ comp.setEnabled(false);
+ comp.setEnabled(true);
+ comp.enable();
+ comp.enable(false);
+ comp.enable(true);
+ comp.disable();
+ comp.isDoubleBuffered();
+ comp.enableInputMethods(false);
+ comp.enableInputMethods(true);
+ comp.setVisible(false);
+ comp.setVisible(true);
+ comp.show();
+ comp.show(false);
+ comp.show(true);
+ comp.hide();
+ comp.getForeground();
+ comp.setForeground(Color.red);
+ comp.isForegroundSet();
+ comp.getBackground();
+ comp.setBackground(Color.red);
+ comp.isBackgroundSet();
+ comp.getFont();
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int i = 8; i < 17; i++) {
+ Font f1 = new Font(font, Font.PLAIN, i);
+ Font f2 = new Font(font, Font.BOLD, i);
+ Font f3 = new Font(font, Font.ITALIC, i);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, i);
+
+ comp.setFont(f1);
+ comp.getFontMetrics(f1);
+ comp.setFont(f2);
+ comp.getFontMetrics(f2);
+ comp.setFont(f3);
+ comp.getFontMetrics(f3);
+ comp.setFont(f4);
+ comp.getFontMetrics(f4);
+ }
+ }
+ comp.isFontSet();
+
+ boolean exceptions = false;
+ try {
+ Container c = new Container();
+ c.add(comp);
+ comp.getLocale();
+ } catch (IllegalComponentStateException ex) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ for (Locale locale : Locale.getAvailableLocales())
+ comp.setLocale(locale);
+
+ comp.getColorModel();
+ comp.getLocation();
+
+ exceptions = false;
+ try {
+ comp = new Component(){};
+ comp.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ comp.location();
+ comp.setLocation(1, 2);
+ comp.move(1, 2);
+ comp.setLocation(new Point(1, 2));
+ comp.getSize();
+ comp.size();
+ comp.setSize(1, 32);
+ comp.resize(1, 32);
+ comp.setSize(new Dimension(1, 32));
+ comp.resize(new Dimension(1, 32));
+ comp.getBounds();
+ comp.bounds();
+ comp.setBounds(10, 10, 10, 10);
+ comp.reshape(10, 10, 10, 10);
+ comp.setBounds(new Rectangle(10, 10, 10, 10));
+ comp.getX();
+ comp.getY();
+ comp.getWidth();
+ comp.getHeight();
+ comp.getBounds(new Rectangle(1, 1, 1, 1));
+ comp.getSize(new Dimension(1, 2));
+ comp.getLocation(new Point(1, 2));
+ comp.isOpaque();
+ comp.isLightweight();
+ comp.getPreferredSize();
+ comp.preferredSize();
+ comp.getMinimumSize();
+ comp.minimumSize();
+ comp.getMaximumSize();
+ comp.getAlignmentX();
+ comp.getAlignmentY();
+ comp.doLayout();
+ comp.layout();
+ comp.validate();
+ comp.invalidate();
+ comp.getGraphics();
+ Cursor c = new Cursor(Cursor.CROSSHAIR_CURSOR);
+ comp.setCursor(c);
+ comp.getCursor();
+ comp.isCursorSet();
+ comp.contains(1, 2);
+ comp.inside(1, 2);
+ comp.contains(new Point(1, 2));
+ comp.getComponentAt(1, 2);
+ comp.locate(1, 2);
+ comp.getComponentAt(new Point(1, 2));
+ comp.isFocusTraversable();
+ comp.isFocusable();
+ comp.setFocusable(true);
+ comp.setFocusable(false);
+ comp.requestFocus();
+ comp.requestFocusInWindow();
+ comp.transferFocus();
+ comp.getFocusCycleRootAncestor();
+ comp.isFocusCycleRoot(new Container());
+ comp.nextFocus();
+ comp.transferFocusBackward();
+ comp.transferFocusUpCycle();
+ comp.hasFocus();
+ comp.isFocusOwner();
+ comp.toString();
+ comp.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ comp.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ comp.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ comp.getComponentOrientation();
+ comp.getAccessibleContext();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Component/Headless/HeadlessContainer.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,216 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+import java.util.*;
+
+/*
+ * @test
+ * @summary Check that Container methods do not throw unexpected exceptions
+ * in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessContainer
+ */
+
+public class HeadlessContainer {
+ public static void main(String args[]) {
+ Container lw = new java.awt.Container();
+ Component c1 = lw.add(new Component(){});
+ Component c2 = lw.add(new Component(){});
+ Component c3 = lw.add(new Component(){});
+
+ lw.getComponentCount();
+ lw.countComponents();
+ lw.getComponent(1);
+ lw.getComponent(2);
+ Component[] cs = lw.getComponents();
+ Insets ins = lw.getInsets();
+ ins = lw.insets();
+ lw.remove(1);
+ lw.remove((java.awt.Component) c2);
+ lw.removeAll();
+
+ lw.add(c1);
+ lw.add(c2);
+ lw.add(c3);
+ lw.getLayout();
+ lw.setLayout(new FlowLayout());
+ lw.doLayout();
+ lw.layout();
+ lw.invalidate();
+ lw.validate();
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int i = 8; i < 17; i++) {
+ Font f1 = new Font(font, Font.PLAIN, i);
+ Font f2 = new Font(font, Font.BOLD, i);
+ Font f3 = new Font(font, Font.ITALIC, i);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, i);
+
+ lw.setFont(f1);
+ lw.setFont(f2);
+ lw.setFont(f3);
+ lw.setFont(f4);
+ }
+ }
+ lw.getPreferredSize();
+ lw.preferredSize();
+ lw.getMinimumSize();
+ lw.minimumSize();
+ lw.getMaximumSize();
+ lw.getAlignmentX();
+ lw.getAlignmentY();
+ lw.getComponentAt(1, 2);
+ lw.locate(1, 2);
+ lw.getComponentAt(new Point(1, 2));
+ lw.isFocusCycleRoot(new Container());
+ lw.transferFocusBackward();
+ lw.getName();
+ lw.setName("goober");
+ lw.getName();
+ lw.getParent();
+ lw.getPeer();
+ lw.getGraphicsConfiguration();
+ lw.getTreeLock();
+ lw.getToolkit();
+ lw.isValid();
+ lw.isDisplayable();
+ lw.isVisible();
+ lw.isShowing();
+ lw.isEnabled();
+ lw.setEnabled(false);
+ lw.setEnabled(true);
+ lw.enable();
+ lw.enable(false);
+ lw.enable(true);
+ lw.disable();
+ lw.isDoubleBuffered();
+ lw.enableInputMethods(false);
+ lw.enableInputMethods(true);
+ lw.setVisible(false);
+ lw.setVisible(true);
+ lw.show();
+ lw.show(false);
+ lw.show(true);
+ lw.hide();
+ lw.getForeground();
+ lw.setForeground(Color.red);
+ lw.isForegroundSet();
+ lw.getBackground();
+ lw.setBackground(Color.red);
+ lw.isBackgroundSet();
+ lw.getFont();
+ lw.isFontSet();
+
+ boolean exceptions = false;
+ try {
+ Container c = new Container();
+ lw = new java.awt.Container();
+ c.add(lw);
+ lw.getLocale();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ for (Locale locale : Locale.getAvailableLocales())
+ lw.setLocale(locale);
+
+ lw.getColorModel();
+ lw.getLocation();
+
+ exceptions = false;
+ try {
+ lw.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ lw.location();
+ lw.setLocation(1, 2);
+ lw.move(1, 2);
+ lw.setLocation(new Point(1, 2));
+ lw.getSize();
+ lw.size();
+ lw.setSize(1, 32);
+ lw.resize(1, 32);
+ lw.setSize(new Dimension(1, 32));
+ lw.resize(new Dimension(1, 32));
+ lw.getBounds();
+ lw.bounds();
+ lw.setBounds(10, 10, 10, 10);
+ lw.reshape(10, 10, 10, 10);
+ lw.setBounds(new Rectangle(10, 10, 10, 10));
+ lw.getX();
+ lw.getY();
+ lw.getWidth();
+ lw.getHeight();
+ lw.getBounds(new Rectangle(1, 1, 1, 1));
+ lw.getSize(new Dimension(1, 2));
+ lw.getLocation(new Point(1, 2));
+ lw.isOpaque();
+ lw.isLightweight();
+ lw.getGraphics();
+
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ lw.getFontMetrics(f1);
+ lw.getFontMetrics(f2);
+ lw.getFontMetrics(f3);
+ lw.getFontMetrics(f4);
+ }
+ }
+
+ Cursor c = new Cursor(Cursor.CROSSHAIR_CURSOR);
+ lw.setCursor(c);
+ lw.getCursor();
+ lw.isCursorSet();
+ lw.contains(1, 2);
+ lw.inside(1, 2);
+ lw.contains(new Point(1, 2));
+ lw.isFocusTraversable();
+ lw.isFocusable();
+ lw.setFocusable(true);
+ lw.setFocusable(false);
+ lw.requestFocus();
+ lw.requestFocusInWindow();
+ lw.transferFocus();
+ lw.getFocusCycleRootAncestor();
+ lw.nextFocus();
+ lw.transferFocusUpCycle();
+ lw.hasFocus();
+ lw.isFocusOwner();
+ lw.toString();
+ lw.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ lw.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ lw.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ lw.getComponentOrientation();
+ lw.getAccessibleContext();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Component/Headless/HeadlessDialog.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that Dialog constructors throw expected HeadlessException
+ * in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessDialog
+ */
+
+public class HeadlessDialog {
+ public static void main(String args[]) {
+ boolean exceptions = false;
+ Dialog d;
+
+ try {
+ d = new Dialog(new Frame("Hi there"));
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ d = new Dialog(new Frame("Hi there"), true);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ d = new Dialog(new Frame("Hi there"), false);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ d = new Dialog(new Frame("Hi there"), "Dialog title");
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ d = new Dialog(new Frame("Hi there"), "Dialog title", true);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ d = new Dialog(new Frame("Hi there"), "Dialog title", false);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Component/Headless/HeadlessFileDialog.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that FileDialog constructors throw HeadlessException
+ * in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessFileDialog
+ */
+
+public class HeadlessFileDialog {
+ public static void main(String args[]) {
+ FileDialog d;
+ boolean exceptions = false;
+ try {
+ d = new FileDialog(new Frame("Hi there"));
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ d = new FileDialog(new Frame("Hi there"), "Dialog title");
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ d = new FileDialog(new Frame("Hi there"), "Dialog title", FileDialog.LOAD);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ d = new FileDialog(new Frame("Hi there"), "Dialog title", FileDialog.SAVE);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Component/Headless/HeadlessFrame.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that Font constructors and throw HeadlessException in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessFrame
+ */
+
+public class HeadlessFrame {
+ public static void main(String args[]) {
+ Frame f;
+ boolean exceptions = false;
+
+ try {
+ f = new Frame();
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ f = new Frame("Frame me peculiar");
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Component/Headless/HeadlessLabel.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that Label constructors do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessLabel
+ */
+
+public class HeadlessLabel {
+ public static void main(String args[]) {
+ Label l;
+
+ boolean exceptions = false;
+ try {
+ l = new Label();
+ } catch (java.awt.HeadlessException java_awt_HeadlessException) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ l = new Label("Label me blue");
+ } catch (java.awt.HeadlessException java_awt_HeadlessException) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ l = new Label("Label me blue", 200);
+ } catch (java.awt.HeadlessException java_awt_HeadlessException) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Component/Headless/HeadlessList.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that List constructors do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessList
+ */
+
+public class HeadlessList {
+ public static void main(String args[]) {
+ List l;
+
+ boolean exceptions = false;
+ try {
+ l = new List();
+ } catch (java.awt.HeadlessException java_awt_HeadlessException) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ l = new List(10);
+ } catch (java.awt.HeadlessException java_awt_HeadlessException) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ l = new List(1000);
+ } catch (java.awt.HeadlessException java_awt_HeadlessException) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ l = new List(10, true);
+ } catch (java.awt.HeadlessException java_awt_HeadlessException) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ l = new List(10, false);
+ } catch (java.awt.HeadlessException java_awt_HeadlessException) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ l = new List(1000, true);
+ } catch (java.awt.HeadlessException java_awt_HeadlessException) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ l = new List(1000, false);
+ } catch (java.awt.HeadlessException java_awt_HeadlessException) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Component/Headless/HeadlessPanel.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,218 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that Panel constructors and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessPanel
+ */
+
+public class HeadlessPanel {
+ public static void main(String args[]) {
+ Panel p;
+ p = new Panel();
+ p = new Panel(new FlowLayout());
+ p.getAccessibleContext();
+ Component c1 = p.add(new Component(){});
+ Component c2 = p.add(new Component(){});
+ Component c3 = p.add(new Component(){});
+ p.getComponentCount();
+ p.countComponents();
+ p.getComponent(1);
+ p.getComponent(2);
+ Component[] cs = p.getComponents();
+ Insets ins = p.getInsets();
+ ins = p.insets();
+ p.remove(0);
+ p.remove((Component) c2);
+ p.removeAll();
+
+ p.add(c1);
+ p.add(c2);
+ p.add(c3);
+ p.getLayout();
+ p.setLayout(new FlowLayout());
+ p.doLayout();
+ p.layout();
+ p.invalidate();
+ p.validate();
+
+ p.getPreferredSize();
+ p.preferredSize();
+ p.getMinimumSize();
+ p.minimumSize();
+ p.getMaximumSize();
+ p.getAlignmentX();
+ p.getAlignmentY();
+ p.getComponentAt(1, 2);
+ p.locate(1, 2);
+ p.getComponentAt(new Point(1, 2));
+ p.isFocusCycleRoot(new Container());
+ p.transferFocusBackward();
+ p.setName("goober");
+ p.getName();
+ p.getParent();
+ p.getPeer();
+ p.getGraphicsConfiguration();
+ p.getTreeLock();
+ p.getToolkit();
+ p.isValid();
+ p.isDisplayable();
+ p.isVisible();
+ p.isShowing();
+ p.isEnabled();
+ p.setEnabled(false);
+ p.setEnabled(true);
+ p.enable();
+ p.enable(false);
+ p.enable(true);
+ p.disable();
+ p.isDoubleBuffered();
+ p.enableInputMethods(false);
+ p.enableInputMethods(true);
+ p.setVisible(false);
+ p.setVisible(true);
+ p.show();
+ p.show(false);
+ p.show(true);
+ p.hide();
+ p.getForeground();
+ p.setForeground(Color.red);
+ p.isForegroundSet();
+ p.getBackground();
+ p.setBackground(Color.red);
+ p.isBackgroundSet();
+ p.getFont();
+ p.isFontSet();
+ p.getColorModel();
+ p.getLocation();
+ p.location();
+ p.setLocation(1, 2);
+ p.move(1, 2);
+ p.setLocation(new Point(1, 2));
+ p.getSize();
+ p.size();
+ p.setSize(1, 32);
+ p.resize(1, 32);
+ p.setSize(new Dimension(1, 32));
+ p.resize(new Dimension(1, 32));
+ p.getBounds();
+ p.bounds();
+ p.setBounds(10, 10, 10, 10);
+ p.reshape(10, 10, 10, 10);
+ p.setBounds(new Rectangle(10, 10, 10, 10));
+ p.getX();
+ p.getY();
+ p.getWidth();
+ p.getHeight();
+ p.getBounds(new Rectangle(1, 1, 1, 1));
+ p.getSize(new Dimension(1, 2));
+ p.getLocation(new Point(1, 2));
+ p.isOpaque();
+ p.isLightweight();
+ p.getGraphics();
+
+
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ p.setFont(f1);
+ p.setFont(f2);
+ p.setFont(f3);
+ p.setFont(f4);
+ }
+ }
+
+ boolean exceptions = false;
+ try {
+ Container c = new Container();
+ p = new Panel();
+ c.add(p);
+ p.getLocale();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ for (Locale locale : Locale.getAvailableLocales())
+ p.setLocale(locale);
+
+ exceptions = false;
+ try {
+ p.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j
+ < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ p.getFontMetrics(f1);
+ p.getFontMetrics(f2);
+ p.getFontMetrics(f3);
+ p.getFontMetrics(f4);
+ }
+ }
+
+ Cursor c = new Cursor(Cursor.CROSSHAIR_CURSOR);
+ p.setCursor(c);
+ p.getCursor();
+ p.isCursorSet();
+ p.contains(1, 2);
+ p.inside(1, 2);
+ p.contains(new Point(1, 2));
+ p.isFocusTraversable();
+ p.isFocusable();
+ p.setFocusable(true);
+ p.setFocusable(false);
+ p.requestFocus();
+ p.requestFocusInWindow();
+ p.transferFocus();
+ p.getFocusCycleRootAncestor();
+ p.nextFocus();
+ p.transferFocusUpCycle();
+ p.hasFocus();
+ p.isFocusOwner();
+ p.toString();
+ p.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ p.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ p.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ p.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Component/Headless/HeadlessScrollPane.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that ScrollPane constructors throw HeadlessException in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessScrollPane
+ */
+
+public class HeadlessScrollPane {
+ public static void main(String args[]) {
+ ScrollPane s;
+ boolean exceptions = false;
+
+ try {
+ s = new ScrollPane();
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ s = new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ s = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ s = new ScrollPane(ScrollPane.SCROLLBARS_NEVER);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Component/Headless/HeadlessScrollbar.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that Scrollbar constructors throw HeadlessException in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessScrollbar
+ */
+
+public class HeadlessScrollbar {
+
+ public static void main(String args[]) {
+ Scrollbar s;
+ boolean exceptions = false;
+
+ try {
+ s = new Scrollbar();
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ s = new Scrollbar(Scrollbar.HORIZONTAL);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ s = new Scrollbar(Scrollbar.VERTICAL);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ s = new Scrollbar(Scrollbar.HORIZONTAL, 1, 10, 0, 100);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ s = new Scrollbar(Scrollbar.VERTICAL, 1, 10, 0, 100);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Component/Headless/HeadlessTextArea.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that TextArea constructors throw HeadlessException in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessTextArea
+ */
+
+public class HeadlessTextArea {
+ public static void main(String args[]) {
+ TextArea t;
+ boolean exceptions = false;
+
+ try {
+ t = new TextArea();
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ t = new TextArea("Hi there");
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ t = new TextArea(10, 100);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ t = new TextArea("Hi there", 10, 100);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ t = new TextArea("Hi there", 10, 100, TextArea.SCROLLBARS_BOTH);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ t = new TextArea("Hi there", 10, 100, TextArea.SCROLLBARS_HORIZONTAL_ONLY);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ t = new TextArea("Hi there", 10, 100, TextArea.SCROLLBARS_VERTICAL_ONLY);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ t = new TextArea("Hi there", 10, 100, TextArea.SCROLLBARS_NONE);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Component/Headless/HeadlessTextField.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that TextField constructors throw HeadlessException in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessTextField
+ */
+
+public class HeadlessTextField {
+ public static void main(String args[]) {
+ TextField t;
+ boolean exceptions = false;
+
+ try {
+ t = new TextField();
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ t = new TextField("Hi there");
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ try {
+ t = new TextField(20);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ t = new TextField(200);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ try {
+ t = new TextField("Hi there", 20);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ t = new TextField("Hi there", 200);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Component/Headless/HeadlessWindow.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that Window constructor throw HeadlessException in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessWindow
+ */
+
+public class HeadlessWindow {
+ public static void main(String args[]) {
+ boolean exceptions = false;
+ try {
+ Window b = new Window(new Frame("Hi there"));
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Cursor/HeadlessCursor.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that Cursor constructors and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessCursor
+ */
+
+public class HeadlessCursor {
+ public static void main(String args[]) {
+ Cursor c;
+ c = new Cursor(Cursor.CROSSHAIR_CURSOR);
+ c.getType();
+ c.getName();
+ c = new Cursor(Cursor.DEFAULT_CURSOR);
+ c.getType();
+ c.getName();
+ c = new Cursor(Cursor.E_RESIZE_CURSOR);
+ c.getType();
+ c.getName();
+ c = new Cursor(Cursor.HAND_CURSOR);
+ c.getType();
+ c.getName();
+ c = new Cursor(Cursor.N_RESIZE_CURSOR);
+ c.getType();
+ c.getName();
+ c = new Cursor(Cursor.NE_RESIZE_CURSOR);
+ c.getType();
+ c.getName();
+ c = new Cursor(Cursor.NW_RESIZE_CURSOR);
+ c.getType();
+ c.getName();
+ c = new Cursor(Cursor.S_RESIZE_CURSOR);
+ c.getType();
+ c.getName();
+ c = new Cursor(Cursor.SE_RESIZE_CURSOR);
+ c.getType();
+ c.getName();
+ c = new Cursor(Cursor.SW_RESIZE_CURSOR);
+ c.getType();
+ c.getName();
+ c = new Cursor(Cursor.TEXT_CURSOR);
+ c.getType();
+ c.getName();
+ c = new Cursor(Cursor.W_RESIZE_CURSOR);
+ c.getType();
+ c.getName();
+ c = new Cursor(Cursor.WAIT_CURSOR);
+ c.getType();
+ c.getName();
+
+ c = Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR);
+ c = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
+ c = Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR);
+ c = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);
+ c = Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR);
+ c = Cursor.getPredefinedCursor(Cursor.NE_RESIZE_CURSOR);
+ c = Cursor.getPredefinedCursor(Cursor.NW_RESIZE_CURSOR);
+ c = Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR);
+ c = Cursor.getPredefinedCursor(Cursor.SE_RESIZE_CURSOR);
+ c = Cursor.getPredefinedCursor(Cursor.SW_RESIZE_CURSOR);
+ c = Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR);
+ c = Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR);
+ c = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
+ c = Cursor.getDefaultCursor();
+ c.getType();
+ c.getName();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/EventQueue/HeadlessEventQueue.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that EventQueue constructor does not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessEventQueue
+ */
+
+public class HeadlessEventQueue {
+ public static void main(String args[]) {
+ EventQueue eq = new EventQueue();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/Headless/HeadlessContainerOrderFocusTraversalPolicy.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that ContainerOrderFocusTraversalPolicy constructor and
+ * methods do not throw unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessContainerOrderFocusTraversalPolicy
+ */
+
+public class HeadlessContainerOrderFocusTraversalPolicy {
+
+ public static void main(String args[]) {
+ ContainerOrderFocusTraversalPolicy cot = new ContainerOrderFocusTraversalPolicy();
+
+ Container c = new Container();
+ Component cb1;
+ Component cb2;
+ Component cb3;
+
+ c.setFocusCycleRoot(true);
+ c.setFocusTraversalPolicy(cot);
+ c.add(cb1 = new Component(){});
+ c.add(cb2 = new Component(){});
+ c.add(cb3 = new Component(){});
+
+ cot.getComponentAfter(c, cb1);
+ cot.getComponentAfter(c, cb2);
+ cot.getComponentAfter(c, cb3);
+
+ cot.getComponentBefore(c, cb1);
+ cot.getComponentBefore(c, cb2);
+ cot.getComponentBefore(c, cb3);
+
+ cot.getFirstComponent(c);
+
+ cot.getLastComponent(c);
+
+ cot.getDefaultComponent(c);
+ cot.setImplicitDownCycleTraversal(true);
+ cot.setImplicitDownCycleTraversal(false);
+ cot.getImplicitDownCycleTraversal();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/Headless/HeadlessDefaultFocusTraversalPolicy.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that DefaultFocusTraversalPolicy constructor and
+ * methods do not throw unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessDefaultFocusTraversalPolicy
+ */
+
+public class HeadlessDefaultFocusTraversalPolicy {
+ public static void main(String args[]) {
+ Container c = new Container();
+ Component cb1;
+ Component cb2;
+ Component cb3;
+
+ DefaultFocusTraversalPolicy cot = new DefaultFocusTraversalPolicy();
+ c.setFocusCycleRoot(true);
+ c.setFocusTraversalPolicy(cot);
+ c.add(cb1 = new Component(){});
+ c.add(cb2 = new Component(){});
+ c.add(cb3 = new Component(){});
+
+ cot.getComponentAfter(c, cb1);
+ cot.getComponentAfter(c, cb2);
+ cot.getComponentAfter(c, cb3);
+
+ cot.getComponentBefore(c, cb1);
+ cot.getComponentBefore(c, cb2);
+ cot.getComponentBefore(c, cb3);
+
+ cot.getFirstComponent(c);
+
+ cot.getLastComponent(c);
+
+ cot.getDefaultComponent(c);
+
+ cot.setImplicitDownCycleTraversal(true);
+
+ cot.setImplicitDownCycleTraversal(false);
+
+ cot.getImplicitDownCycleTraversal();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/Headless/HeadlessDefaultKeyboardFocusManager.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that DefaultKeyboardFocusManager constructor does not
+ * throw unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessDefaultKeyboardFocusManager
+ */
+
+public class HeadlessDefaultKeyboardFocusManager {
+ public static void main(String args[]) {
+ DefaultKeyboardFocusManager dfk = new DefaultKeyboardFocusManager();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/FontClass/HeadlessFont.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,239 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+import java.awt.font.TextAttribute;
+import java.awt.geom.AffineTransform;
+import java.text.AttributedCharacterIterator;
+import java.text.StringCharacterIterator;
+import java.util.HashMap;
+import java.util.Map;
+
+/*
+ * @test
+ * @summary Check that Font constructors and methods do not throw
+ * unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessFont
+ */
+
+public class HeadlessFont {
+
+ public static void main(String args[]) {
+ HashMap attMap = new HashMap();
+ attMap.put(TextAttribute.FAMILY, "Helvetica Bold");
+ attMap.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_LIGHT);
+ attMap.put(TextAttribute.WIDTH, TextAttribute.WIDTH_REGULAR);
+ attMap.put(TextAttribute.SIZE, new Float(20));
+ attMap.put(TextAttribute.FOREGROUND, Color.white);
+ attMap.put(TextAttribute.BACKGROUND, Color.black);
+
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int i = 8; i < 17; i++) {
+ Font f1 = new Font(font, Font.PLAIN, i);
+ Font f2 = new Font(font, Font.BOLD, i);
+ Font f3 = new Font(font, Font.ITALIC, i);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, i);
+
+ FontMetrics metrics = Toolkit.getDefaultToolkit().getFontMetrics(f1);
+ metrics = Toolkit.getDefaultToolkit().getFontMetrics(f2);
+ metrics = Toolkit.getDefaultToolkit().getFontMetrics(f3);
+ metrics = Toolkit.getDefaultToolkit().getFontMetrics(f4);
+
+ AffineTransform trans = f1.getTransform();
+ trans = f2.getTransform();
+ trans = f3.getTransform();
+ trans = f4.getTransform();
+
+ String str;
+ str = f1.getFamily();
+ str = f2.getFamily();
+ str = f3.getFamily();
+ str = f4.getFamily();
+
+ str = f1.getPSName();
+ str = f2.getPSName();
+ str = f3.getPSName();
+ str = f4.getPSName();
+
+ str = f1.getName();
+ str = f2.getName();
+ str = f3.getName();
+ str = f4.getName();
+
+ str = f1.getFontName();
+ str = f2.getFontName();
+ str = f3.getFontName();
+ str = f4.getFontName();
+
+ str = f1.toString();
+ str = f2.toString();
+ str = f3.toString();
+ str = f4.toString();
+
+ int s;
+ s = f1.getStyle();
+ s = f2.getStyle();
+ s = f3.getStyle();
+ s = f4.getStyle();
+
+ s = f1.getSize();
+ s = f2.getSize();
+ s = f3.getSize();
+ s = f4.getSize();
+
+ s = f1.hashCode();
+ s = f2.hashCode();
+ s = f3.hashCode();
+ s = f4.hashCode();
+
+ s = f1.getNumGlyphs();
+ s = f2.getNumGlyphs();
+ s = f3.getNumGlyphs();
+ s = f4.getNumGlyphs();
+
+ s = f1.getMissingGlyphCode();
+ s = f2.getMissingGlyphCode();
+ s = f3.getMissingGlyphCode();
+ s = f4.getMissingGlyphCode();
+
+ float f;
+ f = f1.getSize2D();
+ f = f2.getSize2D();
+ f = f3.getSize2D();
+ f = f4.getSize2D();
+
+
+ byte b;
+ b = f1.getBaselineFor('c');
+ b = f2.getBaselineFor('c');
+ b = f3.getBaselineFor('c');
+ b = f4.getBaselineFor('c');
+
+ Map m = f1.getAttributes();
+ m = f2.getAttributes();
+ m = f3.getAttributes();
+ m = f4.getAttributes();
+
+ AttributedCharacterIterator.Attribute[] a;
+ a = f1.getAvailableAttributes();
+ a = f2.getAvailableAttributes();
+ a = f3.getAvailableAttributes();
+ a = f4.getAvailableAttributes();
+
+
+ Font fnt;
+ fnt = f1.deriveFont(Font.BOLD | Font.ITALIC, (float) 80);
+ fnt = f2.deriveFont(Font.BOLD | Font.ITALIC, (float) 80);
+ fnt = f3.deriveFont(Font.BOLD | Font.ITALIC, (float) 80);
+ fnt = f4.deriveFont(Font.BOLD | Font.ITALIC, (float) 80);
+
+ fnt = f1.deriveFont(80f);
+ fnt = f2.deriveFont(80f);
+ fnt = f3.deriveFont(80f);
+ fnt = f4.deriveFont(80f);
+
+ fnt = f1.deriveFont(Font.BOLD | Font.ITALIC);
+ fnt = f2.deriveFont(Font.BOLD | Font.ITALIC);
+ fnt = f3.deriveFont(Font.BOLD | Font.ITALIC);
+ fnt = f4.deriveFont(Font.BOLD | Font.ITALIC);
+
+ fnt = f1.deriveFont(attMap);
+ fnt = f2.deriveFont(attMap);
+ fnt = f3.deriveFont(attMap);
+ fnt = f4.deriveFont(attMap);
+
+
+ if (!f1.isPlain())
+ throw new RuntimeException("Plain font " + f1.getName() + " says it's not plain");
+ if (f2.isPlain())
+ throw new RuntimeException("Bold font " + f1.getName() + " says it is plain");
+ if (f3.isPlain())
+ throw new RuntimeException("Italic font " + f1.getName() + " says it is plain");
+ if (f4.isPlain())
+ throw new RuntimeException("Bold|Italic font " + f1.getName() + " says it is plain");
+
+ if (f1.isBold())
+ throw new RuntimeException("Plain font " + f1.getName() + " says it is bold");
+ if (!f2.isBold())
+ throw new RuntimeException("Bold font " + f1.getName() + " says it's not bold");
+ if (f3.isBold())
+ throw new RuntimeException("Italic font " + f1.getName() + " says it is bold");
+ if (!f4.isBold())
+ throw new RuntimeException("Bold|Italic font " + f1.getName() + " says it's not bold");
+
+ if (f1.isItalic())
+ throw new RuntimeException("Plain font " + f1.getName() + " says it is italic");
+ if (f2.isItalic())
+ throw new RuntimeException("Bold font " + f1.getName() + " says it is italic");
+ if (!f3.isItalic())
+ throw new RuntimeException("Italic font " + f1.getName() + " says it's not italic");
+ if (!f4.isItalic())
+ throw new RuntimeException("Bold|Italic font " + f1.getName() + " says it's not italic");
+
+ f1.canDisplay('~');
+ f2.canDisplay('~');
+ f3.canDisplay('~');
+ f4.canDisplay('~');
+ f1.canDisplay('c');
+ f2.canDisplay('c');
+ f3.canDisplay('c');
+ f4.canDisplay('c');
+
+ f1.canDisplayUpTo("canDisplayUpTo");
+ f2.canDisplayUpTo("canDisplayUpTo");
+ f3.canDisplayUpTo("canDisplayUpTo");
+ f4.canDisplayUpTo("canDisplayUpTo");
+
+ str = "canDisplayUpTo";
+ f1.canDisplayUpTo(str.toCharArray(), 0, str.length());
+ f2.canDisplayUpTo(str.toCharArray(), 0, str.length());
+ f3.canDisplayUpTo(str.toCharArray(), 0, str.length());
+ f4.canDisplayUpTo(str.toCharArray(), 0, str.length());
+
+ f1.canDisplayUpTo(new StringCharacterIterator(str), 0, str.length());
+ f2.canDisplayUpTo(new StringCharacterIterator(str), 0, str.length());
+ f3.canDisplayUpTo(new StringCharacterIterator(str), 0, str.length());
+ f4.canDisplayUpTo(new StringCharacterIterator(str), 0, str.length());
+
+ f1.getItalicAngle();
+ f2.getItalicAngle();
+ f3.getItalicAngle();
+ f4.getItalicAngle();
+
+ f1.hasUniformLineMetrics();
+ f2.hasUniformLineMetrics();
+ f3.hasUniformLineMetrics();
+ f4.hasUniformLineMetrics();
+
+ f1.getPeer();
+ f2.getPeer();
+ f3.getPeer();
+ f4.getPeer();
+ }
+ }
+
+ Font f = new Font(attMap);
+ f = Font.getFont(attMap);
+ f = Font.decode(null);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/GradientPaint/HeadlessGradientPaint.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that GradientPaint that constructors and methods do not
+ * throw unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessGradientPaint
+ */
+
+public class HeadlessGradientPaint {
+ public static void main(String args[]) {
+ GradientPaint gp;
+ gp = new GradientPaint(10, 10, Color.red, 20, 20, Color.blue);
+ gp = new GradientPaint(new Point(10, 10), Color.red, new Point(20, 20), Color.blue);
+ gp = new GradientPaint(10, 10, Color.red, 20, 20, Color.blue, true);
+ gp = new GradientPaint(10, 10, Color.red, 20, 20, Color.blue, false);
+ gp = new GradientPaint(new Point(10, 10), Color.red, new Point(20, 20), Color.blue, true);
+ gp = new GradientPaint(new Point(10, 10), Color.red, new Point(20, 20), Color.blue, false);
+
+ gp = new GradientPaint(10, 10, Color.red, 20, 20, Color.blue, false);
+ gp.getPoint1();
+ gp.getColor1();
+ gp.getPoint2();
+ gp.getColor2();
+ gp.isCyclic();
+ gp.getTransparency();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Graphics2D/Headless/HeadlessPoint.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that Point constructors and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessPoint
+ */
+
+public class HeadlessPoint {
+ public static void main(String args[]) {
+ Point p;
+ p = new Point();
+ p = new Point(new Point(1, 2));
+ p = new Point(1, 2);
+ p.getX();
+ p.getY();
+ p.getLocation();
+ p.setLocation(new Point(3, 4));
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Graphics2D/Headless/HeadlessPolygon.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2014, 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.Polygon;
+
+/*
+ * @test
+ * @summary Check that Polygon constructor does not throw unexpected exceptions
+ * in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessPolygon
+ */
+
+public class HeadlessPolygon {
+ public static void main(String args[]) {
+ new Polygon();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Graphics2D/Headless/HeadlessRectangle.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that Rectangle constructors and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessRectangle
+ */
+
+public class HeadlessRectangle {
+ public static void main(String args[]) {
+ Rectangle r;
+ r = new Rectangle();
+ r = new Rectangle(new Rectangle());
+ r = new Rectangle(100, 200);
+ r = new Rectangle(new Point(100, 200), new Dimension(300, 400));
+ r = new Rectangle(new Point(100, 200));
+ r = new Rectangle(new Dimension(300, 400));
+ r = new Rectangle(100, 200, 300, 400);
+ r.getX();
+ r.getY();
+ r.getWidth();
+ r.getHeight();
+ r.getBounds();
+ r.getBounds2D();
+ r.getLocation();
+ r.getSize();
+ r.contains(new Point(1, 2));
+ r.contains(1, 2);
+ r.contains(new Rectangle(1, 2, 3, 4));
+ r.contains(1, 2, 3, 4);
+ r.add(1, 2);
+ r.add(new Point(1, 2));
+ r.add(new Rectangle(1, 2, 3, 4));
+ r.grow(1, 2);
+ r.isEmpty();
+ r.toString();
+ r.hashCode();
+ r.getMinX();
+ r.getMinY();
+ r.getMaxX();
+ r.getMaxY();
+ r.getCenterX();
+ r.getCenterY();
+ r.getFrame();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/GraphicsConfiguration/HeadlessGraphicsConfiguration.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+import java.awt.geom.AffineTransform;
+import java.awt.image.BufferedImage;
+import java.awt.image.ColorModel;
+
+/*
+ * @test
+ * @summary Check that GraphicsConfiguration methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessGraphicsConfiguration
+ */
+
+public class HeadlessGraphicsConfiguration {
+ public static void main(String args[]) {
+ GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ Graphics2D gd = ge.createGraphics(new BufferedImage(100, 100, BufferedImage.TYPE_4BYTE_ABGR));
+ GraphicsConfiguration gc = gd.getDeviceConfiguration();
+ GraphicsDevice gdev = gc.getDevice();
+ BufferedImage bi = gc.createCompatibleImage(100, 100);
+ bi = gc.createCompatibleImage(100, 100, Transparency.TRANSLUCENT);
+
+ ColorModel cm = gc.getColorModel();
+ cm = gc.getColorModel(Transparency.TRANSLUCENT);
+
+ AffineTransform at = gc.getDefaultTransform();
+ at = gc.getNormalizingTransform();
+
+ Rectangle r = gc.getBounds();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/GraphicsDevice/HeadlessGraphicsDevice.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+import java.awt.image.BufferedImage;
+
+/*
+ * @test
+ * @summary Check that GraphicsDevice methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessGraphicsDevice
+ */
+
+public class HeadlessGraphicsDevice {
+ public static void main(String args[]) {
+ GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ Graphics2D gd = ge.createGraphics(new BufferedImage(100, 100, BufferedImage.TYPE_4BYTE_ABGR));
+ GraphicsConfiguration gc = gd.getDeviceConfiguration();
+ GraphicsDevice gdev = gc.getDevice();
+
+ for (GraphicsConfiguration gcl : gdev.getConfigurations())
+ gcl.toString();
+
+ gdev.getDefaultConfiguration().toString();
+ gdev.getIDstring();
+
+ if (gdev.getType() != GraphicsDevice.TYPE_IMAGE_BUFFER)
+ throw new RuntimeException("Created GraphicsDevice that should be IMAGE_BUFFER but it isn't");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/GraphicsEnvironment/HeadlessGraphicsEnvironment.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+import java.awt.image.BufferedImage;
+
+/*
+ * @test
+ * @summary Check that GraphicsEnvironment methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessGraphicsEnvironment
+ */
+
+public class HeadlessGraphicsEnvironment {
+ public static void main(String args[]) {
+ GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ if (!GraphicsEnvironment.isHeadless())
+ throw new RuntimeException("GraphicsEnvironment.isHeadless says it's not headless mode when it is");
+
+ boolean exceptions = false;
+ try {
+ GraphicsDevice[] gdl = ge.getScreenDevices();
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when excepted");
+
+ exceptions = false;
+ try {
+ GraphicsDevice gdl = ge.getDefaultScreenDevice();
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when excepted");
+
+ Graphics2D gd = ge.createGraphics(new BufferedImage(100, 100, BufferedImage.TYPE_4BYTE_ABGR));
+
+ for (Font font : ge.getAllFonts()) {
+ for (float j = 8; j < 17; j++) {
+ Font f1 = font.deriveFont(Font.PLAIN, j);
+ Font f2 = font.deriveFont(Font.BOLD, j);
+ Font f3 = font.deriveFont(Font.ITALIC, j);
+ Font f4 = font.deriveFont(Font.BOLD | Font.ITALIC, j);
+
+ f1.hasUniformLineMetrics();
+ f2.hasUniformLineMetrics();
+ f3.hasUniformLineMetrics();
+ f4.hasUniformLineMetrics();
+ }
+ }
+
+ String[] fNames = ge.getAvailableFontFamilyNames();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Headless/HeadlessAWTEventMulticaster.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,247 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+import java.awt.event.*;
+
+/*
+ * @test
+ * @summary Check for AWTEventMulticaster working in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessAWTEventMulticaster
+ */
+
+public class HeadlessAWTEventMulticaster {
+ class ComponentListenerImpl implements ComponentListener {
+ public boolean hidden = false;
+ public boolean moved = false;
+ public boolean resized = false;
+ public boolean shown = false;
+
+ public void componentHidden(ComponentEvent e) {
+ hidden = true;
+ }
+
+ public void componentMoved(ComponentEvent e) {
+ moved = true;
+ }
+
+ public void componentResized(ComponentEvent e) {
+ resized = true;
+ }
+
+ public void componentShown(ComponentEvent e) {
+ shown = true;
+ }
+ }
+
+ class ContainerListenerImpl implements ContainerListener {
+ public boolean removed = false;
+ public boolean added = false;
+
+ public void componentAdded(ContainerEvent e) {
+ added = true;
+ }
+
+ public void componentRemoved(ContainerEvent e) {
+ removed = true;
+ }
+ }
+
+ class FocusListenerImpl implements FocusListener {
+ public boolean gained = false;
+ public boolean lost = false;
+
+ public void focusGained(FocusEvent e) {
+ gained = true;
+ }
+
+ public void focusLost(FocusEvent e) {
+ lost = true;
+ }
+ }
+
+ class KeyListenerImpl implements KeyListener {
+ public boolean pressed = false;
+ public boolean released = false;
+ public boolean typed = false;
+
+ public void keyPressed(KeyEvent e) {
+ pressed = true;
+ }
+
+ public void keyReleased(KeyEvent e) {
+ released = true;
+ }
+
+ public void keyTyped(KeyEvent e) {
+ typed = true;
+ }
+ }
+
+ public static void main(String args[]) {
+ new HeadlessAWTEventMulticaster().doTest();
+ }
+
+ void doTest() {
+ ComponentListener compList;
+ ComponentListenerImpl compListImpl;
+
+ ContainerListener contList;
+ ContainerListenerImpl contListImpl;
+
+ FocusListener focList;
+ FocusListenerImpl focListImpl;
+
+ KeyListener keyList;
+ KeyListenerImpl keyListImpl;
+
+ Component component = new Component(){};
+
+ // Component resized
+ compListImpl = new ComponentListenerImpl();
+ compList = AWTEventMulticaster.add(compListImpl, null);
+ compList.componentResized(new ComponentEvent(component,
+ ComponentEvent.COMPONENT_RESIZED));
+ if (compListImpl.hidden || compListImpl.moved || compListImpl.shown) {
+ throw new RuntimeException("Wrong id delivered: hidden || moved || shown");
+ }
+ if (!compListImpl.resized) {
+ throw new RuntimeException("Expected id, resized, not delivered");
+ }
+
+ // Component moved
+ compListImpl = new ComponentListenerImpl();
+ compList = AWTEventMulticaster.add(compListImpl, null);
+ compList.componentMoved(new ComponentEvent(component,
+ ComponentEvent.COMPONENT_MOVED));
+ if (compListImpl.hidden || compListImpl.resized || compListImpl.shown) {
+ throw new RuntimeException("Wrong id delivered: hidden || resized || shown");
+ }
+ if (!compListImpl.moved) {
+ throw new RuntimeException("Expected id, moved, not delivered");
+ }
+
+ // Component shown
+ compListImpl = new ComponentListenerImpl();
+ compList = AWTEventMulticaster.add(compListImpl, null);
+ compList.componentShown(new ComponentEvent(component,
+ ComponentEvent.COMPONENT_SHOWN));
+ if (compListImpl.hidden || compListImpl.resized || compListImpl.moved) {
+ throw new RuntimeException("Wrong id delivered: hidden || resized || moved");
+ }
+ if (!compListImpl.shown) {
+ throw new RuntimeException("Expected id, shown, not delivered");
+ }
+
+ // Component hidden
+ compListImpl = new ComponentListenerImpl();
+ compList = AWTEventMulticaster.add(compListImpl, null);
+ compList.componentHidden(new ComponentEvent(component,
+ ComponentEvent.COMPONENT_HIDDEN));
+ if (compListImpl.shown || compListImpl.resized || compListImpl.moved) {
+ throw new RuntimeException("Wrong id delivered: shown || resized || moved");
+ }
+ if (!compListImpl.hidden) {
+ throw new RuntimeException("Expected id, hidden, not delivered");
+ }
+
+ // Component added
+ contListImpl = new ContainerListenerImpl();
+ contList = AWTEventMulticaster.add(contListImpl, null);
+ contList.componentAdded(new ContainerEvent(component,
+ ContainerEvent.COMPONENT_ADDED, component));
+ if (contListImpl.removed) {
+ throw new RuntimeException("Wrong id delivered: removed");
+ }
+ if (!contListImpl.added) {
+ throw new RuntimeException("Expected id, added, not delivered");
+ }
+
+ // Component removed
+ contListImpl = new ContainerListenerImpl();
+ contList = AWTEventMulticaster.add(contListImpl, null);
+ contList.componentRemoved(new ContainerEvent(component,
+ ContainerEvent.COMPONENT_REMOVED, component));
+ if (contListImpl.added) {
+ throw new RuntimeException("Wrong id delivered: added");
+ }
+ if (!contListImpl.removed) {
+ throw new RuntimeException("Expected id, removed, not delivered");
+ }
+
+ // Focus gained
+ focListImpl = new FocusListenerImpl();
+ focList = AWTEventMulticaster.add(focListImpl, null);
+ focList.focusGained(new FocusEvent(component, FocusEvent.FOCUS_GAINED));
+ if (focListImpl.lost) {
+ throw new RuntimeException("Wrong id delivered: lost");
+ }
+ if (!focListImpl.gained) {
+ throw new RuntimeException("Expected id, gained, not delivered");
+ }
+
+ // Focus lost
+ focListImpl = new FocusListenerImpl();
+ focList = AWTEventMulticaster.add(focListImpl, null);
+ focList.focusLost(new FocusEvent(component, FocusEvent.FOCUS_LOST));
+ if (focListImpl.gained) {
+ throw new RuntimeException("Wrong id delivered: gained");
+ }
+ if (!focListImpl.lost) {
+ throw new RuntimeException("Expected id, lost, not delivered");
+ }
+
+ // Key typed
+ keyListImpl = new KeyListenerImpl();
+ keyList = AWTEventMulticaster.add(keyListImpl, null);
+ keyList.keyTyped(new KeyEvent(component,
+ KeyEvent.KEY_TYPED, 0L, 0, 0));
+ if (keyListImpl.pressed || keyListImpl.released)
+ throw new RuntimeException("Wrong id delivered: pressed || released");
+
+ if (!keyListImpl.typed)
+ throw new RuntimeException("Expected id, typed, not delivered");
+
+ // Key pressed
+ keyListImpl = new KeyListenerImpl();
+ keyList = AWTEventMulticaster.add(keyListImpl, null);
+ keyList.keyPressed(new KeyEvent(component,
+ KeyEvent.KEY_PRESSED, 0L, 0, 0));
+ if (keyListImpl.typed || keyListImpl.released)
+ throw new RuntimeException("Wrong id delivered: typed || released");
+
+ if (!keyListImpl.pressed)
+ throw new RuntimeException("Expected id, pressed, not delivered");
+
+ // Key released
+ keyListImpl = new KeyListenerImpl();
+ keyList = AWTEventMulticaster.add(keyListImpl, null);
+ keyList.keyReleased(new KeyEvent(component,
+ KeyEvent.KEY_RELEASED, 0L, 0, 0));
+ if (keyListImpl.pressed || keyListImpl.typed)
+ throw new RuntimeException("Wrong id delivered: pressed || typed");
+
+ if (!keyListImpl.released)
+ throw new RuntimeException("Expected id, released, not delivered");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Headless/HeadlessAWTException.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that AWTException can be created in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessAWTException
+ */
+
+public class HeadlessAWTException {
+
+ public static void main (String[] args) {
+ AWTException e = new AWTException("aa");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Headless/HeadlessBasicStroke.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that BasicStroke constructors and get-methods do not
+ * throw exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessBasicStroke
+ */
+
+
+public class HeadlessBasicStroke {
+ public static void main (String[] args) {
+ BasicStroke bs;
+
+ // Constructors without exceptions
+ bs = new BasicStroke(1, BasicStroke.CAP_BUTT,
+ BasicStroke.JOIN_BEVEL, 3, null, -1);
+ bs = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 3,
+ new float[]{(float) 2.0, (float) 3.0}, 0);
+ bs = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 3,
+ new float[]{(float) 2.0, (float) 3.0}, 1);
+ bs = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, (float) 3);
+
+ bs = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, (float) 3);
+
+ bs = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, (float) 3);
+
+ bs = new BasicStroke(1, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 3);
+
+ bs = new BasicStroke(1, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND, 3);
+
+ bs = new BasicStroke(1, BasicStroke.JOIN_ROUND, BasicStroke.CAP_SQUARE, 3);
+
+ bs = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL);
+
+ bs = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER);
+
+ bs = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND);
+
+ bs = new BasicStroke(1, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
+
+ bs = new BasicStroke(1, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND);
+
+ bs = new BasicStroke(1, BasicStroke.JOIN_ROUND, BasicStroke.CAP_SQUARE);
+
+ bs = new BasicStroke((float) 0.1);
+
+ bs = new BasicStroke((float) 0.9);
+
+ bs = new BasicStroke(4);
+
+ bs = new BasicStroke(10);
+
+ bs = new BasicStroke(20);
+
+ bs = new BasicStroke(100);
+
+ bs = new BasicStroke();
+
+ // Constructors with exceptions
+ boolean exceptions = false;
+ try {
+ bs = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, (float) 0.2);
+ } catch (IllegalArgumentException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("Constructor did not throw IllegalArgumentException when expected");
+
+ exceptions = false;
+ try {
+ bs = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, (float) 0.2);
+ } catch (IllegalArgumentException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("Constructor did not throw IllegalArgumentException when expected");
+
+ exceptions = false;
+ try {
+ bs = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, (float) 0.2);
+ } catch (IllegalArgumentException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("Constructor did not throw IllegalArgumentException when expected");
+
+ exceptions = false;
+ try {
+ bs = new BasicStroke(1, 5678, 92039, 3);
+ } catch (IllegalArgumentException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("Constructor did not throw IllegalArgumentException when expected");
+
+ exceptions = false;
+ try {
+ bs = new BasicStroke(1, 5678, 92039);
+ } catch (IllegalArgumentException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("Constructor did not throw IllegalArgumentException when expected");
+
+ exceptions = false;
+ try {
+ bs = new BasicStroke((float) -0.9);
+ } catch (IllegalArgumentException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("Constructor did not throw IllegalArgumentException when expected");
+
+ // Create stroke shape
+ bs = new BasicStroke(20);
+ bs.createStrokedShape(new Rectangle(10, 10, 10, 10));
+
+ // Get-methods
+ bs = new BasicStroke(100);
+ bs.getLineWidth();
+ bs.getEndCap();
+ bs.getLineJoin();
+ bs.getMiterLimit();
+ bs.getDashArray();
+ bs.getDashPhase();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Headless/HeadlessBorderLayout.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check BorderLayout constructors and methods working in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessBorderLayout
+ */
+
+public class HeadlessBorderLayout {
+ public static void main (String[] args) {
+ BorderLayout bl;
+ bl = new BorderLayout();
+ bl = new BorderLayout(10, 10);
+ bl.getHgap();
+ bl.setHgap(10);
+ bl.getVgap();
+ bl.setVgap(10);
+
+ bl = new BorderLayout();
+ bl.setVgap(10);
+ bl.addLayoutComponent(new Component(){}, BorderLayout.AFTER_LAST_LINE);
+ bl.addLayoutComponent(new Component(){}, BorderLayout.AFTER_LINE_ENDS);
+ bl.addLayoutComponent(new Component(){}, BorderLayout.BEFORE_FIRST_LINE);
+ bl.addLayoutComponent(new Component(){}, BorderLayout.BEFORE_LINE_BEGINS);
+ bl.addLayoutComponent(new Component(){}, BorderLayout.PAGE_START);
+ bl.addLayoutComponent(new Component(){}, BorderLayout.PAGE_END);
+ bl.addLayoutComponent(new Component(){}, BorderLayout.LINE_START);
+ bl.addLayoutComponent(new Component(){}, BorderLayout.LINE_END);
+ bl.addLayoutComponent(new Component(){}, BorderLayout.CENTER);
+ bl.addLayoutComponent(new Component(){}, BorderLayout.EAST);
+ bl.addLayoutComponent(new Component(){}, BorderLayout.NORTH);
+ bl.addLayoutComponent(new Component(){}, BorderLayout.SOUTH);
+ bl.addLayoutComponent(new Component(){}, BorderLayout.WEST);
+
+ Component cb = new Component(){};
+ bl.addLayoutComponent(cb, BorderLayout.WEST);
+ bl.removeLayoutComponent(cb);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Headless/HeadlessCardLayout.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check whether CardLayout constructor and methods do not throw exceptions
+ * in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessCardLayout
+ */
+
+public class HeadlessCardLayout {
+
+ public static void main(String args[]) {
+ CardLayout cl;
+ cl = new CardLayout();
+ cl = new CardLayout(10, 10);
+ cl.getHgap();
+ cl.setHgap(10);
+ cl.getVgap();
+ cl.setVgap(10);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Headless/HeadlessCheckboxGroup.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that CheckboxGroup constructor and toString() method do not throw
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessCheckboxGroup
+ */
+
+public class HeadlessCheckboxGroup {
+ public static void main(String args[]) {
+ CheckboxGroup cbg = new CheckboxGroup();
+ cbg.toString();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Headless/HeadlessCheckboxMenuItem.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that CheckboxMenuItem constructors throw HeadlessException
+ * in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessCheckboxMenuItem
+ */
+
+public class HeadlessCheckboxMenuItem {
+
+ public static void main(String args[]) {
+ CheckboxMenuItem c;
+
+ boolean exceptions = false;
+ try {
+ c = new CheckboxMenuItem();
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("Constructor did not throw HeadlessException");
+
+ exceptions = false;
+ try {
+ c = new CheckboxMenuItem("Choices...");
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("Constructor did not throw HeadlessException");
+
+ exceptions = false;
+ try {
+ c = new CheckboxMenuItem("Choices...", true);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("Constructor did not throw HeadlessException");
+
+ exceptions = false;
+ try {
+ c = new CheckboxMenuItem("Choices...", false);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("Constructor did not throw HeadlessException");
+
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Headless/HeadlessComponentOrientation.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that ComponentOrientation methods do not throw exceptions
+ * in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessComponentOrientation
+ */
+
+public class HeadlessComponentOrientation {
+ public static void main(String args[]) {
+ ComponentOrientation.LEFT_TO_RIGHT.isHorizontal();
+ ComponentOrientation.RIGHT_TO_LEFT.isHorizontal();
+ ComponentOrientation.UNKNOWN.isHorizontal();
+ ComponentOrientation.LEFT_TO_RIGHT.isLeftToRight();
+ ComponentOrientation.RIGHT_TO_LEFT.isLeftToRight();
+ ComponentOrientation.UNKNOWN.isLeftToRight();
+
+ for (Locale locale : Locale.getAvailableLocales())
+ ComponentOrientation.getOrientation(locale);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Headless/HeadlessDimension.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that Dimension constructors and methods do not throw
+ * unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessDimension
+ */
+
+public class HeadlessDimension {
+ public static void main(String args[]) {
+ Dimension d;
+ d = new Dimension();
+ d = new Dimension(new Dimension());
+
+ d = new Dimension(100, 100);
+ double f = d.getWidth();
+ f = d.getHeight();
+
+ d = new Dimension();
+ d.setSize(100.0, 100.0);
+ d.setSize(100, 100);
+
+ d = new Dimension(100, 100);
+ Dimension d2 = d.getSize();
+
+ d = new Dimension(100, 100);
+ d2 = new Dimension(200, 200);
+ d.setSize(d2);
+
+ new Dimension(100, 100).equals(new Dimension(200, 200));
+
+ d.hashCode();
+ d.toString();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Headless/HeadlessFlowLayout.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that FlowLayout constructor and method do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessFlowLayout
+ */
+
+public class HeadlessFlowLayout {
+
+ public static void main(String args[]) {
+ FlowLayout bs = new FlowLayout();
+ bs.getHgap();
+ bs.setHgap(10);
+ bs.getVgap();
+ bs.setVgap(10);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Headless/HeadlessMediaTracker.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that MediaTracker constructor does not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessMediaTracker
+ */
+
+public class HeadlessMediaTracker {
+ public static void main(String args[]) {
+ new MediaTracker(new Component(){});
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Headless/HeadlessPopupMenu.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that PopupMenu constructors do not throw HeadlessException in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessPopupMenu
+ */
+
+public class HeadlessPopupMenu {
+ public static void main(String args[]) {
+ PopupMenu pm;
+ boolean exceptions = false;
+ try {
+ pm = new PopupMenu();
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ pm = new PopupMenu("Popup menu");
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Insets/HeadlessInsets.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that Insets constructor does not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessInsets
+ */
+
+public class HeadlessInsets {
+ public static void main(String args[]) {
+ new Insets(1, 2, 3, 4);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Menu/Headless/HeadlessMenu.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that Menu constructors do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessMenu
+ */
+
+public class HeadlessMenu {
+ public static void main(String args[]) {
+ Menu m;
+ boolean exceptions = false;
+ try {
+ m = new Menu();
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ m = new Menu("A Menu");
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ m = new Menu("A Menu", false);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ m = new Menu("A Menu", true);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Menu/Headless/HeadlessMenuItem.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+import java.awt.event.KeyEvent;
+
+/*
+ * @test
+ * @summary Check that MenuItem constructors do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessMenuItem
+ */
+
+public class HeadlessMenuItem {
+
+ public static void main(String args[]) {
+ MenuItem mi;
+
+ boolean exceptions = false;
+ try {
+ mi = new MenuItem();
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ mi = new MenuItem("Choose me");
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ MenuShortcut ms = new MenuShortcut(KeyEvent.VK_A);
+ mi = new MenuItem("Choose me", ms);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Menu/Headless/HeadlessMenuShortcut.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2007, 2014, 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.MenuShortcut;
+import java.awt.event.KeyEvent;
+
+/*
+ * @test
+ * @summary Check that MenuShortcut constructors do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessMenuShortcut
+ */
+
+public class HeadlessMenuShortcut {
+ public static void main(String args[]) {
+ MenuShortcut ms;
+ ms = new MenuShortcut(KeyEvent.VK_A);
+ ms = new MenuShortcut(KeyEvent.VK_A, true);
+ ms = new MenuShortcut(KeyEvent.VK_A, false);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/MenuBar/HeadlessMenuBar.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that MenuBar constructor does not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessMenuBar
+ */
+
+public class HeadlessMenuBar {
+ public static void main(String args[]) {
+ boolean exceptions = false;
+ try {
+ MenuBar m = new MenuBar();
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Toolkit/Headless/HeadlessToolkit.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,329 @@
+/*
+ * Copyright (c) 2007, 2014, 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.imageio.ImageIO;
+import java.awt.*;
+import java.awt.datatransfer.Clipboard;
+import java.awt.event.AWTEventListener;
+import java.awt.event.KeyEvent;
+import java.awt.im.InputMethodHighlight;
+import java.awt.image.BufferedImage;
+import java.awt.image.ColorModel;
+import java.awt.image.MemoryImageSource;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.util.Map;
+
+/*
+ * @test
+ * @summary Check that Toolkit methods do not throw unexpected exceptions
+ * in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessToolkit
+ */
+
+public class HeadlessToolkit {
+
+ class awtEventListener implements AWTEventListener {
+ public void eventDispatched(AWTEvent e) {
+ }
+ }
+
+ class propChangeListener implements PropertyChangeListener {
+ public void propertyChange(PropertyChangeEvent e) {
+ }
+ }
+
+ public static void main(String args[]) throws IOException {
+ new HeadlessToolkit().doTest();
+ }
+
+ void doTest() throws IOException {
+ Toolkit tk = Toolkit.getDefaultToolkit();
+ String[] fl = tk.getFontList();
+ FontMetrics fm = tk.getFontMetrics(new Font(fl[0], Font.PLAIN, 10));
+ tk.sync();
+ tk.beep();
+
+ boolean exceptions = false;
+ try {
+ Dimension d = tk.getScreenSize();
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ int res = tk.getScreenResolution();
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ Graphics2D gd = ge.createGraphics(new BufferedImage(100, 100, BufferedImage.TYPE_4BYTE_ABGR));
+ GraphicsConfiguration gc = gd.getDeviceConfiguration();
+ Insets res = tk.getScreenInsets(gc);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ ColorModel cm = tk.getColorModel();
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ int km = tk.getMenuShortcutKeyMask();
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ boolean state = tk.getLockingKeyState(KeyEvent.VK_CAPS_LOCK);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ boolean state = tk.getLockingKeyState(KeyEvent.VK_NUM_LOCK);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ boolean state = tk.getLockingKeyState(KeyEvent.VK_KANA_LOCK);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ boolean state = tk.getLockingKeyState(KeyEvent.VK_SCROLL_LOCK);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ tk.setLockingKeyState(KeyEvent.VK_CAPS_LOCK, true);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ tk.setLockingKeyState(KeyEvent.VK_NUM_LOCK, true);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ tk.setLockingKeyState(KeyEvent.VK_KANA_LOCK, true);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ tk.setLockingKeyState(KeyEvent.VK_SCROLL_LOCK, true);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ tk.setLockingKeyState(KeyEvent.VK_CAPS_LOCK, false);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ tk.setLockingKeyState(KeyEvent.VK_NUM_LOCK, false);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ tk.setLockingKeyState(KeyEvent.VK_KANA_LOCK, false);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ tk.setLockingKeyState(KeyEvent.VK_SCROLL_LOCK, false);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ Dimension d = tk.getBestCursorSize(32, 32);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ int n = tk.getMaximumCursorColors();
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ EventQueue eq = tk.getSystemEventQueue();
+ awtEventListener el = new awtEventListener();
+ tk.addAWTEventListener(el, 0xffffffff);
+ tk.removeAWTEventListener(el);
+
+ File[] images = new File[]{new File("image.png"), new File("image.jpg"), new File("image.gif")};
+ Image im;
+ for (File image : images) {
+ String path = image.getCanonicalPath();
+ ImageIO.write(new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB), path.substring(path.lastIndexOf('.')+1), image);
+
+ im = tk.getImage(image.getAbsolutePath());
+ im.flush();
+
+ FileInputStream fis = new FileInputStream(image);
+ byte[] b = new byte[(int) (image.length())];
+ fis.read(b);
+ fis.close();
+ im = tk.createImage(b);
+ im.flush();
+
+ im = tk.createImage(image.getAbsolutePath());
+ im.flush();
+
+ }
+
+ im = tk.getImage(new URL("http://openjdk.java.net/images/openjdk.png"));
+ im.flush();
+
+ im = tk.createImage(new URL("http://openjdk.java.net/images/openjdk.png"));
+ im.flush();
+
+ MemoryImageSource mis;
+ int pixels[] = new int[50 * 50];
+ int index = 0;
+ for (int y = 0; y < 50; y++) {
+ int red = (y * 255) / 49;
+ for (int x = 0; x < 50; x++) {
+ int blue = (x * 255) / 49;
+ pixels[index++] = (255 << 24) | (red << 16) | blue;
+ }
+ }
+ mis = new MemoryImageSource(50, 50, pixels, 0, 50);
+ im = tk.createImage(mis);
+ im.flush();
+
+
+ exceptions = false;
+ try {
+ Cursor cur = tk.createCustomCursor(new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB), new Point(0, 0), "Stop");
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ Cursor cur = tk.createCustomCursor(new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB), new Point(0, 0), "Stop");
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ InputMethodHighlight imh = new InputMethodHighlight(true, InputMethodHighlight.CONVERTED_TEXT);
+ Map m = tk.mapInputMethodHighlight(imh);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ Clipboard cl = tk.getSystemClipboard();
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/applet/Applet/HeadlessApplet.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, 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.applet.Applet;
+import java.awt.HeadlessException;
+
+/*
+ * @test
+ * @summary Check HeadlessException occurrence when trying to create Applet
+ * in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessApplet
+ */
+
+public class HeadlessApplet {
+
+ public static void main(String args[]) {
+ boolean noExceptions = true;
+
+ try {
+ Applet a = new Applet();
+ } catch (HeadlessException e) {
+ noExceptions = false;
+ }
+
+ if (noExceptions) {
+ throw new RuntimeException("No HeadlessException occured when creating Applet in headless mode");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/datatransfer/Headless/HeadlessClipboard.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2007, 2014, 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.datatransfer.Clipboard;
+
+/*
+ * @test
+ * @summary Check Clipboard constructor and getName() method do not throw
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessClipboard
+ */
+
+public class HeadlessClipboard {
+ public static void main(String args[]) {
+ Clipboard cb = new Clipboard("dummy");
+ cb.getName();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/datatransfer/Headless/HeadlessDataFlavor.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2007, 2014, 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.datatransfer.DataFlavor;
+
+/*
+ * @test
+ * @summary Check that DataFlavor constructors do not throw unexpected exceptions
+ * in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessDataFlavor
+ */
+
+public class HeadlessDataFlavor {
+ public static void main(String args[]) throws Exception {
+ DataFlavor df;
+ df = new DataFlavor();
+ df = new DataFlavor("text/plain", "plain jane text");
+ df = new DataFlavor("text/html", "HTML text");
+ df = new DataFlavor("text/plain");
+ df = new DataFlavor("text/html");
+ df.toString();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/datatransfer/Headless/HeadlessSystemFlavorMap.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2007, 2014, 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.datatransfer.FlavorMap;
+import java.awt.datatransfer.SystemFlavorMap;
+
+/*
+ * @test
+ * @summary Check that SystemFlavorMap constructor does not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessSystemFlavorMap
+ */
+
+public class HeadlessSystemFlavorMap {
+ public static void main(String args[]) {
+ FlavorMap sfm = SystemFlavorMap.getDefaultFlavorMap();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/im/Headless/HeadlessInputContext.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2007, 2014, 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.im.InputContext;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that InputContext methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessInputContext
+ */
+
+public class HeadlessInputContext {
+ public static void main(String args[]) {
+ InputContext ic = InputContext.getInstance();
+
+ for (Locale locale : Locale.getAvailableLocales())
+ ic.selectInputMethod(locale);
+
+ ic.getLocale();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/im/Headless/HeadlessInputMethodHighlight.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2007, 2014, 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.im.InputMethodHighlight;
+
+/*
+ * @test
+ * @summary Check that InputMethodHighlight constructors do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessInputMethodHighlight
+ */
+
+public class HeadlessInputMethodHighlight {
+ public static void main(String args[]) {
+ InputMethodHighlight imh;
+ imh = new InputMethodHighlight(true, InputMethodHighlight.CONVERTED_TEXT);
+ imh = new InputMethodHighlight(false,InputMethodHighlight.CONVERTED_TEXT);
+ imh = new InputMethodHighlight(true, InputMethodHighlight.RAW_TEXT);
+ imh = new InputMethodHighlight(false,InputMethodHighlight.RAW_TEXT);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/image/Headless/HeadlessAffineTransformOp.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2007, 2014, 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.geom.AffineTransform;
+import java.awt.image.AffineTransformOp;
+
+/*
+ * @test
+ * @summary Check that AffineTransformOp constructors and methods do not throw
+ * unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessAffineTransformOp
+ */
+
+public class HeadlessAffineTransformOp {
+ public static void main(String args[]) {
+ AffineTransformOp ato;
+
+ ato = new AffineTransformOp(new AffineTransform(), AffineTransformOp.TYPE_BILINEAR);
+ ato = new AffineTransformOp(new AffineTransform(), AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
+ ato = new AffineTransformOp(new AffineTransform(), AffineTransformOp.TYPE_BILINEAR);
+ ato.getInterpolationType();
+ ato.getTransform();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/image/Headless/HeadlessAreaAveragingScaleFilter.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2014, 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.image.AreaAveragingScaleFilter;
+
+/*
+ * @test
+ * @summary Check that AreaAveragingScaleFilter constructor and clone() method
+ * do not throw unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessAreaAveragingScaleFilter
+ */
+
+public class HeadlessAreaAveragingScaleFilter {
+ public static void main(String args[]) {
+ new AreaAveragingScaleFilter(100, 100).clone();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/image/Headless/HeadlessBufferedImage.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2007, 2014, 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.image.BufferedImage;
+
+/*
+ * @test
+ * @summary Check that BufferedImage constructors and methods do not throw
+ * unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessBufferedImage
+ */
+
+public class HeadlessBufferedImage {
+
+ public static void main(String args[]) {
+ BufferedImage bi;
+ bi = new BufferedImage(300, 300, BufferedImage.TYPE_3BYTE_BGR);
+ bi = new BufferedImage(300, 300, BufferedImage.TYPE_4BYTE_ABGR);
+ bi = new BufferedImage(300, 300, BufferedImage.TYPE_BYTE_BINARY);
+ bi = new BufferedImage(300, 300, BufferedImage.TYPE_BYTE_GRAY);
+ bi = new BufferedImage(300, 300, BufferedImage.TYPE_BYTE_INDEXED);
+ bi = new BufferedImage(300, 300, BufferedImage.TYPE_INT_ARGB);
+ bi = new BufferedImage(300, 300, BufferedImage.TYPE_INT_ARGB_PRE);
+ bi = new BufferedImage(300, 300, BufferedImage.TYPE_INT_BGR);
+ bi = new BufferedImage(300, 300, BufferedImage.TYPE_INT_RGB);
+ bi = new BufferedImage(300, 300, BufferedImage.TYPE_USHORT_565_RGB);
+ bi = new BufferedImage(300, 300, BufferedImage.TYPE_USHORT_GRAY);
+ bi = new BufferedImage(300, 300, BufferedImage.TYPE_USHORT_555_RGB);
+ bi.getType();
+ bi.getColorModel();
+ bi.getRaster();
+ bi.getAlphaRaster();
+ bi.getRGB(1, 1);
+ bi.getWidth();
+ bi.getHeight();
+ bi.getSource();
+ bi.flush();
+ bi.getGraphics();
+ bi.createGraphics();
+ BufferedImage bi2 = bi.getSubimage(10, 10, 200, 200);
+ bi.isAlphaPremultiplied();
+ bi.coerceData(true);
+ bi.coerceData(false);
+ bi.toString();
+ bi.getSources();
+ bi.getPropertyNames();
+ bi.getMinX();
+ bi.getMinY();
+ bi.getSampleModel();
+ bi.getNumXTiles();
+ bi.getNumYTiles();
+ bi.getMinTileX();
+ bi.getMinTileY();
+ bi.getTileWidth();
+ bi.getTileHeight();
+ bi.getTileGridXOffset();
+ bi.getTileGridYOffset();
+ bi.getData();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/image/Headless/HeadlessBufferedImageFilter.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2007, 2014, 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.image.*;
+import java.awt.geom.*;
+
+/*
+ * @test
+ * @summary Check that BufferedImageFilter constructor and clone() method do not throw
+ * unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessBufferedImageFilter
+ */
+
+public class HeadlessBufferedImageFilter {
+ public static void main(String args[]) {
+ new BufferedImageFilter(new AffineTransformOp(new AffineTransform(), AffineTransformOp.TYPE_BILINEAR)).clone();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/image/Headless/HeadlessColorModel.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2007, 2014, 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.image.*;
+
+/*
+ * @test
+ * @summary Check that ColorModel methods do not throw
+ * unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessColorModel
+ */
+
+public class HeadlessColorModel {
+ public static void main(String args[]) {
+ ColorModel cm = new ColorModel(32) {
+ public int getAlpha(int pixel) { return 255; }
+ public int getBlue(int pixel) { return 255; }
+ public int getGreen(int pixel) { return 255; }
+ public int getRed(int pixel) { return 255; }
+ };
+
+ cm.hasAlpha();
+ cm.isAlphaPremultiplied();
+ cm.getTransferType();
+ cm.getPixelSize();
+ cm.getComponentSize();
+ cm.getComponentSize();
+ cm.getTransparency();
+ cm.getNumComponents();
+ cm.getNumColorComponents();
+ cm.getRed(20);
+ cm.getGreen(20);
+ cm.getBlue(20);
+ cm.getAlpha(20);
+ cm.getRGB(20);
+ cm.isAlphaPremultiplied();
+ cm.isAlphaPremultiplied();
+
+ cm = ColorModel.getRGBdefault();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/image/Headless/HeadlessCropImageFilter.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2014, 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.image.CropImageFilter;
+
+/*
+ * @test
+ * @summary Check that CropImageFilter constructor and clone() method
+ * do not throw unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessCropImageFilter
+ */
+
+public class HeadlessCropImageFilter {
+ public static void main (String[] args) {
+ new CropImageFilter(20, 20, 40, 50).clone();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/image/Headless/HeadlessImageFilter.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2014, 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.image.ImageFilter;
+
+/*
+ * @test
+ * @summary Check that ImageFilter constructor and clone() method
+ * do not throw unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessImageFilter
+ */
+
+public class HeadlessImageFilter {
+ public static void main(String args[]) {
+ new ImageFilter().clone();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/image/Headless/HeadlessIndexColorModel.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2007, 2014, 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.image.IndexColorModel;
+
+/*
+ * @test
+ * @summary Check that IndexColorModel constructor and methods
+ * do not throw unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessIndexColorModel
+ */
+
+public class HeadlessIndexColorModel {
+ public static void main(String args[]) {
+ IndexColorModel cm =
+ new IndexColorModel(8, 1, new byte[]{(byte) 128}, new byte[]{(byte) 128}, new byte[]{(byte) 128});
+ cm.getTransparency();
+ cm.getComponentSize();
+ cm.isAlphaPremultiplied();
+ cm.hasAlpha();
+ cm.isAlphaPremultiplied();
+ cm.getTransferType();
+ cm.getPixelSize();
+ cm.getComponentSize();
+ cm.getNumComponents();
+ cm.getNumColorComponents();
+ cm.getRed(20);
+ cm.getGreen(20);
+ cm.getBlue(20);
+ cm.getAlpha(20);
+ cm.getRGB(20);
+ cm.isAlphaPremultiplied();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/image/Headless/HeadlessRGBImageFilter.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2007, 2014, 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.image.RGBImageFilter;
+
+/*
+ * @test
+ * @summary Check that RGBImageFilter constructor and clone() method
+ * do not throw unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessRGBImageFilter
+ */
+
+public class HeadlessRGBImageFilter {
+
+ public static void main(String args[]) {
+ new RGBImageFilter() {
+ public int filterRGB(int x, int y, int rgb) {
+ return 0;
+ }
+ }.clone();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/image/Headless/HeadlessReplicateScaleFilter.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2014, 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.image.ReplicateScaleFilter;
+
+/*
+ * @test
+ * @summary Check that ReplicateScaleFilter constructor and clone() method
+ * do not throw unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessReplicateScaleFilter
+ */
+
+public class HeadlessReplicateScaleFilter {
+ public static void main(String args[]) {
+ new ReplicateScaleFilter(100, 100).clone();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/print/Headless/HeadlessBook.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2014, 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.print.Book;
+
+/*
+ * @test
+ * @summary Check that Book constructor and getNumberOfPages() method do not throw
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessBook
+ */
+
+public class HeadlessBook {
+ public static void main(String args[]) {
+ new Book().getNumberOfPages();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/print/Headless/HeadlessPageFormat.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2007, 2014, 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.print.PageFormat;
+import java.awt.print.Paper;
+
+/*
+ * @test
+ * @summary Check that PageFormat constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessPageFormat
+ */
+
+public class HeadlessPageFormat {
+ public static void main(String args[]) {
+ PageFormat pf;
+ pf = (PageFormat) new PageFormat().clone();
+ pf.getWidth();
+ pf.getHeight();
+ pf.getImageableX();
+ pf.getImageableY();
+ pf.getImageableWidth();
+ pf.getImageableHeight();
+ pf.getPaper();
+ pf.setPaper(new Paper());
+ pf.setOrientation(PageFormat.PORTRAIT);
+ if (pf.getOrientation() != PageFormat.PORTRAIT)
+ throw new RuntimeException("Changing Orientation did not result in a change: PageFormat.PORTRAIT");
+
+ pf.setOrientation(PageFormat.LANDSCAPE);
+ if (pf.getOrientation() != PageFormat.LANDSCAPE)
+ throw new RuntimeException("Changing Orientation did not result in a change: PageFormat.LANDSCAPE");
+
+ pf.setOrientation(PageFormat.REVERSE_LANDSCAPE);
+ if (pf.getOrientation() != PageFormat.REVERSE_LANDSCAPE)
+ throw new RuntimeException("Changing Orientation did not result in a change: PageFormat.REVERSE_LANDSCAPE");
+
+ pf.getOrientation();
+ pf.getMatrix();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/print/Headless/HeadlessPaper.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2007, 2014, 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.print.Paper;
+
+/*
+ * @test
+ * @summary Check that Paper constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessPaper
+ */
+
+public class HeadlessPaper {
+ public static void main(String args[]) {
+ Paper p;
+ p = (Paper) new Paper().clone();
+ p.getHeight();
+ p.setSize(200.0, 300.0);
+ p.getWidth();
+ p.setImageableArea(1.0, 1.0, 300.0, 400.0);
+ p.getImageableX();
+ p.getImageableY();
+ p.getImageableWidth();
+ p.getImageableHeight();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/print/Headless/HeadlessPrinterJob.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,179 @@
+/*
+ * Copyright (c) 2007, 2014, 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.print.PrintService;
+import javax.print.attribute.PrintServiceAttributeSet;
+import java.awt.*;
+import java.awt.geom.Line2D;
+import java.awt.geom.Rectangle2D;
+import java.awt.geom.RoundRectangle2D;
+import java.awt.print.*;
+
+/*
+ * @test
+ * @summary Check that PrinterJob constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessPrinterJob
+ */
+
+public class HeadlessPrinterJob {
+
+ class testPrintable implements Printable {
+
+ public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) {
+ Graphics2D g2 = (Graphics2D) graphics;
+
+ if (pageIndex >= 10) {
+ return Printable.NO_SUCH_PAGE;
+ }
+
+ int gridWidth = 400 / 6;
+ int gridHeight = 300 / 2;
+
+ int rowspacing = 5;
+ int columnspacing = 7;
+ int rectWidth = gridWidth - columnspacing;
+ int rectHeight = gridHeight - rowspacing;
+
+ Color fg3D = Color.lightGray;
+
+ g2.setPaint(fg3D);
+ g2.drawRect(80, 80, 400 - 1, 310);
+ g2.setPaint(Color.black);
+
+ int x = 85;
+ int y = 87;
+
+
+ // draw Line2D.Double
+ g2.draw(new Line2D.Double(x, y + rectHeight - 1, x + rectWidth, y));
+ x += gridWidth;
+
+ // draw Rectangle2D.Double
+ //g2.setStroke(stroke);
+ g2.draw(new Rectangle2D.Double(x, y, rectWidth, rectHeight));
+ x += gridWidth;
+
+ // draw RoundRectangle2D.Double
+ //g2.setStroke(dashed);
+ g2.draw(new RoundRectangle2D.Double(x, y, rectWidth,
+ rectHeight, 10, 10));
+ return Printable.PAGE_EXISTS;
+ }
+ }
+
+ class testPageable implements Pageable {
+
+ public int getNumberOfPages() {
+ return 10;
+ }
+
+ public PageFormat getPageFormat(int pageIndex) throws IndexOutOfBoundsException {
+ PageFormat pf = null;
+ if (pageIndex >= 10) {
+ throw new IndexOutOfBoundsException("Wrong page#");
+ }
+ switch (pageIndex) {
+ case 0:
+ case 2:
+ case 4:
+ case 6:
+ case 8:
+ pf = new PageFormat();
+ pf.setOrientation(PageFormat.REVERSE_LANDSCAPE);
+ break;
+ case 1:
+ case 3:
+ case 5:
+ case 7:
+ case 9:
+ pf = new PageFormat();
+ pf.setOrientation(PageFormat.LANDSCAPE);
+ break;
+ }
+ return pf;
+ }
+
+ public Printable getPrintable(int pageIndex) throws IndexOutOfBoundsException {
+ if (pageIndex >= 10) {
+ throw new IndexOutOfBoundsException("Wrong page#");
+ }
+ return new testPrintable();
+ }
+ }
+
+ public static void main(String args[]) throws Exception {
+ new HeadlessPrinterJob().doTest();
+ }
+
+ void doTest() throws Exception {
+ PrinterJob pj = PrinterJob.getPrinterJob();
+ for (PrintService psl : pj.lookupPrintServices()) {
+ PrintServiceAttributeSet psas = psl.getAttributes();
+ pj.setPrintService(psl);
+ }
+ PrintService ps = pj.getPrintService();
+ pj.setPrintable(new testPrintable());
+
+ pj = PrinterJob.getPrinterJob();
+ PageFormat pf = new PageFormat();
+ pf.setOrientation(PageFormat.REVERSE_LANDSCAPE);
+ pj.setPrintable(new testPrintable(), pf);
+ pj.setPageable(new testPageable());
+
+ boolean exceptions = false;
+ try {
+ pj.printDialog();
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ pj = PrinterJob.getPrinterJob();
+ pf = new PageFormat();
+ pf.setOrientation(PageFormat.REVERSE_LANDSCAPE);
+ pf = pj.pageDialog(pf);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ pf = new PageFormat();
+ pf.setOrientation(PageFormat.REVERSE_LANDSCAPE);
+ pf = pj.defaultPage(pf);
+ pf = pj.defaultPage();
+
+ pf = new PageFormat();
+ pf.setOrientation(PageFormat.REVERSE_LANDSCAPE);
+ pf = pj.validatePage(pf);
+ pj.setCopies(10);
+ pj.getCopies();
+ pj.getUserName();
+ pj.setJobName("no-job-name");
+ pj.getJobName();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessAbstractSpinnerModel.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that AbstractSpinnerModel constructor and methods do not throw
+ * unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessAbstractSpinnerModel
+ */
+
+public class HeadlessAbstractSpinnerModel {
+ public static void main (String[] args){
+ AbstractSpinnerModel model = new AbstractSpinnerModel(){
+ public Object getValue() { return null; }
+ public void setValue(Object value) {}
+ public Object getNextValue() { return null; }
+ public Object getPreviousValue() { return null; }
+ };
+ model.getPreviousValue();
+ model.getNextValue();
+ model.setValue("next");
+ model.getValue();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessBox.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,221 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that Box constructors and methods do not throw
+ * unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessBox
+ */
+
+public class HeadlessBox {
+
+ public static void main(String args[]) {
+ for (Box b : new Box[]{new Box(BoxLayout.X_AXIS), new Box(BoxLayout.Y_AXIS)}) {
+ b = Box.createHorizontalBox();
+ b = Box.createVerticalBox();
+ b = new Box(BoxLayout.Y_AXIS);
+ b.getAccessibleContext();
+ b.requestFocus();
+ b.requestFocusInWindow();
+ b.getPreferredSize();
+ b.getMaximumSize();
+ b.getMinimumSize();
+ b.contains(1, 2);
+ Component c1 = b.add(new Component() {
+ });
+ Component c2 = b.add(new Component() {
+ });
+ Component c3 = b.add(new Component() {
+ });
+ b.getComponentCount();
+ b.countComponents();
+ b.getComponent(1);
+ b.getComponent(2);
+ Component[] cs = b.getComponents();
+
+ boolean exceptions = false;
+ try {
+ b.setLayout(new BoxLayout(new Container(), BoxLayout.Y_AXIS));
+ } catch (AWTError e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("AWTError did not occur when expected");
+
+ exceptions = false;
+ try {
+ b.setLayout(new BoxLayout(new Container(), BoxLayout.X_AXIS));
+ } catch (AWTError e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("AWTError did not occur when expected");
+
+ b.getLayout();
+ b.invalidate();
+ b.validate();
+ b.revalidate();
+
+ Insets ins = b.getInsets();
+ b.getAlignmentY();
+ b.getAlignmentX();
+ b.getGraphics();
+ b.setVisible(false);
+ b.setVisible(true);
+ b.setEnabled(false);
+ b.setEnabled(true);
+ b.setForeground(Color.red);
+ b.setBackground(Color.red);
+
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ b.setFont(f1);
+ b.setFont(f2);
+ b.setFont(f3);
+ b.setFont(f4);
+
+ b.getFontMetrics(f1);
+ b.getFontMetrics(f2);
+ b.getFontMetrics(f3);
+ b.getFontMetrics(f4);
+
+ }
+ }
+
+ b.enable();
+ b.disable();
+ b.reshape(10, 10, 10, 10);
+ b.getBounds(new Rectangle(1, 1, 1, 1));
+ b.getSize(new Dimension(1, 2));
+ b.getSize(new Dimension(1, 2));
+ b.getLocation(new Point(1, 2));
+ b.getX();
+ b.getY();
+ b.getWidth();
+ b.getHeight();
+ b.isOpaque();
+ b.isValidateRoot();
+ b.isOptimizedDrawingEnabled();
+ b.isDoubleBuffered();
+
+ b.remove(0);
+ b.remove(c2);
+ b.removeAll();
+ b.layout();
+ b.preferredSize();
+ b.minimumSize();
+ b.getComponentAt(1, 2);
+ b.locate(1, 2);
+ b.getComponentAt(new Point(1, 2));
+ b.isFocusCycleRoot(new Container());
+ b.transferFocusBackward();
+ b.setName("goober");
+ b.getName();
+ b.getParent();
+ b.getPeer();
+ b.getGraphicsConfiguration();
+ b.getTreeLock();
+ b.getToolkit();
+ b.isValid();
+ b.isDisplayable();
+ b.isVisible();
+ b.isShowing();
+ b.isEnabled();
+ b.enable(false);
+ b.enable(true);
+ b.enableInputMethods(false);
+ b.enableInputMethods(true);
+ b.show();
+ b.show(false);
+ b.show(true);
+ b.hide();
+ b.getForeground();
+ b.isForegroundSet();
+ b.getBackground();
+ b.isBackgroundSet();
+ b.getFont();
+ b.isFontSet();
+ b.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ b.setLocale(locale);
+
+ b.getColorModel();
+ b.getLocation();
+
+ exceptions = false;
+ try {
+ b.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ b.location();
+ b.setLocation(1, 2);
+ b.move(1, 2);
+ b.setLocation(new Point(1, 2));
+ b.getSize();
+ b.size();
+ b.setSize(1, 32);
+ b.resize(1, 32);
+ b.setSize(new Dimension(1, 32));
+ b.resize(new Dimension(1, 32));
+ b.getBounds();
+ b.bounds();
+ b.setBounds(10, 10, 10, 10);
+ b.setBounds(new Rectangle(10, 10, 10, 10));
+ b.isLightweight();
+ b.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ b.getCursor();
+ b.isCursorSet();
+ b.inside(1, 2);
+ b.contains(new Point(1, 2));
+ b.isFocusTraversable();
+ b.isFocusable();
+ b.setFocusable(true);
+ b.setFocusable(false);
+ b.transferFocus();
+ b.getFocusCycleRootAncestor();
+ b.nextFocus();
+ b.transferFocusUpCycle();
+ b.hasFocus();
+ b.isFocusOwner();
+ b.toString();
+ b.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ b.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ b.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ b.getComponentOrientation();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessBox_Filler.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,194 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that Box.Filler constructors and methods do not throw
+ * unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessBox_Filler
+ */
+
+public class HeadlessBox_Filler {
+ public static void main(String args[]) {
+ Box.Filler bf = new Box.Filler(new Dimension(10, 10),
+ new Dimension(20, 20),
+ new Dimension(30, 30));
+ bf.getMinimumSize();
+ bf.getPreferredSize();
+ bf.getMaximumSize();
+ bf.getAccessibleContext();
+ bf.requestFocus();
+ bf.requestFocusInWindow();
+ bf.contains(1, 2);
+ Component c1 = bf.add(new Component(){});
+ Component c2 = bf.add(new Component(){});
+ Component c3 = bf.add(new Component(){});
+ Insets ins = bf.getInsets();
+ bf.getAlignmentY();
+ bf.getAlignmentX();
+ bf.getGraphics();
+ bf.setVisible(false);
+ bf.setVisible(true);
+ bf.setEnabled(false);
+ bf.setEnabled(true);
+ bf.setForeground(Color.red);
+ bf.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ bf.setFont(f1);
+ bf.setFont(f2);
+ bf.setFont(f3);
+ bf.setFont(f4);
+
+ bf.getFontMetrics(f1);
+ bf.getFontMetrics(f2);
+ bf.getFontMetrics(f3);
+ bf.getFontMetrics(f4);
+ }
+ }
+ bf.enable();
+ bf.disable();
+ bf.reshape(10, 10, 10, 10);
+ bf.getBounds(new Rectangle(1, 1, 1, 1));
+ bf.getSize(new Dimension(1, 2));
+ bf.getLocation(new Point(1, 2));
+ bf.getX();
+ bf.getY();
+ bf.getWidth();
+ bf.getHeight();
+ bf.isOpaque();
+ bf.isValidateRoot();
+ bf.isOptimizedDrawingEnabled();
+ bf.isDoubleBuffered();
+ bf.getComponentCount();
+ bf.countComponents();
+ bf.getComponent(1);
+ bf.getComponent(2);
+ Component[] cs = bf.getComponents();
+ bf.getLayout();
+ bf.setLayout(new FlowLayout());
+ bf.doLayout();
+ bf.layout();
+ bf.invalidate();
+ bf.validate();
+ bf.preferredSize();
+ bf.remove(0);
+ bf.remove(c2);
+ bf.removeAll();
+ bf.minimumSize();
+ bf.getComponentAt(1, 2);
+ bf.locate(1, 2);
+ bf.getComponentAt(new Point(1, 2));
+ bf.isFocusCycleRoot(new Container());
+ bf.transferFocusBackward();
+ bf.setName("goober");
+ bf.getName();
+ bf.getParent();
+ bf.getPeer();
+ bf.getGraphicsConfiguration();
+ bf.getTreeLock();
+ bf.getToolkit();
+ bf.isValid();
+ bf.isDisplayable();
+ bf.isVisible();
+ bf.isShowing();
+ bf.isEnabled();
+ bf.enable(false);
+ bf.enable(true);
+ bf.enableInputMethods(false);
+ bf.enableInputMethods(true);
+ bf.show();
+ bf.show(false);
+ bf.show(true);
+ bf.hide();
+ bf.getForeground();
+ bf.isForegroundSet();
+ bf.getBackground();
+ bf.isBackgroundSet();
+ bf.getFont();
+ bf.isFontSet();
+
+ Container c = new Container();
+ c.add(bf);
+ bf.getLocale();
+
+ for (Locale locale : Locale.getAvailableLocales())
+ bf.setLocale(locale);
+
+ bf.getColorModel();
+ bf.getLocation();
+
+ boolean exceptions = false;
+ try {
+ bf.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ bf.setLocation(1, 2);
+ bf.move(1, 2);
+ bf.setLocation(new Point(1, 2));
+ bf.getSize();
+ bf.size();
+ bf.setSize(1, 32);
+ bf.resize(1, 32);
+ bf.setSize(new Dimension(1, 32));
+ bf.resize(new Dimension(1, 32));
+ bf.getBounds();
+ bf.bounds();
+ bf.setBounds(10, 10, 10, 10);
+ bf.setBounds(new Rectangle(10, 10, 10, 10));
+ bf.isLightweight();
+ bf.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ bf.getCursor();
+ bf.isCursorSet();
+ bf.inside(1, 2);
+ bf.contains(new Point(1, 2));
+ bf.isFocusTraversable();
+ bf.isFocusable();
+ bf.setFocusable(true);
+ bf.setFocusable(false);
+ bf.transferFocus();
+ bf.getFocusCycleRootAncestor();
+ bf.nextFocus();
+ bf.transferFocusUpCycle();
+ bf.hasFocus();
+ bf.isFocusOwner();
+ bf.toString();
+ bf.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ bf.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ bf.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ bf.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessCellRendererPane.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,202 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that CellRendererPane constructors and methods do not throw
+ * unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessCellRendererPane
+ */
+
+public class HeadlessCellRendererPane {
+ public static void main(String args[]) {
+ CellRendererPane crp = new CellRendererPane();
+ Component c1 = crp.add(new Component(){});
+ Component c2 = crp.add(new Component(){});
+ Component c3 = crp.add(new Component(){});
+ crp.setLayout(new FlowLayout());
+ crp.invalidate();
+ crp.getAccessibleContext();
+ crp.getComponentCount();
+ crp.countComponents();
+ crp.getComponent(1);
+ crp.getComponent(2);
+ Component[] cs = crp.getComponents();
+ Insets ins = crp.getInsets();
+ ins = crp.insets();
+ crp.getLayout();
+ crp.setLayout(new FlowLayout());
+ crp.setLayout(new FlowLayout());
+ crp.doLayout();
+ crp.layout();
+ crp.invalidate();
+ crp.validate();
+ crp.remove(0);
+ crp.remove((Component) c2);
+ crp.removeAll();
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ crp.setFont(f1);
+ crp.setFont(f2);
+ crp.setFont(f3);
+ crp.setFont(f4);
+
+ crp.getFontMetrics(f1);
+ crp.getFontMetrics(f2);
+ crp.getFontMetrics(f3);
+ crp.getFontMetrics(f4);
+ }
+ }
+ crp.getPreferredSize();
+ crp.preferredSize();
+ crp.getMinimumSize();
+ crp.minimumSize();
+ crp.getMaximumSize();
+ crp.getAlignmentX();
+ crp.getAlignmentY();
+ crp.getComponentAt(1, 2);
+ crp.locate(1, 2);
+ crp.getComponentAt(new Point(1, 2));
+ crp.isFocusCycleRoot(new Container());
+ crp.transferFocusBackward();
+ crp.setName("goober");
+ crp.getName();
+ crp.getParent();
+ crp.getPeer();
+ crp.getGraphicsConfiguration();
+ crp.getTreeLock();
+ crp.getToolkit();
+ crp.isValid();
+ crp.isDisplayable();
+ crp.isVisible();
+ crp.isShowing();
+ crp.isEnabled();
+ crp.setEnabled(false);
+ crp.setEnabled(true);
+ crp.enable();
+ crp.enable(false);
+ crp.enable(true);
+ crp.disable();
+ crp.isDoubleBuffered();
+ crp.enableInputMethods(false);
+ crp.enableInputMethods(true);
+ crp.setVisible(false);
+ crp.setVisible(true);
+ crp.show();
+ crp.show(false);
+ crp.show(true);
+ crp.hide();
+ crp.getForeground();
+ crp.setForeground(Color.red);
+ crp.isForegroundSet();
+ crp.getBackground();
+ crp.setBackground(Color.red);
+ crp.isBackgroundSet();
+ crp.getFont();
+ crp.isFontSet();
+
+ boolean exceptions = false;
+ try {
+ Container c = new Container();
+ c.add(crp);
+ crp.getLocale();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ for (Locale locale : Locale.getAvailableLocales())
+ crp.setLocale(locale);
+
+ crp.getColorModel();
+ crp.getLocation();
+
+ exceptions = false;
+ try {
+ crp.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ crp.location();
+ crp.setLocation(1, 2);
+ crp.move(1, 2);
+ crp.setLocation(new Point(1, 2));
+ crp.getSize();
+ crp.size();
+ crp.setSize(1, 32);
+ crp.resize(1, 32);
+ crp.setSize(new Dimension(1, 32));
+ crp.resize(new Dimension(1, 32));
+ crp.getBounds();
+ crp.bounds();
+ crp.setBounds(10, 10, 10, 10);
+ crp.reshape(10, 10, 10, 10);
+ crp.setBounds(new Rectangle(10, 10, 10, 10));
+ crp.getX();
+ crp.getY();
+ crp.getWidth();
+ crp.getHeight();
+ crp.getBounds(new Rectangle(1, 1, 1, 1));
+ crp.getSize(new Dimension(1, 2));
+ crp.getLocation(new Point(1, 2));
+ crp.isOpaque();
+ crp.isLightweight();
+ crp.getGraphics();
+ crp.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ crp.getCursor();
+ crp.isCursorSet();
+ crp.contains(1, 2);
+ crp.inside(1, 2);
+ crp.contains(new Point(1, 2));
+ crp.isFocusTraversable();
+ crp.isFocusable();
+ crp.setFocusable(true);
+ crp.setFocusable(false);
+ crp.requestFocus();
+ crp.requestFocusInWindow();
+ crp.transferFocus();
+ crp.getFocusCycleRootAncestor();
+ crp.nextFocus();
+ crp.transferFocusUpCycle();
+ crp.hasFocus();
+ crp.isFocusOwner();
+ crp.toString();
+ crp.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ crp.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ crp.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ crp.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessDefaultListCellRenderer.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,198 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that DefaultListCellRenderer constructors and methods do not throw
+ * unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessDefaultListCellRenderer
+ */
+
+public class HeadlessDefaultListCellRenderer {
+ public static void main(String args[]) {
+ DefaultListCellRenderer dcr = new DefaultListCellRenderer();
+ Component c1 = dcr.add(new Component(){});
+ Component c2 = dcr.add(new Component(){});
+ Component c3 = dcr.add(new Component(){});
+ dcr.setLayout(new FlowLayout());
+ dcr.invalidate();
+ dcr.validate();
+ dcr.getAccessibleContext();
+ dcr.requestFocus();
+ dcr.requestFocusInWindow();
+ dcr.getPreferredSize();
+ dcr.getMaximumSize();
+ dcr.getMinimumSize();
+ dcr.contains(1, 2);
+ Insets ins = dcr.getInsets();
+ dcr.getAlignmentY();
+ dcr.getAlignmentX();
+ dcr.getGraphics();
+ dcr.setVisible(false);
+ dcr.setVisible(true);
+ dcr.setEnabled(false);
+ dcr.setEnabled(true);
+ dcr.setForeground(Color.red);
+ dcr.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ dcr.setFont(f1);
+ dcr.setFont(f2);
+ dcr.setFont(f3);
+ dcr.setFont(f4);
+
+ dcr.getFontMetrics(f1);
+ dcr.getFontMetrics(f2);
+ dcr.getFontMetrics(f3);
+ dcr.getFontMetrics(f4);
+ }
+ }
+ dcr.enable();
+ dcr.disable();
+ dcr.reshape(10, 10, 10, 10);
+ dcr.getBounds(new Rectangle(1, 1, 1, 1));
+ dcr.getSize(new Dimension(1, 2));
+ dcr.getLocation(new Point(1, 2));
+ dcr.getX();
+ dcr.getY();
+ dcr.getWidth();
+ dcr.getHeight();
+ dcr.isOpaque();
+ dcr.isValidateRoot();
+ dcr.isOptimizedDrawingEnabled();
+ dcr.isDoubleBuffered();
+ dcr.getComponentCount();
+ dcr.countComponents();
+ dcr.getComponent(1);
+ dcr.getComponent(2);
+ Component[] cs = dcr.getComponents();
+ ins = dcr.insets();
+ dcr.remove(0);
+ dcr.remove((java.awt.Component) c2);
+ dcr.removeAll();
+ dcr.getLayout();
+ dcr.setLayout(new FlowLayout());
+ dcr.doLayout();
+ dcr.layout();
+ dcr.invalidate();
+ dcr.validate();
+ dcr.revalidate();
+ dcr.preferredSize();
+ dcr.minimumSize();
+ dcr.getComponentAt(1, 2);
+ dcr.locate(1, 2);
+ dcr.getComponentAt(new Point(1, 2));
+ dcr.isFocusCycleRoot(new Container());
+ dcr.transferFocusBackward();
+ dcr.setName("goober");
+ dcr.getName();
+ dcr.getParent();
+ dcr.getPeer();
+ dcr.getGraphicsConfiguration();
+ dcr.getTreeLock();
+ dcr.getToolkit();
+ dcr.isValid();
+ dcr.isDisplayable();
+ dcr.isVisible();
+ dcr.isShowing();
+ dcr.isEnabled();
+ dcr.enable(false);
+ dcr.enable(true);
+ dcr.enableInputMethods(false);
+ dcr.enableInputMethods(true);
+ dcr.show();
+ dcr.show(false);
+ dcr.show(true);
+ dcr.hide();
+ dcr.getForeground();
+ dcr.isForegroundSet();
+ dcr.getBackground();
+ dcr.isBackgroundSet();
+ dcr.getFont();
+ dcr.isFontSet();
+
+ Container c = new Container();
+ c.add(dcr);
+ dcr.getLocale();
+
+ for (Locale locale : Locale.getAvailableLocales())
+ dcr.setLocale(locale);
+
+ dcr.getColorModel();
+ dcr.getLocation();
+
+ boolean exceptions = false;
+ try {
+ dcr.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ dcr.location();
+ dcr.setLocation(1, 2);
+ dcr.move(1, 2);
+ dcr.setLocation(new Point(1, 2));
+ dcr.getSize();
+ dcr.size();
+ dcr.setSize(1, 32);
+ dcr.resize(1, 32);
+ dcr.setSize(new Dimension(1, 32));
+ dcr.resize(new Dimension(1, 32));
+ dcr.getBounds();
+ dcr.bounds();
+ dcr.setBounds(10, 10, 10, 10);
+ dcr.setBounds(new Rectangle(10, 10, 10, 10));
+ dcr.isLightweight();
+ dcr.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ dcr.getCursor();
+ dcr.isCursorSet();
+ dcr.inside(1, 2);
+ dcr.contains(new Point(1, 2));
+ dcr.isFocusTraversable();
+ dcr.isFocusable();
+ dcr.setFocusable(true);
+ dcr.setFocusable(false);
+ dcr.transferFocus();
+ dcr.getFocusCycleRootAncestor();
+ dcr.nextFocus();
+ dcr.transferFocusUpCycle();
+ dcr.hasFocus();
+ dcr.isFocusOwner();
+ dcr.toString();
+ dcr.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ dcr.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ dcr.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ dcr.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessDefaultListCellRenderer_UIResource.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,198 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that DefaultListCellRenderer.UIResource constructors and methods do not throw
+ * unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessDefaultListCellRenderer_UIResource
+ */
+
+public class HeadlessDefaultListCellRenderer_UIResource {
+ public static void main(String args[]) {
+ DefaultListCellRenderer.UIResource dcr = new DefaultListCellRenderer.UIResource();
+ Component c1 = dcr.add(new Component(){});
+ Component c2 = dcr.add(new Component(){});
+ Component c3 = dcr.add(new Component(){});
+ dcr.setLayout(new FlowLayout());
+ dcr.invalidate();
+ dcr.validate();
+ dcr.getAccessibleContext();
+ dcr.requestFocus();
+ dcr.requestFocusInWindow();
+ dcr.getPreferredSize();
+ dcr.getMaximumSize();
+ dcr.getMinimumSize();
+ dcr.contains(1, 2);
+ Insets ins = dcr.getInsets();
+ dcr.getAlignmentY();
+ dcr.getAlignmentX();
+ dcr.getGraphics();
+ dcr.setVisible(false);
+ dcr.setVisible(true);
+ dcr.setEnabled(false);
+ dcr.setEnabled(true);
+ dcr.setForeground(Color.red);
+ dcr.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ dcr.setFont(f1);
+ dcr.setFont(f2);
+ dcr.setFont(f3);
+ dcr.setFont(f4);
+
+ dcr.getFontMetrics(f1);
+ dcr.getFontMetrics(f2);
+ dcr.getFontMetrics(f3);
+ dcr.getFontMetrics(f4);
+ }
+ }
+ dcr.enable();
+ dcr.disable();
+ dcr.reshape(10, 10, 10, 10);
+ dcr.getBounds(new Rectangle(1, 1, 1, 1));
+ dcr.getSize(new Dimension(1, 2));
+ dcr.getLocation(new Point(1, 2));
+ dcr.getX();
+ dcr.getY();
+ dcr.getWidth();
+ dcr.getHeight();
+ dcr.isOpaque();
+ dcr.isValidateRoot();
+ dcr.isOptimizedDrawingEnabled();
+ dcr.isDoubleBuffered();
+ dcr.getComponentCount();
+ dcr.countComponents();
+ dcr.getComponent(1);
+ dcr.getComponent(2);
+ Component[] cs = dcr.getComponents();
+ ins = dcr.insets();
+ dcr.remove(0);
+ dcr.remove((java.awt.Component) c2);
+ dcr.removeAll();
+ dcr.getLayout();
+ dcr.setLayout(new FlowLayout());
+ dcr.doLayout();
+ dcr.layout();
+ dcr.invalidate();
+ dcr.validate();
+ dcr.revalidate();
+ dcr.preferredSize();
+ dcr.minimumSize();
+ dcr.getComponentAt(1, 2);
+ dcr.locate(1, 2);
+ dcr.getComponentAt(new Point(1, 2));
+ dcr.isFocusCycleRoot(new Container());
+ dcr.transferFocusBackward();
+ dcr.setName("goober");
+ dcr.getName();
+ dcr.getParent();
+ dcr.getPeer();
+ dcr.getGraphicsConfiguration();
+ dcr.getTreeLock();
+ dcr.getToolkit();
+ dcr.isValid();
+ dcr.isDisplayable();
+ dcr.isVisible();
+ dcr.isShowing();
+ dcr.isEnabled();
+ dcr.enable(false);
+ dcr.enable(true);
+ dcr.enableInputMethods(false);
+ dcr.enableInputMethods(true);
+ dcr.show();
+ dcr.show(false);
+ dcr.show(true);
+ dcr.hide();
+ dcr.getForeground();
+ dcr.isForegroundSet();
+ dcr.getBackground();
+ dcr.isBackgroundSet();
+ dcr.getFont();
+ dcr.isFontSet();
+
+ Container c = new Container();
+ c.add(dcr);
+ dcr.getLocale();
+
+ for (Locale locale : Locale.getAvailableLocales())
+ dcr.setLocale(locale);
+
+ dcr.getColorModel();
+ dcr.getLocation();
+
+ boolean exceptions = false;
+ try {
+ dcr.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ dcr.location();
+ dcr.setLocation(1, 2);
+ dcr.move(1, 2);
+ dcr.setLocation(new Point(1, 2));
+ dcr.getSize();
+ dcr.size();
+ dcr.setSize(1, 32);
+ dcr.resize(1, 32);
+ dcr.setSize(new Dimension(1, 32));
+ dcr.resize(new Dimension(1, 32));
+ dcr.getBounds();
+ dcr.bounds();
+ dcr.setBounds(10, 10, 10, 10);
+ dcr.setBounds(new Rectangle(10, 10, 10, 10));
+ dcr.isLightweight();
+ dcr.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ dcr.getCursor();
+ dcr.isCursorSet();
+ dcr.inside(1, 2);
+ dcr.contains(new Point(1, 2));
+ dcr.isFocusTraversable();
+ dcr.isFocusable();
+ dcr.setFocusable(true);
+ dcr.setFocusable(false);
+ dcr.transferFocus();
+ dcr.getFocusCycleRootAncestor();
+ dcr.nextFocus();
+ dcr.transferFocusUpCycle();
+ dcr.hasFocus();
+ dcr.isFocusOwner();
+ dcr.toString();
+ dcr.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ dcr.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ dcr.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ dcr.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessGrayFilter.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that GrayFilter constructor and clone() method do not throw
+ * unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessGrayFilter
+ */
+
+public class HeadlessGrayFilter {
+ public static void main(String args[]) {
+ new GrayFilter(true, 60).clone();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJApplet.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2007, 2014, 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.JApplet;
+import java.awt.HeadlessException;
+
+/*
+ * @test
+ * @summary Check that JApplet constructor throws HeadlessException in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJApplet
+ */
+
+public class HeadlessJApplet {
+ public static void main(String args[]) {
+ boolean exceptions = false;
+ try {
+ new JApplet();
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJButton.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JButton constructors and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJButton
+ */
+
+public class HeadlessJButton {
+ public static void main(String args[]) {
+ JButton b = new JButton();
+ b = new JButton("Press me");
+ b.getAccessibleContext();
+ b.isFocusTraversable();
+ b.setEnabled(false);
+ b.setEnabled(true);
+ b.requestFocus();
+ b.requestFocusInWindow();
+ b.getPreferredSize();
+ b.getMaximumSize();
+ b.getMinimumSize();
+ b.contains(1, 2);
+ Component c1 = b.add(new Component(){});
+ Component c2 = b.add(new Component(){});
+ Component c3 = b.add(new Component(){});
+ Insets ins = b.getInsets();
+ b.getAlignmentY();
+ b.getAlignmentX();
+ b.getGraphics();
+ b.setVisible(false);
+ b.setVisible(true);
+ b.setForeground(Color.red);
+ b.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ b.setFont(f1);
+ b.setFont(f2);
+ b.setFont(f3);
+ b.setFont(f4);
+
+ b.getFontMetrics(f1);
+ b.getFontMetrics(f2);
+ b.getFontMetrics(f3);
+ b.getFontMetrics(f4);
+ }
+ }
+ b.enable();
+ b.disable();
+ b.reshape(10, 10, 10, 10);
+ b.getBounds(new Rectangle(1, 1, 1, 1));
+ b.getSize(new Dimension(1, 2));
+ b.getLocation(new Point(1, 2));
+ b.getX();
+ b.getY();
+ b.getWidth();
+ b.getHeight();
+ b.isOpaque();
+ b.isValidateRoot();
+ b.isOptimizedDrawingEnabled();
+ b.isDoubleBuffered();
+ b.getComponentCount();
+ b.countComponents();
+ b.getComponent(1);
+ b.getComponent(2);
+ Component[] cs = b.getComponents();
+ b.getLayout();
+ b.setLayout(new FlowLayout());
+ b.doLayout();
+ b.layout();
+ b.invalidate();
+ b.validate();
+ b.remove(0);
+ b.remove(c2);
+ b.removeAll();
+ b.preferredSize();
+ b.minimumSize();
+ b.getComponentAt(1, 2);
+ b.locate(1, 2);
+ b.getComponentAt(new Point(1, 2));
+ b.isFocusCycleRoot(new Container());
+ b.transferFocusBackward();
+ b.setName("goober");
+ b.getName();
+ b.getParent();
+ b.getPeer();
+ b.getGraphicsConfiguration();
+ b.getTreeLock();
+ b.getToolkit();
+ b.isValid();
+ b.isDisplayable();
+ b.isVisible();
+ b.isShowing();
+ b.isEnabled();
+ b.enable(false);
+ b.enable(true);
+ b.enableInputMethods(false);
+ b.enableInputMethods(true);
+ b.show();
+ b.show(false);
+ b.show(true);
+ b.hide();
+ b.getForeground();
+ b.isForegroundSet();
+ b.getBackground();
+ b.isBackgroundSet();
+ b.getFont();
+ b.isFontSet();
+ Container c = new Container();
+ c.add(b);
+ b.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ b.setLocale(locale);
+
+ b.getColorModel();
+ b.getLocation();
+
+ boolean exceptions = false;
+ try {
+ b.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ b.location();
+ b.setLocation(1, 2);
+ b.move(1, 2);
+ b.setLocation(new Point(1, 2));
+ b.getSize();
+ b.size();
+ b.setSize(1, 32);
+ b.resize(1, 32);
+ b.setSize(new Dimension(1, 32));
+ b.resize(new Dimension(1, 32));
+ b.getBounds();
+ b.bounds();
+ b.setBounds(10, 10, 10, 10);
+ b.setBounds(new Rectangle(10, 10, 10, 10));
+ b.isLightweight();
+ b.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ b.getCursor();
+ b.isCursorSet();
+ b.inside(1, 2);
+ b.contains(new Point(1, 2));
+ b.isFocusable();
+ b.setFocusable(true);
+ b.setFocusable(false);
+ b.transferFocus();
+ b.getFocusCycleRootAncestor();
+ b.nextFocus();
+ b.transferFocusUpCycle();
+ b.hasFocus();
+ b.isFocusOwner();
+ b.toString();
+ b.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ b.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ b.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ b.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJCheckBox.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JCheckBox constructors and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJCheckBox
+ */
+
+public class HeadlessJCheckBox {
+ public static void main(String args[]) {
+ JCheckBox ch;
+ ch = new JCheckBox();
+ ch = new JCheckBox("Press me");
+ ch = new JCheckBox("Press me", true);
+ ch = new JCheckBox("Press me", false);
+ ch.getAccessibleContext();
+ ch.isFocusTraversable();
+ ch.setEnabled(false);
+ ch.setEnabled(true);
+ ch.requestFocus();
+ ch.requestFocusInWindow();
+ ch.getPreferredSize();
+ ch.getMaximumSize();
+ ch.getMinimumSize();
+ ch.contains(1, 2);
+ Component c1 = ch.add(new Component(){});
+ Component c2 = ch.add(new Component(){});
+ Component c3 = ch.add(new Component(){});
+ Insets ins = ch.getInsets();
+ ch.getAlignmentY();
+ ch.getAlignmentX();
+ ch.getGraphics();
+ ch.setVisible(false);
+ ch.setVisible(true);
+ ch.setForeground(Color.red);
+ ch.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ ch.setFont(f1);
+ ch.setFont(f2);
+ ch.setFont(f3);
+ ch.setFont(f4);
+
+ ch.getFontMetrics(f1);
+ ch.getFontMetrics(f2);
+ ch.getFontMetrics(f3);
+ ch.getFontMetrics(f4);
+ }
+ }
+ ch.enable();
+ ch.disable();
+ ch.reshape(10, 10, 10, 10);
+ ch.getBounds(new Rectangle(1, 1, 1, 1));
+ ch.getSize(new Dimension(1, 2));
+ ch.getLocation(new Point(1, 2));
+ ch.getX();
+ ch.getY();
+ ch.getWidth();
+ ch.getHeight();
+ ch.isOpaque();
+ ch.isValidateRoot();
+ ch.isOptimizedDrawingEnabled();
+ ch.isDoubleBuffered();
+ ch.getComponentCount();
+ ch.countComponents();
+ ch.getComponent(1);
+ ch.getComponent(2);
+ Component[] cs = ch.getComponents();
+ ch.getLayout();
+ ch.setLayout(new FlowLayout());
+ ch.doLayout();
+ ch.layout();
+ ch.invalidate();
+ ch.validate();
+ ch.remove(0);
+ ch.remove(c2);
+ ch.removeAll();
+ ch.preferredSize();
+ ch.minimumSize();
+ ch.getComponentAt(1, 2);
+ ch.locate(1, 2);
+ ch.getComponentAt(new Point(1, 2));
+ ch.isFocusCycleRoot(new Container());
+ ch.transferFocusBackward();
+ ch.setName("goober");
+ ch.getName();
+ ch.getParent();
+ ch.getPeer();
+ ch.getGraphicsConfiguration();
+ ch.getTreeLock();
+ ch.getToolkit();
+ ch.isValid();
+ ch.isDisplayable();
+ ch.isVisible();
+ ch.isShowing();
+ ch.isEnabled();
+ ch.enable(false);
+ ch.enable(true);
+ ch.enableInputMethods(false);
+ ch.enableInputMethods(true);
+ ch.show();
+ ch.show(false);
+ ch.show(true);
+ ch.hide();
+ ch.getForeground();
+ ch.isForegroundSet();
+ ch.getBackground();
+ ch.isBackgroundSet();
+ ch.getFont();
+ ch.isFontSet();
+ Container c = new Container();
+ c.add(ch);
+ ch.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ ch.setLocale(locale);
+
+ ch.getColorModel();
+ ch.getLocation();
+
+ boolean exceptions = false;
+ try {
+ ch.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ ch.location();
+ ch.setLocation(1, 2);
+ ch.move(1, 2);
+ ch.setLocation(new Point(1, 2));
+ ch.getSize();
+ ch.size();
+ ch.setSize(1, 32);
+ ch.resize(1, 32);
+ ch.setSize(new Dimension(1, 32));
+ ch.resize(new Dimension(1, 32));
+ ch.getBounds();
+ ch.bounds();
+ ch.setBounds(10, 10, 10, 10);
+ ch.setBounds(new Rectangle(10, 10, 10, 10));
+ ch.isLightweight();
+ ch.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ ch.getCursor();
+ ch.isCursorSet();
+ ch.inside(1, 2);
+ ch.contains(new Point(1, 2));
+ ch.isFocusable();
+ ch.setFocusable(true);
+ ch.setFocusable(false);
+ ch.transferFocus();
+ ch.getFocusCycleRootAncestor();
+ ch.nextFocus();
+ ch.transferFocusUpCycle();
+ ch.hasFocus();
+ ch.isFocusOwner();
+ ch.toString();
+ ch.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ ch.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ ch.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ ch.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJCheckBoxMenuItem.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JCheckBoxMenuItem constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJCheckBoxMenuItem
+ */
+
+public class HeadlessJCheckBoxMenuItem {
+ public static void main(String args[]) {
+ JCheckBoxMenuItem ch;
+ ch = new JCheckBoxMenuItem();
+ ch.getAccessibleContext();
+ ch.isFocusTraversable();
+ ch.setEnabled(false);
+ ch.setEnabled(true);
+ ch.requestFocus();
+ ch.requestFocusInWindow();
+ ch.getPreferredSize();
+ ch.getMaximumSize();
+ ch.getMinimumSize();
+ ch.contains(1, 2);
+ Component c1 = ch.add(new Component(){});
+ Component c2 = ch.add(new Component(){});
+ Component c3 = ch.add(new Component(){});
+ Insets ins = ch.getInsets();
+ ch.getAlignmentY();
+ ch.getAlignmentX();
+ ch.getGraphics();
+ ch.setVisible(false);
+ ch.setVisible(true);
+ ch.setForeground(Color.red);
+ ch.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ ch.setFont(f1);
+ ch.setFont(f2);
+ ch.setFont(f3);
+ ch.setFont(f4);
+
+ ch.getFontMetrics(f1);
+ ch.getFontMetrics(f2);
+ ch.getFontMetrics(f3);
+ ch.getFontMetrics(f4);
+ }
+ }
+ ch.enable();
+ ch.disable();
+ ch.reshape(10, 10, 10, 10);
+ ch.getBounds(new Rectangle(1, 1, 1, 1));
+ ch.getSize(new Dimension(1, 2));
+ ch.getLocation(new Point(1, 2));
+ ch.getX();
+ ch.getY();
+ ch.getWidth();
+ ch.getHeight();
+ ch.isOpaque();
+ ch.isValidateRoot();
+ ch.isOptimizedDrawingEnabled();
+ ch.isDoubleBuffered();
+ ch.getComponentCount();
+ ch.countComponents();
+ ch.getComponent(1);
+ ch.getComponent(2);
+ Component[] cs = ch.getComponents();
+ ch.getLayout();
+ ch.setLayout(new FlowLayout());
+ ch.doLayout();
+ ch.layout();
+ ch.invalidate();
+ ch.validate();
+ ch.remove(0);
+ ch.remove(c2);
+ ch.removeAll();
+ ch.preferredSize();
+ ch.minimumSize();
+ ch.getComponentAt(1, 2);
+ ch.locate(1, 2);
+ ch.getComponentAt(new Point(1, 2));
+ ch.isFocusCycleRoot(new Container());
+ ch.transferFocusBackward();
+ ch.setName("goober");
+ ch.getName();
+ ch.getParent();
+ ch.getPeer();
+ ch.getGraphicsConfiguration();
+ ch.getTreeLock();
+ ch.getToolkit();
+ ch.isValid();
+ ch.isDisplayable();
+ ch.isVisible();
+ ch.isShowing();
+ ch.isEnabled();
+ ch.enable(false);
+ ch.enable(true);
+ ch.enableInputMethods(false);
+ ch.enableInputMethods(true);
+ ch.show();
+ ch.show(false);
+ ch.show(true);
+ ch.hide();
+ ch.getForeground();
+ ch.isForegroundSet();
+ ch.getBackground();
+ ch.isBackgroundSet();
+ ch.getFont();
+ ch.isFontSet();
+ Container c = new Container();
+ c.add(ch);
+ ch.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ ch.setLocale(locale);
+
+ ch.getColorModel();
+ ch.getLocation();
+
+ boolean exceptions = false;
+ try {
+ ch.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ ch.location();
+ ch.setLocation(1, 2);
+ ch.move(1, 2);
+ ch.setLocation(new Point(1, 2));
+ ch.getSize();
+ ch.size();
+ ch.setSize(1, 32);
+ ch.resize(1, 32);
+ ch.setSize(new Dimension(1, 32));
+ ch.resize(new Dimension(1, 32));
+ ch.getBounds();
+ ch.bounds();
+ ch.setBounds(10, 10, 10, 10);
+ ch.setBounds(new Rectangle(10, 10, 10, 10));
+ ch.isLightweight();
+ ch.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ ch.getCursor();
+ ch.isCursorSet();
+ ch.inside(1, 2);
+ ch.contains(new Point(1, 2));
+ ch.isFocusable();
+ ch.setFocusable(true);
+ ch.setFocusable(false);
+ ch.transferFocus();
+ ch.getFocusCycleRootAncestor();
+ ch.nextFocus();
+ ch.transferFocusUpCycle();
+ ch.hasFocus();
+ ch.isFocusOwner();
+ ch.toString();
+ ch.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ ch.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ ch.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ ch.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJColorChooser.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JColorChooser constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJColorChooser
+ */
+
+public class HeadlessJColorChooser {
+ public static void main(String args[]) {
+ JColorChooser cc;
+ cc = new JColorChooser();
+ cc.getAccessibleContext();
+ cc.isFocusTraversable();
+ cc.setEnabled(false);
+ cc.setEnabled(true);
+ cc.requestFocus();
+ cc.requestFocusInWindow();
+ cc.getPreferredSize();
+ cc.getMaximumSize();
+ cc.getMinimumSize();
+ cc.contains(1, 2);
+ Component c1 = cc.add(new Component(){});
+ Component c2 = cc.add(new Component(){});
+ Component c3 = cc.add(new Component(){});
+ Insets ins = cc.getInsets();
+ cc.getAlignmentY();
+ cc.getAlignmentX();
+ cc.getGraphics();
+ cc.setVisible(false);
+ cc.setVisible(true);
+ cc.setForeground(Color.red);
+ cc.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ cc.setFont(f1);
+ cc.setFont(f2);
+ cc.setFont(f3);
+ cc.setFont(f4);
+
+ cc.getFontMetrics(f1);
+ cc.getFontMetrics(f2);
+ cc.getFontMetrics(f3);
+ cc.getFontMetrics(f4);
+ }
+ }
+ cc.enable();
+ cc.disable();
+ cc.reshape(10, 10, 10, 10);
+ cc.getBounds(new Rectangle(1, 1, 1, 1));
+ cc.getSize(new Dimension(1, 2));
+ cc.getLocation(new Point(1, 2));
+ cc.getX();
+ cc.getY();
+ cc.getWidth();
+ cc.getHeight();
+ cc.isOpaque();
+ cc.isValidateRoot();
+ cc.isOptimizedDrawingEnabled();
+ cc.isDoubleBuffered();
+ cc.getComponentCount();
+ cc.countComponents();
+ cc.getComponent(1);
+ cc.getComponent(2);
+ Component[] cs = cc.getComponents();
+ cc.getLayout();
+ cc.setLayout(new FlowLayout());
+ cc.doLayout();
+ cc.layout();
+ cc.invalidate();
+ cc.validate();
+ cc.remove(0);
+ cc.remove(c2);
+ cc.removeAll();
+ cc.preferredSize();
+ cc.minimumSize();
+ cc.getComponentAt(1, 2);
+ cc.locate(1, 2);
+ cc.getComponentAt(new Point(1, 2));
+ cc.isFocusCycleRoot(new Container());
+ cc.transferFocusBackward();
+ cc.setName("goober");
+ cc.getName();
+ cc.getParent();
+ cc.getPeer();
+ cc.getGraphicsConfiguration();
+ cc.getTreeLock();
+ cc.getToolkit();
+ cc.isValid();
+ cc.isDisplayable();
+ cc.isVisible();
+ cc.isShowing();
+ cc.isEnabled();
+ cc.enable(false);
+ cc.enable(true);
+ cc.enableInputMethods(false);
+ cc.enableInputMethods(true);
+ cc.show();
+ cc.show(false);
+ cc.show(true);
+ cc.hide();
+ cc.getForeground();
+ cc.isForegroundSet();
+ cc.getBackground();
+ cc.isBackgroundSet();
+ cc.getFont();
+ cc.isFontSet();
+ Container c = new Container();
+ c.add(cc);
+ cc.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ cc.setLocale(locale);
+
+ cc.getColorModel();
+ cc.getLocation();
+
+ boolean exceptions = false;
+ try {
+ cc.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ cc.location();
+ cc.setLocation(1, 2);
+ cc.move(1, 2);
+ cc.setLocation(new Point(1, 2));
+ cc.getSize();
+ cc.size();
+ cc.setSize(1, 32);
+ cc.resize(1, 32);
+ cc.setSize(new Dimension(1, 32));
+ cc.resize(new Dimension(1, 32));
+ cc.getBounds();
+ cc.bounds();
+ cc.setBounds(10, 10, 10, 10);
+ cc.setBounds(new Rectangle(10, 10, 10, 10));
+ cc.isLightweight();
+ cc.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ cc.getCursor();
+ cc.isCursorSet();
+ cc.inside(1, 2);
+ cc.contains(new Point(1, 2));
+ cc.isFocusable();
+ cc.setFocusable(true);
+ cc.setFocusable(false);
+ cc.transferFocus();
+ cc.getFocusCycleRootAncestor();
+ cc.nextFocus();
+ cc.transferFocusUpCycle();
+ cc.hasFocus();
+ cc.isFocusOwner();
+ cc.toString();
+ cc.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ cc.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ cc.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ cc.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJComboBox.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JComboBox constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJComboBox
+ */
+
+public class HeadlessJComboBox {
+ public static void main(String args[]) {
+ JComboBox ch;
+ ch = new JComboBox();
+ ch.getAccessibleContext();
+ ch.isFocusTraversable();
+ ch.setEnabled(false);
+ ch.setEnabled(true);
+ ch.requestFocus();
+ ch.requestFocusInWindow();
+ ch.getPreferredSize();
+ ch.getMaximumSize();
+ ch.getMinimumSize();
+ ch.contains(1, 2);
+ Component c1 = ch.add(new Component(){});
+ Component c2 = ch.add(new Component(){});
+ Component c3 = ch.add(new Component(){});
+ Insets ins = ch.getInsets();
+ ch.getAlignmentY();
+ ch.getAlignmentX();
+ ch.getGraphics();
+ ch.setVisible(false);
+ ch.setVisible(true);
+ ch.setForeground(Color.red);
+ ch.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ ch.setFont(f1);
+ ch.setFont(f2);
+ ch.setFont(f3);
+ ch.setFont(f4);
+
+ ch.getFontMetrics(f1);
+ ch.getFontMetrics(f2);
+ ch.getFontMetrics(f3);
+ ch.getFontMetrics(f4);
+ }
+ }
+ ch.enable();
+ ch.disable();
+ ch.reshape(10, 10, 10, 10);
+ ch.getBounds(new Rectangle(1, 1, 1, 1));
+ ch.getSize(new Dimension(1, 2));
+ ch.getLocation(new Point(1, 2));
+ ch.getX();
+ ch.getY();
+ ch.getWidth();
+ ch.getHeight();
+ ch.isOpaque();
+ ch.isValidateRoot();
+ ch.isOptimizedDrawingEnabled();
+ ch.isDoubleBuffered();
+ ch.getComponentCount();
+ ch.countComponents();
+ ch.getComponent(1);
+ ch.getComponent(2);
+ Component[] cs = ch.getComponents();
+ ch.getLayout();
+ ch.setLayout(new FlowLayout());
+ ch.doLayout();
+ ch.layout();
+ ch.invalidate();
+ ch.validate();
+ ch.remove(0);
+ ch.remove(c2);
+ ch.removeAll();
+ ch.preferredSize();
+ ch.minimumSize();
+ ch.getComponentAt(1, 2);
+ ch.locate(1, 2);
+ ch.getComponentAt(new Point(1, 2));
+ ch.isFocusCycleRoot(new Container());
+ ch.transferFocusBackward();
+ ch.setName("goober");
+ ch.getName();
+ ch.getParent();
+ ch.getPeer();
+ ch.getGraphicsConfiguration();
+ ch.getTreeLock();
+ ch.getToolkit();
+ ch.isValid();
+ ch.isDisplayable();
+ ch.isVisible();
+ ch.isShowing();
+ ch.isEnabled();
+ ch.enable(false);
+ ch.enable(true);
+ ch.enableInputMethods(false);
+ ch.enableInputMethods(true);
+ ch.show();
+ ch.show(false);
+ ch.show(true);
+ ch.hide();
+ ch.getForeground();
+ ch.isForegroundSet();
+ ch.getBackground();
+ ch.isBackgroundSet();
+ ch.getFont();
+ ch.isFontSet();
+ Container c = new Container();
+ c.add(ch);
+ ch.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ ch.setLocale(locale);
+
+ ch.getColorModel();
+ ch.getLocation();
+
+ boolean exceptions = false;
+ try {
+ ch.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ ch.location();
+ ch.setLocation(1, 2);
+ ch.move(1, 2);
+ ch.setLocation(new Point(1, 2));
+ ch.getSize();
+ ch.size();
+ ch.setSize(1, 32);
+ ch.resize(1, 32);
+ ch.setSize(new Dimension(1, 32));
+ ch.resize(new Dimension(1, 32));
+ ch.getBounds();
+ ch.bounds();
+ ch.setBounds(10, 10, 10, 10);
+ ch.setBounds(new Rectangle(10, 10, 10, 10));
+ ch.isLightweight();
+ ch.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ ch.getCursor();
+ ch.isCursorSet();
+ ch.inside(1, 2);
+ ch.contains(new Point(1, 2));
+ ch.isFocusable();
+ ch.setFocusable(true);
+ ch.setFocusable(false);
+ ch.transferFocus();
+ ch.getFocusCycleRootAncestor();
+ ch.nextFocus();
+ ch.transferFocusUpCycle();
+ ch.hasFocus();
+ ch.isFocusOwner();
+ ch.toString();
+ ch.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ ch.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ ch.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ ch.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJComponent.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JComponent constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJComponent
+ */
+
+public class HeadlessJComponent {
+ public static void main(String args[]) {
+ JComponent ch = new JComponent(){};
+ ch.getAccessibleContext();
+ ch.isFocusTraversable();
+ ch.setEnabled(false);
+ ch.setEnabled(true);
+ ch.requestFocus();
+ ch.requestFocusInWindow();
+ ch.getPreferredSize();
+ ch.getMaximumSize();
+ ch.getMinimumSize();
+ ch.contains(1, 2);
+ Component c1 = ch.add(new Component(){});
+ Component c2 = ch.add(new Component(){});
+ Component c3 = ch.add(new Component(){});
+ Insets ins = ch.getInsets();
+ ch.getAlignmentY();
+ ch.getAlignmentX();
+ ch.getGraphics();
+ ch.setVisible(false);
+ ch.setVisible(true);
+ ch.setForeground(Color.red);
+ ch.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ ch.setFont(f1);
+ ch.setFont(f2);
+ ch.setFont(f3);
+ ch.setFont(f4);
+
+ ch.getFontMetrics(f1);
+ ch.getFontMetrics(f2);
+ ch.getFontMetrics(f3);
+ ch.getFontMetrics(f4);
+ }
+ }
+ ch.enable();
+ ch.disable();
+ ch.reshape(10, 10, 10, 10);
+ ch.getBounds(new Rectangle(1, 1, 1, 1));
+ ch.getSize(new Dimension(1, 2));
+ ch.getLocation(new Point(1, 2));
+ ch.getX();
+ ch.getY();
+ ch.getWidth();
+ ch.getHeight();
+ ch.isOpaque();
+ ch.isValidateRoot();
+ ch.isOptimizedDrawingEnabled();
+ ch.isDoubleBuffered();
+ ch.getComponentCount();
+ ch.countComponents();
+ ch.getComponent(1);
+ ch.getComponent(2);
+ Component[] cs = ch.getComponents();
+ ch.getLayout();
+ ch.setLayout(new FlowLayout());
+ ch.doLayout();
+ ch.layout();
+ ch.invalidate();
+ ch.validate();
+ ch.remove(0);
+ ch.remove(c2);
+ ch.removeAll();
+ ch.preferredSize();
+ ch.minimumSize();
+ ch.getComponentAt(1, 2);
+ ch.locate(1, 2);
+ ch.getComponentAt(new Point(1, 2));
+ ch.isFocusCycleRoot(new Container());
+ ch.transferFocusBackward();
+ ch.setName("goober");
+ ch.getName();
+ ch.getParent();
+ ch.getPeer();
+ ch.getGraphicsConfiguration();
+ ch.getTreeLock();
+ ch.getToolkit();
+ ch.isValid();
+ ch.isDisplayable();
+ ch.isVisible();
+ ch.isShowing();
+ ch.isEnabled();
+ ch.enable(false);
+ ch.enable(true);
+ ch.enableInputMethods(false);
+ ch.enableInputMethods(true);
+ ch.show();
+ ch.show(false);
+ ch.show(true);
+ ch.hide();
+ ch.getForeground();
+ ch.isForegroundSet();
+ ch.getBackground();
+ ch.isBackgroundSet();
+ ch.getFont();
+ ch.isFontSet();
+ Container c = new Container();
+ c.add(ch);
+ ch.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ ch.setLocale(locale);
+
+ ch.getColorModel();
+ ch.getLocation();
+
+ boolean exceptions = false;
+ try {
+ ch.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ ch.location();
+ ch.setLocation(1, 2);
+ ch.move(1, 2);
+ ch.setLocation(new Point(1, 2));
+ ch.getSize();
+ ch.size();
+ ch.setSize(1, 32);
+ ch.resize(1, 32);
+ ch.setSize(new Dimension(1, 32));
+ ch.resize(new Dimension(1, 32));
+ ch.getBounds();
+ ch.bounds();
+ ch.setBounds(10, 10, 10, 10);
+ ch.setBounds(new Rectangle(10, 10, 10, 10));
+ ch.isLightweight();
+ ch.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ ch.getCursor();
+ ch.isCursorSet();
+ ch.inside(1, 2);
+ ch.contains(new Point(1, 2));
+ ch.isFocusable();
+ ch.setFocusable(true);
+ ch.setFocusable(false);
+ ch.transferFocus();
+ ch.getFocusCycleRootAncestor();
+ ch.nextFocus();
+ ch.transferFocusUpCycle();
+ ch.hasFocus();
+ ch.isFocusOwner();
+ ch.toString();
+ ch.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ ch.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ ch.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ ch.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJDesktopPane.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JDesktopPane constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJDesktopPane
+ */
+
+public class HeadlessJDesktopPane {
+ public static void main(String args[]) {
+ JComponent ch = new JComponent(){};
+ ch.getAccessibleContext();
+ ch.isFocusTraversable();
+ ch.setEnabled(false);
+ ch.setEnabled(true);
+ ch.requestFocus();
+ ch.requestFocusInWindow();
+ ch.getPreferredSize();
+ ch.getMaximumSize();
+ ch.getMinimumSize();
+ ch.contains(1, 2);
+ Component c1 = ch.add(new Component(){});
+ Component c2 = ch.add(new Component(){});
+ Component c3 = ch.add(new Component(){});
+ Insets ins = ch.getInsets();
+ ch.getAlignmentY();
+ ch.getAlignmentX();
+ ch.getGraphics();
+ ch.setVisible(false);
+ ch.setVisible(true);
+ ch.setForeground(Color.red);
+ ch.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ ch.setFont(f1);
+ ch.setFont(f2);
+ ch.setFont(f3);
+ ch.setFont(f4);
+
+ ch.getFontMetrics(f1);
+ ch.getFontMetrics(f2);
+ ch.getFontMetrics(f3);
+ ch.getFontMetrics(f4);
+ }
+ }
+ ch.enable();
+ ch.disable();
+ ch.reshape(10, 10, 10, 10);
+ ch.getBounds(new Rectangle(1, 1, 1, 1));
+ ch.getSize(new Dimension(1, 2));
+ ch.getLocation(new Point(1, 2));
+ ch.getX();
+ ch.getY();
+ ch.getWidth();
+ ch.getHeight();
+ ch.isOpaque();
+ ch.isValidateRoot();
+ ch.isOptimizedDrawingEnabled();
+ ch.isDoubleBuffered();
+ ch.getComponentCount();
+ ch.countComponents();
+ ch.getComponent(1);
+ ch.getComponent(2);
+ Component[] cs = ch.getComponents();
+ ch.getLayout();
+ ch.setLayout(new FlowLayout());
+ ch.doLayout();
+ ch.layout();
+ ch.invalidate();
+ ch.validate();
+ ch.remove(0);
+ ch.remove(c2);
+ ch.removeAll();
+ ch.preferredSize();
+ ch.minimumSize();
+ ch.getComponentAt(1, 2);
+ ch.locate(1, 2);
+ ch.getComponentAt(new Point(1, 2));
+ ch.isFocusCycleRoot(new Container());
+ ch.transferFocusBackward();
+ ch.setName("goober");
+ ch.getName();
+ ch.getParent();
+ ch.getPeer();
+ ch.getGraphicsConfiguration();
+ ch.getTreeLock();
+ ch.getToolkit();
+ ch.isValid();
+ ch.isDisplayable();
+ ch.isVisible();
+ ch.isShowing();
+ ch.isEnabled();
+ ch.enable(false);
+ ch.enable(true);
+ ch.enableInputMethods(false);
+ ch.enableInputMethods(true);
+ ch.show();
+ ch.show(false);
+ ch.show(true);
+ ch.hide();
+ ch.getForeground();
+ ch.isForegroundSet();
+ ch.getBackground();
+ ch.isBackgroundSet();
+ ch.getFont();
+ ch.isFontSet();
+ Container c = new Container();
+ c.add(ch);
+ ch.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ ch.setLocale(locale);
+
+ ch.getColorModel();
+ ch.getLocation();
+
+ boolean exceptions = false;
+ try {
+ ch.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ ch.location();
+ ch.setLocation(1, 2);
+ ch.move(1, 2);
+ ch.setLocation(new Point(1, 2));
+ ch.getSize();
+ ch.size();
+ ch.setSize(1, 32);
+ ch.resize(1, 32);
+ ch.setSize(new Dimension(1, 32));
+ ch.resize(new Dimension(1, 32));
+ ch.getBounds();
+ ch.bounds();
+ ch.setBounds(10, 10, 10, 10);
+ ch.setBounds(new Rectangle(10, 10, 10, 10));
+ ch.isLightweight();
+ ch.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ ch.getCursor();
+ ch.isCursorSet();
+ ch.inside(1, 2);
+ ch.contains(new Point(1, 2));
+ ch.isFocusable();
+ ch.setFocusable(true);
+ ch.setFocusable(false);
+ ch.transferFocus();
+ ch.getFocusCycleRootAncestor();
+ ch.nextFocus();
+ ch.transferFocusUpCycle();
+ ch.hasFocus();
+ ch.isFocusOwner();
+ ch.toString();
+ ch.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ ch.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ ch.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ ch.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJDialog.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that JDialog constructors throw HeadlessException in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJDialog
+ */
+
+public class HeadlessJDialog {
+ public static void main(String args[]) {
+ boolean exceptions = false;
+ JDialog b;
+
+ try {
+ b = new JDialog();
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ b = new JDialog(new Frame("Frame title"));
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ b = new JDialog(new Frame("Frame title"), true);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ b = new JDialog(new Frame("Frame title"), false);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ b = new JDialog(new Frame("Frame title"), "Dialog title");
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ b = new JDialog(new Frame("Frame title"), "Dialog title", true);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ b = new JDialog(new Frame("Frame title"), "Dialog title", false);
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJEditorPane.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,194 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JEditorPane constructors and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJEditorPane
+ */
+
+public class HeadlessJEditorPane {
+ public static void main(String args[]) {
+ JEditorPane b;
+ b = new JEditorPane("text/plain", "The Text");
+ b = new JEditorPane("unknown/unknown", "The Text");
+ b = new JEditorPane();
+ b.getAccessibleContext();
+ b.isFocusTraversable();
+ b.setEnabled(false);
+ b.setEnabled(true);
+ b.requestFocus();
+ b.requestFocusInWindow();
+ b.getPreferredSize();
+ b.getMaximumSize();
+ b.getMinimumSize();
+ b.contains(1, 2);
+ Component c1 = b.add(new Component(){});
+ Component c2 = b.add(new Component(){});
+ Component c3 = b.add(new Component(){});
+ Insets ins = b.getInsets();
+ b.getAlignmentY();
+ b.getAlignmentX();
+ b.getGraphics();
+ b.setVisible(false);
+ b.setVisible(true);
+ b.setForeground(Color.red);
+ b.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ b.setFont(f1);
+ b.setFont(f2);
+ b.setFont(f3);
+ b.setFont(f4);
+
+ b.getFontMetrics(f1);
+ b.getFontMetrics(f2);
+ b.getFontMetrics(f3);
+ b.getFontMetrics(f4);
+ }
+ }
+ b.enable();
+ b.disable();
+ b.reshape(10, 10, 10, 10);
+ b.getBounds(new Rectangle(1, 1, 1, 1));
+ b.getSize(new Dimension(1, 2));
+ b.getLocation(new Point(1, 2));
+ b.getX();
+ b.getY();
+ b.getWidth();
+ b.getHeight();
+ b.isOpaque();
+ b.isValidateRoot();
+ b.isOptimizedDrawingEnabled();
+ b.isDoubleBuffered();
+ b.getComponentCount();
+ b.countComponents();
+ b.getComponent(1);
+ b.getComponent(2);
+ Component[] cs = b.getComponents();
+ b.getLayout();
+ b.setLayout(new FlowLayout());
+ b.doLayout();
+ b.layout();
+ b.invalidate();
+ b.validate();
+ b.remove(0);
+ b.remove(c2);
+ b.removeAll();
+ b.preferredSize();
+ b.minimumSize();
+ b.getComponentAt(1, 2);
+ b.locate(1, 2);
+ b.getComponentAt(new Point(1, 2));
+ b.isFocusCycleRoot(new Container());
+ b.transferFocusBackward();
+ b.setName("goober");
+ b.getName();
+ b.getParent();
+ b.getPeer();
+ b.getGraphicsConfiguration();
+ b.getTreeLock();
+ b.getToolkit();
+ b.isValid();
+ b.isDisplayable();
+ b.isVisible();
+ b.isShowing();
+ b.isEnabled();
+ b.enable(false);
+ b.enable(true);
+ b.enableInputMethods(false);
+ b.enableInputMethods(true);
+ b.show();
+ b.show(false);
+ b.show(true);
+ b.hide();
+ b.getForeground();
+ b.isForegroundSet();
+ b.getBackground();
+ b.isBackgroundSet();
+ b.getFont();
+ b.isFontSet();
+ Container c = new Container();
+ c.add(b);
+ b.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ b.setLocale(locale);
+
+ b.getColorModel();
+ b.getLocation();
+
+ boolean exceptions = false;
+ try {
+ b.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ b.location();
+ b.setLocation(1, 2);
+ b.move(1, 2);
+ b.setLocation(new Point(1, 2));
+ b.getSize();
+ b.size();
+ b.setSize(1, 32);
+ b.resize(1, 32);
+ b.setSize(new Dimension(1, 32));
+ b.resize(new Dimension(1, 32));
+ b.getBounds();
+ b.bounds();
+ b.setBounds(10, 10, 10, 10);
+ b.setBounds(new Rectangle(10, 10, 10, 10));
+ b.isLightweight();
+ b.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ b.getCursor();
+ b.isCursorSet();
+ b.inside(1, 2);
+ b.contains(new Point(1, 2));
+ b.isFocusable();
+ b.setFocusable(true);
+ b.setFocusable(false);
+ b.transferFocus();
+ b.getFocusCycleRootAncestor();
+ b.nextFocus();
+ b.transferFocusUpCycle();
+ b.hasFocus();
+ b.isFocusOwner();
+ b.toString();
+ b.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ b.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ b.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ b.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJFileChooser.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JFileChooser constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJFileChooser
+ */
+
+public class HeadlessJFileChooser {
+ public static void main(String args[]) {
+ JFileChooser ch = new JFileChooser();
+ ch.getAccessibleContext();
+ ch.isFocusTraversable();
+ ch.setEnabled(false);
+ ch.setEnabled(true);
+ ch.requestFocus();
+ ch.requestFocusInWindow();
+ ch.getPreferredSize();
+ ch.getMaximumSize();
+ ch.getMinimumSize();
+ ch.contains(1, 2);
+ Component c1 = ch.add(new Component(){});
+ Component c2 = ch.add(new Component(){});
+ Component c3 = ch.add(new Component(){});
+ Insets ins = ch.getInsets();
+ ch.getAlignmentY();
+ ch.getAlignmentX();
+ ch.getGraphics();
+ ch.setVisible(false);
+ ch.setVisible(true);
+ ch.setForeground(Color.red);
+ ch.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ ch.setFont(f1);
+ ch.setFont(f2);
+ ch.setFont(f3);
+ ch.setFont(f4);
+
+ ch.getFontMetrics(f1);
+ ch.getFontMetrics(f2);
+ ch.getFontMetrics(f3);
+ ch.getFontMetrics(f4);
+ }
+ }
+ ch.enable();
+ ch.disable();
+ ch.reshape(10, 10, 10, 10);
+ ch.getBounds(new Rectangle(1, 1, 1, 1));
+ ch.getSize(new Dimension(1, 2));
+ ch.getLocation(new Point(1, 2));
+ ch.getX();
+ ch.getY();
+ ch.getWidth();
+ ch.getHeight();
+ ch.isOpaque();
+ ch.isValidateRoot();
+ ch.isOptimizedDrawingEnabled();
+ ch.isDoubleBuffered();
+ ch.getComponentCount();
+ ch.countComponents();
+ ch.getComponent(1);
+ ch.getComponent(2);
+ Component[] cs = ch.getComponents();
+ ch.getLayout();
+ ch.setLayout(new FlowLayout());
+ ch.doLayout();
+ ch.layout();
+ ch.invalidate();
+ ch.validate();
+ ch.remove(0);
+ ch.remove(c2);
+ ch.removeAll();
+ ch.preferredSize();
+ ch.minimumSize();
+ ch.getComponentAt(1, 2);
+ ch.locate(1, 2);
+ ch.getComponentAt(new Point(1, 2));
+ ch.isFocusCycleRoot(new Container());
+ ch.transferFocusBackward();
+ ch.setName("goober");
+ ch.getName();
+ ch.getParent();
+ ch.getPeer();
+ ch.getGraphicsConfiguration();
+ ch.getTreeLock();
+ ch.getToolkit();
+ ch.isValid();
+ ch.isDisplayable();
+ ch.isVisible();
+ ch.isShowing();
+ ch.isEnabled();
+ ch.enable(false);
+ ch.enable(true);
+ ch.enableInputMethods(false);
+ ch.enableInputMethods(true);
+ ch.show();
+ ch.show(false);
+ ch.show(true);
+ ch.hide();
+ ch.getForeground();
+ ch.isForegroundSet();
+ ch.getBackground();
+ ch.isBackgroundSet();
+ ch.getFont();
+ ch.isFontSet();
+ Container c = new Container();
+ c.add(ch);
+ ch.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ ch.setLocale(locale);
+
+ ch.getColorModel();
+ ch.getLocation();
+
+ boolean exceptions = false;
+ try {
+ ch.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ ch.location();
+ ch.setLocation(1, 2);
+ ch.move(1, 2);
+ ch.setLocation(new Point(1, 2));
+ ch.getSize();
+ ch.size();
+ ch.setSize(1, 32);
+ ch.resize(1, 32);
+ ch.setSize(new Dimension(1, 32));
+ ch.resize(new Dimension(1, 32));
+ ch.getBounds();
+ ch.bounds();
+ ch.setBounds(10, 10, 10, 10);
+ ch.setBounds(new Rectangle(10, 10, 10, 10));
+ ch.isLightweight();
+ ch.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ ch.getCursor();
+ ch.isCursorSet();
+ ch.inside(1, 2);
+ ch.contains(new Point(1, 2));
+ ch.isFocusable();
+ ch.setFocusable(true);
+ ch.setFocusable(false);
+ ch.transferFocus();
+ ch.getFocusCycleRootAncestor();
+ ch.nextFocus();
+ ch.transferFocusUpCycle();
+ ch.hasFocus();
+ ch.isFocusOwner();
+ ch.toString();
+ ch.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ ch.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ ch.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ ch.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJFormattedTextField.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that JFormattedTextField constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJFormattedTextField
+ */
+
+public class HeadlessJFormattedTextField {
+ public static void main(String args[]) {
+ JTextField f = new JTextField("field");
+ f.selectAll();
+ f.getSelectionStart();
+ f.getSelectionEnd();
+ f.selectAll();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJFrame.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2007, 2014, 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.JFrame;
+import java.awt.HeadlessException;
+
+/*
+ * @test
+ * @summary Check that JFrame constructors throw HeadlessException in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJFrame
+ */
+
+public class HeadlessJFrame {
+ public static void main(String args[]) {
+ boolean exceptions = false;
+ try {
+ JFrame b = new JFrame();
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ JFrame b = new JFrame("Swingin' in the window");
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJInternalFrame.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,214 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import javax.swing.plaf.basic.BasicInternalFrameTitlePane;
+import javax.swing.plaf.basic.BasicInternalFrameUI;
+import java.awt.*;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JInternalFrame constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJInternalFrame
+ */
+
+public class HeadlessJInternalFrame {
+ public static void main(String args[]) {
+ JInternalFrame intf = new JInternalFrame("TEST");
+ intf.setUI(new BasicInternalFrameUI(intf) {
+ protected JComponent createNorthPane(JInternalFrame w) {
+ titlePane = new BasicInternalFrameTitlePane(w) {
+ protected PropertyChangeListener createPropertyChangeListener() {
+ return new BasicInternalFrameTitlePane.PropertyChangeHandler() {
+ int countUI = 0;
+
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getPropertyName().equals("UI"))
+ countUI++;
+ else if (countUI > 1)
+ throw new RuntimeException("Test failed. Listener not removed!");
+ }
+ };
+ }
+ };
+ return titlePane;
+ }
+ });
+ intf.setUI(null);
+ intf.getAccessibleContext();
+ intf.isFocusTraversable();
+ intf.setEnabled(false);
+ intf.setEnabled(true);
+ intf.requestFocus();
+ intf.requestFocusInWindow();
+ intf.getPreferredSize();
+ intf.getMaximumSize();
+ intf.getMinimumSize();
+ intf.contains(1, 2);
+ Component c1 = intf.add(new Component(){});
+ Component c2 = intf.add(new Component(){});
+ Component c3 = intf.add(new Component(){});
+ Insets ins = intf.getInsets();
+ intf.getAlignmentY();
+ intf.getAlignmentX();
+ intf.getGraphics();
+ intf.setVisible(false);
+ intf.setVisible(true);
+ intf.setForeground(Color.red);
+ intf.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ intf.setFont(f1);
+ intf.setFont(f2);
+ intf.setFont(f3);
+ intf.setFont(f4);
+
+ intf.getFontMetrics(f1);
+ intf.getFontMetrics(f2);
+ intf.getFontMetrics(f3);
+ intf.getFontMetrics(f4);
+ }
+ }
+ intf.enable();
+ intf.disable();
+ intf.reshape(10, 10, 10, 10);
+ intf.getBounds(new Rectangle(1, 1, 1, 1));
+ intf.getSize(new Dimension(1, 2));
+ intf.getLocation(new Point(1, 2));
+ intf.getX();
+ intf.getY();
+ intf.getWidth();
+ intf.getHeight();
+ intf.isOpaque();
+ intf.isValidateRoot();
+ intf.isOptimizedDrawingEnabled();
+ intf.isDoubleBuffered();
+ intf.getComponentCount();
+ intf.countComponents();
+ intf.getComponent(0);
+ Component[] cs = intf.getComponents();
+ intf.getLayout();
+ intf.setLayout(new FlowLayout());
+ intf.doLayout();
+ intf.layout();
+ intf.invalidate();
+ intf.validate();
+ intf.remove(0);
+ intf.remove(c2);
+ intf.removeAll();
+ intf.preferredSize();
+ intf.minimumSize();
+ intf.getComponentAt(1, 2);
+ intf.locate(1, 2);
+ intf.getComponentAt(new Point(1, 2));
+ intf.isFocusCycleRoot(new Container());
+ intf.transferFocusBackward();
+ intf.setName("goober");
+ intf.getName();
+ intf.getParent();
+ intf.getPeer();
+ intf.getGraphicsConfiguration();
+ intf.getTreeLock();
+ intf.getToolkit();
+ intf.isValid();
+ intf.isDisplayable();
+ intf.isVisible();
+ intf.isShowing();
+ intf.isEnabled();
+ intf.enable(false);
+ intf.enable(true);
+ intf.enableInputMethods(false);
+ intf.enableInputMethods(true);
+ intf.show();
+ intf.show(false);
+ intf.show(true);
+ intf.hide();
+ intf.getForeground();
+ intf.isForegroundSet();
+ intf.getBackground();
+ intf.isBackgroundSet();
+ intf.getFont();
+ intf.isFontSet();
+ Container c = new Container();
+ c.add(intf);
+ intf.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ intf.setLocale(locale);
+
+ intf.getColorModel();
+ intf.getLocation();
+
+ boolean exceptions = false;
+ try {
+ intf.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ intf.location();
+ intf.setLocation(1, 2);
+ intf.move(1, 2);
+ intf.setLocation(new Point(1, 2));
+ intf.getSize();
+ intf.size();
+ intf.setSize(1, 32);
+ intf.resize(1, 32);
+ intf.setSize(new Dimension(1, 32));
+ intf.resize(new Dimension(1, 32));
+ intf.getBounds();
+ intf.bounds();
+ intf.setBounds(10, 10, 10, 10);
+ intf.setBounds(new Rectangle(10, 10, 10, 10));
+ intf.isLightweight();
+ intf.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ intf.getCursor();
+ intf.isCursorSet();
+ intf.inside(1, 2);
+ intf.contains(new Point(1, 2));
+ intf.isFocusable();
+ intf.setFocusable(true);
+ intf.setFocusable(false);
+ intf.transferFocus();
+ intf.getFocusCycleRootAncestor();
+ intf.nextFocus();
+ intf.transferFocusUpCycle();
+ intf.hasFocus();
+ intf.isFocusOwner();
+ intf.toString();
+ intf.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ intf.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ intf.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ intf.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJInternalFrame_JDesktopIcon.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JInternalFrame.JDesktopIcon constructor and methods do not throw
+ * unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJInternalFrame_JDesktopIcon
+ */
+
+public class HeadlessJInternalFrame_JDesktopIcon {
+ public static void main(String args[]) {
+ JInternalFrame.JDesktopIcon jdi = new JInternalFrame.JDesktopIcon(new JInternalFrame());
+ jdi.getAccessibleContext();
+ jdi.isFocusTraversable();
+ jdi.setEnabled(false);
+ jdi.setEnabled(true);
+ jdi.requestFocus();
+ jdi.requestFocusInWindow();
+ jdi.getPreferredSize();
+ jdi.getMaximumSize();
+ jdi.getMinimumSize();
+ jdi.contains(1, 2);
+ Component c1 = jdi.add(new Component(){});
+ Component c2 = jdi.add(new Component(){});
+ Component c3 = jdi.add(new Component(){});
+ Insets ins = jdi.getInsets();
+ jdi.getAlignmentY();
+ jdi.getAlignmentX();
+ jdi.getGraphics();
+ jdi.setVisible(false);
+ jdi.setVisible(true);
+ jdi.setForeground(Color.red);
+ jdi.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ jdi.setFont(f1);
+ jdi.setFont(f2);
+ jdi.setFont(f3);
+ jdi.setFont(f4);
+
+ jdi.getFontMetrics(f1);
+ jdi.getFontMetrics(f2);
+ jdi.getFontMetrics(f3);
+ jdi.getFontMetrics(f4);
+ }
+ }
+ jdi.enable();
+ jdi.disable();
+ jdi.reshape(10, 10, 10, 10);
+ jdi.getBounds(new Rectangle(1, 1, 1, 1));
+ jdi.getSize(new Dimension(1, 2));
+ jdi.getLocation(new Point(1, 2));
+ jdi.getX();
+ jdi.getY();
+ jdi.getWidth();
+ jdi.getHeight();
+ jdi.isOpaque();
+ jdi.isValidateRoot();
+ jdi.isOptimizedDrawingEnabled();
+ jdi.isDoubleBuffered();
+ jdi.getComponentCount();
+ jdi.countComponents();
+ jdi.getComponent(1);
+ jdi.getComponent(2);
+ Component[] cs = jdi.getComponents();
+ jdi.getLayout();
+ jdi.setLayout(new FlowLayout());
+ jdi.doLayout();
+ jdi.layout();
+ jdi.invalidate();
+ jdi.validate();
+ jdi.remove(0);
+ jdi.remove(c2);
+ jdi.removeAll();
+ jdi.preferredSize();
+ jdi.minimumSize();
+ jdi.getComponentAt(1, 2);
+ jdi.locate(1, 2);
+ jdi.getComponentAt(new Point(1, 2));
+ jdi.isFocusCycleRoot(new Container());
+ jdi.transferFocusBackward();
+ jdi.setName("goober");
+ jdi.getName();
+ jdi.getParent();
+ jdi.getPeer();
+ jdi.getGraphicsConfiguration();
+ jdi.getTreeLock();
+ jdi.getToolkit();
+ jdi.isValid();
+ jdi.isDisplayable();
+ jdi.isVisible();
+ jdi.isShowing();
+ jdi.isEnabled();
+ jdi.enable(false);
+ jdi.enable(true);
+ jdi.enableInputMethods(false);
+ jdi.enableInputMethods(true);
+ jdi.show();
+ jdi.show(false);
+ jdi.show(true);
+ jdi.hide();
+ jdi.getForeground();
+ jdi.isForegroundSet();
+ jdi.getBackground();
+ jdi.isBackgroundSet();
+ jdi.getFont();
+ jdi.isFontSet();
+ Container c = new Container();
+ c.add(jdi);
+ jdi.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ jdi.setLocale(locale);
+
+ jdi.getColorModel();
+ jdi.getLocation();
+
+ boolean exceptions = false;
+ try {
+ jdi.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ jdi.location();
+ jdi.setLocation(1, 2);
+ jdi.move(1, 2);
+ jdi.setLocation(new Point(1, 2));
+ jdi.getSize();
+ jdi.size();
+ jdi.setSize(1, 32);
+ jdi.resize(1, 32);
+ jdi.setSize(new Dimension(1, 32));
+ jdi.resize(new Dimension(1, 32));
+ jdi.getBounds();
+ jdi.bounds();
+ jdi.setBounds(10, 10, 10, 10);
+ jdi.setBounds(new Rectangle(10, 10, 10, 10));
+ jdi.isLightweight();
+ jdi.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ jdi.getCursor();
+ jdi.isCursorSet();
+ jdi.inside(1, 2);
+ jdi.contains(new Point(1, 2));
+ jdi.isFocusable();
+ jdi.setFocusable(true);
+ jdi.setFocusable(false);
+ jdi.transferFocus();
+ jdi.getFocusCycleRootAncestor();
+ jdi.nextFocus();
+ jdi.transferFocusUpCycle();
+ jdi.hasFocus();
+ jdi.isFocusOwner();
+ jdi.toString();
+ jdi.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ jdi.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ jdi.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ jdi.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJLabel.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JLabel constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJLabel
+ */
+
+public class HeadlessJLabel {
+ public static void main(String args[]) {
+ JLabel l = new JLabel("<html><body><bold>Foo</bold></body></html>");
+ l.getAccessibleContext();
+ l.isFocusTraversable();
+ l.setEnabled(false);
+ l.setEnabled(true);
+ l.requestFocus();
+ l.requestFocusInWindow();
+ l.getPreferredSize();
+ l.getMaximumSize();
+ l.getMinimumSize();
+ l.contains(1, 2);
+ Component c1 = l.add(new Component(){});
+ Component c2 = l.add(new Component(){});
+ Component c3 = l.add(new Component(){});
+ Insets ins = l.getInsets();
+ l.getAlignmentY();
+ l.getAlignmentX();
+ l.getGraphics();
+ l.setVisible(false);
+ l.setVisible(true);
+ l.setForeground(Color.red);
+ l.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ l.setFont(f1);
+ l.setFont(f2);
+ l.setFont(f3);
+ l.setFont(f4);
+
+ l.getFontMetrics(f1);
+ l.getFontMetrics(f2);
+ l.getFontMetrics(f3);
+ l.getFontMetrics(f4);
+ }
+ }
+ l.enable();
+ l.disable();
+ l.reshape(10, 10, 10, 10);
+ l.getBounds(new Rectangle(1, 1, 1, 1));
+ l.getSize(new Dimension(1, 2));
+ l.getLocation(new Point(1, 2));
+ l.getX();
+ l.getY();
+ l.getWidth();
+ l.getHeight();
+ l.isOpaque();
+ l.isValidateRoot();
+ l.isOptimizedDrawingEnabled();
+ l.isDoubleBuffered();
+ l.getComponentCount();
+ l.countComponents();
+ l.getComponent(1);
+ l.getComponent(2);
+ Component[] cs = l.getComponents();
+ l.getLayout();
+ l.setLayout(new FlowLayout());
+ l.doLayout();
+ l.layout();
+ l.invalidate();
+ l.validate();
+ l.remove(0);
+ l.remove(c2);
+ l.removeAll();
+ l.preferredSize();
+ l.minimumSize();
+ l.getComponentAt(1, 2);
+ l.locate(1, 2);
+ l.getComponentAt(new Point(1, 2));
+ l.isFocusCycleRoot(new Container());
+ l.transferFocusBackward();
+ l.setName("goober");
+ l.getName();
+ l.getParent();
+ l.getPeer();
+ l.getGraphicsConfiguration();
+ l.getTreeLock();
+ l.getToolkit();
+ l.isValid();
+ l.isDisplayable();
+ l.isVisible();
+ l.isShowing();
+ l.isEnabled();
+ l.enable(false);
+ l.enable(true);
+ l.enableInputMethods(false);
+ l.enableInputMethods(true);
+ l.show();
+ l.show(false);
+ l.show(true);
+ l.hide();
+ l.getForeground();
+ l.isForegroundSet();
+ l.getBackground();
+ l.isBackgroundSet();
+ l.getFont();
+ l.isFontSet();
+ Container c = new Container();
+ c.add(l);
+ l.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ l.setLocale(locale);
+
+ l.getColorModel();
+ l.getLocation();
+
+ boolean exceptions = false;
+ try {
+ l.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ l.location();
+ l.setLocation(1, 2);
+ l.move(1, 2);
+ l.setLocation(new Point(1, 2));
+ l.getSize();
+ l.size();
+ l.setSize(1, 32);
+ l.resize(1, 32);
+ l.setSize(new Dimension(1, 32));
+ l.resize(new Dimension(1, 32));
+ l.getBounds();
+ l.bounds();
+ l.setBounds(10, 10, 10, 10);
+ l.setBounds(new Rectangle(10, 10, 10, 10));
+ l.isLightweight();
+ l.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ l.getCursor();
+ l.isCursorSet();
+ l.inside(1, 2);
+ l.contains(new Point(1, 2));
+ l.isFocusable();
+ l.setFocusable(true);
+ l.setFocusable(false);
+ l.transferFocus();
+ l.getFocusCycleRootAncestor();
+ l.nextFocus();
+ l.transferFocusUpCycle();
+ l.hasFocus();
+ l.isFocusOwner();
+ l.toString();
+ l.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ l.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ l.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ l.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJLayeredPane.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JLayeredPane constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJLayeredPane
+ */
+
+public class HeadlessJLayeredPane {
+ public static void main(String args[]) {
+ JLayeredPane lp = new JLayeredPane();
+ lp.getAccessibleContext();
+ lp.isFocusTraversable();
+ lp.setEnabled(false);
+ lp.setEnabled(true);
+ lp.requestFocus();
+ lp.requestFocusInWindow();
+ lp.getPreferredSize();
+ lp.getMaximumSize();
+ lp.getMinimumSize();
+ lp.contains(1, 2);
+ Component c1 = lp.add(new Component(){});
+ Component c2 = lp.add(new Component(){});
+ Component c3 = lp.add(new Component(){});
+ Insets ins = lp.getInsets();
+ lp.getAlignmentY();
+ lp.getAlignmentX();
+ lp.getGraphics();
+ lp.setVisible(false);
+ lp.setVisible(true);
+ lp.setForeground(Color.red);
+ lp.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ lp.setFont(f1);
+ lp.setFont(f2);
+ lp.setFont(f3);
+ lp.setFont(f4);
+
+ lp.getFontMetrics(f1);
+ lp.getFontMetrics(f2);
+ lp.getFontMetrics(f3);
+ lp.getFontMetrics(f4);
+ }
+ }
+ lp.enable();
+ lp.disable();
+ lp.reshape(10, 10, 10, 10);
+ lp.getBounds(new Rectangle(1, 1, 1, 1));
+ lp.getSize(new Dimension(1, 2));
+ lp.getLocation(new Point(1, 2));
+ lp.getX();
+ lp.getY();
+ lp.getWidth();
+ lp.getHeight();
+ lp.isOpaque();
+ lp.isValidateRoot();
+ lp.isOptimizedDrawingEnabled();
+ lp.isDoubleBuffered();
+ lp.getComponentCount();
+ lp.countComponents();
+ lp.getComponent(1);
+ lp.getComponent(2);
+ Component[] cs = lp.getComponents();
+ lp.getLayout();
+ lp.setLayout(new FlowLayout());
+ lp.doLayout();
+ lp.layout();
+ lp.invalidate();
+ lp.validate();
+ lp.remove(0);
+ lp.remove(c2);
+ lp.removeAll();
+ lp.preferredSize();
+ lp.minimumSize();
+ lp.getComponentAt(1, 2);
+ lp.locate(1, 2);
+ lp.getComponentAt(new Point(1, 2));
+ lp.isFocusCycleRoot(new Container());
+ lp.transferFocusBackward();
+ lp.setName("goober");
+ lp.getName();
+ lp.getParent();
+ lp.getPeer();
+ lp.getGraphicsConfiguration();
+ lp.getTreeLock();
+ lp.getToolkit();
+ lp.isValid();
+ lp.isDisplayable();
+ lp.isVisible();
+ lp.isShowing();
+ lp.isEnabled();
+ lp.enable(false);
+ lp.enable(true);
+ lp.enableInputMethods(false);
+ lp.enableInputMethods(true);
+ lp.show();
+ lp.show(false);
+ lp.show(true);
+ lp.hide();
+ lp.getForeground();
+ lp.isForegroundSet();
+ lp.getBackground();
+ lp.isBackgroundSet();
+ lp.getFont();
+ lp.isFontSet();
+ Container c = new Container();
+ c.add(lp);
+ lp.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ lp.setLocale(locale);
+
+ lp.getColorModel();
+ lp.getLocation();
+
+ boolean exceptions = false;
+ try {
+ lp.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ lp.location();
+ lp.setLocation(1, 2);
+ lp.move(1, 2);
+ lp.setLocation(new Point(1, 2));
+ lp.getSize();
+ lp.size();
+ lp.setSize(1, 32);
+ lp.resize(1, 32);
+ lp.setSize(new Dimension(1, 32));
+ lp.resize(new Dimension(1, 32));
+ lp.getBounds();
+ lp.bounds();
+ lp.setBounds(10, 10, 10, 10);
+ lp.setBounds(new Rectangle(10, 10, 10, 10));
+ lp.isLightweight();
+ lp.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ lp.getCursor();
+ lp.isCursorSet();
+ lp.inside(1, 2);
+ lp.contains(new Point(1, 2));
+ lp.isFocusable();
+ lp.setFocusable(true);
+ lp.setFocusable(false);
+ lp.transferFocus();
+ lp.getFocusCycleRootAncestor();
+ lp.nextFocus();
+ lp.transferFocusUpCycle();
+ lp.hasFocus();
+ lp.isFocusOwner();
+ lp.toString();
+ lp.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ lp.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ lp.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ lp.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJList.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JList constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJList
+ */
+
+public class HeadlessJList {
+ public static void main(String args[]) {
+ JList l = new JList();
+ l.getAccessibleContext();
+ l.isFocusTraversable();
+ l.setEnabled(false);
+ l.setEnabled(true);
+ l.requestFocus();
+ l.requestFocusInWindow();
+ l.getPreferredSize();
+ l.getMaximumSize();
+ l.getMinimumSize();
+ l.contains(1, 2);
+ Component c1 = l.add(new Component(){});
+ Component c2 = l.add(new Component(){});
+ Component c3 = l.add(new Component(){});
+ Insets ins = l.getInsets();
+ l.getAlignmentY();
+ l.getAlignmentX();
+ l.getGraphics();
+ l.setVisible(false);
+ l.setVisible(true);
+ l.setForeground(Color.red);
+ l.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ l.setFont(f1);
+ l.setFont(f2);
+ l.setFont(f3);
+ l.setFont(f4);
+
+ l.getFontMetrics(f1);
+ l.getFontMetrics(f2);
+ l.getFontMetrics(f3);
+ l.getFontMetrics(f4);
+ }
+ }
+ l.enable();
+ l.disable();
+ l.reshape(10, 10, 10, 10);
+ l.getBounds(new Rectangle(1, 1, 1, 1));
+ l.getSize(new Dimension(1, 2));
+ l.getLocation(new Point(1, 2));
+ l.getX();
+ l.getY();
+ l.getWidth();
+ l.getHeight();
+ l.isOpaque();
+ l.isValidateRoot();
+ l.isOptimizedDrawingEnabled();
+ l.isDoubleBuffered();
+ l.getComponentCount();
+ l.countComponents();
+ l.getComponent(1);
+ l.getComponent(2);
+ Component[] cs = l.getComponents();
+ l.getLayout();
+ l.setLayout(new FlowLayout());
+ l.doLayout();
+ l.layout();
+ l.invalidate();
+ l.validate();
+ l.remove(0);
+ l.remove(c2);
+ l.removeAll();
+ l.preferredSize();
+ l.minimumSize();
+ l.getComponentAt(1, 2);
+ l.locate(1, 2);
+ l.getComponentAt(new Point(1, 2));
+ l.isFocusCycleRoot(new Container());
+ l.transferFocusBackward();
+ l.setName("goober");
+ l.getName();
+ l.getParent();
+ l.getPeer();
+ l.getGraphicsConfiguration();
+ l.getTreeLock();
+ l.getToolkit();
+ l.isValid();
+ l.isDisplayable();
+ l.isVisible();
+ l.isShowing();
+ l.isEnabled();
+ l.enable(false);
+ l.enable(true);
+ l.enableInputMethods(false);
+ l.enableInputMethods(true);
+ l.show();
+ l.show(false);
+ l.show(true);
+ l.hide();
+ l.getForeground();
+ l.isForegroundSet();
+ l.getBackground();
+ l.isBackgroundSet();
+ l.getFont();
+ l.isFontSet();
+ Container c = new Container();
+ c.add(l);
+ l.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ l.setLocale(locale);
+
+ l.getColorModel();
+ l.getLocation();
+
+ boolean exceptions = false;
+ try {
+ l.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ l.location();
+ l.setLocation(1, 2);
+ l.move(1, 2);
+ l.setLocation(new Point(1, 2));
+ l.getSize();
+ l.size();
+ l.setSize(1, 32);
+ l.resize(1, 32);
+ l.setSize(new Dimension(1, 32));
+ l.resize(new Dimension(1, 32));
+ l.getBounds();
+ l.bounds();
+ l.setBounds(10, 10, 10, 10);
+ l.setBounds(new Rectangle(10, 10, 10, 10));
+ l.isLightweight();
+ l.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ l.getCursor();
+ l.isCursorSet();
+ l.inside(1, 2);
+ l.contains(new Point(1, 2));
+ l.isFocusable();
+ l.setFocusable(true);
+ l.setFocusable(false);
+ l.transferFocus();
+ l.getFocusCycleRootAncestor();
+ l.nextFocus();
+ l.transferFocusUpCycle();
+ l.hasFocus();
+ l.isFocusOwner();
+ l.toString();
+ l.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ l.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ l.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ l.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJMenu.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,189 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JMenu constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJMenu
+ */
+
+public class HeadlessJMenu {
+ public static void main(String args[]) {
+ JMenu m = new JMenu();
+ m.getAccessibleContext();
+ m.isFocusTraversable();
+ m.setEnabled(false);
+ m.setEnabled(true);
+ m.requestFocus();
+ m.requestFocusInWindow();
+ m.getPreferredSize();
+ m.getMaximumSize();
+ m.getMinimumSize();
+ m.contains(1, 2);
+ Component c1 = m.add(new Component(){});
+ Component c2 = m.add(new Component(){});
+ Component c3 = m.add(new Component(){});
+ Insets ins = m.getInsets();
+ m.getAlignmentY();
+ m.getAlignmentX();
+ m.getGraphics();
+ m.setVisible(false);
+ m.setVisible(true);
+ m.setForeground(Color.red);
+ m.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ m.setFont(f1);
+ m.setFont(f2);
+ m.setFont(f3);
+ m.setFont(f4);
+
+ m.getFontMetrics(f1);
+ m.getFontMetrics(f2);
+ m.getFontMetrics(f3);
+ m.getFontMetrics(f4);
+ }
+ }
+ m.enable();
+ m.disable();
+ m.reshape(10, 10, 10, 10);
+ m.getBounds(new Rectangle(1, 1, 1, 1));
+ m.getSize(new Dimension(1, 2));
+ m.getLocation(new Point(1, 2));
+ m.getX();
+ m.getY();
+ m.getWidth();
+ m.getHeight();
+ m.isOpaque();
+ m.isValidateRoot();
+ m.isOptimizedDrawingEnabled();
+ m.isDoubleBuffered();
+ m.getComponentCount();
+ m.countComponents();
+ Component[] cs = m.getComponents();
+ m.getLayout();
+ m.setLayout(new FlowLayout());
+ m.doLayout();
+ m.layout();
+ m.invalidate();
+ m.validate();
+ m.remove(0);
+ m.remove(c2);
+ m.removeAll();
+ m.preferredSize();
+ m.minimumSize();
+ m.getComponentAt(1, 2);
+ m.locate(1, 2);
+ m.getComponentAt(new Point(1, 2));
+ m.isFocusCycleRoot(new Container());
+ m.transferFocusBackward();
+ m.setName("goober");
+ m.getName();
+ m.getParent();
+ m.getPeer();
+ m.getGraphicsConfiguration();
+ m.getTreeLock();
+ m.getToolkit();
+ m.isValid();
+ m.isDisplayable();
+ m.isVisible();
+ m.isShowing();
+ m.isEnabled();
+ m.enable(false);
+ m.enable(true);
+ m.enableInputMethods(false);
+ m.enableInputMethods(true);
+ m.show();
+ m.show(false);
+ m.show(true);
+ m.hide();
+ m.getForeground();
+ m.isForegroundSet();
+ m.getBackground();
+ m.isBackgroundSet();
+ m.getFont();
+ m.isFontSet();
+ Container c = new Container();
+ c.add(m);
+ m.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ m.setLocale(locale);
+
+ m.getColorModel();
+ m.getLocation();
+
+ boolean exceptions = false;
+ try {
+ m.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ m.location();
+ m.setLocation(1, 2);
+ m.move(1, 2);
+ m.setLocation(new Point(1, 2));
+ m.getSize();
+ m.size();
+ m.setSize(1, 32);
+ m.resize(1, 32);
+ m.setSize(new Dimension(1, 32));
+ m.resize(new Dimension(1, 32));
+ m.getBounds();
+ m.bounds();
+ m.setBounds(10, 10, 10, 10);
+ m.setBounds(new Rectangle(10, 10, 10, 10));
+ m.isLightweight();
+ m.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ m.getCursor();
+ m.isCursorSet();
+ m.inside(1, 2);
+ m.contains(new Point(1, 2));
+ m.isFocusable();
+ m.setFocusable(true);
+ m.setFocusable(false);
+ m.transferFocus();
+ m.getFocusCycleRootAncestor();
+ m.nextFocus();
+ m.transferFocusUpCycle();
+ m.hasFocus();
+ m.isFocusOwner();
+ m.toString();
+ m.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ m.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ m.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ m.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJMenuBar.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JMenuBar constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJMenuBar
+ */
+
+public class HeadlessJMenuBar {
+ public static void main(String args[]) {
+ JMenuBar mb = new JMenuBar();
+ mb.getAccessibleContext();
+ mb.isFocusTraversable();
+ mb.setEnabled(false);
+ mb.setEnabled(true);
+ mb.requestFocus();
+ mb.requestFocusInWindow();
+ mb.getPreferredSize();
+ mb.getMaximumSize();
+ mb.getMinimumSize();
+ mb.contains(1, 2);
+ Component c1 = mb.add(new Component(){});
+ Component c2 = mb.add(new Component(){});
+ Component c3 = mb.add(new Component(){});
+ Insets ins = mb.getInsets();
+ mb.getAlignmentY();
+ mb.getAlignmentX();
+ mb.getGraphics();
+ mb.setVisible(false);
+ mb.setVisible(true);
+ mb.setForeground(Color.red);
+ mb.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ mb.setFont(f1);
+ mb.setFont(f2);
+ mb.setFont(f3);
+ mb.setFont(f4);
+
+ mb.getFontMetrics(f1);
+ mb.getFontMetrics(f2);
+ mb.getFontMetrics(f3);
+ mb.getFontMetrics(f4);
+ }
+ }
+ mb.enable();
+ mb.disable();
+ mb.reshape(10, 10, 10, 10);
+ mb.getBounds(new Rectangle(1, 1, 1, 1));
+ mb.getSize(new Dimension(1, 2));
+ mb.getLocation(new Point(1, 2));
+ mb.getX();
+ mb.getY();
+ mb.getWidth();
+ mb.getHeight();
+ mb.isOpaque();
+ mb.isValidateRoot();
+ mb.isOptimizedDrawingEnabled();
+ mb.isDoubleBuffered();
+ mb.getComponentCount();
+ mb.countComponents();
+ mb.getComponent(1);
+ mb.getComponent(2);
+ Component[] cs = mb.getComponents();
+ mb.getLayout();
+ mb.setLayout(new FlowLayout());
+ mb.doLayout();
+ mb.layout();
+ mb.invalidate();
+ mb.validate();
+ mb.remove(0);
+ mb.remove(c2);
+ mb.removeAll();
+ mb.preferredSize();
+ mb.minimumSize();
+ mb.getComponentAt(1, 2);
+ mb.locate(1, 2);
+ mb.getComponentAt(new Point(1, 2));
+ mb.isFocusCycleRoot(new Container());
+ mb.transferFocusBackward();
+ mb.setName("goober");
+ mb.getName();
+ mb.getParent();
+ mb.getPeer();
+ mb.getGraphicsConfiguration();
+ mb.getTreeLock();
+ mb.getToolkit();
+ mb.isValid();
+ mb.isDisplayable();
+ mb.isVisible();
+ mb.isShowing();
+ mb.isEnabled();
+ mb.enable(false);
+ mb.enable(true);
+ mb.enableInputMethods(false);
+ mb.enableInputMethods(true);
+ mb.show();
+ mb.show(false);
+ mb.show(true);
+ mb.hide();
+ mb.getForeground();
+ mb.isForegroundSet();
+ mb.getBackground();
+ mb.isBackgroundSet();
+ mb.getFont();
+ mb.isFontSet();
+ Container c = new Container();
+ c.add(mb);
+ mb.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ mb.setLocale(locale);
+
+ mb.getColorModel();
+ mb.getLocation();
+
+ boolean exceptions = false;
+ try {
+ mb.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ mb.location();
+ mb.setLocation(1, 2);
+ mb.move(1, 2);
+ mb.setLocation(new Point(1, 2));
+ mb.getSize();
+ mb.size();
+ mb.setSize(1, 32);
+ mb.resize(1, 32);
+ mb.setSize(new Dimension(1, 32));
+ mb.resize(new Dimension(1, 32));
+ mb.getBounds();
+ mb.bounds();
+ mb.setBounds(10, 10, 10, 10);
+ mb.setBounds(new Rectangle(10, 10, 10, 10));
+ mb.isLightweight();
+ mb.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ mb.getCursor();
+ mb.isCursorSet();
+ mb.inside(1, 2);
+ mb.contains(new Point(1, 2));
+ mb.isFocusable();
+ mb.setFocusable(true);
+ mb.setFocusable(false);
+ mb.transferFocus();
+ mb.getFocusCycleRootAncestor();
+ mb.nextFocus();
+ mb.transferFocusUpCycle();
+ mb.hasFocus();
+ mb.isFocusOwner();
+ mb.toString();
+ mb.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ mb.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ mb.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ mb.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJMenuItem.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JMenuItem constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJMenuItem
+ */
+
+public class HeadlessJMenuItem {
+ public static void main(String args[]) {
+ JMenuItem mi = new JMenuItem();
+ mi.getAccessibleContext();
+ mi.isFocusTraversable();
+ mi.setEnabled(false);
+ mi.setEnabled(true);
+ mi.requestFocus();
+ mi.requestFocusInWindow();
+ mi.getPreferredSize();
+ mi.getMaximumSize();
+ mi.getMinimumSize();
+ mi.contains(1, 2);
+ Component c1 = mi.add(new Component(){});
+ Component c2 = mi.add(new Component(){});
+ Component c3 = mi.add(new Component(){});
+ Insets ins = mi.getInsets();
+ mi.getAlignmentY();
+ mi.getAlignmentX();
+ mi.getGraphics();
+ mi.setVisible(false);
+ mi.setVisible(true);
+ mi.setForeground(Color.red);
+ mi.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ mi.setFont(f1);
+ mi.setFont(f2);
+ mi.setFont(f3);
+ mi.setFont(f4);
+
+ mi.getFontMetrics(f1);
+ mi.getFontMetrics(f2);
+ mi.getFontMetrics(f3);
+ mi.getFontMetrics(f4);
+ }
+ }
+ mi.enable();
+ mi.disable();
+ mi.reshape(10, 10, 10, 10);
+ mi.getBounds(new Rectangle(1, 1, 1, 1));
+ mi.getSize(new Dimension(1, 2));
+ mi.getLocation(new Point(1, 2));
+ mi.getX();
+ mi.getY();
+ mi.getWidth();
+ mi.getHeight();
+ mi.isOpaque();
+ mi.isValidateRoot();
+ mi.isOptimizedDrawingEnabled();
+ mi.isDoubleBuffered();
+ mi.getComponentCount();
+ mi.countComponents();
+ mi.getComponent(1);
+ mi.getComponent(2);
+ Component[] cs = mi.getComponents();
+ mi.getLayout();
+ mi.setLayout(new FlowLayout());
+ mi.doLayout();
+ mi.layout();
+ mi.invalidate();
+ mi.validate();
+ mi.remove(0);
+ mi.remove(c2);
+ mi.removeAll();
+ mi.preferredSize();
+ mi.minimumSize();
+ mi.getComponentAt(1, 2);
+ mi.locate(1, 2);
+ mi.getComponentAt(new Point(1, 2));
+ mi.isFocusCycleRoot(new Container());
+ mi.transferFocusBackward();
+ mi.setName("goober");
+ mi.getName();
+ mi.getParent();
+ mi.getPeer();
+ mi.getGraphicsConfiguration();
+ mi.getTreeLock();
+ mi.getToolkit();
+ mi.isValid();
+ mi.isDisplayable();
+ mi.isVisible();
+ mi.isShowing();
+ mi.isEnabled();
+ mi.enable(false);
+ mi.enable(true);
+ mi.enableInputMethods(false);
+ mi.enableInputMethods(true);
+ mi.show();
+ mi.show(false);
+ mi.show(true);
+ mi.hide();
+ mi.getForeground();
+ mi.isForegroundSet();
+ mi.getBackground();
+ mi.isBackgroundSet();
+ mi.getFont();
+ mi.isFontSet();
+ Container c = new Container();
+ c.add(mi);
+ mi.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ mi.setLocale(locale);
+
+ mi.getColorModel();
+ mi.getLocation();
+
+ boolean exceptions = false;
+ try {
+ mi.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ mi.location();
+ mi.setLocation(1, 2);
+ mi.move(1, 2);
+ mi.setLocation(new Point(1, 2));
+ mi.getSize();
+ mi.size();
+ mi.setSize(1, 32);
+ mi.resize(1, 32);
+ mi.setSize(new Dimension(1, 32));
+ mi.resize(new Dimension(1, 32));
+ mi.getBounds();
+ mi.bounds();
+ mi.setBounds(10, 10, 10, 10);
+ mi.setBounds(new Rectangle(10, 10, 10, 10));
+ mi.isLightweight();
+ mi.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ mi.getCursor();
+ mi.isCursorSet();
+ mi.inside(1, 2);
+ mi.contains(new Point(1, 2));
+ mi.isFocusable();
+ mi.setFocusable(true);
+ mi.setFocusable(false);
+ mi.transferFocus();
+ mi.getFocusCycleRootAncestor();
+ mi.nextFocus();
+ mi.transferFocusUpCycle();
+ mi.hasFocus();
+ mi.isFocusOwner();
+ mi.toString();
+ mi.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ mi.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ mi.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ mi.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJOptionPane.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JOptionPane constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJOptionPane
+ */
+
+public class HeadlessJOptionPane {
+ public static void main(String args[]) {
+ JOptionPane op = new JOptionPane();
+ op.getAccessibleContext();
+ op.isFocusTraversable();
+ op.setEnabled(false);
+ op.setEnabled(true);
+ op.requestFocus();
+ op.requestFocusInWindow();
+ op.getPreferredSize();
+ op.getMaximumSize();
+ op.getMinimumSize();
+ op.contains(1, 2);
+ Component c1 = op.add(new Component(){});
+ Component c2 = op.add(new Component(){});
+ Component c3 = op.add(new Component(){});
+ Insets ins = op.getInsets();
+ op.getAlignmentY();
+ op.getAlignmentX();
+ op.getGraphics();
+ op.setVisible(false);
+ op.setVisible(true);
+ op.setForeground(Color.red);
+ op.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ op.setFont(f1);
+ op.setFont(f2);
+ op.setFont(f3);
+ op.setFont(f4);
+
+ op.getFontMetrics(f1);
+ op.getFontMetrics(f2);
+ op.getFontMetrics(f3);
+ op.getFontMetrics(f4);
+ }
+ }
+ op.enable();
+ op.disable();
+ op.reshape(10, 10, 10, 10);
+ op.getBounds(new Rectangle(1, 1, 1, 1));
+ op.getSize(new Dimension(1, 2));
+ op.getLocation(new Point(1, 2));
+ op.getX();
+ op.getY();
+ op.getWidth();
+ op.getHeight();
+ op.isOpaque();
+ op.isValidateRoot();
+ op.isOptimizedDrawingEnabled();
+ op.isDoubleBuffered();
+ op.getComponentCount();
+ op.countComponents();
+ op.getComponent(1);
+ op.getComponent(2);
+ Component[] cs = op.getComponents();
+ op.getLayout();
+ op.setLayout(new FlowLayout());
+ op.doLayout();
+ op.layout();
+ op.invalidate();
+ op.validate();
+ op.remove(0);
+ op.remove(c2);
+ op.removeAll();
+ op.preferredSize();
+ op.minimumSize();
+ op.getComponentAt(1, 2);
+ op.locate(1, 2);
+ op.getComponentAt(new Point(1, 2));
+ op.isFocusCycleRoot(new Container());
+ op.transferFocusBackward();
+ op.setName("goober");
+ op.getName();
+ op.getParent();
+ op.getPeer();
+ op.getGraphicsConfiguration();
+ op.getTreeLock();
+ op.getToolkit();
+ op.isValid();
+ op.isDisplayable();
+ op.isVisible();
+ op.isShowing();
+ op.isEnabled();
+ op.enable(false);
+ op.enable(true);
+ op.enableInputMethods(false);
+ op.enableInputMethods(true);
+ op.show();
+ op.show(false);
+ op.show(true);
+ op.hide();
+ op.getForeground();
+ op.isForegroundSet();
+ op.getBackground();
+ op.isBackgroundSet();
+ op.getFont();
+ op.isFontSet();
+ Container c = new Container();
+ c.add(op);
+ op.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ op.setLocale(locale);
+
+ op.getColorModel();
+ op.getLocation();
+
+ boolean exceptions = false;
+ try {
+ op.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ op.location();
+ op.setLocation(1, 2);
+ op.move(1, 2);
+ op.setLocation(new Point(1, 2));
+ op.getSize();
+ op.size();
+ op.setSize(1, 32);
+ op.resize(1, 32);
+ op.setSize(new Dimension(1, 32));
+ op.resize(new Dimension(1, 32));
+ op.getBounds();
+ op.bounds();
+ op.setBounds(10, 10, 10, 10);
+ op.setBounds(new Rectangle(10, 10, 10, 10));
+ op.isLightweight();
+ op.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ op.getCursor();
+ op.isCursorSet();
+ op.inside(1, 2);
+ op.contains(new Point(1, 2));
+ op.isFocusable();
+ op.setFocusable(true);
+ op.setFocusable(false);
+ op.transferFocus();
+ op.getFocusCycleRootAncestor();
+ op.nextFocus();
+ op.transferFocusUpCycle();
+ op.hasFocus();
+ op.isFocusOwner();
+ op.toString();
+ op.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ op.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ op.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ op.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJPanel.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JPanel constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJPanel
+ */
+
+public class HeadlessJPanel {
+ public static void main(String args[]) {
+ JPanel p = new JPanel();
+ p.getAccessibleContext();
+ p.isFocusTraversable();
+ p.setEnabled(false);
+ p.setEnabled(true);
+ p.requestFocus();
+ p.requestFocusInWindow();
+ p.getPreferredSize();
+ p.getMaximumSize();
+ p.getMinimumSize();
+ p.contains(1, 2);
+ Component c1 = p.add(new Component(){});
+ Component c2 = p.add(new Component(){});
+ Component c3 = p.add(new Component(){});
+ Insets ins = p.getInsets();
+ p.getAlignmentY();
+ p.getAlignmentX();
+ p.getGraphics();
+ p.setVisible(false);
+ p.setVisible(true);
+ p.setForeground(Color.red);
+ p.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ p.setFont(f1);
+ p.setFont(f2);
+ p.setFont(f3);
+ p.setFont(f4);
+
+ p.getFontMetrics(f1);
+ p.getFontMetrics(f2);
+ p.getFontMetrics(f3);
+ p.getFontMetrics(f4);
+ }
+ }
+ p.enable();
+ p.disable();
+ p.reshape(10, 10, 10, 10);
+ p.getBounds(new Rectangle(1, 1, 1, 1));
+ p.getSize(new Dimension(1, 2));
+ p.getLocation(new Point(1, 2));
+ p.getX();
+ p.getY();
+ p.getWidth();
+ p.getHeight();
+ p.isOpaque();
+ p.isValidateRoot();
+ p.isOptimizedDrawingEnabled();
+ p.isDoubleBuffered();
+ p.getComponentCount();
+ p.countComponents();
+ p.getComponent(1);
+ p.getComponent(2);
+ Component[] cs = p.getComponents();
+ p.getLayout();
+ p.setLayout(new FlowLayout());
+ p.doLayout();
+ p.layout();
+ p.invalidate();
+ p.validate();
+ p.remove(0);
+ p.remove(c2);
+ p.removeAll();
+ p.preferredSize();
+ p.minimumSize();
+ p.getComponentAt(1, 2);
+ p.locate(1, 2);
+ p.getComponentAt(new Point(1, 2));
+ p.isFocusCycleRoot(new Container());
+ p.transferFocusBackward();
+ p.setName("goober");
+ p.getName();
+ p.getParent();
+ p.getPeer();
+ p.getGraphicsConfiguration();
+ p.getTreeLock();
+ p.getToolkit();
+ p.isValid();
+ p.isDisplayable();
+ p.isVisible();
+ p.isShowing();
+ p.isEnabled();
+ p.enable(false);
+ p.enable(true);
+ p.enableInputMethods(false);
+ p.enableInputMethods(true);
+ p.show();
+ p.show(false);
+ p.show(true);
+ p.hide();
+ p.getForeground();
+ p.isForegroundSet();
+ p.getBackground();
+ p.isBackgroundSet();
+ p.getFont();
+ p.isFontSet();
+ Container c = new Container();
+ c.add(p);
+ p.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ p.setLocale(locale);
+
+ p.getColorModel();
+ p.getLocation();
+
+ boolean exceptions = false;
+ try {
+ p.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ p.location();
+ p.setLocation(1, 2);
+ p.move(1, 2);
+ p.setLocation(new Point(1, 2));
+ p.getSize();
+ p.size();
+ p.setSize(1, 32);
+ p.resize(1, 32);
+ p.setSize(new Dimension(1, 32));
+ p.resize(new Dimension(1, 32));
+ p.getBounds();
+ p.bounds();
+ p.setBounds(10, 10, 10, 10);
+ p.setBounds(new Rectangle(10, 10, 10, 10));
+ p.isLightweight();
+ p.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ p.getCursor();
+ p.isCursorSet();
+ p.inside(1, 2);
+ p.contains(new Point(1, 2));
+ p.isFocusable();
+ p.setFocusable(true);
+ p.setFocusable(false);
+ p.transferFocus();
+ p.getFocusCycleRootAncestor();
+ p.nextFocus();
+ p.transferFocusUpCycle();
+ p.hasFocus();
+ p.isFocusOwner();
+ p.toString();
+ p.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ p.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ p.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ p.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJPasswordField.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that JPasswordField constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJPasswordField
+ */
+
+public class HeadlessJPasswordField {
+ public static void main(String args[]) {
+ JPasswordField f = new JPasswordField("field");
+ f.selectAll();
+ f.getSelectionStart();
+ f.getSelectionEnd();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJPopupMenu.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,189 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JPopupMenu constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJPopupMenu
+ */
+
+public class HeadlessJPopupMenu {
+ public static void main(String args[]) {
+ JMenu m = new JMenu();
+ m.getAccessibleContext();
+ m.isFocusTraversable();
+ m.setEnabled(false);
+ m.setEnabled(true);
+ m.requestFocus();
+ m.requestFocusInWindow();
+ m.getPreferredSize();
+ m.getMaximumSize();
+ m.getMinimumSize();
+ m.contains(1, 2);
+ Component c1 = m.add(new Component(){});
+ Component c2 = m.add(new Component(){});
+ Component c3 = m.add(new Component(){});
+ Insets ins = m.getInsets();
+ m.getAlignmentY();
+ m.getAlignmentX();
+ m.getGraphics();
+ m.setVisible(false);
+ m.setVisible(true);
+ m.setForeground(Color.red);
+ m.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ m.setFont(f1);
+ m.setFont(f2);
+ m.setFont(f3);
+ m.setFont(f4);
+
+ m.getFontMetrics(f1);
+ m.getFontMetrics(f2);
+ m.getFontMetrics(f3);
+ m.getFontMetrics(f4);
+ }
+ }
+ m.enable();
+ m.disable();
+ m.reshape(10, 10, 10, 10);
+ m.getBounds(new Rectangle(1, 1, 1, 1));
+ m.getSize(new Dimension(1, 2));
+ m.getLocation(new Point(1, 2));
+ m.getX();
+ m.getY();
+ m.getWidth();
+ m.getHeight();
+ m.isOpaque();
+ m.isValidateRoot();
+ m.isOptimizedDrawingEnabled();
+ m.isDoubleBuffered();
+ m.getComponentCount();
+ m.countComponents();
+ Component[] cs = m.getComponents();
+ m.getLayout();
+ m.setLayout(new FlowLayout());
+ m.doLayout();
+ m.layout();
+ m.invalidate();
+ m.validate();
+ m.remove(0);
+ m.remove(c2);
+ m.removeAll();
+ m.preferredSize();
+ m.minimumSize();
+ m.getComponentAt(1, 2);
+ m.locate(1, 2);
+ m.getComponentAt(new Point(1, 2));
+ m.isFocusCycleRoot(new Container());
+ m.transferFocusBackward();
+ m.setName("goober");
+ m.getName();
+ m.getParent();
+ m.getPeer();
+ m.getGraphicsConfiguration();
+ m.getTreeLock();
+ m.getToolkit();
+ m.isValid();
+ m.isDisplayable();
+ m.isVisible();
+ m.isShowing();
+ m.isEnabled();
+ m.enable(false);
+ m.enable(true);
+ m.enableInputMethods(false);
+ m.enableInputMethods(true);
+ m.show();
+ m.show(false);
+ m.show(true);
+ m.hide();
+ m.getForeground();
+ m.isForegroundSet();
+ m.getBackground();
+ m.isBackgroundSet();
+ m.getFont();
+ m.isFontSet();
+ Container c = new Container();
+ c.add(m);
+ m.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ m.setLocale(locale);
+
+ m.getColorModel();
+ m.getLocation();
+
+ boolean exceptions = false;
+ try {
+ m.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ m.location();
+ m.setLocation(1, 2);
+ m.move(1, 2);
+ m.setLocation(new Point(1, 2));
+ m.getSize();
+ m.size();
+ m.setSize(1, 32);
+ m.resize(1, 32);
+ m.setSize(new Dimension(1, 32));
+ m.resize(new Dimension(1, 32));
+ m.getBounds();
+ m.bounds();
+ m.setBounds(10, 10, 10, 10);
+ m.setBounds(new Rectangle(10, 10, 10, 10));
+ m.isLightweight();
+ m.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ m.getCursor();
+ m.isCursorSet();
+ m.inside(1, 2);
+ m.contains(new Point(1, 2));
+ m.isFocusable();
+ m.setFocusable(true);
+ m.setFocusable(false);
+ m.transferFocus();
+ m.getFocusCycleRootAncestor();
+ m.nextFocus();
+ m.transferFocusUpCycle();
+ m.hasFocus();
+ m.isFocusOwner();
+ m.toString();
+ m.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ m.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ m.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ m.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJPopupMenu_Separator.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JPopupMenu.Separator constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJPopupMenu_Separator
+ */
+
+public class HeadlessJPopupMenu_Separator {
+ public static void main(String args[]) {
+ JPopupMenu.Separator s = new JPopupMenu.Separator();
+ s.getAccessibleContext();
+ s.isFocusTraversable();
+ s.setEnabled(false);
+ s.setEnabled(true);
+ s.requestFocus();
+ s.requestFocusInWindow();
+ s.getPreferredSize();
+ s.getMaximumSize();
+ s.getMinimumSize();
+ s.contains(1, 2);
+ Component c1 = s.add(new Component(){});
+ Component c2 = s.add(new Component(){});
+ Component c3 = s.add(new Component(){});
+ Insets ins = s.getInsets();
+ s.getAlignmentY();
+ s.getAlignmentX();
+ s.getGraphics();
+ s.setVisible(false);
+ s.setVisible(true);
+ s.setForeground(Color.red);
+ s.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ s.setFont(f1);
+ s.setFont(f2);
+ s.setFont(f3);
+ s.setFont(f4);
+
+ s.getFontMetrics(f1);
+ s.getFontMetrics(f2);
+ s.getFontMetrics(f3);
+ s.getFontMetrics(f4);
+ }
+ }
+ s.enable();
+ s.disable();
+ s.reshape(10, 10, 10, 10);
+ s.getBounds(new Rectangle(1, 1, 1, 1));
+ s.getSize(new Dimension(1, 2));
+ s.getLocation(new Point(1, 2));
+ s.getX();
+ s.getY();
+ s.getWidth();
+ s.getHeight();
+ s.isOpaque();
+ s.isValidateRoot();
+ s.isOptimizedDrawingEnabled();
+ s.isDoubleBuffered();
+ s.getComponentCount();
+ s.countComponents();
+ s.getComponent(1);
+ s.getComponent(2);
+ Component[] cs = s.getComponents();
+ s.getLayout();
+ s.setLayout(new FlowLayout());
+ s.doLayout();
+ s.layout();
+ s.invalidate();
+ s.validate();
+ s.remove(0);
+ s.remove(c2);
+ s.removeAll();
+ s.preferredSize();
+ s.minimumSize();
+ s.getComponentAt(1, 2);
+ s.locate(1, 2);
+ s.getComponentAt(new Point(1, 2));
+ s.isFocusCycleRoot(new Container());
+ s.transferFocusBackward();
+ s.setName("goober");
+ s.getName();
+ s.getParent();
+ s.getPeer();
+ s.getGraphicsConfiguration();
+ s.getTreeLock();
+ s.getToolkit();
+ s.isValid();
+ s.isDisplayable();
+ s.isVisible();
+ s.isShowing();
+ s.isEnabled();
+ s.enable(false);
+ s.enable(true);
+ s.enableInputMethods(false);
+ s.enableInputMethods(true);
+ s.show();
+ s.show(false);
+ s.show(true);
+ s.hide();
+ s.getForeground();
+ s.isForegroundSet();
+ s.getBackground();
+ s.isBackgroundSet();
+ s.getFont();
+ s.isFontSet();
+ Container c = new Container();
+ c.add(s);
+ s.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ s.setLocale(locale);
+
+ s.getColorModel();
+ s.getLocation();
+
+ boolean exceptions = false;
+ try {
+ s.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ s.location();
+ s.setLocation(1, 2);
+ s.move(1, 2);
+ s.setLocation(new Point(1, 2));
+ s.getSize();
+ s.size();
+ s.setSize(1, 32);
+ s.resize(1, 32);
+ s.setSize(new Dimension(1, 32));
+ s.resize(new Dimension(1, 32));
+ s.getBounds();
+ s.bounds();
+ s.setBounds(10, 10, 10, 10);
+ s.setBounds(new Rectangle(10, 10, 10, 10));
+ s.isLightweight();
+ s.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ s.getCursor();
+ s.isCursorSet();
+ s.inside(1, 2);
+ s.contains(new Point(1, 2));
+ s.isFocusable();
+ s.setFocusable(true);
+ s.setFocusable(false);
+ s.transferFocus();
+ s.getFocusCycleRootAncestor();
+ s.nextFocus();
+ s.transferFocusUpCycle();
+ s.hasFocus();
+ s.isFocusOwner();
+ s.toString();
+ s.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ s.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ s.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ s.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJProgressBar.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JProgressBar constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJProgressBar
+ */
+
+public class HeadlessJProgressBar {
+ public static void main(String args[]) {
+ JProgressBar pb = new JProgressBar();
+ pb.getAccessibleContext();
+ pb.isFocusTraversable();
+ pb.setEnabled(false);
+ pb.setEnabled(true);
+ pb.requestFocus();
+ pb.requestFocusInWindow();
+ pb.getPreferredSize();
+ pb.getMaximumSize();
+ pb.getMinimumSize();
+ pb.contains(1, 2);
+ Component c1 = pb.add(new Component(){});
+ Component c2 = pb.add(new Component(){});
+ Component c3 = pb.add(new Component(){});
+ Insets ins = pb.getInsets();
+ pb.getAlignmentY();
+ pb.getAlignmentX();
+ pb.getGraphics();
+ pb.setVisible(false);
+ pb.setVisible(true);
+ pb.setForeground(Color.red);
+ pb.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ pb.setFont(f1);
+ pb.setFont(f2);
+ pb.setFont(f3);
+ pb.setFont(f4);
+
+ pb.getFontMetrics(f1);
+ pb.getFontMetrics(f2);
+ pb.getFontMetrics(f3);
+ pb.getFontMetrics(f4);
+ }
+ }
+ pb.enable();
+ pb.disable();
+ pb.reshape(10, 10, 10, 10);
+ pb.getBounds(new Rectangle(1, 1, 1, 1));
+ pb.getSize(new Dimension(1, 2));
+ pb.getLocation(new Point(1, 2));
+ pb.getX();
+ pb.getY();
+ pb.getWidth();
+ pb.getHeight();
+ pb.isOpaque();
+ pb.isValidateRoot();
+ pb.isOptimizedDrawingEnabled();
+ pb.isDoubleBuffered();
+ pb.getComponentCount();
+ pb.countComponents();
+ pb.getComponent(1);
+ pb.getComponent(2);
+ Component[] cs = pb.getComponents();
+ pb.getLayout();
+ pb.setLayout(new FlowLayout());
+ pb.doLayout();
+ pb.layout();
+ pb.invalidate();
+ pb.validate();
+ pb.remove(0);
+ pb.remove(c2);
+ pb.removeAll();
+ pb.preferredSize();
+ pb.minimumSize();
+ pb.getComponentAt(1, 2);
+ pb.locate(1, 2);
+ pb.getComponentAt(new Point(1, 2));
+ pb.isFocusCycleRoot(new Container());
+ pb.transferFocusBackward();
+ pb.setName("goober");
+ pb.getName();
+ pb.getParent();
+ pb.getPeer();
+ pb.getGraphicsConfiguration();
+ pb.getTreeLock();
+ pb.getToolkit();
+ pb.isValid();
+ pb.isDisplayable();
+ pb.isVisible();
+ pb.isShowing();
+ pb.isEnabled();
+ pb.enable(false);
+ pb.enable(true);
+ pb.enableInputMethods(false);
+ pb.enableInputMethods(true);
+ pb.show();
+ pb.show(false);
+ pb.show(true);
+ pb.hide();
+ pb.getForeground();
+ pb.isForegroundSet();
+ pb.getBackground();
+ pb.isBackgroundSet();
+ pb.getFont();
+ pb.isFontSet();
+ Container c = new Container();
+ c.add(pb);
+ pb.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ pb.setLocale(locale);
+
+ pb.getColorModel();
+ pb.getLocation();
+
+ boolean exceptions = false;
+ try {
+ pb.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ pb.location();
+ pb.setLocation(1, 2);
+ pb.move(1, 2);
+ pb.setLocation(new Point(1, 2));
+ pb.getSize();
+ pb.size();
+ pb.setSize(1, 32);
+ pb.resize(1, 32);
+ pb.setSize(new Dimension(1, 32));
+ pb.resize(new Dimension(1, 32));
+ pb.getBounds();
+ pb.bounds();
+ pb.setBounds(10, 10, 10, 10);
+ pb.setBounds(new Rectangle(10, 10, 10, 10));
+ pb.isLightweight();
+ pb.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ pb.getCursor();
+ pb.isCursorSet();
+ pb.inside(1, 2);
+ pb.contains(new Point(1, 2));
+ pb.isFocusable();
+ pb.setFocusable(true);
+ pb.setFocusable(false);
+ pb.transferFocus();
+ pb.getFocusCycleRootAncestor();
+ pb.nextFocus();
+ pb.transferFocusUpCycle();
+ pb.hasFocus();
+ pb.isFocusOwner();
+ pb.toString();
+ pb.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ pb.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ pb.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ pb.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJRadioButton.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JRadioButton constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJRadioButton
+ */
+
+public class HeadlessJRadioButton {
+ public static void main(String args[]) {
+ JRadioButton rb = new JRadioButton();
+ rb.getAccessibleContext();
+ rb.isFocusTraversable();
+ rb.setEnabled(false);
+ rb.setEnabled(true);
+ rb.requestFocus();
+ rb.requestFocusInWindow();
+ rb.getPreferredSize();
+ rb.getMaximumSize();
+ rb.getMinimumSize();
+ rb.contains(1, 2);
+ Component c1 = rb.add(new Component(){});
+ Component c2 = rb.add(new Component(){});
+ Component c3 = rb.add(new Component(){});
+ Insets ins = rb.getInsets();
+ rb.getAlignmentY();
+ rb.getAlignmentX();
+ rb.getGraphics();
+ rb.setVisible(false);
+ rb.setVisible(true);
+ rb.setForeground(Color.red);
+ rb.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ rb.setFont(f1);
+ rb.setFont(f2);
+ rb.setFont(f3);
+ rb.setFont(f4);
+
+ rb.getFontMetrics(f1);
+ rb.getFontMetrics(f2);
+ rb.getFontMetrics(f3);
+ rb.getFontMetrics(f4);
+ }
+ }
+ rb.enable();
+ rb.disable();
+ rb.reshape(10, 10, 10, 10);
+ rb.getBounds(new Rectangle(1, 1, 1, 1));
+ rb.getSize(new Dimension(1, 2));
+ rb.getLocation(new Point(1, 2));
+ rb.getX();
+ rb.getY();
+ rb.getWidth();
+ rb.getHeight();
+ rb.isOpaque();
+ rb.isValidateRoot();
+ rb.isOptimizedDrawingEnabled();
+ rb.isDoubleBuffered();
+ rb.getComponentCount();
+ rb.countComponents();
+ rb.getComponent(1);
+ rb.getComponent(2);
+ Component[] cs = rb.getComponents();
+ rb.getLayout();
+ rb.setLayout(new FlowLayout());
+ rb.doLayout();
+ rb.layout();
+ rb.invalidate();
+ rb.validate();
+ rb.remove(0);
+ rb.remove(c2);
+ rb.removeAll();
+ rb.preferredSize();
+ rb.minimumSize();
+ rb.getComponentAt(1, 2);
+ rb.locate(1, 2);
+ rb.getComponentAt(new Point(1, 2));
+ rb.isFocusCycleRoot(new Container());
+ rb.transferFocusBackward();
+ rb.setName("goober");
+ rb.getName();
+ rb.getParent();
+ rb.getPeer();
+ rb.getGraphicsConfiguration();
+ rb.getTreeLock();
+ rb.getToolkit();
+ rb.isValid();
+ rb.isDisplayable();
+ rb.isVisible();
+ rb.isShowing();
+ rb.isEnabled();
+ rb.enable(false);
+ rb.enable(true);
+ rb.enableInputMethods(false);
+ rb.enableInputMethods(true);
+ rb.show();
+ rb.show(false);
+ rb.show(true);
+ rb.hide();
+ rb.getForeground();
+ rb.isForegroundSet();
+ rb.getBackground();
+ rb.isBackgroundSet();
+ rb.getFont();
+ rb.isFontSet();
+ Container c = new Container();
+ c.add(rb);
+ rb.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ rb.setLocale(locale);
+
+ rb.getColorModel();
+ rb.getLocation();
+
+ boolean exceptions = false;
+ try {
+ rb.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ rb.location();
+ rb.setLocation(1, 2);
+ rb.move(1, 2);
+ rb.setLocation(new Point(1, 2));
+ rb.getSize();
+ rb.size();
+ rb.setSize(1, 32);
+ rb.resize(1, 32);
+ rb.setSize(new Dimension(1, 32));
+ rb.resize(new Dimension(1, 32));
+ rb.getBounds();
+ rb.bounds();
+ rb.setBounds(10, 10, 10, 10);
+ rb.setBounds(new Rectangle(10, 10, 10, 10));
+ rb.isLightweight();
+ rb.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ rb.getCursor();
+ rb.isCursorSet();
+ rb.inside(1, 2);
+ rb.contains(new Point(1, 2));
+ rb.isFocusable();
+ rb.setFocusable(true);
+ rb.setFocusable(false);
+ rb.transferFocus();
+ rb.getFocusCycleRootAncestor();
+ rb.nextFocus();
+ rb.transferFocusUpCycle();
+ rb.hasFocus();
+ rb.isFocusOwner();
+ rb.toString();
+ rb.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ rb.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ rb.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ rb.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJRadioButtonMenuItem.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JRadioButtonMenuItem constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJRadioButtonMenuItem
+ */
+
+public class HeadlessJRadioButtonMenuItem {
+ public static void main(String args[]) {
+ JRadioButtonMenuItem i = new JRadioButtonMenuItem();
+ i.getAccessibleContext();
+ i.isFocusTraversable();
+ i.setEnabled(false);
+ i.setEnabled(true);
+ i.requestFocus();
+ i.requestFocusInWindow();
+ i.getPreferredSize();
+ i.getMaximumSize();
+ i.getMinimumSize();
+ i.contains(1, 2);
+ Component c1 = i.add(new Component(){});
+ Component c2 = i.add(new Component(){});
+ Component c3 = i.add(new Component(){});
+ Insets ins = i.getInsets();
+ i.getAlignmentY();
+ i.getAlignmentX();
+ i.getGraphics();
+ i.setVisible(false);
+ i.setVisible(true);
+ i.setForeground(Color.red);
+ i.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ i.setFont(f1);
+ i.setFont(f2);
+ i.setFont(f3);
+ i.setFont(f4);
+
+ i.getFontMetrics(f1);
+ i.getFontMetrics(f2);
+ i.getFontMetrics(f3);
+ i.getFontMetrics(f4);
+ }
+ }
+ i.enable();
+ i.disable();
+ i.reshape(10, 10, 10, 10);
+ i.getBounds(new Rectangle(1, 1, 1, 1));
+ i.getSize(new Dimension(1, 2));
+ i.getLocation(new Point(1, 2));
+ i.getX();
+ i.getY();
+ i.getWidth();
+ i.getHeight();
+ i.isOpaque();
+ i.isValidateRoot();
+ i.isOptimizedDrawingEnabled();
+ i.isDoubleBuffered();
+ i.getComponentCount();
+ i.countComponents();
+ i.getComponent(1);
+ i.getComponent(2);
+ Component[] cs = i.getComponents();
+ i.getLayout();
+ i.setLayout(new FlowLayout());
+ i.doLayout();
+ i.layout();
+ i.invalidate();
+ i.validate();
+ i.remove(0);
+ i.remove(c2);
+ i.removeAll();
+ i.preferredSize();
+ i.minimumSize();
+ i.getComponentAt(1, 2);
+ i.locate(1, 2);
+ i.getComponentAt(new Point(1, 2));
+ i.isFocusCycleRoot(new Container());
+ i.transferFocusBackward();
+ i.setName("goober");
+ i.getName();
+ i.getParent();
+ i.getPeer();
+ i.getGraphicsConfiguration();
+ i.getTreeLock();
+ i.getToolkit();
+ i.isValid();
+ i.isDisplayable();
+ i.isVisible();
+ i.isShowing();
+ i.isEnabled();
+ i.enable(false);
+ i.enable(true);
+ i.enableInputMethods(false);
+ i.enableInputMethods(true);
+ i.show();
+ i.show(false);
+ i.show(true);
+ i.hide();
+ i.getForeground();
+ i.isForegroundSet();
+ i.getBackground();
+ i.isBackgroundSet();
+ i.getFont();
+ i.isFontSet();
+ Container c = new Container();
+ c.add(i);
+ i.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ i.setLocale(locale);
+
+ i.getColorModel();
+ i.getLocation();
+
+ boolean exceptions = false;
+ try {
+ i.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ i.location();
+ i.setLocation(1, 2);
+ i.move(1, 2);
+ i.setLocation(new Point(1, 2));
+ i.getSize();
+ i.size();
+ i.setSize(1, 32);
+ i.resize(1, 32);
+ i.setSize(new Dimension(1, 32));
+ i.resize(new Dimension(1, 32));
+ i.getBounds();
+ i.bounds();
+ i.setBounds(10, 10, 10, 10);
+ i.setBounds(new Rectangle(10, 10, 10, 10));
+ i.isLightweight();
+ i.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ i.getCursor();
+ i.isCursorSet();
+ i.inside(1, 2);
+ i.contains(new Point(1, 2));
+ i.isFocusable();
+ i.setFocusable(true);
+ i.setFocusable(false);
+ i.transferFocus();
+ i.getFocusCycleRootAncestor();
+ i.nextFocus();
+ i.transferFocusUpCycle();
+ i.hasFocus();
+ i.isFocusOwner();
+ i.toString();
+ i.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ i.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ i.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ i.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJRootPane.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JRootPane constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJRootPane
+ */
+
+public class HeadlessJRootPane {
+ public static void main(String args[]) {
+ JRootPane rp = new JRootPane();
+ rp.getAccessibleContext();
+ rp.isFocusTraversable();
+ rp.setEnabled(false);
+ rp.setEnabled(true);
+ rp.requestFocus();
+ rp.requestFocusInWindow();
+ rp.getPreferredSize();
+ rp.getMaximumSize();
+ rp.getMinimumSize();
+ rp.contains(1, 2);
+ Component c1 = rp.add(new Component(){});
+ Component c2 = rp.add(new Component(){});
+ Component c3 = rp.add(new Component(){});
+ Insets ins = rp.getInsets();
+ rp.getAlignmentY();
+ rp.getAlignmentX();
+ rp.getGraphics();
+ rp.setVisible(false);
+ rp.setVisible(true);
+ rp.setForeground(Color.red);
+ rp.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ rp.setFont(f1);
+ rp.setFont(f2);
+ rp.setFont(f3);
+ rp.setFont(f4);
+
+ rp.getFontMetrics(f1);
+ rp.getFontMetrics(f2);
+ rp.getFontMetrics(f3);
+ rp.getFontMetrics(f4);
+ }
+ }
+ rp.enable();
+ rp.disable();
+ rp.reshape(10, 10, 10, 10);
+ rp.getBounds(new Rectangle(1, 1, 1, 1));
+ rp.getSize(new Dimension(1, 2));
+ rp.getLocation(new Point(1, 2));
+ rp.getX();
+ rp.getY();
+ rp.getWidth();
+ rp.getHeight();
+ rp.isOpaque();
+ rp.isValidateRoot();
+ rp.isOptimizedDrawingEnabled();
+ rp.isDoubleBuffered();
+ rp.getComponentCount();
+ rp.countComponents();
+ rp.getComponent(1);
+ rp.getComponent(2);
+ Component[] cs = rp.getComponents();
+ rp.getLayout();
+ rp.setLayout(new FlowLayout());
+ rp.doLayout();
+ rp.layout();
+ rp.invalidate();
+ rp.validate();
+ rp.remove(0);
+ rp.remove(c2);
+ rp.removeAll();
+ rp.preferredSize();
+ rp.minimumSize();
+ rp.getComponentAt(1, 2);
+ rp.locate(1, 2);
+ rp.getComponentAt(new Point(1, 2));
+ rp.isFocusCycleRoot(new Container());
+ rp.transferFocusBackward();
+ rp.setName("goober");
+ rp.getName();
+ rp.getParent();
+ rp.getPeer();
+ rp.getGraphicsConfiguration();
+ rp.getTreeLock();
+ rp.getToolkit();
+ rp.isValid();
+ rp.isDisplayable();
+ rp.isVisible();
+ rp.isShowing();
+ rp.isEnabled();
+ rp.enable(false);
+ rp.enable(true);
+ rp.enableInputMethods(false);
+ rp.enableInputMethods(true);
+ rp.show();
+ rp.show(false);
+ rp.show(true);
+ rp.hide();
+ rp.getForeground();
+ rp.isForegroundSet();
+ rp.getBackground();
+ rp.isBackgroundSet();
+ rp.getFont();
+ rp.isFontSet();
+ Container c = new Container();
+ c.add(rp);
+ rp.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ rp.setLocale(locale);
+
+ rp.getColorModel();
+ rp.getLocation();
+
+ boolean exceptions = false;
+ try {
+ rp.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ rp.location();
+ rp.setLocation(1, 2);
+ rp.move(1, 2);
+ rp.setLocation(new Point(1, 2));
+ rp.getSize();
+ rp.size();
+ rp.setSize(1, 32);
+ rp.resize(1, 32);
+ rp.setSize(new Dimension(1, 32));
+ rp.resize(new Dimension(1, 32));
+ rp.getBounds();
+ rp.bounds();
+ rp.setBounds(10, 10, 10, 10);
+ rp.setBounds(new Rectangle(10, 10, 10, 10));
+ rp.isLightweight();
+ rp.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ rp.getCursor();
+ rp.isCursorSet();
+ rp.inside(1, 2);
+ rp.contains(new Point(1, 2));
+ rp.isFocusable();
+ rp.setFocusable(true);
+ rp.setFocusable(false);
+ rp.transferFocus();
+ rp.getFocusCycleRootAncestor();
+ rp.nextFocus();
+ rp.transferFocusUpCycle();
+ rp.hasFocus();
+ rp.isFocusOwner();
+ rp.toString();
+ rp.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ rp.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ rp.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ rp.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJScrollBar.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JScrollBar constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJScrollBar
+ */
+
+public class HeadlessJScrollBar {
+ public static void main(String args[]) {
+ JScrollBar sb = new JScrollBar();
+ sb.getAccessibleContext();
+ sb.isFocusTraversable();
+ sb.setEnabled(false);
+ sb.setEnabled(true);
+ sb.requestFocus();
+ sb.requestFocusInWindow();
+ sb.getPreferredSize();
+ sb.getMaximumSize();
+ sb.getMinimumSize();
+ sb.contains(1, 2);
+ Component c1 = sb.add(new Component(){});
+ Component c2 = sb.add(new Component(){});
+ Component c3 = sb.add(new Component(){});
+ Insets ins = sb.getInsets();
+ sb.getAlignmentY();
+ sb.getAlignmentX();
+ sb.getGraphics();
+ sb.setVisible(false);
+ sb.setVisible(true);
+ sb.setForeground(Color.red);
+ sb.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ sb.setFont(f1);
+ sb.setFont(f2);
+ sb.setFont(f3);
+ sb.setFont(f4);
+
+ sb.getFontMetrics(f1);
+ sb.getFontMetrics(f2);
+ sb.getFontMetrics(f3);
+ sb.getFontMetrics(f4);
+ }
+ }
+ sb.enable();
+ sb.disable();
+ sb.reshape(10, 10, 10, 10);
+ sb.getBounds(new Rectangle(1, 1, 1, 1));
+ sb.getSize(new Dimension(1, 2));
+ sb.getLocation(new Point(1, 2));
+ sb.getX();
+ sb.getY();
+ sb.getWidth();
+ sb.getHeight();
+ sb.isOpaque();
+ sb.isValidateRoot();
+ sb.isOptimizedDrawingEnabled();
+ sb.isDoubleBuffered();
+ sb.getComponentCount();
+ sb.countComponents();
+ sb.getComponent(1);
+ sb.getComponent(2);
+ Component[] cs = sb.getComponents();
+ sb.getLayout();
+ sb.setLayout(new FlowLayout());
+ sb.doLayout();
+ sb.layout();
+ sb.invalidate();
+ sb.validate();
+ sb.remove(0);
+ sb.remove(c2);
+ sb.removeAll();
+ sb.preferredSize();
+ sb.minimumSize();
+ sb.getComponentAt(1, 2);
+ sb.locate(1, 2);
+ sb.getComponentAt(new Point(1, 2));
+ sb.isFocusCycleRoot(new Container());
+ sb.transferFocusBackward();
+ sb.setName("goober");
+ sb.getName();
+ sb.getParent();
+ sb.getPeer();
+ sb.getGraphicsConfiguration();
+ sb.getTreeLock();
+ sb.getToolkit();
+ sb.isValid();
+ sb.isDisplayable();
+ sb.isVisible();
+ sb.isShowing();
+ sb.isEnabled();
+ sb.enable(false);
+ sb.enable(true);
+ sb.enableInputMethods(false);
+ sb.enableInputMethods(true);
+ sb.show();
+ sb.show(false);
+ sb.show(true);
+ sb.hide();
+ sb.getForeground();
+ sb.isForegroundSet();
+ sb.getBackground();
+ sb.isBackgroundSet();
+ sb.getFont();
+ sb.isFontSet();
+ Container c = new Container();
+ c.add(sb);
+ sb.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ sb.setLocale(locale);
+
+ sb.getColorModel();
+ sb.getLocation();
+
+ boolean exceptions = false;
+ try {
+ sb.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ sb.location();
+ sb.setLocation(1, 2);
+ sb.move(1, 2);
+ sb.setLocation(new Point(1, 2));
+ sb.getSize();
+ sb.size();
+ sb.setSize(1, 32);
+ sb.resize(1, 32);
+ sb.setSize(new Dimension(1, 32));
+ sb.resize(new Dimension(1, 32));
+ sb.getBounds();
+ sb.bounds();
+ sb.setBounds(10, 10, 10, 10);
+ sb.setBounds(new Rectangle(10, 10, 10, 10));
+ sb.isLightweight();
+ sb.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ sb.getCursor();
+ sb.isCursorSet();
+ sb.inside(1, 2);
+ sb.contains(new Point(1, 2));
+ sb.isFocusable();
+ sb.setFocusable(true);
+ sb.setFocusable(false);
+ sb.transferFocus();
+ sb.getFocusCycleRootAncestor();
+ sb.nextFocus();
+ sb.transferFocusUpCycle();
+ sb.hasFocus();
+ sb.isFocusOwner();
+ sb.toString();
+ sb.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ sb.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ sb.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ sb.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJScrollPane.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JScrollPane constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJScrollPane
+ */
+
+public class HeadlessJScrollPane {
+ public static void main(String args[]) {
+ JScrollPane sp = new JScrollPane();
+ sp.getAccessibleContext();
+ sp.isFocusTraversable();
+ sp.setEnabled(false);
+ sp.setEnabled(true);
+ sp.requestFocus();
+ sp.requestFocusInWindow();
+ sp.getPreferredSize();
+ sp.getMaximumSize();
+ sp.getMinimumSize();
+ sp.contains(1, 2);
+ Component c1 = sp.add(new Component(){});
+ Component c2 = sp.add(new Component(){});
+ Component c3 = sp.add(new Component(){});
+ Insets ins = sp.getInsets();
+ sp.getAlignmentY();
+ sp.getAlignmentX();
+ sp.getGraphics();
+ sp.setVisible(false);
+ sp.setVisible(true);
+ sp.setForeground(Color.red);
+ sp.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ sp.setFont(f1);
+ sp.setFont(f2);
+ sp.setFont(f3);
+ sp.setFont(f4);
+
+ sp.getFontMetrics(f1);
+ sp.getFontMetrics(f2);
+ sp.getFontMetrics(f3);
+ sp.getFontMetrics(f4);
+ }
+ }
+ sp.enable();
+ sp.disable();
+ sp.reshape(10, 10, 10, 10);
+ sp.getBounds(new Rectangle(1, 1, 1, 1));
+ sp.getSize(new Dimension(1, 2));
+ sp.getLocation(new Point(1, 2));
+ sp.getX();
+ sp.getY();
+ sp.getWidth();
+ sp.getHeight();
+ sp.isOpaque();
+ sp.isValidateRoot();
+ sp.isOptimizedDrawingEnabled();
+ sp.isDoubleBuffered();
+ sp.getComponentCount();
+ sp.countComponents();
+ sp.getComponent(1);
+ sp.getComponent(2);
+ Component[] cs = sp.getComponents();
+ sp.getLayout();
+ sp.setLayout(new ScrollPaneLayout());
+ sp.doLayout();
+ sp.layout();
+ sp.invalidate();
+ sp.validate();
+ sp.remove(0);
+ sp.remove(c2);
+ sp.removeAll();
+ sp.preferredSize();
+ sp.minimumSize();
+ sp.getComponentAt(1, 2);
+ sp.locate(1, 2);
+ sp.getComponentAt(new Point(1, 2));
+ sp.isFocusCycleRoot(new Container());
+ sp.transferFocusBackward();
+ sp.setName("goober");
+ sp.getName();
+ sp.getParent();
+ sp.getPeer();
+ sp.getGraphicsConfiguration();
+ sp.getTreeLock();
+ sp.getToolkit();
+ sp.isValid();
+ sp.isDisplayable();
+ sp.isVisible();
+ sp.isShowing();
+ sp.isEnabled();
+ sp.enable(false);
+ sp.enable(true);
+ sp.enableInputMethods(false);
+ sp.enableInputMethods(true);
+ sp.show();
+ sp.show(false);
+ sp.show(true);
+ sp.hide();
+ sp.getForeground();
+ sp.isForegroundSet();
+ sp.getBackground();
+ sp.isBackgroundSet();
+ sp.getFont();
+ sp.isFontSet();
+ Container c = new Container();
+ c.add(sp);
+ sp.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ sp.setLocale(locale);
+
+ sp.getColorModel();
+ sp.getLocation();
+
+ boolean exceptions = false;
+ try {
+ sp.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ sp.location();
+ sp.setLocation(1, 2);
+ sp.move(1, 2);
+ sp.setLocation(new Point(1, 2));
+ sp.getSize();
+ sp.size();
+ sp.setSize(1, 32);
+ sp.resize(1, 32);
+ sp.setSize(new Dimension(1, 32));
+ sp.resize(new Dimension(1, 32));
+ sp.getBounds();
+ sp.bounds();
+ sp.setBounds(10, 10, 10, 10);
+ sp.setBounds(new Rectangle(10, 10, 10, 10));
+ sp.isLightweight();
+ sp.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ sp.getCursor();
+ sp.isCursorSet();
+ sp.inside(1, 2);
+ sp.contains(new Point(1, 2));
+ sp.isFocusable();
+ sp.setFocusable(true);
+ sp.setFocusable(false);
+ sp.transferFocus();
+ sp.getFocusCycleRootAncestor();
+ sp.nextFocus();
+ sp.transferFocusUpCycle();
+ sp.hasFocus();
+ sp.isFocusOwner();
+ sp.toString();
+ sp.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ sp.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ sp.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ sp.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJSeparator.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JSeparator constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJSeparator
+ */
+
+public class HeadlessJSeparator {
+ public static void main(String args[]) {
+ JSeparator sp = new JSeparator();
+ sp.getAccessibleContext();
+ sp.isFocusTraversable();
+ sp.setEnabled(false);
+ sp.setEnabled(true);
+ sp.requestFocus();
+ sp.requestFocusInWindow();
+ sp.getPreferredSize();
+ sp.getMaximumSize();
+ sp.getMinimumSize();
+ sp.contains(1, 2);
+ Component c1 = sp.add(new Component(){});
+ Component c2 = sp.add(new Component(){});
+ Component c3 = sp.add(new Component(){});
+ Insets ins = sp.getInsets();
+ sp.getAlignmentY();
+ sp.getAlignmentX();
+ sp.getGraphics();
+ sp.setVisible(false);
+ sp.setVisible(true);
+ sp.setForeground(Color.red);
+ sp.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ sp.setFont(f1);
+ sp.setFont(f2);
+ sp.setFont(f3);
+ sp.setFont(f4);
+
+ sp.getFontMetrics(f1);
+ sp.getFontMetrics(f2);
+ sp.getFontMetrics(f3);
+ sp.getFontMetrics(f4);
+ }
+ }
+ sp.enable();
+ sp.disable();
+ sp.reshape(10, 10, 10, 10);
+ sp.getBounds(new Rectangle(1, 1, 1, 1));
+ sp.getSize(new Dimension(1, 2));
+ sp.getLocation(new Point(1, 2));
+ sp.getX();
+ sp.getY();
+ sp.getWidth();
+ sp.getHeight();
+ sp.isOpaque();
+ sp.isValidateRoot();
+ sp.isOptimizedDrawingEnabled();
+ sp.isDoubleBuffered();
+ sp.getComponentCount();
+ sp.countComponents();
+ sp.getComponent(1);
+ sp.getComponent(2);
+ Component[] cs = sp.getComponents();
+ sp.getLayout();
+ sp.setLayout(new FlowLayout());
+ sp.doLayout();
+ sp.layout();
+ sp.invalidate();
+ sp.validate();
+ sp.remove(0);
+ sp.remove(c2);
+ sp.removeAll();
+ sp.preferredSize();
+ sp.minimumSize();
+ sp.getComponentAt(1, 2);
+ sp.locate(1, 2);
+ sp.getComponentAt(new Point(1, 2));
+ sp.isFocusCycleRoot(new Container());
+ sp.transferFocusBackward();
+ sp.setName("goober");
+ sp.getName();
+ sp.getParent();
+ sp.getPeer();
+ sp.getGraphicsConfiguration();
+ sp.getTreeLock();
+ sp.getToolkit();
+ sp.isValid();
+ sp.isDisplayable();
+ sp.isVisible();
+ sp.isShowing();
+ sp.isEnabled();
+ sp.enable(false);
+ sp.enable(true);
+ sp.enableInputMethods(false);
+ sp.enableInputMethods(true);
+ sp.show();
+ sp.show(false);
+ sp.show(true);
+ sp.hide();
+ sp.getForeground();
+ sp.isForegroundSet();
+ sp.getBackground();
+ sp.isBackgroundSet();
+ sp.getFont();
+ sp.isFontSet();
+ Container c = new Container();
+ c.add(sp);
+ sp.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ sp.setLocale(locale);
+
+ sp.getColorModel();
+ sp.getLocation();
+
+ boolean exceptions = false;
+ try {
+ sp.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ sp.location();
+ sp.setLocation(1, 2);
+ sp.move(1, 2);
+ sp.setLocation(new Point(1, 2));
+ sp.getSize();
+ sp.size();
+ sp.setSize(1, 32);
+ sp.resize(1, 32);
+ sp.setSize(new Dimension(1, 32));
+ sp.resize(new Dimension(1, 32));
+ sp.getBounds();
+ sp.bounds();
+ sp.setBounds(10, 10, 10, 10);
+ sp.setBounds(new Rectangle(10, 10, 10, 10));
+ sp.isLightweight();
+ sp.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ sp.getCursor();
+ sp.isCursorSet();
+ sp.inside(1, 2);
+ sp.contains(new Point(1, 2));
+ sp.isFocusable();
+ sp.setFocusable(true);
+ sp.setFocusable(false);
+ sp.transferFocus();
+ sp.getFocusCycleRootAncestor();
+ sp.nextFocus();
+ sp.transferFocusUpCycle();
+ sp.hasFocus();
+ sp.isFocusOwner();
+ sp.toString();
+ sp.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ sp.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ sp.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ sp.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJSlider.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JSlider constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJSlider
+ */
+
+public class HeadlessJSlider {
+ public static void main(String args[]) {
+ JSlider s = new JSlider();
+ s.getAccessibleContext();
+ s.isFocusTraversable();
+ s.setEnabled(false);
+ s.setEnabled(true);
+ s.requestFocus();
+ s.requestFocusInWindow();
+ s.getPreferredSize();
+ s.getMaximumSize();
+ s.getMinimumSize();
+ s.contains(1, 2);
+ Component c1 = s.add(new Component(){});
+ Component c2 = s.add(new Component(){});
+ Component c3 = s.add(new Component(){});
+ Insets ins = s.getInsets();
+ s.getAlignmentY();
+ s.getAlignmentX();
+ s.getGraphics();
+ s.setVisible(false);
+ s.setVisible(true);
+ s.setForeground(Color.red);
+ s.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ s.setFont(f1);
+ s.setFont(f2);
+ s.setFont(f3);
+ s.setFont(f4);
+
+ s.getFontMetrics(f1);
+ s.getFontMetrics(f2);
+ s.getFontMetrics(f3);
+ s.getFontMetrics(f4);
+ }
+ }
+ s.enable();
+ s.disable();
+ s.reshape(10, 10, 10, 10);
+ s.getBounds(new Rectangle(1, 1, 1, 1));
+ s.getSize(new Dimension(1, 2));
+ s.getLocation(new Point(1, 2));
+ s.getX();
+ s.getY();
+ s.getWidth();
+ s.getHeight();
+ s.isOpaque();
+ s.isValidateRoot();
+ s.isOptimizedDrawingEnabled();
+ s.isDoubleBuffered();
+ s.getComponentCount();
+ s.countComponents();
+ s.getComponent(1);
+ s.getComponent(2);
+ Component[] cs = s.getComponents();
+ s.getLayout();
+ s.setLayout(new FlowLayout());
+ s.doLayout();
+ s.layout();
+ s.invalidate();
+ s.validate();
+ s.remove(0);
+ s.remove(c2);
+ s.removeAll();
+ s.preferredSize();
+ s.minimumSize();
+ s.getComponentAt(1, 2);
+ s.locate(1, 2);
+ s.getComponentAt(new Point(1, 2));
+ s.isFocusCycleRoot(new Container());
+ s.transferFocusBackward();
+ s.setName("goober");
+ s.getName();
+ s.getParent();
+ s.getPeer();
+ s.getGraphicsConfiguration();
+ s.getTreeLock();
+ s.getToolkit();
+ s.isValid();
+ s.isDisplayable();
+ s.isVisible();
+ s.isShowing();
+ s.isEnabled();
+ s.enable(false);
+ s.enable(true);
+ s.enableInputMethods(false);
+ s.enableInputMethods(true);
+ s.show();
+ s.show(false);
+ s.show(true);
+ s.hide();
+ s.getForeground();
+ s.isForegroundSet();
+ s.getBackground();
+ s.isBackgroundSet();
+ s.getFont();
+ s.isFontSet();
+ Container c = new Container();
+ c.add(s);
+ s.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ s.setLocale(locale);
+
+ s.getColorModel();
+ s.getLocation();
+
+ boolean exceptions = false;
+ try {
+ s.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ s.location();
+ s.setLocation(1, 2);
+ s.move(1, 2);
+ s.setLocation(new Point(1, 2));
+ s.getSize();
+ s.size();
+ s.setSize(1, 32);
+ s.resize(1, 32);
+ s.setSize(new Dimension(1, 32));
+ s.resize(new Dimension(1, 32));
+ s.getBounds();
+ s.bounds();
+ s.setBounds(10, 10, 10, 10);
+ s.setBounds(new Rectangle(10, 10, 10, 10));
+ s.isLightweight();
+ s.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ s.getCursor();
+ s.isCursorSet();
+ s.inside(1, 2);
+ s.contains(new Point(1, 2));
+ s.isFocusable();
+ s.setFocusable(true);
+ s.setFocusable(false);
+ s.transferFocus();
+ s.getFocusCycleRootAncestor();
+ s.nextFocus();
+ s.transferFocusUpCycle();
+ s.hasFocus();
+ s.isFocusOwner();
+ s.toString();
+ s.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ s.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ s.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ s.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJSpinner.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JSpinner constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJSpinner
+ */
+
+public class HeadlessJSpinner {
+ public static void main(String args[]) {
+ JSpinner s = new JSpinner();
+ s.getAccessibleContext();
+ s.isFocusTraversable();
+ s.setEnabled(false);
+ s.setEnabled(true);
+ s.requestFocus();
+ s.requestFocusInWindow();
+ s.getPreferredSize();
+ s.getMaximumSize();
+ s.getMinimumSize();
+ s.contains(1, 2);
+ Component c1 = s.add(new Component(){});
+ Component c2 = s.add(new Component(){});
+ Component c3 = s.add(new Component(){});
+ Insets ins = s.getInsets();
+ s.getAlignmentY();
+ s.getAlignmentX();
+ s.getGraphics();
+ s.setVisible(false);
+ s.setVisible(true);
+ s.setForeground(Color.red);
+ s.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ s.setFont(f1);
+ s.setFont(f2);
+ s.setFont(f3);
+ s.setFont(f4);
+
+ s.getFontMetrics(f1);
+ s.getFontMetrics(f2);
+ s.getFontMetrics(f3);
+ s.getFontMetrics(f4);
+ }
+ }
+ s.enable();
+ s.disable();
+ s.reshape(10, 10, 10, 10);
+ s.getBounds(new Rectangle(1, 1, 1, 1));
+ s.getSize(new Dimension(1, 2));
+ s.getLocation(new Point(1, 2));
+ s.getX();
+ s.getY();
+ s.getWidth();
+ s.getHeight();
+ s.isOpaque();
+ s.isValidateRoot();
+ s.isOptimizedDrawingEnabled();
+ s.isDoubleBuffered();
+ s.getComponentCount();
+ s.countComponents();
+ s.getComponent(1);
+ s.getComponent(2);
+ Component[] cs = s.getComponents();
+ s.getLayout();
+ s.setLayout(new FlowLayout());
+ s.doLayout();
+ s.layout();
+ s.invalidate();
+ s.validate();
+ s.remove(0);
+ s.remove(c2);
+ s.removeAll();
+ s.preferredSize();
+ s.minimumSize();
+ s.getComponentAt(1, 2);
+ s.locate(1, 2);
+ s.getComponentAt(new Point(1, 2));
+ s.isFocusCycleRoot(new Container());
+ s.transferFocusBackward();
+ s.setName("goober");
+ s.getName();
+ s.getParent();
+ s.getPeer();
+ s.getGraphicsConfiguration();
+ s.getTreeLock();
+ s.getToolkit();
+ s.isValid();
+ s.isDisplayable();
+ s.isVisible();
+ s.isShowing();
+ s.isEnabled();
+ s.enable(false);
+ s.enable(true);
+ s.enableInputMethods(false);
+ s.enableInputMethods(true);
+ s.show();
+ s.show(false);
+ s.show(true);
+ s.hide();
+ s.getForeground();
+ s.isForegroundSet();
+ s.getBackground();
+ s.isBackgroundSet();
+ s.getFont();
+ s.isFontSet();
+ Container c = new Container();
+ c.add(s);
+ s.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ s.setLocale(locale);
+
+ s.getColorModel();
+ s.getLocation();
+
+ boolean exceptions = false;
+ try {
+ s.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ s.location();
+ s.setLocation(1, 2);
+ s.move(1, 2);
+ s.setLocation(new Point(1, 2));
+ s.getSize();
+ s.size();
+ s.setSize(1, 32);
+ s.resize(1, 32);
+ s.setSize(new Dimension(1, 32));
+ s.resize(new Dimension(1, 32));
+ s.getBounds();
+ s.bounds();
+ s.setBounds(10, 10, 10, 10);
+ s.setBounds(new Rectangle(10, 10, 10, 10));
+ s.isLightweight();
+ s.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ s.getCursor();
+ s.isCursorSet();
+ s.inside(1, 2);
+ s.contains(new Point(1, 2));
+ s.isFocusable();
+ s.setFocusable(true);
+ s.setFocusable(false);
+ s.transferFocus();
+ s.getFocusCycleRootAncestor();
+ s.nextFocus();
+ s.transferFocusUpCycle();
+ s.hasFocus();
+ s.isFocusOwner();
+ s.toString();
+ s.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ s.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ s.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ s.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJSplitPane.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JSplitPane constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJSplitPane
+ */
+
+public class HeadlessJSplitPane {
+ public static void main(String args[]) {
+ JSplitPane s = new JSplitPane();
+ s.getAccessibleContext();
+ s.isFocusTraversable();
+ s.setEnabled(false);
+ s.setEnabled(true);
+ s.requestFocus();
+ s.requestFocusInWindow();
+ s.getPreferredSize();
+ s.getMaximumSize();
+ s.getMinimumSize();
+ s.contains(1, 2);
+ Insets ins = s.getInsets();
+ s.getAlignmentY();
+ s.getAlignmentX();
+ s.getGraphics();
+ s.setVisible(false);
+ s.setVisible(true);
+ s.setForeground(Color.red);
+ s.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ s.setFont(f1);
+ s.setFont(f2);
+ s.setFont(f3);
+ s.setFont(f4);
+
+ s.getFontMetrics(f1);
+ s.getFontMetrics(f2);
+ s.getFontMetrics(f3);
+ s.getFontMetrics(f4);
+ }
+ }
+ s.enable();
+ s.disable();
+ s.reshape(10, 10, 10, 10);
+ s.getBounds(new Rectangle(1, 1, 1, 1));
+ s.getSize(new Dimension(1, 2));
+ s.getLocation(new Point(1, 2));
+ s.getX();
+ s.getY();
+ s.getWidth();
+ s.getHeight();
+ s.isOpaque();
+ s.isValidateRoot();
+ s.isOptimizedDrawingEnabled();
+ s.isDoubleBuffered();
+ s.getComponentCount();
+ s.countComponents();
+ s.getComponent(1);
+ s.getComponent(2);
+ Component[] cs = s.getComponents();
+ s.getLayout();
+ s.setLayout(new FlowLayout());
+ s.doLayout();
+ s.layout();
+ s.invalidate();
+ s.validate();
+ s.preferredSize();
+ s.minimumSize();
+ s.getComponentAt(1, 2);
+ s.locate(1, 2);
+ s.getComponentAt(new Point(1, 2));
+ s.isFocusCycleRoot(new Container());
+ s.transferFocusBackward();
+ s.setName("goober");
+ s.getName();
+ s.getParent();
+ s.getPeer();
+ s.getGraphicsConfiguration();
+ s.getTreeLock();
+ s.getToolkit();
+ s.isValid();
+ s.isDisplayable();
+ s.isVisible();
+ s.isShowing();
+ s.isEnabled();
+ s.enable(false);
+ s.enable(true);
+ s.enableInputMethods(false);
+ s.enableInputMethods(true);
+ s.show();
+ s.show(false);
+ s.show(true);
+ s.hide();
+ s.getForeground();
+ s.isForegroundSet();
+ s.getBackground();
+ s.isBackgroundSet();
+ s.getFont();
+ s.isFontSet();
+ Container c = new Container();
+ c.add(s);
+ s.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ s.setLocale(locale);
+
+ s.getColorModel();
+ s.getLocation();
+
+ boolean exceptions = false;
+ try {
+ s.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ s.location();
+ s.setLocation(1, 2);
+ s.move(1, 2);
+ s.setLocation(new Point(1, 2));
+ s.getSize();
+ s.size();
+ s.setSize(1, 32);
+ s.resize(1, 32);
+ s.setSize(new Dimension(1, 32));
+ s.resize(new Dimension(1, 32));
+ s.getBounds();
+ s.bounds();
+ s.setBounds(10, 10, 10, 10);
+ s.setBounds(new Rectangle(10, 10, 10, 10));
+ s.isLightweight();
+ s.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ s.getCursor();
+ s.isCursorSet();
+ s.inside(1, 2);
+ s.contains(new Point(1, 2));
+ s.isFocusable();
+ s.setFocusable(true);
+ s.setFocusable(false);
+ s.transferFocus();
+ s.getFocusCycleRootAncestor();
+ s.nextFocus();
+ s.transferFocusUpCycle();
+ s.hasFocus();
+ s.isFocusOwner();
+ s.toString();
+ s.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ s.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ s.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ s.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJTabbedPane.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JTabbedPane constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJTabbedPane
+ */
+
+public class HeadlessJTabbedPane {
+ public static void main(String args[]) {
+ JTabbedPane s = new JTabbedPane();
+ s.getAccessibleContext();
+ s.isFocusTraversable();
+ s.setEnabled(false);
+ s.setEnabled(true);
+ s.requestFocus();
+ s.requestFocusInWindow();
+ s.getPreferredSize();
+ s.getMaximumSize();
+ s.getMinimumSize();
+ s.contains(1, 2);
+ Component c1 = s.add(new Component(){});
+ Component c2 = s.add(new Component(){});
+ Component c3 = s.add(new Component(){});
+ Insets ins = s.getInsets();
+ s.getAlignmentY();
+ s.getAlignmentX();
+ s.getGraphics();
+ s.setVisible(false);
+ s.setVisible(true);
+ s.setForeground(Color.red);
+ s.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ s.setFont(f1);
+ s.setFont(f2);
+ s.setFont(f3);
+ s.setFont(f4);
+
+ s.getFontMetrics(f1);
+ s.getFontMetrics(f2);
+ s.getFontMetrics(f3);
+ s.getFontMetrics(f4);
+ }
+ }
+ s.enable();
+ s.disable();
+ s.reshape(10, 10, 10, 10);
+ s.getBounds(new Rectangle(1, 1, 1, 1));
+ s.getSize(new Dimension(1, 2));
+ s.getLocation(new Point(1, 2));
+ s.getX();
+ s.getY();
+ s.getWidth();
+ s.getHeight();
+ s.isOpaque();
+ s.isValidateRoot();
+ s.isOptimizedDrawingEnabled();
+ s.isDoubleBuffered();
+ s.getComponentCount();
+ s.countComponents();
+ s.getComponent(1);
+ s.getComponent(2);
+ Component[] cs = s.getComponents();
+ s.getLayout();
+ s.setLayout(new FlowLayout());
+ s.doLayout();
+ s.layout();
+ s.invalidate();
+ s.validate();
+ s.remove(0);
+ s.remove(c2);
+ s.removeAll();
+ s.preferredSize();
+ s.minimumSize();
+ s.getComponentAt(1, 2);
+ s.locate(1, 2);
+ s.getComponentAt(new Point(1, 2));
+ s.isFocusCycleRoot(new Container());
+ s.transferFocusBackward();
+ s.setName("goober");
+ s.getName();
+ s.getParent();
+ s.getPeer();
+ s.getGraphicsConfiguration();
+ s.getTreeLock();
+ s.getToolkit();
+ s.isValid();
+ s.isDisplayable();
+ s.isVisible();
+ s.isShowing();
+ s.isEnabled();
+ s.enable(false);
+ s.enable(true);
+ s.enableInputMethods(false);
+ s.enableInputMethods(true);
+ s.show();
+ s.show(false);
+ s.show(true);
+ s.hide();
+ s.getForeground();
+ s.isForegroundSet();
+ s.getBackground();
+ s.isBackgroundSet();
+ s.getFont();
+ s.isFontSet();
+ Container c = new Container();
+ c.add(s);
+ s.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ s.setLocale(locale);
+
+ s.getColorModel();
+ s.getLocation();
+
+ boolean exceptions = false;
+ try {
+ s.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ s.location();
+ s.setLocation(1, 2);
+ s.move(1, 2);
+ s.setLocation(new Point(1, 2));
+ s.getSize();
+ s.size();
+ s.setSize(1, 32);
+ s.resize(1, 32);
+ s.setSize(new Dimension(1, 32));
+ s.resize(new Dimension(1, 32));
+ s.getBounds();
+ s.bounds();
+ s.setBounds(10, 10, 10, 10);
+ s.setBounds(new Rectangle(10, 10, 10, 10));
+ s.isLightweight();
+ s.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ s.getCursor();
+ s.isCursorSet();
+ s.inside(1, 2);
+ s.contains(new Point(1, 2));
+ s.isFocusable();
+ s.setFocusable(true);
+ s.setFocusable(false);
+ s.transferFocus();
+ s.getFocusCycleRootAncestor();
+ s.nextFocus();
+ s.transferFocusUpCycle();
+ s.hasFocus();
+ s.isFocusOwner();
+ s.toString();
+ s.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ s.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ s.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ s.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJTable.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,214 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableModel;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JTable constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJTable
+ */
+
+public class HeadlessJTable {
+ public static void main(String args[]) {
+ JTable t;
+ t = new JTable();
+ final Object[][] data = {
+ {"cell_1_1", "cell_1_2", "cell_1_3"},
+ {"cell_2_1", "cell_2_2", "cell_2_3"},
+ {"cell_3_1", "cell_3_2", "cell_3_3"},
+ {"cell_4_1", "cell_4_2", "cell_4_3"},
+ };
+
+ TableModel dataModel = new AbstractTableModel() {
+ public int getColumnCount() { return 3; }
+ public int getRowCount() { return data.length;}
+ public Object getValueAt(int row, int col) {return data[row][col];}
+ };
+ t = new JTable(dataModel);
+
+ t.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
+ t.getAutoResizeMode();
+ t.getColumnModel().getColumn(1).setMinWidth(5);
+ t.getTableHeader().setReorderingAllowed(false);
+ t.getTableHeader().setResizingAllowed(false);
+
+ t.getAccessibleContext();
+ t.isFocusTraversable();
+ t.setEnabled(false);
+ t.setEnabled(true);
+ t.requestFocus();
+ t.requestFocusInWindow();
+ t.getPreferredSize();
+ t.getMaximumSize();
+ t.getMinimumSize();
+ t.contains(1, 2);
+ Component c1 = t.add(new Component(){});
+ Component c2 = t.add(new Component(){});
+ Component c3 = t.add(new Component(){});
+ Insets ins = t.getInsets();
+ t.getAlignmentY();
+ t.getAlignmentX();
+ t.getGraphics();
+ t.setVisible(false);
+ t.setVisible(true);
+ t.setForeground(Color.red);
+ t.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ t.setFont(f1);
+ t.setFont(f2);
+ t.setFont(f3);
+ t.setFont(f4);
+
+ t.getFontMetrics(f1);
+ t.getFontMetrics(f2);
+ t.getFontMetrics(f3);
+ t.getFontMetrics(f4);
+ }
+ }
+ t.enable();
+ t.disable();
+ t.reshape(10, 10, 10, 10);
+ t.getBounds(new Rectangle(1, 1, 1, 1));
+ t.getSize(new Dimension(1, 2));
+ t.getLocation(new Point(1, 2));
+ t.getX();
+ t.getY();
+ t.getWidth();
+ t.getHeight();
+ t.isOpaque();
+ t.isValidateRoot();
+ t.isOptimizedDrawingEnabled();
+ t.isDoubleBuffered();
+ t.getComponentCount();
+ t.countComponents();
+ t.getComponent(1);
+ t.getComponent(2);
+ Component[] cs = t.getComponents();
+ t.getLayout();
+ t.setLayout(new FlowLayout());
+ t.doLayout();
+ t.layout();
+ t.invalidate();
+ t.validate();
+ t.remove(0);
+ t.remove(c2);
+ t.removeAll();
+ t.preferredSize();
+ t.minimumSize();
+ t.getComponentAt(1, 2);
+ t.locate(1, 2);
+ t.getComponentAt(new Point(1, 2));
+ t.isFocusCycleRoot(new Container());
+ t.transferFocusBackward();
+ t.setName("goober");
+ t.getName();
+ t.getParent();
+ t.getPeer();
+ t.getGraphicsConfiguration();
+ t.getTreeLock();
+ t.getToolkit();
+ t.isValid();
+ t.isDisplayable();
+ t.isVisible();
+ t.isShowing();
+ t.isEnabled();
+ t.enable(false);
+ t.enable(true);
+ t.enableInputMethods(false);
+ t.enableInputMethods(true);
+ t.show();
+ t.show(false);
+ t.show(true);
+ t.hide();
+ t.getForeground();
+ t.isForegroundSet();
+ t.getBackground();
+ t.isBackgroundSet();
+ t.getFont();
+ t.isFontSet();
+ Container c = new Container();
+ c.add(t);
+ t.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ t.setLocale(locale);
+
+ t.getColorModel();
+ t.getLocation();
+
+ boolean exceptions = false;
+ try {
+ t.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ t.location();
+ t.setLocation(1, 2);
+ t.move(1, 2);
+ t.setLocation(new Point(1, 2));
+ t.getSize();
+ t.size();
+ t.setSize(1, 32);
+ t.resize(1, 32);
+ t.setSize(new Dimension(1, 32));
+ t.resize(new Dimension(1, 32));
+ t.getBounds();
+ t.bounds();
+ t.setBounds(10, 10, 10, 10);
+ t.setBounds(new Rectangle(10, 10, 10, 10));
+ t.isLightweight();
+ t.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ t.getCursor();
+ t.isCursorSet();
+ t.inside(1, 2);
+ t.contains(new Point(1, 2));
+ t.isFocusable();
+ t.setFocusable(true);
+ t.setFocusable(false);
+ t.transferFocus();
+ t.getFocusCycleRootAncestor();
+ t.nextFocus();
+ t.transferFocusUpCycle();
+ t.hasFocus();
+ t.isFocusOwner();
+ t.toString();
+ t.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ t.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ t.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ t.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJTextArea.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JTextArea constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJTextArea
+ */
+
+public class HeadlessJTextArea {
+ public static void main(String args[]) {
+ JTextArea t = new JTextArea();
+ t.selectAll();
+ t.getSelectionStart();
+ t.getSelectionEnd();
+
+ t.getAccessibleContext();
+ t.isFocusTraversable();
+ t.setEnabled(false);
+ t.setEnabled(true);
+ t.requestFocus();
+ t.requestFocusInWindow();
+ t.getPreferredSize();
+ t.getMaximumSize();
+ t.getMinimumSize();
+ t.contains(1, 2);
+ Component c1 = t.add(new Component(){});
+ Component c2 = t.add(new Component(){});
+ Component c3 = t.add(new Component(){});
+ Insets ins = t.getInsets();
+ t.getAlignmentY();
+ t.getAlignmentX();
+ t.getGraphics();
+ t.setVisible(false);
+ t.setVisible(true);
+ t.setForeground(Color.red);
+ t.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ t.setFont(f1);
+ t.setFont(f2);
+ t.setFont(f3);
+ t.setFont(f4);
+
+ t.getFontMetrics(f1);
+ t.getFontMetrics(f2);
+ t.getFontMetrics(f3);
+ t.getFontMetrics(f4);
+ }
+ }
+ t.enable();
+ t.disable();
+ t.reshape(10, 10, 10, 10);
+ t.getBounds(new Rectangle(1, 1, 1, 1));
+ t.getSize(new Dimension(1, 2));
+ t.getLocation(new Point(1, 2));
+ t.getX();
+ t.getY();
+ t.getWidth();
+ t.getHeight();
+ t.isOpaque();
+ t.isValidateRoot();
+ t.isOptimizedDrawingEnabled();
+ t.isDoubleBuffered();
+ t.getComponentCount();
+ t.countComponents();
+ t.getComponent(1);
+ t.getComponent(2);
+ Component[] cs = t.getComponents();
+ t.getLayout();
+ t.setLayout(new FlowLayout());
+ t.doLayout();
+ t.layout();
+ t.invalidate();
+ t.validate();
+ t.remove(0);
+ t.remove(c2);
+ t.removeAll();
+ t.preferredSize();
+ t.minimumSize();
+ t.getComponentAt(1, 2);
+ t.locate(1, 2);
+ t.getComponentAt(new Point(1, 2));
+ t.isFocusCycleRoot(new Container());
+ t.transferFocusBackward();
+ t.setName("goober");
+ t.getName();
+ t.getParent();
+ t.getPeer();
+ t.getGraphicsConfiguration();
+ t.getTreeLock();
+ t.getToolkit();
+ t.isValid();
+ t.isDisplayable();
+ t.isVisible();
+ t.isShowing();
+ t.isEnabled();
+ t.enable(false);
+ t.enable(true);
+ t.enableInputMethods(false);
+ t.enableInputMethods(true);
+ t.show();
+ t.show(false);
+ t.show(true);
+ t.hide();
+ t.getForeground();
+ t.isForegroundSet();
+ t.getBackground();
+ t.isBackgroundSet();
+ t.getFont();
+ t.isFontSet();
+ Container c = new Container();
+ c.add(t);
+ t.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ t.setLocale(locale);
+
+ t.getColorModel();
+ t.getLocation();
+
+ boolean exceptions = false;
+ try {
+ t.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ t.location();
+ t.setLocation(1, 2);
+ t.move(1, 2);
+ t.setLocation(new Point(1, 2));
+ t.getSize();
+ t.size();
+ t.setSize(1, 32);
+ t.resize(1, 32);
+ t.setSize(new Dimension(1, 32));
+ t.resize(new Dimension(1, 32));
+ t.getBounds();
+ t.bounds();
+ t.setBounds(10, 10, 10, 10);
+ t.setBounds(new Rectangle(10, 10, 10, 10));
+ t.isLightweight();
+ t.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ t.getCursor();
+ t.isCursorSet();
+ t.inside(1, 2);
+ t.contains(new Point(1, 2));
+ t.isFocusable();
+ t.setFocusable(true);
+ t.setFocusable(false);
+ t.transferFocus();
+ t.getFocusCycleRootAncestor();
+ t.nextFocus();
+ t.transferFocusUpCycle();
+ t.hasFocus();
+ t.isFocusOwner();
+ t.toString();
+ t.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ t.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ t.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ t.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJTextField.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JTextField constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJTextField
+ */
+
+public class HeadlessJTextField {
+ public static void main(String args[]) {
+ JTextField t = new JTextField();
+ t.selectAll();
+ t.getSelectionStart();
+ t.getSelectionEnd();
+
+ t.getAccessibleContext();
+ t.isFocusTraversable();
+ t.setEnabled(false);
+ t.setEnabled(true);
+ t.requestFocus();
+ t.requestFocusInWindow();
+ t.getPreferredSize();
+ t.getMaximumSize();
+ t.getMinimumSize();
+ t.contains(1, 2);
+ Component c1 = t.add(new Component(){});
+ Component c2 = t.add(new Component(){});
+ Component c3 = t.add(new Component(){});
+ Insets ins = t.getInsets();
+ t.getAlignmentY();
+ t.getAlignmentX();
+ t.getGraphics();
+ t.setVisible(false);
+ t.setVisible(true);
+ t.setForeground(Color.red);
+ t.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ t.setFont(f1);
+ t.setFont(f2);
+ t.setFont(f3);
+ t.setFont(f4);
+
+ t.getFontMetrics(f1);
+ t.getFontMetrics(f2);
+ t.getFontMetrics(f3);
+ t.getFontMetrics(f4);
+ }
+ }
+ t.enable();
+ t.disable();
+ t.reshape(10, 10, 10, 10);
+ t.getBounds(new Rectangle(1, 1, 1, 1));
+ t.getSize(new Dimension(1, 2));
+ t.getLocation(new Point(1, 2));
+ t.getX();
+ t.getY();
+ t.getWidth();
+ t.getHeight();
+ t.isOpaque();
+ t.isValidateRoot();
+ t.isOptimizedDrawingEnabled();
+ t.isDoubleBuffered();
+ t.getComponentCount();
+ t.countComponents();
+ t.getComponent(1);
+ t.getComponent(2);
+ Component[] cs = t.getComponents();
+ t.getLayout();
+ t.setLayout(new FlowLayout());
+ t.doLayout();
+ t.layout();
+ t.invalidate();
+ t.validate();
+ t.remove(0);
+ t.remove(c2);
+ t.removeAll();
+ t.preferredSize();
+ t.minimumSize();
+ t.getComponentAt(1, 2);
+ t.locate(1, 2);
+ t.getComponentAt(new Point(1, 2));
+ t.isFocusCycleRoot(new Container());
+ t.transferFocusBackward();
+ t.setName("goober");
+ t.getName();
+ t.getParent();
+ t.getPeer();
+ t.getGraphicsConfiguration();
+ t.getTreeLock();
+ t.getToolkit();
+ t.isValid();
+ t.isDisplayable();
+ t.isVisible();
+ t.isShowing();
+ t.isEnabled();
+ t.enable(false);
+ t.enable(true);
+ t.enableInputMethods(false);
+ t.enableInputMethods(true);
+ t.show();
+ t.show(false);
+ t.show(true);
+ t.hide();
+ t.getForeground();
+ t.isForegroundSet();
+ t.getBackground();
+ t.isBackgroundSet();
+ t.getFont();
+ t.isFontSet();
+ Container c = new Container();
+ c.add(t);
+ t.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ t.setLocale(locale);
+
+ t.getColorModel();
+ t.getLocation();
+
+ boolean exceptions = false;
+ try {
+ t.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ t.location();
+ t.setLocation(1, 2);
+ t.move(1, 2);
+ t.setLocation(new Point(1, 2));
+ t.getSize();
+ t.size();
+ t.setSize(1, 32);
+ t.resize(1, 32);
+ t.setSize(new Dimension(1, 32));
+ t.resize(new Dimension(1, 32));
+ t.getBounds();
+ t.bounds();
+ t.setBounds(10, 10, 10, 10);
+ t.setBounds(new Rectangle(10, 10, 10, 10));
+ t.isLightweight();
+ t.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ t.getCursor();
+ t.isCursorSet();
+ t.inside(1, 2);
+ t.contains(new Point(1, 2));
+ t.isFocusable();
+ t.setFocusable(true);
+ t.setFocusable(false);
+ t.transferFocus();
+ t.getFocusCycleRootAncestor();
+ t.nextFocus();
+ t.transferFocusUpCycle();
+ t.hasFocus();
+ t.isFocusOwner();
+ t.toString();
+ t.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ t.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ t.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ t.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJTextPane.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that JTextPane constructor and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJTextPane
+ */
+
+public class HeadlessJTextPane {
+
+ public static void main(String args[]) {
+ JTextPane tp;
+ tp = new JTextPane();
+ tp.getEditorKit();
+ tp.setContentType("text/html");
+ tp.getContentType();
+ tp.setText("Merry Parrot");
+ tp.getText();
+ tp.getDocument();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJToggleButton.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JToggleButton constructors and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJToggleButton
+ */
+
+public class HeadlessJToggleButton {
+ public static void main(String args[]) {
+ JToggleButton tb = new JToggleButton();
+ tb.getAccessibleContext();
+ tb.isFocusTraversable();
+ tb.setEnabled(false);
+ tb.setEnabled(true);
+ tb.requestFocus();
+ tb.requestFocusInWindow();
+ tb.getPreferredSize();
+ tb.getMaximumSize();
+ tb.getMinimumSize();
+ tb.contains(1, 2);
+ Component c1 = tb.add(new Component(){});
+ Component c2 = tb.add(new Component(){});
+ Component c3 = tb.add(new Component(){});
+ Insets ins = tb.getInsets();
+ tb.getAlignmentY();
+ tb.getAlignmentX();
+ tb.getGraphics();
+ tb.setVisible(false);
+ tb.setVisible(true);
+ tb.setForeground(Color.red);
+ tb.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ tb.setFont(f1);
+ tb.setFont(f2);
+ tb.setFont(f3);
+ tb.setFont(f4);
+
+ tb.getFontMetrics(f1);
+ tb.getFontMetrics(f2);
+ tb.getFontMetrics(f3);
+ tb.getFontMetrics(f4);
+ }
+ }
+ tb.enable();
+ tb.disable();
+ tb.reshape(10, 10, 10, 10);
+ tb.getBounds(new Rectangle(1, 1, 1, 1));
+ tb.getSize(new Dimension(1, 2));
+ tb.getLocation(new Point(1, 2));
+ tb.getX();
+ tb.getY();
+ tb.getWidth();
+ tb.getHeight();
+ tb.isOpaque();
+ tb.isValidateRoot();
+ tb.isOptimizedDrawingEnabled();
+ tb.isDoubleBuffered();
+ tb.getComponentCount();
+ tb.countComponents();
+ tb.getComponent(1);
+ tb.getComponent(2);
+ Component[] cs = tb.getComponents();
+ tb.getLayout();
+ tb.setLayout(new FlowLayout());
+ tb.doLayout();
+ tb.layout();
+ tb.invalidate();
+ tb.validate();
+ tb.remove(0);
+ tb.remove(c2);
+ tb.removeAll();
+ tb.preferredSize();
+ tb.minimumSize();
+ tb.getComponentAt(1, 2);
+ tb.locate(1, 2);
+ tb.getComponentAt(new Point(1, 2));
+ tb.isFocusCycleRoot(new Container());
+ tb.transferFocusBackward();
+ tb.setName("goober");
+ tb.getName();
+ tb.getParent();
+ tb.getPeer();
+ tb.getGraphicsConfiguration();
+ tb.getTreeLock();
+ tb.getToolkit();
+ tb.isValid();
+ tb.isDisplayable();
+ tb.isVisible();
+ tb.isShowing();
+ tb.isEnabled();
+ tb.enable(false);
+ tb.enable(true);
+ tb.enableInputMethods(false);
+ tb.enableInputMethods(true);
+ tb.show();
+ tb.show(false);
+ tb.show(true);
+ tb.hide();
+ tb.getForeground();
+ tb.isForegroundSet();
+ tb.getBackground();
+ tb.isBackgroundSet();
+ tb.getFont();
+ tb.isFontSet();
+ Container c = new Container();
+ c.add(tb);
+ tb.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ tb.setLocale(locale);
+
+ tb.getColorModel();
+ tb.getLocation();
+
+ boolean exceptions = false;
+ try {
+ tb.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ tb.location();
+ tb.setLocation(1, 2);
+ tb.move(1, 2);
+ tb.setLocation(new Point(1, 2));
+ tb.getSize();
+ tb.size();
+ tb.setSize(1, 32);
+ tb.resize(1, 32);
+ tb.setSize(new Dimension(1, 32));
+ tb.resize(new Dimension(1, 32));
+ tb.getBounds();
+ tb.bounds();
+ tb.setBounds(10, 10, 10, 10);
+ tb.setBounds(new Rectangle(10, 10, 10, 10));
+ tb.isLightweight();
+ tb.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ tb.getCursor();
+ tb.isCursorSet();
+ tb.inside(1, 2);
+ tb.contains(new Point(1, 2));
+ tb.isFocusable();
+ tb.setFocusable(true);
+ tb.setFocusable(false);
+ tb.transferFocus();
+ tb.getFocusCycleRootAncestor();
+ tb.nextFocus();
+ tb.transferFocusUpCycle();
+ tb.hasFocus();
+ tb.isFocusOwner();
+ tb.toString();
+ tb.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ tb.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ tb.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ tb.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJToolBar.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JToolBar constructors and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJToolBar
+ */
+
+public class HeadlessJToolBar {
+ public static void main(String args[]) {
+ JToolBar tb = new JToolBar();
+ tb.getAccessibleContext();
+ tb.isFocusTraversable();
+ tb.setEnabled(false);
+ tb.setEnabled(true);
+ tb.requestFocus();
+ tb.requestFocusInWindow();
+ tb.getPreferredSize();
+ tb.getMaximumSize();
+ tb.getMinimumSize();
+ tb.contains(1, 2);
+ Component c1 = tb.add(new Component(){});
+ Component c2 = tb.add(new Component(){});
+ Component c3 = tb.add(new Component(){});
+ Insets ins = tb.getInsets();
+ tb.getAlignmentY();
+ tb.getAlignmentX();
+ tb.getGraphics();
+ tb.setVisible(false);
+ tb.setVisible(true);
+ tb.setForeground(Color.red);
+ tb.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ tb.setFont(f1);
+ tb.setFont(f2);
+ tb.setFont(f3);
+ tb.setFont(f4);
+
+ tb.getFontMetrics(f1);
+ tb.getFontMetrics(f2);
+ tb.getFontMetrics(f3);
+ tb.getFontMetrics(f4);
+ }
+ }
+ tb.enable();
+ tb.disable();
+ tb.reshape(10, 10, 10, 10);
+ tb.getBounds(new Rectangle(1, 1, 1, 1));
+ tb.getSize(new Dimension(1, 2));
+ tb.getLocation(new Point(1, 2));
+ tb.getX();
+ tb.getY();
+ tb.getWidth();
+ tb.getHeight();
+ tb.isOpaque();
+ tb.isValidateRoot();
+ tb.isOptimizedDrawingEnabled();
+ tb.isDoubleBuffered();
+ tb.getComponentCount();
+ tb.countComponents();
+ tb.getComponent(1);
+ tb.getComponent(2);
+ Component[] cs = tb.getComponents();
+ tb.getLayout();
+ tb.setLayout(new FlowLayout());
+ tb.doLayout();
+ tb.layout();
+ tb.invalidate();
+ tb.validate();
+ tb.remove(0);
+ tb.remove(c2);
+ tb.removeAll();
+ tb.preferredSize();
+ tb.minimumSize();
+ tb.getComponentAt(1, 2);
+ tb.locate(1, 2);
+ tb.getComponentAt(new Point(1, 2));
+ tb.isFocusCycleRoot(new Container());
+ tb.transferFocusBackward();
+ tb.setName("goober");
+ tb.getName();
+ tb.getParent();
+ tb.getPeer();
+ tb.getGraphicsConfiguration();
+ tb.getTreeLock();
+ tb.getToolkit();
+ tb.isValid();
+ tb.isDisplayable();
+ tb.isVisible();
+ tb.isShowing();
+ tb.isEnabled();
+ tb.enable(false);
+ tb.enable(true);
+ tb.enableInputMethods(false);
+ tb.enableInputMethods(true);
+ tb.show();
+ tb.show(false);
+ tb.show(true);
+ tb.hide();
+ tb.getForeground();
+ tb.isForegroundSet();
+ tb.getBackground();
+ tb.isBackgroundSet();
+ tb.getFont();
+ tb.isFontSet();
+ Container c = new Container();
+ c.add(tb);
+ tb.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ tb.setLocale(locale);
+
+ tb.getColorModel();
+ tb.getLocation();
+
+ boolean exceptions = false;
+ try {
+ tb.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ tb.location();
+ tb.setLocation(1, 2);
+ tb.move(1, 2);
+ tb.setLocation(new Point(1, 2));
+ tb.getSize();
+ tb.size();
+ tb.setSize(1, 32);
+ tb.resize(1, 32);
+ tb.setSize(new Dimension(1, 32));
+ tb.resize(new Dimension(1, 32));
+ tb.getBounds();
+ tb.bounds();
+ tb.setBounds(10, 10, 10, 10);
+ tb.setBounds(new Rectangle(10, 10, 10, 10));
+ tb.isLightweight();
+ tb.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ tb.getCursor();
+ tb.isCursorSet();
+ tb.inside(1, 2);
+ tb.contains(new Point(1, 2));
+ tb.isFocusable();
+ tb.setFocusable(true);
+ tb.setFocusable(false);
+ tb.transferFocus();
+ tb.getFocusCycleRootAncestor();
+ tb.nextFocus();
+ tb.transferFocusUpCycle();
+ tb.hasFocus();
+ tb.isFocusOwner();
+ tb.toString();
+ tb.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ tb.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ tb.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ tb.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJToolBar_Separator.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JToolBar.Separator constructors and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJToolBar_Separator
+ */
+
+public class HeadlessJToolBar_Separator {
+ public static void main(String args[]) {
+ JToolBar.Separator s = new JToolBar.Separator();
+ s.getAccessibleContext();
+ s.isFocusTraversable();
+ s.setEnabled(false);
+ s.setEnabled(true);
+ s.requestFocus();
+ s.requestFocusInWindow();
+ s.getPreferredSize();
+ s.getMaximumSize();
+ s.getMinimumSize();
+ s.contains(1, 2);
+ Component c1 = s.add(new Component(){});
+ Component c2 = s.add(new Component(){});
+ Component c3 = s.add(new Component(){});
+ Insets ins = s.getInsets();
+ s.getAlignmentY();
+ s.getAlignmentX();
+ s.getGraphics();
+ s.setVisible(false);
+ s.setVisible(true);
+ s.setForeground(Color.red);
+ s.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ s.setFont(f1);
+ s.setFont(f2);
+ s.setFont(f3);
+ s.setFont(f4);
+
+ s.getFontMetrics(f1);
+ s.getFontMetrics(f2);
+ s.getFontMetrics(f3);
+ s.getFontMetrics(f4);
+ }
+ }
+ s.enable();
+ s.disable();
+ s.reshape(10, 10, 10, 10);
+ s.getBounds(new Rectangle(1, 1, 1, 1));
+ s.getSize(new Dimension(1, 2));
+ s.getLocation(new Point(1, 2));
+ s.getX();
+ s.getY();
+ s.getWidth();
+ s.getHeight();
+ s.isOpaque();
+ s.isValidateRoot();
+ s.isOptimizedDrawingEnabled();
+ s.isDoubleBuffered();
+ s.getComponentCount();
+ s.countComponents();
+ s.getComponent(1);
+ s.getComponent(2);
+ Component[] cs = s.getComponents();
+ s.getLayout();
+ s.setLayout(new FlowLayout());
+ s.doLayout();
+ s.layout();
+ s.invalidate();
+ s.validate();
+ s.remove(0);
+ s.remove(c2);
+ s.removeAll();
+ s.preferredSize();
+ s.minimumSize();
+ s.getComponentAt(1, 2);
+ s.locate(1, 2);
+ s.getComponentAt(new Point(1, 2));
+ s.isFocusCycleRoot(new Container());
+ s.transferFocusBackward();
+ s.setName("goober");
+ s.getName();
+ s.getParent();
+ s.getPeer();
+ s.getGraphicsConfiguration();
+ s.getTreeLock();
+ s.getToolkit();
+ s.isValid();
+ s.isDisplayable();
+ s.isVisible();
+ s.isShowing();
+ s.isEnabled();
+ s.enable(false);
+ s.enable(true);
+ s.enableInputMethods(false);
+ s.enableInputMethods(true);
+ s.show();
+ s.show(false);
+ s.show(true);
+ s.hide();
+ s.getForeground();
+ s.isForegroundSet();
+ s.getBackground();
+ s.isBackgroundSet();
+ s.getFont();
+ s.isFontSet();
+ Container c = new Container();
+ c.add(s);
+ s.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ s.setLocale(locale);
+
+ s.getColorModel();
+ s.getLocation();
+
+ boolean exceptions = false;
+ try {
+ s.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ s.location();
+ s.setLocation(1, 2);
+ s.move(1, 2);
+ s.setLocation(new Point(1, 2));
+ s.getSize();
+ s.size();
+ s.setSize(1, 32);
+ s.resize(1, 32);
+ s.setSize(new Dimension(1, 32));
+ s.resize(new Dimension(1, 32));
+ s.getBounds();
+ s.bounds();
+ s.setBounds(10, 10, 10, 10);
+ s.setBounds(new Rectangle(10, 10, 10, 10));
+ s.isLightweight();
+ s.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ s.getCursor();
+ s.isCursorSet();
+ s.inside(1, 2);
+ s.contains(new Point(1, 2));
+ s.isFocusable();
+ s.setFocusable(true);
+ s.setFocusable(false);
+ s.transferFocus();
+ s.getFocusCycleRootAncestor();
+ s.nextFocus();
+ s.transferFocusUpCycle();
+ s.hasFocus();
+ s.isFocusOwner();
+ s.toString();
+ s.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ s.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ s.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ s.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJToolTip.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JToolTip constructors and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJToolTip
+ */
+
+public class HeadlessJToolTip {
+ public static void main(String args[]) {
+ JToolTip tt = new JToolTip();
+ tt.getAccessibleContext();
+ tt.isFocusTraversable();
+ tt.setEnabled(false);
+ tt.setEnabled(true);
+ tt.requestFocus();
+ tt.requestFocusInWindow();
+ tt.getPreferredSize();
+ tt.getMaximumSize();
+ tt.getMinimumSize();
+ tt.contains(1, 2);
+ Component c1 = tt.add(new Component(){});
+ Component c2 = tt.add(new Component(){});
+ Component c3 = tt.add(new Component(){});
+ Insets ins = tt.getInsets();
+ tt.getAlignmentY();
+ tt.getAlignmentX();
+ tt.getGraphics();
+ tt.setVisible(false);
+ tt.setVisible(true);
+ tt.setForeground(Color.red);
+ tt.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ tt.setFont(f1);
+ tt.setFont(f2);
+ tt.setFont(f3);
+ tt.setFont(f4);
+
+ tt.getFontMetrics(f1);
+ tt.getFontMetrics(f2);
+ tt.getFontMetrics(f3);
+ tt.getFontMetrics(f4);
+ }
+ }
+ tt.enable();
+ tt.disable();
+ tt.reshape(10, 10, 10, 10);
+ tt.getBounds(new Rectangle(1, 1, 1, 1));
+ tt.getSize(new Dimension(1, 2));
+ tt.getLocation(new Point(1, 2));
+ tt.getX();
+ tt.getY();
+ tt.getWidth();
+ tt.getHeight();
+ tt.isOpaque();
+ tt.isValidateRoot();
+ tt.isOptimizedDrawingEnabled();
+ tt.isDoubleBuffered();
+ tt.getComponentCount();
+ tt.countComponents();
+ tt.getComponent(1);
+ tt.getComponent(2);
+ Component[] cs = tt.getComponents();
+ tt.getLayout();
+ tt.setLayout(new FlowLayout());
+ tt.doLayout();
+ tt.layout();
+ tt.invalidate();
+ tt.validate();
+ tt.remove(0);
+ tt.remove(c2);
+ tt.removeAll();
+ tt.preferredSize();
+ tt.minimumSize();
+ tt.getComponentAt(1, 2);
+ tt.locate(1, 2);
+ tt.getComponentAt(new Point(1, 2));
+ tt.isFocusCycleRoot(new Container());
+ tt.transferFocusBackward();
+ tt.setName("goober");
+ tt.getName();
+ tt.getParent();
+ tt.getPeer();
+ tt.getGraphicsConfiguration();
+ tt.getTreeLock();
+ tt.getToolkit();
+ tt.isValid();
+ tt.isDisplayable();
+ tt.isVisible();
+ tt.isShowing();
+ tt.isEnabled();
+ tt.enable(false);
+ tt.enable(true);
+ tt.enableInputMethods(false);
+ tt.enableInputMethods(true);
+ tt.show();
+ tt.show(false);
+ tt.show(true);
+ tt.hide();
+ tt.getForeground();
+ tt.isForegroundSet();
+ tt.getBackground();
+ tt.isBackgroundSet();
+ tt.getFont();
+ tt.isFontSet();
+ Container c = new Container();
+ c.add(tt);
+ tt.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ tt.setLocale(locale);
+
+ tt.getColorModel();
+ tt.getLocation();
+
+ boolean exceptions = false;
+ try {
+ tt.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ tt.location();
+ tt.setLocation(1, 2);
+ tt.move(1, 2);
+ tt.setLocation(new Point(1, 2));
+ tt.getSize();
+ tt.size();
+ tt.setSize(1, 32);
+ tt.resize(1, 32);
+ tt.setSize(new Dimension(1, 32));
+ tt.resize(new Dimension(1, 32));
+ tt.getBounds();
+ tt.bounds();
+ tt.setBounds(10, 10, 10, 10);
+ tt.setBounds(new Rectangle(10, 10, 10, 10));
+ tt.isLightweight();
+ tt.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ tt.getCursor();
+ tt.isCursorSet();
+ tt.inside(1, 2);
+ tt.contains(new Point(1, 2));
+ tt.isFocusable();
+ tt.setFocusable(true);
+ tt.setFocusable(false);
+ tt.transferFocus();
+ tt.getFocusCycleRootAncestor();
+ tt.nextFocus();
+ tt.transferFocusUpCycle();
+ tt.hasFocus();
+ tt.isFocusOwner();
+ tt.toString();
+ tt.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ tt.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ tt.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ tt.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJTree.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,232 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeCellRenderer;
+import javax.swing.tree.DefaultTreeModel;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JTree constructors and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJTree
+ */
+
+public class HeadlessJTree {
+ public static void main(String args[]) {
+ JTree t;
+
+ DefaultMutableTreeNode root = new DefaultMutableTreeNode("JTree");
+ DefaultMutableTreeNode parent;
+
+ parent = new DefaultMutableTreeNode("colors");
+ root.add(parent);
+ parent.add(new DefaultMutableTreeNode("blue"));
+ parent.add(new DefaultMutableTreeNode("violet"));
+ parent.add(new DefaultMutableTreeNode("red"));
+ parent.add(new DefaultMutableTreeNode("yellow"));
+
+ parent = new DefaultMutableTreeNode("sports");
+ root.add(parent);
+ parent.add(new DefaultMutableTreeNode("basketball"));
+ parent.add(new DefaultMutableTreeNode("soccer"));
+ parent.add(new DefaultMutableTreeNode("football"));
+ parent.add(new DefaultMutableTreeNode("hockey"));
+
+ parent = new DefaultMutableTreeNode("food");
+ root.add(parent);
+ parent.add(new DefaultMutableTreeNode("hot dogs"));
+ parent.add(new DefaultMutableTreeNode("pizza"));
+ parent.add(new DefaultMutableTreeNode("ravioli"));
+ parent.add(new DefaultMutableTreeNode("bananas"));
+
+ t = new JTree(root);
+ t = new JTree(new DefaultTreeModel(root));
+ t.setCellRenderer(new DefaultTreeCellRenderer() {
+ public Component getTreeCellRendererComponent(
+ JTree tree, Object value, boolean selected, boolean expanded,
+ boolean leaf, int row, boolean hasFocus) {
+ return super.getTreeCellRendererComponent(
+ tree, value, selected, expanded,
+ leaf, row, hasFocus);
+ }
+ });
+ t.getCellRenderer();
+
+ t.getAccessibleContext();
+ t.isFocusTraversable();
+ t.setEnabled(false);
+ t.setEnabled(true);
+ t.requestFocus();
+ t.requestFocusInWindow();
+ t.getPreferredSize();
+ t.getMaximumSize();
+ t.getMinimumSize();
+ t.contains(1, 2);
+ Component c1 = t.add(new Component(){});
+ Component c2 = t.add(new Component(){});
+ Component c3 = t.add(new Component(){});
+ Insets ins = t.getInsets();
+ t.getAlignmentY();
+ t.getAlignmentX();
+ t.getGraphics();
+ t.setVisible(false);
+ t.setVisible(true);
+ t.setForeground(Color.red);
+ t.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ t.setFont(f1);
+ t.setFont(f2);
+ t.setFont(f3);
+ t.setFont(f4);
+
+ t.getFontMetrics(f1);
+ t.getFontMetrics(f2);
+ t.getFontMetrics(f3);
+ t.getFontMetrics(f4);
+ }
+ }
+ t.enable();
+ t.disable();
+ t.reshape(10, 10, 10, 10);
+ t.getBounds(new Rectangle(1, 1, 1, 1));
+ t.getSize(new Dimension(1, 2));
+ t.getLocation(new Point(1, 2));
+ t.getX();
+ t.getY();
+ t.getWidth();
+ t.getHeight();
+ t.isOpaque();
+ t.isValidateRoot();
+ t.isOptimizedDrawingEnabled();
+ t.isDoubleBuffered();
+ t.getComponentCount();
+ t.countComponents();
+ t.getComponent(1);
+ t.getComponent(2);
+ Component[] cs = t.getComponents();
+ t.getLayout();
+ t.setLayout(new FlowLayout());
+ t.doLayout();
+ t.layout();
+ t.invalidate();
+ t.validate();
+ t.remove(0);
+ t.remove(c2);
+ t.removeAll();
+ t.preferredSize();
+ t.minimumSize();
+ t.getComponentAt(1, 2);
+ t.locate(1, 2);
+ t.getComponentAt(new Point(1, 2));
+ t.isFocusCycleRoot(new Container());
+ t.transferFocusBackward();
+ t.setName("goober");
+ t.getName();
+ t.getParent();
+ t.getPeer();
+ t.getGraphicsConfiguration();
+ t.getTreeLock();
+ t.getToolkit();
+ t.isValid();
+ t.isDisplayable();
+ t.isVisible();
+ t.isShowing();
+ t.isEnabled();
+ t.enable(false);
+ t.enable(true);
+ t.enableInputMethods(false);
+ t.enableInputMethods(true);
+ t.show();
+ t.show(false);
+ t.show(true);
+ t.hide();
+ t.getForeground();
+ t.isForegroundSet();
+ t.getBackground();
+ t.isBackgroundSet();
+ t.getFont();
+ t.isFontSet();
+ Container c = new Container();
+ c.add(t);
+ t.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ t.setLocale(locale);
+
+ t.getColorModel();
+ t.getLocation();
+
+ boolean exceptions = false;
+ try {
+ t.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ t.location();
+ t.setLocation(1, 2);
+ t.move(1, 2);
+ t.setLocation(new Point(1, 2));
+ t.getSize();
+ t.size();
+ t.setSize(1, 32);
+ t.resize(1, 32);
+ t.setSize(new Dimension(1, 32));
+ t.resize(new Dimension(1, 32));
+ t.getBounds();
+ t.bounds();
+ t.setBounds(10, 10, 10, 10);
+ t.setBounds(new Rectangle(10, 10, 10, 10));
+ t.isLightweight();
+ t.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ t.getCursor();
+ t.isCursorSet();
+ t.inside(1, 2);
+ t.contains(new Point(1, 2));
+ t.isFocusable();
+ t.setFocusable(true);
+ t.setFocusable(false);
+ t.transferFocus();
+ t.getFocusCycleRootAncestor();
+ t.nextFocus();
+ t.transferFocusUpCycle();
+ t.hasFocus();
+ t.isFocusOwner();
+ t.toString();
+ t.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ t.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ t.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ t.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJViewport.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,199 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Locale;
+
+/*
+ * @test
+ * @summary Check that JViewport constructors and methods do not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJViewport
+ */
+
+public class HeadlessJViewport {
+ public static void main(String args[]) {
+ JViewport v = new JViewport();
+ v.getUI();
+ v.getUIClassID();
+ v.setUI(null);
+ v.updateUI();
+
+ JComponent view = new JPanel();
+ view.setMinimumSize(new Dimension(123, 456));
+ v.setView(view);
+
+ v.getAccessibleContext();
+ v.isFocusTraversable();
+ v.setEnabled(false);
+ v.setEnabled(true);
+ v.requestFocus();
+ v.requestFocusInWindow();
+ v.getPreferredSize();
+ v.getMaximumSize();
+ v.getMinimumSize();
+ v.contains(1, 2);
+ Component c1 = v.add(new Component(){});
+ Component c2 = v.add(new Component(){});
+ Component c3 = v.add(new Component(){});
+ Insets ins = v.getInsets();
+ v.getAlignmentY();
+ v.getAlignmentX();
+ v.getGraphics();
+ v.setVisible(false);
+ v.setVisible(true);
+ v.setForeground(Color.red);
+ v.setBackground(Color.red);
+ for (String font : Toolkit.getDefaultToolkit().getFontList()) {
+ for (int j = 8; j < 17; j++) {
+ Font f1 = new Font(font, Font.PLAIN, j);
+ Font f2 = new Font(font, Font.BOLD, j);
+ Font f3 = new Font(font, Font.ITALIC, j);
+ Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j);
+
+ v.setFont(f1);
+ v.setFont(f2);
+ v.setFont(f3);
+ v.setFont(f4);
+
+ v.getFontMetrics(f1);
+ v.getFontMetrics(f2);
+ v.getFontMetrics(f3);
+ v.getFontMetrics(f4);
+ }
+ }
+ v.enable();
+ v.disable();
+ v.reshape(10, 10, 10, 10);
+ v.getBounds(new Rectangle(1, 1, 1, 1));
+ v.getSize(new Dimension(1, 2));
+ v.getLocation(new Point(1, 2));
+ v.getX();
+ v.getY();
+ v.getWidth();
+ v.getHeight();
+ v.isOpaque();
+ v.isValidateRoot();
+ v.isOptimizedDrawingEnabled();
+ v.isDoubleBuffered();
+ v.getComponentCount();
+ v.countComponents();
+ v.getComponent(0);
+ Component[] cs = v.getComponents();
+ v.getLayout();
+ v.setLayout(new FlowLayout());
+ v.doLayout();
+ v.layout();
+ v.invalidate();
+ v.validate();
+ v.remove(0);
+ v.remove(c2);
+ v.removeAll();
+ v.preferredSize();
+ v.minimumSize();
+ v.getComponentAt(1, 2);
+ v.locate(1, 2);
+ v.getComponentAt(new Point(1, 2));
+ v.isFocusCycleRoot(new Container());
+ v.transferFocusBackward();
+ v.setName("goober");
+ v.getName();
+ v.getParent();
+ v.getPeer();
+ v.getGraphicsConfiguration();
+ v.getTreeLock();
+ v.getToolkit();
+ v.isValid();
+ v.isDisplayable();
+ v.isVisible();
+ v.isShowing();
+ v.isEnabled();
+ v.enable(false);
+ v.enable(true);
+ v.enableInputMethods(false);
+ v.enableInputMethods(true);
+ v.show();
+ v.show(false);
+ v.show(true);
+ v.hide();
+ v.getForeground();
+ v.isForegroundSet();
+ v.getBackground();
+ v.isBackgroundSet();
+ v.getFont();
+ v.isFontSet();
+ Container c = new Container();
+ c.add(v);
+ v.getLocale();
+ for (Locale locale : Locale.getAvailableLocales())
+ v.setLocale(locale);
+
+ v.getColorModel();
+ v.getLocation();
+
+ boolean exceptions = false;
+ try {
+ v.getLocationOnScreen();
+ } catch (IllegalComponentStateException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("IllegalComponentStateException did not occur when expected");
+
+ v.location();
+ v.setLocation(1, 2);
+ v.move(1, 2);
+ v.setLocation(new Point(1, 2));
+ v.getSize();
+ v.size();
+ v.setSize(1, 32);
+ v.resize(1, 32);
+ v.setSize(new Dimension(1, 32));
+ v.resize(new Dimension(1, 32));
+ v.getBounds();
+ v.bounds();
+ v.setBounds(10, 10, 10, 10);
+ v.setBounds(new Rectangle(10, 10, 10, 10));
+ v.isLightweight();
+ v.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
+ v.getCursor();
+ v.isCursorSet();
+ v.inside(1, 2);
+ v.contains(new Point(1, 2));
+ v.isFocusable();
+ v.setFocusable(true);
+ v.setFocusable(false);
+ v.transferFocus();
+ v.getFocusCycleRootAncestor();
+ v.nextFocus();
+ v.transferFocusUpCycle();
+ v.hasFocus();
+ v.isFocusOwner();
+ v.toString();
+ v.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ v.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+ v.setComponentOrientation(ComponentOrientation.UNKNOWN);
+ v.getComponentOrientation();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessJWindow.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that JWindow constructors throw HeadlessException in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessJWindow
+ */
+
+public class HeadlessJWindow {
+ public static void main(String args[]) {
+ boolean exceptions = false;
+ JWindow w;
+
+ try {
+ w = new JWindow();
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ exceptions = false;
+ try {
+ w = new JWindow(new Frame("Frame title"));
+ } catch (HeadlessException e) {
+ exceptions = true;
+ }
+ if (!exceptions)
+ throw new RuntimeException("HeadlessException did not occur when expected");
+
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessLookAndFeel.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2014, 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.plaf.metal.MetalLookAndFeel;
+
+/*
+ * @test
+ * @summary Check that MetalLookAndFeel constructor does not throw unexpected
+ * exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessLookAndFeel
+ */
+
+public class HeadlessLookAndFeel {
+ public static void main(String args[]) {
+ new MetalLookAndFeel();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessMenuSelectionManager.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that MenuSelectionManager constructor and defaultManager() method do not
+ * throw unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessMenuSelectionManager
+ */
+
+public class HeadlessMenuSelectionManager {
+ public static void main(String args[]) {
+ MenuSelectionManager msm = new MenuSelectionManager();
+ msm = MenuSelectionManager.defaultManager();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessOverlayLayout.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+
+/*
+ * @test
+ * @summary Check that OverlayLayout constructor does not throw unexpected exceptions
+ * in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessOverlayLayout
+ */
+
+public class HeadlessOverlayLayout {
+ public static void main(String args[]) {
+ OverlayLayout msm = new OverlayLayout(new Container());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessPopupFactory.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that PopupFactory.getSharedInstance() method does not throw
+ * unexpected exceptions in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessPopupFactory
+ */
+
+public class HeadlessPopupFactory {
+ public static void main(String args[]) {
+ PopupFactory msm = PopupFactory.getSharedInstance();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessScrollPaneLayout.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that ScrollPaneLayout constructor does not throw unexpected exceptions
+ * in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessScrollPaneLayout
+ */
+
+public class HeadlessScrollPaneLayout {
+ public static void main(String args[]) {
+ ScrollPaneLayout msm = new ScrollPaneLayout();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessSizeRequirements.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that SizeRequirements constructors do not throw unexpected exceptions
+ * in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessSizeRequirements
+ */
+
+public class HeadlessSizeRequirements {
+ public static void main(String args[]) {
+ SizeRequirements sr;
+ sr = new SizeRequirements();
+ sr = new SizeRequirements(20, 20, 20, (float) 1.0);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessSizeSequence.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that SizeSequence constructors do not throw unexpected exceptions
+ * in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessSizeSequence
+ */
+
+public class HeadlessSizeSequence {
+ public static void main(String args[]) {
+ SizeSequence ss;
+ ss = new SizeSequence();
+ ss = new SizeSequence(10);
+ ss = new SizeSequence(10, 10);
+ ss = new SizeSequence(new int[]{1, 2, 3, 4, 5, 6, 76, 9});
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessSpinnerListModel.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.util.LinkedList;
+
+/*
+ * @test
+ * @summary Check that SpinnerListModel constructors and methods do not throw unexpected exceptions
+ * in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessSpinnerListModel
+ */
+
+public class HeadlessSpinnerListModel {
+ public static void main(String args[]) {
+ LinkedList list = new LinkedList();
+ list.add("prev");
+ list.add("this");
+ list.add("next");
+ SpinnerListModel m;
+ m = new SpinnerListModel(list);
+ m = new SpinnerListModel(new String[]{"prev", "this", "next"});
+ m.getList();
+ m.setList(list);
+ m.setValue("next");
+ m.getNextValue();
+ m.getPreviousValue();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessSpinnerNumberModel.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that SpinnerNumberModel constructor and methods do not throw unexpected exceptions
+ * in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessSpinnerNumberModel
+ */
+
+public class HeadlessSpinnerNumberModel {
+ public static void main(String args[]) {
+ SpinnerNumberModel model = new SpinnerNumberModel();
+ model.setValue(5);
+ model.getValue();
+ model.getPreviousValue();
+ model.getNextValue();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/Headless/HeadlessTimer.java Fri Jun 20 16:48:30 2014 +0400
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2014, 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.*;
+
+/*
+ * @test
+ * @summary Check that Timer constructors do not throw unexpected exceptions
+ * in headless mode
+ * @run main/othervm -Djava.awt.headless=true HeadlessTimer
+ */
+
+public class HeadlessTimer {
+ public static void main(String args[]) {
+ Timer t = new Timer(100, null);
+ }
+}