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