/** * IRC Constructor * * @param jo the JVN object representing the Chat */ public Irc(JvnObject jo) { sentence = jo; frame = new JFrame(); frame.setLayout(new GridLayout(1, 1)); text = new TextArea(10, 60); text.setEditable(false); text.setForeground(Color.red); frame.add(text); data = new TextField(40); frame.add(data); Button read_button = new Button("read"); read_button.addActionListener(new readListener(this)); frame.add(read_button); Button write_button = new Button("write"); write_button.addActionListener(new writeListener(this)); frame.add(write_button); frame.setSize(545, 201); // frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); frame.addWindowListener( new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { System.out.println("Closed"); try { JvnServerImpl.jvnGetServer().jvnTerminate(); } catch (Exception exc) { System.out.println("An exception: " + exc); } e.getWindow().dispose(); } }); text.setBackground(Color.black); frame.setVisible(true); }
public Irc(Sentence_itf s) { setLayout(new FlowLayout()); text = new TextArea(10, 60); text.setEditable(false); text.setForeground(Color.red); add(text); data = new TextField(60); add(data); Button write_button = new Button("write"); write_button.addActionListener(new writeListener(this)); add(write_button); Button read_button = new Button("read"); read_button.addActionListener(new readListener(this)); add(read_button); setSize(470, 300); text.setBackground(Color.black); show(); sentence = s; }