changeset 25203:ea684628f900

8047180: Move functional tests AWT_Headless/Automated to OpenJDK repository Reviewed-by: pchelko, alexsch Contributed-by: Dmitriy Ermashov <dmitriy.ermashov@oracle.com>
author yan
date Fri, 20 Jun 2014 16:48:30 +0400
parents a617d3450e3e
children 65c62411e10f
files jdk/test/java/awt/AlphaComposite/HeadlessAlphaComposite.java jdk/test/java/awt/Color/HeadlessColor.java jdk/test/java/awt/Component/Headless/HeadlessButton.java jdk/test/java/awt/Component/Headless/HeadlessCanvas.java jdk/test/java/awt/Component/Headless/HeadlessCheckbox.java jdk/test/java/awt/Component/Headless/HeadlessChoice.java jdk/test/java/awt/Component/Headless/HeadlessComponent.java jdk/test/java/awt/Component/Headless/HeadlessContainer.java jdk/test/java/awt/Component/Headless/HeadlessDialog.java jdk/test/java/awt/Component/Headless/HeadlessFileDialog.java jdk/test/java/awt/Component/Headless/HeadlessFrame.java jdk/test/java/awt/Component/Headless/HeadlessLabel.java jdk/test/java/awt/Component/Headless/HeadlessList.java jdk/test/java/awt/Component/Headless/HeadlessPanel.java jdk/test/java/awt/Component/Headless/HeadlessScrollPane.java jdk/test/java/awt/Component/Headless/HeadlessScrollbar.java jdk/test/java/awt/Component/Headless/HeadlessTextArea.java jdk/test/java/awt/Component/Headless/HeadlessTextField.java jdk/test/java/awt/Component/Headless/HeadlessWindow.java jdk/test/java/awt/Cursor/HeadlessCursor.java jdk/test/java/awt/EventQueue/HeadlessEventQueue.java jdk/test/java/awt/Focus/Headless/HeadlessContainerOrderFocusTraversalPolicy.java jdk/test/java/awt/Focus/Headless/HeadlessDefaultFocusTraversalPolicy.java jdk/test/java/awt/Focus/Headless/HeadlessDefaultKeyboardFocusManager.java jdk/test/java/awt/FontClass/HeadlessFont.java jdk/test/java/awt/GradientPaint/HeadlessGradientPaint.java jdk/test/java/awt/Graphics2D/Headless/HeadlessPoint.java jdk/test/java/awt/Graphics2D/Headless/HeadlessPolygon.java jdk/test/java/awt/Graphics2D/Headless/HeadlessRectangle.java jdk/test/java/awt/GraphicsConfiguration/HeadlessGraphicsConfiguration.java jdk/test/java/awt/GraphicsDevice/HeadlessGraphicsDevice.java jdk/test/java/awt/GraphicsEnvironment/HeadlessGraphicsEnvironment.java jdk/test/java/awt/Headless/HeadlessAWTEventMulticaster.java jdk/test/java/awt/Headless/HeadlessAWTException.java jdk/test/java/awt/Headless/HeadlessBasicStroke.java jdk/test/java/awt/Headless/HeadlessBorderLayout.java jdk/test/java/awt/Headless/HeadlessCardLayout.java jdk/test/java/awt/Headless/HeadlessCheckboxGroup.java jdk/test/java/awt/Headless/HeadlessCheckboxMenuItem.java jdk/test/java/awt/Headless/HeadlessComponentOrientation.java jdk/test/java/awt/Headless/HeadlessDimension.java jdk/test/java/awt/Headless/HeadlessFlowLayout.java jdk/test/java/awt/Headless/HeadlessMediaTracker.java jdk/test/java/awt/Headless/HeadlessPopupMenu.java jdk/test/java/awt/Insets/HeadlessInsets.java jdk/test/java/awt/Menu/Headless/HeadlessMenu.java jdk/test/java/awt/Menu/Headless/HeadlessMenuItem.java jdk/test/java/awt/Menu/Headless/HeadlessMenuShortcut.java jdk/test/java/awt/MenuBar/HeadlessMenuBar.java jdk/test/java/awt/Toolkit/Headless/HeadlessToolkit.java jdk/test/java/awt/applet/Applet/HeadlessApplet.java jdk/test/java/awt/datatransfer/Headless/HeadlessClipboard.java jdk/test/java/awt/datatransfer/Headless/HeadlessDataFlavor.java jdk/test/java/awt/datatransfer/Headless/HeadlessSystemFlavorMap.java jdk/test/java/awt/im/Headless/HeadlessInputContext.java jdk/test/java/awt/im/Headless/HeadlessInputMethodHighlight.java jdk/test/java/awt/image/Headless/HeadlessAffineTransformOp.java jdk/test/java/awt/image/Headless/HeadlessAreaAveragingScaleFilter.java jdk/test/java/awt/image/Headless/HeadlessBufferedImage.java jdk/test/java/awt/image/Headless/HeadlessBufferedImageFilter.java jdk/test/java/awt/image/Headless/HeadlessColorModel.java jdk/test/java/awt/image/Headless/HeadlessCropImageFilter.java jdk/test/java/awt/image/Headless/HeadlessImageFilter.java jdk/test/java/awt/image/Headless/HeadlessIndexColorModel.java jdk/test/java/awt/image/Headless/HeadlessRGBImageFilter.java jdk/test/java/awt/image/Headless/HeadlessReplicateScaleFilter.java jdk/test/java/awt/print/Headless/HeadlessBook.java jdk/test/java/awt/print/Headless/HeadlessPageFormat.java jdk/test/java/awt/print/Headless/HeadlessPaper.java jdk/test/java/awt/print/Headless/HeadlessPrinterJob.java jdk/test/javax/swing/Headless/HeadlessAbstractSpinnerModel.java jdk/test/javax/swing/Headless/HeadlessBox.java jdk/test/javax/swing/Headless/HeadlessBox_Filler.java jdk/test/javax/swing/Headless/HeadlessCellRendererPane.java jdk/test/javax/swing/Headless/HeadlessDefaultListCellRenderer.java jdk/test/javax/swing/Headless/HeadlessDefaultListCellRenderer_UIResource.java jdk/test/javax/swing/Headless/HeadlessGrayFilter.java jdk/test/javax/swing/Headless/HeadlessJApplet.java jdk/test/javax/swing/Headless/HeadlessJButton.java jdk/test/javax/swing/Headless/HeadlessJCheckBox.java jdk/test/javax/swing/Headless/HeadlessJCheckBoxMenuItem.java jdk/test/javax/swing/Headless/HeadlessJColorChooser.java jdk/test/javax/swing/Headless/HeadlessJComboBox.java jdk/test/javax/swing/Headless/HeadlessJComponent.java jdk/test/javax/swing/Headless/HeadlessJDesktopPane.java jdk/test/javax/swing/Headless/HeadlessJDialog.java jdk/test/javax/swing/Headless/HeadlessJEditorPane.java jdk/test/javax/swing/Headless/HeadlessJFileChooser.java jdk/test/javax/swing/Headless/HeadlessJFormattedTextField.java jdk/test/javax/swing/Headless/HeadlessJFrame.java jdk/test/javax/swing/Headless/HeadlessJInternalFrame.java jdk/test/javax/swing/Headless/HeadlessJInternalFrame_JDesktopIcon.java jdk/test/javax/swing/Headless/HeadlessJLabel.java jdk/test/javax/swing/Headless/HeadlessJLayeredPane.java jdk/test/javax/swing/Headless/HeadlessJList.java jdk/test/javax/swing/Headless/HeadlessJMenu.java jdk/test/javax/swing/Headless/HeadlessJMenuBar.java jdk/test/javax/swing/Headless/HeadlessJMenuItem.java jdk/test/javax/swing/Headless/HeadlessJOptionPane.java jdk/test/javax/swing/Headless/HeadlessJPanel.java jdk/test/javax/swing/Headless/HeadlessJPasswordField.java jdk/test/javax/swing/Headless/HeadlessJPopupMenu.java jdk/test/javax/swing/Headless/HeadlessJPopupMenu_Separator.java jdk/test/javax/swing/Headless/HeadlessJProgressBar.java jdk/test/javax/swing/Headless/HeadlessJRadioButton.java jdk/test/javax/swing/Headless/HeadlessJRadioButtonMenuItem.java jdk/test/javax/swing/Headless/HeadlessJRootPane.java jdk/test/javax/swing/Headless/HeadlessJScrollBar.java jdk/test/javax/swing/Headless/HeadlessJScrollPane.java jdk/test/javax/swing/Headless/HeadlessJSeparator.java jdk/test/javax/swing/Headless/HeadlessJSlider.java jdk/test/javax/swing/Headless/HeadlessJSpinner.java jdk/test/javax/swing/Headless/HeadlessJSplitPane.java jdk/test/javax/swing/Headless/HeadlessJTabbedPane.java jdk/test/javax/swing/Headless/HeadlessJTable.java jdk/test/javax/swing/Headless/HeadlessJTextArea.java jdk/test/javax/swing/Headless/HeadlessJTextField.java jdk/test/javax/swing/Headless/HeadlessJTextPane.java jdk/test/javax/swing/Headless/HeadlessJToggleButton.java jdk/test/javax/swing/Headless/HeadlessJToolBar.java jdk/test/javax/swing/Headless/HeadlessJToolBar_Separator.java jdk/test/javax/swing/Headless/HeadlessJToolTip.java jdk/test/javax/swing/Headless/HeadlessJTree.java jdk/test/javax/swing/Headless/HeadlessJViewport.java jdk/test/javax/swing/Headless/HeadlessJWindow.java jdk/test/javax/swing/Headless/HeadlessLookAndFeel.java jdk/test/javax/swing/Headless/HeadlessMenuSelectionManager.java jdk/test/javax/swing/Headless/HeadlessOverlayLayout.java jdk/test/javax/swing/Headless/HeadlessPopupFactory.java jdk/test/javax/swing/Headless/HeadlessScrollPaneLayout.java jdk/test/javax/swing/Headless/HeadlessSizeRequirements.java jdk/test/javax/swing/Headless/HeadlessSizeSequence.java jdk/test/javax/swing/Headless/HeadlessSpinnerListModel.java jdk/test/javax/swing/Headless/HeadlessSpinnerNumberModel.java jdk/test/javax/swing/Headless/HeadlessTimer.java
diffstat 135 files changed, 15192 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /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.
+ *