import javax.swing.*; import java.awt.event.*; import java.awt.*; class ChatFrame1 extends JFrame implements ActionListener,CommListener { protected JTextField input; protected JTextArea output; protected Comm com; protected Comm_Proxy party; public ChatFrame1() { super(); input = new JTextField(20); output = new JTextArea(20,20); output.setLineWrap(true); output.setWrapStyleWord(false); input.addActionListener(this); getContentPane().setLayout(new FlowLayout()); getContentPane().add(input); getContentPane().add(output); } public void setParty(Comm_Proxy proxy) { this.party = proxy; } public void start(){System.out.println("start");} public void end(){ System.out.println("end");} public void connect() { setParty(new Comm_Proxy("horb://localhost:9000/00")); } public void output(String d) { if(party != null) { party.input(d); } } public void input(String d) { if(output !=null) { output.append(d); } } public void actionPerformed(ActionEvent e ) { if(party == null) { connect(); } output(input.getText()); } }