lib/browser/awtUtilities/MessageDialog.java
changeset 6541 d3ac35b2bfbf
parent 3599 89cbba12863d
child 33686 8e33ca8832b1
equal deleted inserted replaced
6540:eaf90f6806df 6541:d3ac35b2bfbf
     8 ***************************************************************************/
     8 ***************************************************************************/
     9 
     9 
    10 package awtUtilities;
    10 package awtUtilities;
    11 
    11 
    12 import java.awt.*;
    12 import java.awt.*;
       
    13 import java.awt.event.*;
    13 
    14 
    14 public class MessageDialog extends Dialog {
    15 public class MessageDialog extends Dialog implements ActionListener {
    15 	String txt;
    16 	String txt;
    16 
    17 
    17 	public String getText() { return txt; }
    18 	public String getText() { return txt; }
    18 
    19 
    19 	public boolean action(Event evt, Object arg) {
    20 	public void actionPerformed(ActionEvent evt) {
    20 		if (evt.target instanceof Button) {
    21 		txt = evt.getActionCommand();
    21 			txt=(String)arg;
    22 		setVisible(false);
    22 			hide();
       
    23 			return true;
       
    24 		} else return false;
       
    25 	}
    23 	}
    26 
    24 
    27 	public MessageDialog(Frame parent,String title,String text,String []buttons) {
    25 	public MessageDialog(Frame parent,String title,String text,String []buttons) {
    28 		super(parent,title,true);
    26 		super(parent,title,true);
    29 		int i;
    27 		int i;
    46 					text=text.substring(pos+1);
    44 					text=text.substring(pos+1);
    47 			}
    45 			}
    48 		}
    46 		}
    49 
    47 
    50 		add(p1);add(p2);
    48 		add(p1);add(p2);
    51 		for (i=0;i<buttons.length;i++)
    49 		for (i=0;i<buttons.length;i++) {
    52 			p2.add(new Button(buttons[i]));
    50 			Button bt = new Button(buttons[i]);
       
    51 			p2.add(bt);
       
    52 			bt.addActionListener(this);
       
    53 		}
    53 	}
    54 	}
    54 }
    55 }