1 23 import javax.swing.Box ; 24 25 public class ServerImplGUI implements Service, ServiceAttributes { 26 27 private String header = ""; 28 29 private int count = 0; 30 31 public void print (final String msg) { 32 javax.swing.JFrame f = new javax.swing.JFrame ("New Message (ServerGUI)"); 34 f.getContentPane().setLayout(new java.awt.BorderLayout ()); 35 Box b = Box.createVerticalBox(); 36 for (int i = 0; i < count; ++i) { 37 b.add(new javax.swing.JLabel (header + msg)); 38 } 39 f.getContentPane().add(b); 40 f.pack(); 41 java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); 42 f.setLocation((screenSize.width - f.getWidth()) / 2, (screenSize.height - f.getHeight()) / 2); 43 f.setVisible(true); 44 } 45 46 public String getHeader () { 47 return header; 48 } 49 50 public void setHeader (final String header) { 51 this.header = header; 52 } 53 54 public int getCount () { 55 return count; 56 } 57 58 public void setCount (final int count) { 59 this.count = count; 60 } 61 } 62 | Popular Tags |