1   package org.wcb.gui.event;
2   
3   import org.wcb.gui.LogbookFrame;
4   import org.wcb.gui.dialog.AboutDialog;
5   import org.wcb.resources.MessageResourceRegister;
6   import org.wcb.resources.MessageKey;
7   
8   import javax.swing.*;
9   import java.awt.event.ActionListener;
10  import java.awt.event.ActionEvent;
11  
12  /**
13   * Copyright (c)  2006  wbogaardt.
14   * This library is free software; you can redistribute it and/or
15   * modify it under the terms of the GNU Lesser General Public
16   * License as published by the Free Software Foundation; either
17   * version 2.1 of the License, or (at your option) any later version.
18   *
19   * This library is distributed in the hope that it will be useful,
20   * but WITHOUT ANY WARRANTY; without even the implied warranty of
21   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22   * Lesser General Public License for more details.
23   *
24   * You should have received a copy of the GNU Lesser General Public
25   * License along with this library; if not, write to the Free Software
26   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
27   * <p/>
28   * </small>
29   */
30  
31  public class AboutListener implements ActionListener {
32  
33      private LogbookFrame frame;
34      private AboutDialog dialog;
35  
36      public AboutListener(LogbookFrame frame) {
37          this.frame = frame;
38          dialog = new AboutDialog();
39          dialog.addActionListener(this);
40      }
41  
42      public void actionPerformed(ActionEvent evt) {
43          Object src = evt.getSource();
44          if (src instanceof JMenuItem) {
45              frame.showJDialogAsSheet(dialog);
46          }
47          if (evt.getActionCommand().equalsIgnoreCase(MessageResourceRegister.getInstance().getValue(MessageKey.BUTTON_CLOSE))) {
48              frame.hideSheet();
49          }
50      }
51  }