|
|||||||||||||||||||
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 | |||||||||||||||
ContentFrame.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/07/12 0:00:57
|
|
6 |
*/
|
|
7 |
package org.asyrinx.brownie.swing.content;
|
|
8 |
|
|
9 |
import java.awt.Component;
|
|
10 |
import java.awt.Container;
|
|
11 |
import java.awt.HeadlessException;
|
|
12 |
|
|
13 |
import javax.swing.JFrame;
|
|
14 |
import javax.swing.JPanel;
|
|
15 |
|
|
16 |
/**
|
|
17 |
* @author akima
|
|
18 |
*
|
|
19 |
* TODO To change the template for this generated type comment go to Window -
|
|
20 |
* Preferences - Java - Code Style - Code Templates
|
|
21 |
*/
|
|
22 |
public class ContentFrame extends JFrame { |
|
23 |
|
|
24 |
protected final Component content;
|
|
25 |
|
|
26 |
/**
|
|
27 |
* @param title
|
|
28 |
* @throws java.awt.HeadlessException
|
|
29 |
*/
|
|
30 | 0 |
public ContentFrame(Component content, String title)
|
31 |
throws HeadlessException {
|
|
32 | 0 |
super(title);
|
33 | 0 |
this.content = content;
|
34 | 0 |
intiPane(); |
35 |
} |
|
36 |
|
|
37 | 0 |
protected void intiPane() { |
38 | 0 |
if (content instanceof Container) { |
39 | 0 |
this.setContentPane((Container) content);
|
40 |
} else {
|
|
41 | 0 |
final JPanel panel = new JPanel();
|
42 | 0 |
panel.add(content); |
43 | 0 |
this.setContentPane(panel);
|
44 |
} |
|
45 |
} |
|
46 |
|
|
47 |
/*
|
|
48 |
* (non-Javadoc)
|
|
49 |
*
|
|
50 |
* @see java.awt.Window#show()
|
|
51 |
*/
|
|
52 | 0 |
public void show() { |
53 | 0 |
invokeBeforeShow(); |
54 | 0 |
super.show();
|
55 | 0 |
invokeAfterShow(); |
56 |
} |
|
57 |
|
|
58 |
/**
|
|
59 |
*
|
|
60 |
*/
|
|
61 | 0 |
protected void invokeBeforeShow() { |
62 | 0 |
if (content instanceof WindowContent) |
63 | 0 |
((WindowContent) content).beforeShow(); |
64 |
} |
|
65 |
|
|
66 |
/**
|
|
67 |
*
|
|
68 |
*/
|
|
69 | 0 |
protected void invokeAfterShow() { |
70 | 0 |
if (content instanceof WindowContent) |
71 | 0 |
((WindowContent) content).afterShow(); |
72 |
} |
|
73 |
|
|
74 |
/*
|
|
75 |
* (non-Javadoc)
|
|
76 |
*
|
|
77 |
* @see java.awt.Window#hide()
|
|
78 |
*/
|
|
79 | 0 |
public void hide() { |
80 | 0 |
invokeBeforeHide(); |
81 | 0 |
super.hide();
|
82 | 0 |
invokeAfterHide(); |
83 |
} |
|
84 |
|
|
85 |
/**
|
|
86 |
*
|
|
87 |
*/
|
|
88 | 0 |
protected void invokeBeforeHide() { |
89 | 0 |
if (content instanceof WindowContent) |
90 | 0 |
((WindowContent) content).beforeHide(); |
91 |
} |
|
92 |
|
|
93 |
/**
|
|
94 |
*
|
|
95 |
*/
|
|
96 | 0 |
protected void invokeAfterHide() { |
97 | 0 |
if (content instanceof WindowContent) |
98 | 0 |
((WindowContent) content).afterHide(); |
99 |
} |
|
100 |
|
|
101 |
} |
|