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

Quick Search    Search Deep

Source code: com/ciphermod/cipherchat/ChatMenuBar.java


1   /* $Id: ChatMenuBar.java,v 1.1 2001/03/26 10:48:43 cvsbob Exp $ */
2   
3   /*
4    * ChatMenuBar.java, menu bar for the GUI front end to the ChatClient.
5    * Copyright (C) 2001 Robert Bushman.
6    *
7    * I reserve the right to release this program under seperate license.
8    * If you require a special license grant contact Robert Bushman.
9    *
10   * This program is free software; you can redistribute it and/or
11   * modify it under the terms of the GNU General Public License
12   * as published by the Free Software Foundation; either version 2
13   * of the License, or (at your option) any later version.
14   *
15   * This program is distributed in the hope that it will be useful,
16   * but WITHOUT ANY WARRANTY; without even the implied warranty of
17   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18   * GNU General Public License for more details.
19   * 
20   * You should have received a copy of the GNU General Public License
21   * along with this program; if not, write to the Free Software
22   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 
23   * 02111-1307, USA.
24   */
25  
26  package com.ciphermod.cipherchat;
27  
28  import java.awt.event.ActionListener;
29  import javax.swing.JMenu;
30  import javax.swing.JMenuBar;
31  import javax.swing.JMenuItem;
32  
33  class ChatMenuBar extends JMenuBar {
34      
35      // ----------------------------------------------------
36      // CONSTRUCTOR
37      // ----------------------------------------------------
38      
39      public ChatMenuBar( ActionListener actionListener ) {
40          super();
41          initializeMenus();
42          initializeActionCommands();
43          initializeSelf();
44          addActionListener( actionListener );
45      }
46      
47      protected void initializeMenus() {
48          _file.add( _connect );
49          _file.addSeparator();
50          _file.add( _exit );
51      }
52      
53      protected void initializeActionCommands() {
54          _connect.setActionCommand( "Connect" );
55          _exit.setActionCommand( "Exit" );
56      }
57      
58      protected void initializeSelf() {
59          add( _file );
60      }
61      
62      // -------------------------------------------------
63      // PUBLIC API
64      // -------------------------------------------------
65      
66      public void addActionListener( ActionListener actionListener ) {
67          _connect.addActionListener( actionListener );
68          _exit.addActionListener( actionListener );
69      }
70      
71      // ---------------------------------------------------
72      // INSTANCE PARAMETERS AND ACCESSORS
73      // ---------------------------------------------------
74      
75      private JMenu _file = new JMenu( "File" );
76      private JMenuItem _connect = new JMenuItem( "Connect" );
77      private JMenuItem _exit = new JMenuItem( "Exit" );
78  }
79