Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/memoire/bu/BuDialogConfirmation.java


1   /**
2    * @modification $Date: 2002/11/14 19:25:32 $
3    * @statut       unstable
4    * @file         BuDialogConfirmation.java
5    * @version      0.36
6    * @author       Guillaume Desnoix
7    * @email        guillaume@desnoix.com
8    * @license      GNU General Public License 2 (GPL2)
9    * @copyright    1998-2001 Guillaume Desnoix
10   */
11  
12  package com.memoire.bu;
13  
14  import com.memoire.bu.*;
15  import com.memoire.dnd.*;
16  import com.memoire.fu.*;
17  import com.memoire.re.*;
18  
19  
20  import java.awt.*;
21  import java.awt.event.*;
22  import javax.swing.*;
23  import javax.swing.border.*;
24  
25  /**
26   * A standard confirm dialog (yes/no).
27   */
28  
29  public class BuDialogConfirmation
30         extends BuDialog
31         implements ActionListener
32  {
33    protected BuButton btOui_;
34    protected BuButton btNon_;
35  
36    public BuDialogConfirmation(BuCommonInterface      _parent,
37              BuInformationsSoftware _isoft,
38              Object                 _message)
39    {
40      super(_parent,_isoft,BuResource.BU.getString("Confirmation"),_message);
41  
42      BuPanel pnb=new BuPanel();
43      pnb.setLayout(new BuButtonLayout());
44      //new FlowLayout(FlowLayout.RIGHT));
45  
46      btOui_=new BuButton(BuLib.loadToolCommandIcon("OUI"),
47             BuResource.BU.getString("Oui"));
48      btOui_.addActionListener(this);
49      pnb.add(btOui_);
50  
51      btNon_=new BuButton(BuLib.loadToolCommandIcon("NON"),
52             BuResource.BU.getString("Non"));
53      btNon_.addActionListener(this);
54      getRootPane().setDefaultButton(btNon_);
55      pnb.add(btNon_);
56  
57      content_.add(pnb,BuBorderLayout.SOUTH);
58    }
59  
60    public JComponent getComponent()
61    { return null; }
62  
63    public void actionPerformed(ActionEvent _evt)
64    {
65      JComponent source=(JComponent)_evt.getSource();
66      // System.err.println("BuDialog : "+source);
67  
68      if(source==btOui_)
69      {
70        reponse_=JOptionPane.YES_OPTION;
71        setVisible(false);
72      }
73  
74      if(source==btNon_)
75      {
76        reponse_=JOptionPane.NO_OPTION;
77        setVisible(false);
78      }
79    }
80  
81    public static void main(String[] _args)
82    {
83      new BuDialogConfirmation
84        (null,null,
85         "Please confirm the total destruction of the world.")
86        .activate();
87      System.exit(0);
88    }
89  }