2 |
26 Feb 07 |
jari |
1 |
/* |
2 |
26 Feb 07 |
jari |
Copyright @ 1999-2005, The Institute for Genomic Research (TIGR). |
2 |
26 Feb 07 |
jari |
All rights reserved. |
2 |
26 Feb 07 |
jari |
4 |
*/ |
2 |
26 Feb 07 |
jari |
5 |
/* |
2 |
26 Feb 07 |
jari |
* DAMStatusDialog.java |
2 |
26 Feb 07 |
jari |
7 |
* |
2 |
26 Feb 07 |
jari |
8 |
*/ |
2 |
26 Feb 07 |
jari |
9 |
|
2 |
26 Feb 07 |
jari |
10 |
package org.tigr.microarray.mev.cluster.gui.impl.dam; |
2 |
26 Feb 07 |
jari |
11 |
|
2 |
26 Feb 07 |
jari |
12 |
import java.awt.Color; |
2 |
26 Feb 07 |
jari |
13 |
import java.awt.Dimension; |
2 |
26 Feb 07 |
jari |
14 |
import java.awt.GridBagConstraints; |
2 |
26 Feb 07 |
jari |
15 |
import java.awt.GridBagLayout; |
2 |
26 Feb 07 |
jari |
16 |
import java.awt.Toolkit; |
2 |
26 Feb 07 |
jari |
17 |
|
2 |
26 Feb 07 |
jari |
18 |
import javax.swing.JDialog; |
2 |
26 Feb 07 |
jari |
19 |
import javax.swing.JFrame; |
2 |
26 Feb 07 |
jari |
20 |
import javax.swing.JLabel; |
2 |
26 Feb 07 |
jari |
21 |
import javax.swing.JPanel; |
2 |
26 Feb 07 |
jari |
22 |
|
2 |
26 Feb 07 |
jari |
23 |
import org.tigr.microarray.mev.cluster.gui.impl.GUIFactory; |
2 |
26 Feb 07 |
jari |
24 |
/** |
2 |
26 Feb 07 |
jari |
25 |
* |
2 |
26 Feb 07 |
jari |
26 |
*/ |
2 |
26 Feb 07 |
jari |
27 |
public class DAMStatusDialog extends JDialog { |
2 |
26 Feb 07 |
jari |
28 |
|
2 |
26 Feb 07 |
jari |
29 |
private JLabel statusLabel, iconLabel; |
2 |
26 Feb 07 |
jari |
30 |
|
2 |
26 Feb 07 |
jari |
/** Creates a new instance of DAMStatusDialog */ |
2 |
26 Feb 07 |
jari |
32 |
public DAMStatusDialog(JFrame parentFrame, boolean modality) { |
2 |
26 Feb 07 |
jari |
33 |
super(parentFrame, modality); |
2 |
26 Feb 07 |
jari |
34 |
this.setTitle("DAM Classify Initialization"); |
2 |
26 Feb 07 |
jari |
35 |
setBounds(0, 0, 400, 200); |
2 |
26 Feb 07 |
jari |
36 |
this.getContentPane().setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
37 |
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); |
2 |
26 Feb 07 |
jari |
38 |
iconLabel = new JLabel(GUIFactory.getIcon("dialog_banner2.gif")); |
2 |
26 Feb 07 |
jari |
39 |
iconLabel.setOpaque(false); |
2 |
26 Feb 07 |
jari |
40 |
iconLabel.setAlignmentX(JLabel.LEFT_ALIGNMENT); |
2 |
26 Feb 07 |
jari |
41 |
statusLabel = new JLabel("DAM Status Dialog"); |
2 |
26 Feb 07 |
jari |
42 |
statusLabel.setBackground(Color.blue); |
2 |
26 Feb 07 |
jari |
43 |
GridBagLayout gridbag = new GridBagLayout(); |
2 |
26 Feb 07 |
jari |
44 |
GridBagConstraints constraints = new GridBagConstraints(); |
2 |
26 Feb 07 |
jari |
45 |
constraints.fill = GridBagConstraints.BOTH; |
2 |
26 Feb 07 |
jari |
46 |
|
2 |
26 Feb 07 |
jari |
47 |
this.getContentPane().setLayout(gridbag); |
2 |
26 Feb 07 |
jari |
48 |
|
2 |
26 Feb 07 |
jari |
49 |
JPanel iconPanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
50 |
GridBagLayout grid1 = new GridBagLayout(); |
2 |
26 Feb 07 |
jari |
51 |
|
2 |
26 Feb 07 |
jari |
52 |
iconPanel.setLayout(grid1); |
2 |
26 Feb 07 |
jari |
53 |
buildConstraints(constraints, 0, 0, 1, 1, 100, 100); |
2 |
26 Feb 07 |
jari |
54 |
grid1.setConstraints(iconPanel, constraints); |
2 |
26 Feb 07 |
jari |
55 |
iconPanel.add(iconLabel); |
2 |
26 Feb 07 |
jari |
56 |
|
2 |
26 Feb 07 |
jari |
//constraints.fill = GridBagConstraints.NONE; |
2 |
26 Feb 07 |
jari |
58 |
buildConstraints(constraints, 0, 0, 1, 1, 100, 3); |
2 |
26 Feb 07 |
jari |
59 |
gridbag.setConstraints(iconPanel, constraints); |
2 |
26 Feb 07 |
jari |
60 |
this.getContentPane().add(iconPanel); |
2 |
26 Feb 07 |
jari |
61 |
|
2 |
26 Feb 07 |
jari |
62 |
buildConstraints(constraints, 0, 1, 1, 1, 0, 97); |
2 |
26 Feb 07 |
jari |
63 |
constraints.fill = GridBagConstraints.NONE; |
2 |
26 Feb 07 |
jari |
64 |
gridbag.setConstraints(statusLabel, constraints); |
2 |
26 Feb 07 |
jari |
65 |
this.getContentPane().add(statusLabel); |
2 |
26 Feb 07 |
jari |
66 |
|
2 |
26 Feb 07 |
jari |
//setContentPane(this); |
2 |
26 Feb 07 |
jari |
68 |
} |
2 |
26 Feb 07 |
jari |
69 |
|
2 |
26 Feb 07 |
jari |
70 |
public void setVisible(boolean visible) { |
2 |
26 Feb 07 |
jari |
71 |
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); |
2 |
26 Feb 07 |
jari |
72 |
setLocation((screenSize.width - getSize().width)/2, (screenSize.height - getSize().height)/2); |
2 |
26 Feb 07 |
jari |
73 |
|
2 |
26 Feb 07 |
jari |
74 |
super.setVisible(visible); |
2 |
26 Feb 07 |
jari |
75 |
} |
2 |
26 Feb 07 |
jari |
76 |
|
2 |
26 Feb 07 |
jari |
77 |
void buildConstraints(GridBagConstraints gbc, int gx, int gy, |
2 |
26 Feb 07 |
jari |
78 |
int gw, int gh, int wx, int wy) { |
2 |
26 Feb 07 |
jari |
79 |
|
2 |
26 Feb 07 |
jari |
80 |
gbc.gridx = gx; |
2 |
26 Feb 07 |
jari |
81 |
gbc.gridy = gy; |
2 |
26 Feb 07 |
jari |
82 |
gbc.gridwidth = gw; |
2 |
26 Feb 07 |
jari |
83 |
gbc.gridheight = gh; |
2 |
26 Feb 07 |
jari |
84 |
gbc.weightx = wx; |
2 |
26 Feb 07 |
jari |
85 |
gbc.weighty = wy; |
2 |
26 Feb 07 |
jari |
86 |
} |
2 |
26 Feb 07 |
jari |
87 |
|
2 |
26 Feb 07 |
jari |
88 |
public static void main (String[] args) { |
2 |
26 Feb 07 |
jari |
89 |
DAMStatusDialog ksDialog = new DAMStatusDialog(new JFrame(), true); |
2 |
26 Feb 07 |
jari |
90 |
ksDialog.setVisible(true); |
2 |
26 Feb 07 |
jari |
91 |
} |
2 |
26 Feb 07 |
jari |
92 |
} |