|
1 /* |
|
2 * Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. |
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 * |
|
5 * This code is free software; you can redistribute it and/or modify it |
|
6 * under the terms of the GNU General Public License version 2 only, as |
|
7 * published by the Free Software Foundation. |
|
8 * |
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
|
13 * accompanied this code). |
|
14 * |
|
15 * You should have received a copy of the GNU General Public License version |
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 * |
|
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
20 * CA 95054 USA or visit www.sun.com if you need additional information or |
|
21 * have any questions. |
|
22 */ |
|
23 |
|
24 /* @test |
|
25 * @bug 6925473 |
|
26 * @summary REGRESSION: JOptionPane in dialog is full-screen height |
|
27 * @author Pavel Porvatov |
|
28 * @run main bug6925473 |
|
29 */ |
|
30 |
|
31 import javax.swing.*; |
|
32 import java.awt.*; |
|
33 |
|
34 public class bug6925473 { |
|
35 private static final String LONG_TEXT = "Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. " + |
|
36 "DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. " + |
|
37 "This code is free software; you can redistribute it and/or modify it " + |
|
38 "under the terms of the GNU General Public License version 2 only, as " + |
|
39 "published by the Free Software Foundation. "; |
|
40 |
|
41 public static void main(String[] args) throws Exception { |
|
42 SwingUtilities.invokeAndWait(new Runnable() { |
|
43 public void run() { |
|
44 JTextArea textArea = new JTextArea(LONG_TEXT); |
|
45 |
|
46 Dimension preferredSize = textArea.getPreferredSize(); |
|
47 |
|
48 if (preferredSize.width <= 0 || preferredSize.height <= 0) { |
|
49 throw new RuntimeException("Invalid preferred size " + preferredSize); |
|
50 } |
|
51 |
|
52 JTextArea textAreaLW = new JTextArea(LONG_TEXT); |
|
53 |
|
54 textAreaLW.setLineWrap(true); |
|
55 |
|
56 Dimension preferredSizeLW = textAreaLW.getPreferredSize(); |
|
57 |
|
58 if (preferredSizeLW.width <= 0 || preferredSizeLW.height <= 0) { |
|
59 throw new RuntimeException("Invalid preferred size " + preferredSizeLW); |
|
60 } |
|
61 } |
|
62 }); |
|
63 } |
|
64 } |