import java.awt.*; import java.awt.event.*; public class FrameExample { TextField tf; TextArea ta; Checkbox cb; Scrollbar sb; public static void main(String args[]) { FrameExample fe = new FrameExample(); } public FrameExample() { Frame f= new Frame("Frame Example"); Button button = new Button("Button"); Label lbl= new Label("Label"); tf = new TextField("TextField", 100); ta = new TextArea("TextArea"); cb = new Checkbox("Checkbox"); sb = new Scrollbar(); button.setBounds(20, 40, 50, 50); lbl.setLocation(130, 200); tf.setBounds(100, 40, 120, 50); ta.setBounds(30, 110, 150, 100); cb.setLocation(250, 200); sb.setBounds(5, 110, 25, 100); f.add(button); f.add(lbl); f.add(tf); f.add(ta); f.add(cb); f.add(sb); button.addMouseListener(new MyMouseListener()); f.addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent we) { System.exit(0); } }); f.setSize(300,300); f.setVisible(true); }