// J2Applet2.java // A second Java 2 Applet // Orange Coast College // CS 170 Online // Stephen Gilbert import java.awt.*; // Graphics, Color, etc. import javax.swing.*; // JApplet public class J2Applet2 extends JApplet { public void init() { PaintPanel p = new PaintPanel(); Container c = getContentPane(); c.add(p); JButton b = new JButton("Hi There"); p.add(b); } class PaintPanel extends JPanel { public void paintComponent(Graphics g) { super.paintComponent(g); int width = getSize().width; int height = getSize().height; g.setColor(Color.red); g.fillOval(0, 0, width, height); g.setColor(Color.blue); g.drawOval(width/4, 0, width/2, height); g.setColor(Color.green); g.drawOval(0, height/4, width, height/2); } } }