3 import java.awt.event.*;
5 public class enterRoomWindow extends JFrame {
8 public enterRoomWindow() {
12 public enterRoomWindow( String def ) {
13 Container c = getContentPane();
16 addWindowListener( new WindowAdapter() {
17 public void windowClosing( WindowEvent e ) {
21 c.setLayout( new BorderLayout() );
23 PairPanel pp = new PairPanel();
24 pp.addLeft( new JLabel( "Name:" ) );
25 pp.addRight( room = new JTextField(10) );
26 room.addActionListener( new ActionListener() {
27 public void actionPerformed( ActionEvent e ) {
37 pp.addLeft( new JLabel( "Password: " ) );
38 pp.addRight( pass = new JPasswordField(10) );
40 pass.addActionListener( new ActionListener() {
41 public void actionPerformed( ActionEvent e ) {
46 c.add( "Center", pp );
48 JPanel p = new JPanel();
49 JButton b = new JButton( "Go" );
52 b.addActionListener( new ActionListener() {
53 public void actionPerformed( ActionEvent e ) {
57 p.add( b = new JButton( "Cancel" ) );
58 b.addActionListener( new ActionListener() {
59 public void actionPerformed( ActionEvent e ) {
65 citadel.me.registerWindow( this );
70 public void closeWin() {
71 citadel.me.removeWindow( this );
75 public void enterRoom() {
78 if( pass != null ) p = pass.getText();
79 citadel.me.enterRoom( r, p );