3185N/A/*
3185N/A * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
3185N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3185N/A *
3185N/A * This code is free software; you can redistribute it and/or modify it
3185N/A * under the terms of the GNU General Public License version 2 only, as
3185N/A * published by the Free Software Foundation.
3185N/A *
3185N/A * This code is distributed in the hope that it will be useful, but WITHOUT
3185N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3185N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3185N/A * version 2 for more details (a copy is included in the LICENSE file that
3185N/A * accompanied this code).
3185N/A *
3185N/A * You should have received a copy of the GNU General Public License version
3185N/A * 2 along with this work; if not, write to the Free Software Foundation,
3185N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3185N/A *
3185N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3185N/A * or visit www.oracle.com if you need additional information or have any
3185N/A * questions.
3185N/A */
3185N/A
3185N/A/* @test
3185N/A @bug 6639507
3185N/A @summary Title of javax.swing.JDialog is null while spec says it's empty
3185N/A @author Pavel Porvatov
3185N/A*/
3185N/Aimport javax.swing.*;
3185N/Aimport java.awt.*;
3185N/A
3185N/Apublic class bug6639507 {
3185N/A public static void main(String[] args) {
3185N/A SwingUtilities.invokeLater(new Runnable() {
3185N/A public void run() {
3185N/A assertEmptyTitle(new Dialog((Frame) null), "new Dialog((Frame) null)");
3185N/A assertEmptyTitle(new Dialog((Frame) null, true), "new Dialog((Frame) null, true)");
3185N/A assertEmptyTitle(new Dialog((Dialog) null), "new Dialog((Dialog) null)");
3185N/A assertEmptyTitle(new Dialog((Window) null), "new Dialog((Window) null)");
3185N/A assertEmptyTitle(new Dialog(new Dialog((Window) null), Dialog.ModalityType.APPLICATION_MODAL),
3185N/A "new Dialog((Window) null), Dialog.ModalityType.APPLICATION_MODAL");
3185N/A
3185N/A assertEmptyTitle(new JDialog((Frame) null), "new JDialog((Frame) null)");
3185N/A assertEmptyTitle(new JDialog((Frame) null, true), "new JDialog((Frame) null, true)");
3185N/A assertEmptyTitle(new JDialog((Dialog) null), "new JDialog((Dialog) null)");
3185N/A assertEmptyTitle(new JDialog((Dialog) null, true), "new JDialog((Dialog) null, true)");
3185N/A assertEmptyTitle(new JDialog((Window) null), "new JDialog((Window) null)");
3185N/A assertEmptyTitle(new JDialog((Window) null, Dialog.ModalityType.APPLICATION_MODAL),
3185N/A "new JDialog((Window) null, Dialog.ModalityType.APPLICATION_MODAL)");
3185N/A }
3185N/A });
3185N/A }
3185N/A
3185N/A private static void assertEmptyTitle(Dialog dialog, String ctr) {
3185N/A String title = dialog.getTitle();
3185N/A
3185N/A if (title == null || title.length() > 0) {
3185N/A throw new RuntimeException("Title is not empty for constructor " + ctr);
3185N/A }
3185N/A }
3185N/A}