Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/javax/swing/JInternalFrame/Test6802868.java
38839 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* @bug 680286826* @summary JInternalFrame is not maximized when maximized parent frame27* @author Alexander Potochkin28* @library ..29*/3031import java.awt.Dimension;32import java.awt.Point;33import java.beans.PropertyVetoException;34import javax.swing.JDesktopPane;35import javax.swing.JFrame;36import javax.swing.JInternalFrame;3738public class Test6802868 {3940public static void main(String[] args) throws Throwable {41SwingTest.start(Test6802868.class);42}4344private final JFrame frame;45private final JInternalFrame internal;46private Dimension size;47private Point location;4849public Test6802868(JFrame frame) {50JDesktopPane desktop = new JDesktopPane();5152this.frame = frame;53this.frame.add(desktop);5455this.internal = new JInternalFrame(getClass().getName(), true, true, true, true);56this.internal.setVisible(true);5758desktop.add(this.internal);59}6061public void firstAction() throws PropertyVetoException {62this.internal.setMaximum(true);63}6465public void firstTest() {66this.size = this.internal.getSize();67resizeFrame();68}6970public void firstValidation() {71if (this.internal.getSize().equals(this.size)) {72throw new Error("InternalFrame hasn't changed its size");73}74}7576public void secondAction() throws PropertyVetoException {77this.internal.setIcon(true);78}7980public void secondTest() {81this.location = this.internal.getDesktopIcon().getLocation();82resizeFrame();83}8485public void secondValidation() {86if (this.internal.getDesktopIcon().getLocation().equals(this.location)) {87throw new Error("JDesktopIcon hasn't moved");88}89}9091private void resizeFrame() {92Dimension size = this.frame.getSize();93size.width += 10;94size.height += 10;95this.frame.setSize(size);96}97}9899100