1 package hudson.jnlp; 2 3 import javax.swing.BorderFactory ; 4 import javax.swing.ImageIcon ; 5 import javax.swing.JFrame ; 6 import javax.swing.JLabel ; 7 import javax.swing.JPanel ; 8 import javax.swing.WindowConstants ; 9 import java.awt.BorderLayout ; 10 import java.awt.Color ; 11 import java.awt.Dimension ; 12 import java.awt.HeadlessException ; 13 14 17 public class MainDialog extends JFrame { 18 19 private JLabel statusLabel; 20 21 public MainDialog() throws HeadlessException { 22 super("Hudson slave agent"); 23 24 ImageIcon background = new ImageIcon (getClass().getResource("title.png")); 25 26 JPanel foregroundPanel = new JPanel (new BorderLayout (10, 10)); 27 foregroundPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10)); 28 foregroundPanel.setOpaque(false); 29 30 statusLabel = new JLabel ("",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 (250,150)); 37 getContentPane().setBackground(Color.WHITE); 38 39 setLocationByPlatform(true); 40 setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); 41 } 42 43 public void status(String msg) { 44 statusLabel.setText(msg); 45 } 46 } 47 | Popular Tags |