| 1 19 package org.openharmonise.him.authentication.gui; 20 21 import java.awt.*; 22 import java.awt.event.*; 23 24 import javax.swing.*; 25 import javax.swing.border.*; 26 27 import org.openharmonise.vfs.gui.*; 28 29 30 37 public class LoginMessageDialog extends JDialog implements LayoutManager, ActionListener { 38 39 42 private JLabel m_logo = null; 43 44 47 private JLabel m_logoBuildings = null; 48 49 52 private JLabel m_logoPeople = null; 53 54 57 private JLabel m_logoFiles = null; 58 59 62 private JTextArea m_messageTextArea = null; 63 64 67 private JButton m_exitButton = null; 68 69 75 public LoginMessageDialog(Frame frame) throws HeadlessException { 76 super(frame, true); 77 this.setup(); 78 } 79 80 84 private void setup() { 85 86 this.setResizable(false); 87 88 JPanel panel = new JPanel(); 89 panel.setLayout(this); 90 this.getContentPane().setLayout(new BorderLayout()); 91 this.getContentPane().add(panel); 92 93 this.setTitle("Harmonise Information Manager"); 94 this.setSize(500,300); 95 panel.setBackground(new Color(224,224,224)); 96 97 int x = this.getGraphicsConfiguration().getBounds().width/2-this.getSize().width/2; 98 int y = this.getGraphicsConfiguration().getBounds().height/2-this.getSize().height/2; 99 100 this.setLocation(x, y); 101 102 m_logo = new JLabel(); 103 m_logo.setToolTipText("Connecting people and information to create knowledge"); 104 m_logo.setIcon( IconManager.getInstance().getIcon("login-sim-logo.png") ); 105 panel.add(m_logo); 106 107 m_logoBuildings = new JLabel(); 108 m_logoBuildings.setToolTipText("Conecting organisations"); 109 m_logoBuildings.setIcon( IconManager.getInstance().getIcon("login-sim-buildings.png") ); 110 panel.add(m_logoBuildings); 111 112 m_logoPeople = new JLabel(); 113 m_logoPeople.setToolTipText("Conecting people"); 114 m_logoPeople.setIcon( IconManager.getInstance().getIcon("login-sim-people.png") ); 115 panel.add(m_logoPeople); 116 117 m_logoFiles = new JLabel(); 118 m_logoFiles.setToolTipText("Conecting information"); 119 m_logoFiles.setIcon( IconManager.getInstance().getIcon("login-sim-files.png") ); 120 panel.add(m_logoFiles); 121 122 String fontName = "Dialog"; 123 int fontSize = 11; 124 Font font = new Font(fontName, Font.PLAIN, fontSize); 125 Font fontBold = new Font(fontName, Font.BOLD, fontSize); 126 127 this.m_messageTextArea = new JTextArea(); 128 this.m_messageTextArea.setOpaque(false); 129 this.m_messageTextArea.setFont(fontBold); 130 this.m_messageTextArea.setWrapStyleWord(true); 131 this.m_messageTextArea.setLineWrap(true); 132 this.m_messageTextArea.setTabSize(2); 133 134 LineBorder lineBorder = (LineBorder) BorderFactory.createLineBorder(Color.BLACK); 135 136 m_messageTextArea.setBorder( lineBorder ); 137 this.m_messageTextArea.setEditable(false); 138 panel.add(m_messageTextArea); 139 140 m_exitButton = new JButton("Exit"); 141 m_exitButton.setActionCommand("EXIT"); 142 m_exitButton.setFont(font); 143 m_exitButton.addActionListener(this); 144 panel.add(m_exitButton); 145 } 146 147 public static void main(String [] args) { 148 JFrame tempFrame = new JFrame(); 149 tempFrame.setIconImage( ((ImageIcon)IconManager.getInstance().getIcon("32-sim-logo.gif")).getImage() ); 150 LoginDialog login = new LoginDialog(tempFrame); 151 login.show(); 152 } 153 154 155 156 157 158 159 160 161 162 166 private LoginMessageDialog(Dialog arg0) throws HeadlessException { 167 super(arg0); 168 } 169 170 175 private LoginMessageDialog(Dialog arg0, boolean arg1) throws HeadlessException { 176 super(arg0, arg1); 177 } 178 179 183 private LoginMessageDialog() throws HeadlessException { 184 super(); 185 } 186 187 192 private LoginMessageDialog(Frame arg0, boolean arg1) throws HeadlessException { 193 super(arg0, arg1); 194 } 195 196 201 private LoginMessageDialog(Dialog arg0, String arg1) throws HeadlessException { 202 super(arg0, arg1); 203 } 204 205 211 private LoginMessageDialog(Dialog arg0, String arg1, boolean arg2) 212 throws HeadlessException { 213 super(arg0, arg1, arg2); 214 } 215 216 221 private LoginMessageDialog(Frame arg0, String arg1) throws HeadlessException { 222 super(arg0, arg1); 223 } 224 225 231 private LoginMessageDialog(Frame arg0, String arg1, boolean arg2) 232 throws HeadlessException { 233 super(arg0, arg1, arg2); 234 } 235 236 243 private LoginMessageDialog( 244 Dialog arg0, 245 String arg1, 246 boolean arg2, 247 GraphicsConfiguration arg3) 248 throws HeadlessException { 249 super(arg0, arg1, arg2, arg3); 250 } 251 252 258 private LoginMessageDialog( 259 Frame arg0, 260 String arg1, 261 boolean arg2, 262 GraphicsConfiguration arg3) { 263 super(arg0, arg1, arg2, arg3); 264 } 265 266 269 public void removeLayoutComponent(Component arg0) { 270 271 } 272 273 276 public void layoutContainer(Container arg0) { 277 m_logo.setLocation(10,10); 278 m_logo.setSize(new Dimension(200,50)); 279 280 m_logoBuildings.setLocation(320,10); 281 m_logoBuildings.setSize(new Dimension(50,50)); 282 283 m_logoPeople.setLocation(375,10); 284 m_logoPeople.setSize(new Dimension(50,50)); 285 286 m_logoFiles.setLocation(430,10); 287 m_logoFiles.setSize(new Dimension(50,50)); 288 289 this.m_messageTextArea.setLocation(10, 70); 290 m_messageTextArea.setSize(new Dimension(470, 150)); 291 292 m_exitButton.setLocation(410, 230); 293 m_exitButton.setSize(70,20); 294 } 295 296 301 public void setMessage(String sMessage) { 302 this.m_messageTextArea.setEditable(true); 303 this.m_messageTextArea.setText(sMessage); 304 this.m_messageTextArea.setEditable(false); 305 } 306 307 310 public void addLayoutComponent(String arg0, Component arg1) { 311 312 } 313 314 317 public Dimension minimumLayoutSize(Container arg0) { 318 return new Dimension(500,250); 319 } 320 321 324 public Dimension preferredLayoutSize(Container arg0) { 325 return new Dimension(500,250); 326 } 327 328 331 public void actionPerformed(ActionEvent ae) { 332 if(ae.getActionCommand().equals("EXIT")) { 333 this.hide(); 334 System.exit(0); 335 } 336 } 337 338 } 339 | Popular Tags |