1 26 27 28 package org.objectweb.mobilitools.util.gui; 29 30 31 import java.awt.*; 32 import java.awt.event.*; 33 34 35 public class AlertWindow extends Dialog implements ActionListener 36 { 37 Button OKbtn; 38 39 40 public AlertWindow(Frame frame, String title, String text, String button) 41 { 42 super(frame, title, true); 43 44 setLayout(new BorderLayout()); 45 TextArea textZone = new TextArea(text, 5, 30); 46 textZone.setEditable(false); 47 add("Center", textZone); 48 add("South", OKbtn = new Button(button)); 49 OKbtn.addActionListener(this); 50 addWindowListener(new OnWindowClosing()); 51 pack(); 52 show(); 53 } 54 55 56 public AlertWindow(boolean modal, Frame frame, String title, String text, String button) 57 { 58 super(frame, title, modal); 59 60 setLayout(new BorderLayout()); 61 TextArea textZone = new TextArea(text, 5, 30); 62 textZone.setEditable(false); 63 add("Center", textZone); 64 add("South", OKbtn = new Button(button)); 65 OKbtn.addActionListener(this); 66 addWindowListener(new OnWindowClosing()); 67 pack(); 68 show(); 69 } 70 71 72 76 77 public void actionPerformed(ActionEvent evt) 78 { 79 dispose(); 80 } 81 82 83 87 88 class OnWindowClosing extends WindowAdapter 89 { 90 public void windowClosing(WindowEvent e) 91 { 92 AlertWindow.this.dispose(); 93 } 94 } 95 } 96 | Popular Tags |