Clover coverage report - brownies library - 1.0-beta-1 Coverage timestamp: 月 8 16 2004 17:14:42 GMT+09:00 FRAMES NO FRAMES |
file stats: | LOC: | 78 |  | Methods: | 4
| NCLOC: | 59 |  | Classes: | 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
Source file | Conditionals | Statements | Methods | TOTAL
SwingUtils.java | 0% | 0% | 0% | 0% |

1 |  |
     /*
2 |  |
      * brownies and its relative products are published under the terms
3 |  |
      * of the Apache Software License.
4 |  |
      *
5 |  |
      * Created on 2004/05/27 1:04:01
6 |  |
      */
7 |  |
     package org.asyrinx.brownie.swing;
8 |  |
9 |  |
     import java.awt.Component;
10 |  |
     import java.awt.Dialog;
11 |  |
     import java.awt.Frame;
12 |  |
     import java.awt.Window;
13 |  |
14 |  |
     import javax.swing.JDialog;
15 |  |
     import javax.swing.JFrame;
16 |  |
     import javax.swing.SwingUtilities;
17 |  |
18 |  |
     import org.asyrinx.brownie.swing.content.ContentDialog;
19 |  |
     import org.asyrinx.brownie.swing.content.ContentFrame;
20 |  |
21 |  |
     /**
22 |  |
      * @author akima
23 |  |
      */
24 |  |
     public class SwingUtils {
25 |  |
26 | 0 |
         public static JFrame showComponentByFrame(Component component, int width,
27 |  |
                 int height, String title) {
28 | 0 |
             final ContentFrame frame = new ContentFrame(component, title);
29 | 0 |
             frame.setSize(width, height);
30 | 0 |
             frame.pack();
31 | 0 |
             frame.show();
32 | 0 |
             return frame;
33 |  |
         }
34 |  |
35 | 0 |
         public static JDialog showComponent(Component component, Component owner,
36 |  |
                 int width, int height, String title, boolean modal) {
37 | 0 |
             if (owner instanceof Frame) {
38 | 0 |
                 return showComponent(component, (Frame) owner, width, height,
39 |  |
                         title, modal);
40 | 0 |
             } else if (owner instanceof Dialog) {
41 | 0 |
                 return showComponent(component, (Dialog) owner, width, height,
42 |  |
                         title, modal);
43 |  |
             } else {
44 | 0 |
                 final Window window = SwingUtilities.getWindowAncestor(owner);
45 | 0 |
                 if (window instanceof Frame) {
46 | 0 |
                     return showComponent(component, (Frame) window, width, height,
47 |  |
                             title, modal);
48 | 0 |
                 } else if (window instanceof Dialog) {
49 | 0 |
                     return showComponent(component, (Dialog) window, width, height,
50 |  |
                             title, modal);
51 |  |
                 } else {
52 | 0 |
                     throw new GuiRuntimeException(
53 |  |
                             "owner and its window don't extended Frame or Dialog.");
54 |  |
                 }
55 |  |
             }
56 |  |
         }
57 |  |
58 | 0 |
         public static JDialog showComponent(Component component, Frame owner,
59 |  |
                 int width, int height, String title, boolean modal) {
60 | 0 |
             final ContentDialog dialog = new ContentDialog(component, owner, title,
61 |  |
                     modal);
62 | 0 |
             dialog.setSize(width, height);
63 | 0 |
             dialog.pack();
64 | 0 |
             dialog.show();
65 | 0 |
             return dialog;
66 |  |
         }
67 |  |
68 | 0 |
         public static JDialog showComponent(Component component, Dialog owner,
69 |  |
                 int width, int height, String title, boolean modal) {
70 | 0 |
             final ContentDialog dialog = new ContentDialog(component, owner, title,
71 |  |
                     modal);
72 | 0 |
             dialog.setSize(width, height);
73 | 0 |
             dialog.pack();
74 | 0 |
             dialog.show();
75 | 0 |
             return dialog;
76 |  |
         }
77 |  |
78 |  |
     }