1341N/A/*
2362N/A * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
1341N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1341N/A *
1341N/A * This code is free software; you can redistribute it and/or modify it
1341N/A * under the terms of the GNU General Public License version 2 only, as
1341N/A * published by the Free Software Foundation.
1341N/A *
1341N/A * This code is distributed in the hope that it will be useful, but WITHOUT
1341N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1341N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1341N/A * version 2 for more details (a copy is included in the LICENSE file that
1341N/A * accompanied this code).
1341N/A *
1341N/A * You should have received a copy of the GNU General Public License version
1341N/A * 2 along with this work; if not, write to the Free Software Foundation,
1341N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1341N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
1341N/A */
1341N/A
1341N/A/*
1341N/A test
1341N/A @bug 5004032
1341N/A @summary GridBagConstraints.ipad(x|y) defined in a new way
1341N/A @author dav@sparc.spb.su area=
1341N/A @run applet GridBagLayoutIpadXYTest.html
1341N/A*/
1341N/A
1341N/Aimport java.applet.Applet;
1341N/Aimport java.awt.*;
1341N/A
1341N/Apublic class GridBagLayoutIpadXYTest extends Applet
1341N/A{
1341N/A Frame frame = new Frame();
1341N/A TextField jtf = null;
1341N/A final int customIpadx = 300;
1341N/A final int customIpady = 40;
1341N/A
1341N/A public void init()
1341N/A {
1341N/A this.setLayout (new BorderLayout ());
1341N/A
1341N/A String[] instructions =
1341N/A {
1341N/A "This is an AUTOMATIC test",
1341N/A "simply wait until it is done"
1341N/A };
1341N/A }//End init()
1341N/A
1341N/A public void start ()
1341N/A {
1341N/A validate();
1341N/A frame.setLayout(new GridBagLayout());
1341N/A GridBagConstraints gc = new GridBagConstraints();
1341N/A Insets fieldInsets = new Insets(0,5,5,0);
1341N/A
1341N/A gc.anchor = gc.NORTH;
1341N/A gc.fill = gc.HORIZONTAL;
1341N/A gc.gridx = 1;
1341N/A gc.gridy = 0;
1341N/A gc.weightx = 1;
1341N/A gc.ipadx = customIpadx;
1341N/A gc.ipady = customIpady;
1341N/A gc.insets = fieldInsets;
1341N/A jtf = new TextField();
1341N/A frame.add(jtf, gc);
1341N/A
1341N/A frame.pack();
1341N/A frame.setVisible(true);
1341N/A
1341N/A ((sun.awt.SunToolkit)Toolkit.getDefaultToolkit()).realSync();
1341N/A
1341N/A Dimension minSize = jtf.getMinimumSize();
1341N/A if ( minSize.width + customIpadx != jtf.getSize().width ||
1341N/A minSize.height + customIpady != jtf.getSize().height ){
1341N/A System.out.println("TextField originally has min size = " + jtf.getMinimumSize());
1341N/A System.out.println("TextField supplied with ipadx = 300, ipady =40");
1341N/A System.out.println("Frame size: " + frame.getSize());
1341N/A System.out.println(" Fields's size is "+jtf.getSize());
1341N/A
1341N/A throw new RuntimeException("Test Failed. TextField has incorrect width. ");
1341N/A }
1341N/A System.out.println("Test Passed.");
1341N/A
1341N/A }// start()
1341N/A}