KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hudson > jnlp > MainDialog


1 package hudson.jnlp;
2
3 import javax.swing.BorderFactory JavaDoc;
4 import javax.swing.ImageIcon JavaDoc;
5 import javax.swing.JFrame JavaDoc;
6 import javax.swing.JLabel JavaDoc;
7 import javax.swing.JPanel JavaDoc;
8 import javax.swing.WindowConstants JavaDoc;
9 import java.awt.BorderLayout JavaDoc;
10 import java.awt.Color JavaDoc;
11 import java.awt.Dimension JavaDoc;
12 import java.awt.HeadlessException JavaDoc;
13
14 /**
15  * @author Kohsuke Kawaguchi
16  */

17 public class MainDialog extends JFrame JavaDoc {
18
19     private JLabel JavaDoc statusLabel;
20
21     public MainDialog() throws HeadlessException JavaDoc {
22         super("Hudson slave agent");
23
24         ImageIcon JavaDoc background = new ImageIcon JavaDoc(getClass().getResource("title.png"));
25
26         JPanel JavaDoc foregroundPanel = new JPanel JavaDoc(new BorderLayout JavaDoc(10, 10));
27         foregroundPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
28         foregroundPanel.setOpaque(false);
29
30         statusLabel = new JLabel JavaDoc("",JLabel.TRAILING);
31         foregroundPanel.add(statusLabel, BorderLayout.CENTER);
32
33         setContentPane(GUI.wrapInBackgroundImage(foregroundPanel, background,JLabel.BOTTOM,JLabel.LEADING));
34         pack();
35
36         setSize(new Dimension JavaDoc(250,150));
37         getContentPane().setBackground(Color.WHITE);
38
39         setLocationByPlatform(true);
40         setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
41     }
42
43     public void status(String JavaDoc msg) {
44         statusLabel.setText(msg);
45     }
46 }
47
Popular Tags