import java.awt.*; import java.awt.event.*; import java.applet.Applet; import java.io.*; public class CommentsApplet extends Applet { TextArea ta; TextField name; TextField user; TextField comments; public void init () { Panel p1 = new Panel(new BorderLayout(10, 10)); Button b1 = new Button ("Query"); p1.add (b1, BorderLayout.SOUTH); ta = new TextArea (); ta.setEditable(false); p1.add (ta, BorderLayout.CENTER); b1.addActionListener (new ActionListener() { public void actionPerformed (ActionEvent e) { ByteArrayOutputStream bao = new ByteArrayOutputStream(); CommentsClient cc = new CommentsClient ("localhost", 0, bao); ta.setText (bao.toString()); } } ); add (p1); Panel p2 = new Panel (new BorderLayout (10, 10)); Button b2 = new Button ("Insert"); p2.add (b2, BorderLayout.SOUTH); Panel p3 = new Panel(); name = new TextField ("", 10); user = new TextField ("", 10); comments = new TextField ("", 50); p3.add (name); p3.add (user); p3.add (comments); p2.add (p3, BorderLayout.CENTER); b2.addActionListener (new ActionListener() { public void actionPerformed (ActionEvent e) { ByteArrayOutputStream bao = new ByteArrayOutputStream(); CommentsClient cc = new CommentsClient ("localhost", 0, bao, name.getText(), user.getText(), comments.getText()); ta.setText (bao.toString()); } } ); add (p2); } }