import java.awt.Container; import java.awt.FlowLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; public class ComponentsJFrame extends JFrame { public ComponentsJFrame() { Container cp = this.getContentPane(); cp.setLayout(new FlowLayout()); JButton b = new JButton("Yo"); cp.add(b); JButton b2 = new JButton("Ya"); cp.add(b2); JButton b3 = new JButton("Yu"); cp.add(b3); JLabel l1 = new JLabel("Word"); cp.add(l1); JTextField tf = new JTextField(10); cp.add(tf); this.setSize(200,150); this.setTitle("A few simple components."); this.setVisible(true); } public static void main(String[] args) { ComponentsJFrame cjf = new ComponentsJFrame(); } }