1 package org.jacorb.poa.gui.beans; 2 3 22 23 29 public class MessageDialog extends java.awt.Dialog 30 implements CloseButtonPanelController, java.awt.event.WindowListener { 31 private String message = ""; 32 private int xPos = 0; 33 private int yPos = 0; 34 private CloseButtonPanel ivjButtonPanel = null; 35 private java.awt.Panel ivjContentsPane = null; 36 private java.awt.Label ivjMessageLabel = null; 37 private java.awt.Panel ivjWorkPanel = null; 38 42 43 public MessageDialog(java.awt.Frame parent) { 44 super(parent); 45 initialize(); 46 } 47 52 public MessageDialog(java.awt.Frame parent, String title) { 53 super(parent, title); 54 } 55 public MessageDialog(java.awt.Frame parent, String title, String _message) { 56 super(parent, title); 57 message = _message; 58 xPos = parent.getBounds().x + parent.getBounds().width/4; 59 yPos = parent.getBounds().y + parent.getBounds().height/3; 60 initialize(); 61 } 62 68 public MessageDialog(java.awt.Frame parent, String title, boolean modal) { 69 super(parent, title, modal); 70 } 71 76 public MessageDialog(java.awt.Frame parent, boolean modal) { 77 super(parent, modal); 78 } 79 public void _actionCloseButtonPressed() { 80 dispose(); 81 } 82 86 87 private void connEtoC1(java.awt.event.WindowEvent arg1) { 88 try { 89 this.dispose(); 92 } catch (java.lang.Throwable ivjExc) { 95 handleException(ivjExc); 98 } 99 } 100 104 105 private CloseButtonPanel getButtonPanel() { 106 if (ivjButtonPanel == null) { 107 try { 108 ivjButtonPanel = new org.jacorb.poa.gui.beans.CloseButtonPanel(); 109 ivjButtonPanel.setName("ButtonPanel"); 110 } catch (java.lang.Throwable ivjExc) { 113 handleException(ivjExc); 116 } 117 }; 118 return ivjButtonPanel; 119 } 120 124 125 private java.awt.Panel getContentsPane() { 126 if (ivjContentsPane == null) { 127 try { 128 ivjContentsPane = new java.awt.Panel (); 129 ivjContentsPane.setName("ContentsPane"); 130 ivjContentsPane.setLayout(new java.awt.BorderLayout ()); 131 getContentsPane().add(getButtonPanel(), "South"); 132 getContentsPane().add(getWorkPanel(), "Center"); 133 } catch (java.lang.Throwable ivjExc) { 136 handleException(ivjExc); 139 } 140 }; 141 return ivjContentsPane; 142 } 143 147 148 private java.awt.Label getMessageLabel() { 149 if (ivjMessageLabel == null) { 150 try { 151 ivjMessageLabel = new java.awt.Label (); 152 ivjMessageLabel.setName("MessageLabel"); 153 ivjMessageLabel.setAlignment(java.awt.Label.CENTER); 154 ivjMessageLabel.setText("Message"); 155 ivjMessageLabel.setBackground(java.awt.SystemColor.control); 156 } catch (java.lang.Throwable ivjExc) { 159 handleException(ivjExc); 162 } 163 }; 164 return ivjMessageLabel; 165 } 166 170 171 private java.awt.Panel getWorkPanel() { 172 if (ivjWorkPanel == null) { 173 try { 174 ivjWorkPanel = new java.awt.Panel (); 175 ivjWorkPanel.setName("WorkPanel"); 176 ivjWorkPanel.setLayout(new java.awt.BorderLayout ()); 177 getWorkPanel().add(getMessageLabel(), "Center"); 178 } catch (java.lang.Throwable ivjExc) { 181 handleException(ivjExc); 184 } 185 }; 186 return ivjWorkPanel; 187 } 188 192 private void handleException(Throwable exception) { 193 194 195 } 198 201 202 private void initConnections() { 203 this.addWindowListener(this); 206 } 207 210 211 private void initialize() { 212 setName("MessageDialog"); 215 setLayout(new java.awt.BorderLayout ()); 216 setBackground(java.awt.SystemColor.control); 217 setSize(420, 120); 218 setModal(true); 219 add(getContentsPane(), "Center"); 220 initConnections(); 221 getButtonPanel()._init(this, " OK "); 223 setLocation(xPos, yPos); 224 getMessageLabel().setText(message); 225 } 227 231 public static void main(java.lang.String [] args) { 232 try { 233 MessageDialog aMessageDialog = new org.jacorb.poa.gui.beans.MessageDialog(new java.awt.Frame ()); 234 aMessageDialog.setModal(true); 235 try { 236 Class aCloserClass = Class.forName("com.ibm.uvm.abt.edit.WindowCloser"); 237 Class parmTypes[] = { java.awt.Window .class }; 238 Object parms[] = { aMessageDialog }; 239 java.lang.reflect.Constructor aCtor = aCloserClass.getConstructor(parmTypes); 240 aCtor.newInstance(parms); 241 } catch (java.lang.Throwable exc) {}; 242 aMessageDialog.setVisible(true); 243 } catch (Throwable exception) { 244 System.err.println("Exception occurred in main() of java.awt.Dialog"); 245 exception.printStackTrace(System.out); 246 } 247 } 248 252 253 public void windowActivated(java.awt.event.WindowEvent e) { 254 } 259 263 264 public void windowClosed(java.awt.event.WindowEvent e) { 265 } 270 274 275 public void windowClosing(java.awt.event.WindowEvent e) { 276 if ((e.getSource() == this) ) { 279 connEtoC1(e); 280 } 281 } 284 288 289 public void windowDeactivated(java.awt.event.WindowEvent e) { 290 } 295 299 300 public void windowDeiconified(java.awt.event.WindowEvent e) { 301 } 306 310 311 public void windowIconified(java.awt.event.WindowEvent e) { 312 } 317 321 322 public void windowOpened(java.awt.event.WindowEvent e) { 323 } 328 329 } 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | Popular Tags |