diff --git a/test/javax/swing/border/Test4120351.java b/test/javax/swing/border/Test4120351.java new file mode 100644 index 0000000000000000000000000000000000000000..1253e638a0eb5a02fac3fed0a002decf939b3f7c --- /dev/null +++ b/test/javax/swing/border/Test4120351.java @@ -0,0 +1,43 @@ +/* + * Copyright 1999-2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* + * @test + * @bug 4120351 + * @summary Tests that the methods createEtchedBorder(int type) and + * createEtchedBorder(int type, Color highlight, Color shadows) are added + * @author Andrey Pikalev + */ + +import java.awt.Color; +import javax.swing.BorderFactory; +import javax.swing.border.EtchedBorder; + +public class Test4120351 { + public static void main(String[] args) { + BorderFactory.createEtchedBorder(EtchedBorder.RAISED); + BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); + BorderFactory.createEtchedBorder(EtchedBorder.RAISED, Color.BLACK, Color.WHITE); + BorderFactory.createEtchedBorder(EtchedBorder.LOWERED, Color.WHITE, Color.BLACK); + } +} diff --git a/test/javax/swing/border/Test4124729.java b/test/javax/swing/border/Test4124729.java new file mode 100644 index 0000000000000000000000000000000000000000..d48ce9d1d5f3d69a3489607daab477f04228ccd1 --- /dev/null +++ b/test/javax/swing/border/Test4124729.java @@ -0,0 +1,38 @@ +/* + * Copyright 1999-2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* + * @test + * @bug 4124729 + * @summary Test that constrtructor LineBorder(?,?,?) is public + * @author Andrey Pikalev + */ + +import java.awt.Color; +import javax.swing.border.LineBorder; + +public class Test4124729 { + public static void main(String[] args) { + new LineBorder(Color.BLUE, 3, true); + } +} diff --git a/test/javax/swing/border/Test4243289.html b/test/javax/swing/border/Test4243289.html new file mode 100644 index 0000000000000000000000000000000000000000..9133d99c582008f09546ee9acd84a8d282466f85 --- /dev/null +++ b/test/javax/swing/border/Test4243289.html @@ -0,0 +1,9 @@ + + +When applet starts, you'll see a panel with a TitledBorder with title "Panel Title". +If this title is overstriken with the border line, test fails, otherwise it passes. + + + + + diff --git a/test/javax/swing/border/Test4243289.java b/test/javax/swing/border/Test4243289.java new file mode 100644 index 0000000000000000000000000000000000000000..1c462a85973e49783d96c80c7334e53464ede785 --- /dev/null +++ b/test/javax/swing/border/Test4243289.java @@ -0,0 +1,52 @@ +/* + * Copyright 1999-2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* + * @test + * @bug 4243289 + * @summary Tests that TitledBorder do not draw line through its caption + * @author Peter Zhelezniakov + * @run applet/manual=yesno Test4243289.html + */ + +import java.awt.Font; +import javax.swing.BorderFactory; +import javax.swing.JApplet; +import javax.swing.JPanel; +import javax.swing.border.TitledBorder; + +public class Test4243289 extends JApplet { + public void init() { + Font font = new Font("Dialog", Font.PLAIN, 12); // NON-NLS: the font name + TitledBorder border = BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), + "Panel Title", // NON-NLS: the title of the border + TitledBorder.DEFAULT_JUSTIFICATION, + TitledBorder.DEFAULT_POSITION, + font); + + JPanel panel = new JPanel(); + panel.setBorder(border); + getContentPane().add(panel); + } +} diff --git a/test/javax/swing/border/Test4247606.html b/test/javax/swing/border/Test4247606.html new file mode 100644 index 0000000000000000000000000000000000000000..d501ab221d6ebb62d23b931de6d3d0c786fcb5fb --- /dev/null +++ b/test/javax/swing/border/Test4247606.html @@ -0,0 +1,10 @@ + + +If the button do not fit into the titled border bounds +and cover the bottom border's line then test fails. +Otherwise test passes. + + + + + diff --git a/test/javax/swing/border/Test4247606.java b/test/javax/swing/border/Test4247606.java new file mode 100644 index 0000000000000000000000000000000000000000..b598d4a1b9e3d656ca3f3f813f7b74dc6476f91d --- /dev/null +++ b/test/javax/swing/border/Test4247606.java @@ -0,0 +1,62 @@ +/* + * Copyright 2001-2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* + * @test + * @bug 4247606 + * @summary BorderedPane appears wrong with Title Position Below Bottom + * @author Andrey Pikalev + * @run applet/manual=yesno Test4247606.html + */ + +import java.awt.BorderLayout; +import java.awt.Color; +import javax.swing.BorderFactory; +import javax.swing.JApplet; +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.border.Border; +import javax.swing.border.TitledBorder; + +public class Test4247606 extends JApplet { + public void init() { + JButton button = new JButton("Button"); // NON-NLS: the button text + button.setBorder(BorderFactory.createLineBorder(Color.red, 1)); + + TitledBorder border = new TitledBorder("Bordered Pane"); // NON-NLS: the panel title + border.setTitlePosition(TitledBorder.BELOW_BOTTOM); + + JPanel panel = create(button, border); + panel.setBackground(Color.green); + + getContentPane().add(create(panel, BorderFactory.createEmptyBorder(10, 10, 10, 10))); + } + + private static JPanel create(JComponent component, Border border) { + JPanel panel = new JPanel(new BorderLayout()); + panel.setBorder(border); + panel.add(component); + return panel; + } +} diff --git a/test/javax/swing/border/Test4252164.html b/test/javax/swing/border/Test4252164.html new file mode 100644 index 0000000000000000000000000000000000000000..eb436c53fe38644d893ea4159edacbaa87e9f1f9 --- /dev/null +++ b/test/javax/swing/border/Test4252164.html @@ -0,0 +1,10 @@ + + +Please, ensure that rounded border is filled completely. +It should not contain white points inside. +Use Mouse Wheel to change thickness of the border. + + + + + diff --git a/test/javax/swing/border/Test4252164.java b/test/javax/swing/border/Test4252164.java new file mode 100644 index 0000000000000000000000000000000000000000..a39193fc6f90ca9dc8360a53c288e843dafd7c0c --- /dev/null +++ b/test/javax/swing/border/Test4252164.java @@ -0,0 +1,73 @@ +/* + * Copyright 2007-2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* + * @test + * @bug 4252164 + * @summary Tests rounded LineBorder for components + * @author Sergey Malenkov + * @run applet/manual=yesno Test4252164.html + */ + +import java.awt.Color; +import java.awt.event.MouseWheelEvent; +import java.awt.event.MouseWheelListener; +import javax.swing.JApplet; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.border.LineBorder; + +public class Test4252164 extends JApplet implements MouseWheelListener { + private int thickness; + private JLabel rounded; + private JLabel straight; + + public void mouseWheelMoved(MouseWheelEvent event) { + update(event.getWheelRotation()); + } + + public void init() { + add(createUI()); + addMouseWheelListener(this); + } + + private JPanel createUI() { + this.rounded = new JLabel("ROUNDED"); // NON-NLS: the label for rounded border + this.straight = new JLabel("STRAIGHT"); // NON-NLS: the label for straight border + + JPanel panel = new JPanel(); + panel.add(this.rounded); + panel.add(this.straight); + + update(10); + + return panel; + } + + private void update(int thickness) { + this.thickness += thickness; + + this.rounded.setBorder(new LineBorder(Color.RED, this.thickness, true)); + this.straight.setBorder(new LineBorder(Color.RED, this.thickness, false)); + } +} diff --git a/test/javax/swing/border/Test6461042.java b/test/javax/swing/border/Test6461042.java new file mode 100644 index 0000000000000000000000000000000000000000..3224b1db83e9f486b09d17ff557804dc9776707b --- /dev/null +++ b/test/javax/swing/border/Test6461042.java @@ -0,0 +1,57 @@ +/* + * Copyright 2006-2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/* + * @test + * @bug 6461042 + * @summary Tests that toString() doesn't cause StackOverflowException + * when a JComponent is its own border + * @author Shannon Hickey + */ + +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Insets; +import javax.swing.JComponent; +import javax.swing.border.Border; + +public class Test6461042 extends JComponent implements Border { + public static void main(String[] args) { + new Test6461042().toString(); + } + + public Test6461042() { + setBorder(this); + } + + public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { + } + + public Insets getBorderInsets(Component c) { + return null; + } + + public boolean isBorderOpaque() { + return false; + } +}