Path: blob/master/test/jdk/javax/swing/JInternalFrame/Test6802868.java
41152 views
/*1* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25* @key headful26* @bug 680286827* @summary JInternalFrame is not maximized when maximized parent frame28* @author Alexander Potochkin29* @library ..30*/3132import java.awt.Dimension;33import java.awt.Point;34import java.beans.PropertyVetoException;35import javax.swing.JDesktopPane;36import javax.swing.JFrame;37import javax.swing.JInternalFrame;3839public class Test6802868 {4041public static void main(String[] args) throws Throwable {42SwingTest.start(Test6802868.class);43}4445private final JFrame frame;46private final JInternalFrame internal;47private Dimension size;48private Point location;4950public Test6802868(JFrame frame) {51JDesktopPane desktop = new JDesktopPane();5253this.frame = frame;54this.frame.add(desktop);5556this.internal = new JInternalFrame(getClass().getName(), true, true, true, true);57this.internal.setVisible(true);5859desktop.add(this.internal);60}6162public void firstAction() throws PropertyVetoException {63this.internal.setMaximum(true);64}6566public void firstTest() {67this.size = this.internal.getSize();68resizeFrame();69}7071public void firstValidation() {72if (this.internal.getSize().equals(this.size)) {73throw new Error("InternalFrame hasn't changed its size");74}75}7677public void secondAction() throws PropertyVetoException {78this.internal.setIcon(true);79}8081public void secondTest() {82this.location = this.internal.getDesktopIcon().getLocation();83resizeFrame();84}8586public void secondValidation() {87if (this.internal.getDesktopIcon().getLocation().equals(this.location)) {88throw new Error("JDesktopIcon hasn't moved");89}90}9192private void resizeFrame() {93Dimension size = this.frame.getSize();94size.width += 10;95size.height += 10;96this.frame.setSize(size);97}98}99100101