package userClass; import java.awt.*; import java.awt.event.*; public class userDialog extends Dialog implements ActionListener{ public Button b1; public Button b2; public int dia = 0;//選択の結果を代入 public userDialog(Frame f, String title){ super(f,title,true); setResizable(false); setBackground(Color.white); setForeground(Color.black); dialoginit(); buttoninit(); } public void dialoginit(){//ダイアログ初期化 オーバーライト自由 setSize(100,100); } public void buttoninit(){//ボタンの初期化&レイアウト オーバーライト自由 b1 = new Button("はい"); b1.addActionListener(this); Panel p = new Panel(); p.add(b1); setLayout(new BorderLayout()); /* ラベルは呼び出し側から貼る インスタンス.add("Center", new Label("確認", Label.CENTER)); */ add("South",p); } public void actionPerformed(ActionEvent e){ if(e.getSource() == b1){ dia = 1; dispose(); } } public int getdia(){ return dia; } /* public boolean action (Event e, Object o){//オーバーライト自由 Button event = (Button)e.target; if ( b1.getLabel() == event.getLabel() ){ dia = 1; dispose(); } return true; } */ public void dialogshow(Point p){ setLocation(p); show(); } }