// filename: ORings.java import java.awt.*; import java.applet.Applet; public class ORings extends Applet { int x = 20; int y = 20; int size = 90; int overlap = size/2; public void paint(Graphics g) { g.setColor(Color.blue); g.drawOval(x, y, size, size); g.setColor(Color.black); g.drawOval(x + size, y, size, size); g.setColor(Color.red); g.drawOval(x + size + size, y, size, size); g.setColor(Color.yellow); g.drawOval(x + size-overlap, y + size-overlap, size, size); g.setColor(Color.green); g.drawOval(x + size + size-overlap, y + size-overlap, size, size); } } //filename: Constellation.java import java.awt.*; import java.applet.Applet; public class Constellation { public String englishName; public String latinName; public void drawStar(Graphics g, int x, int y) { g.drawLine(x + 15, y, x + 25, y + 28); g.drawLine(x + 25, y + 28, x, y + 10); g.drawLine(x, y + 10, x + 30, y + 10); g.drawLine(x + 30, y + 10, x + 5, y + 28); g.drawLine(x + 5, y + 28, x + 15, y); } public void drawConstName(Graphics g, int x, int y) { g.drawString(latinName + ", the " + englishName, x, y); } } //filename: BigDipper.java import java.awt.*; import java.applet.Applet; public class BigDipper extends Constellation { public void drawBigDipper(Graphics g, int x, int y) { drawStar(g, 0, 25); drawStar(g, 65, 0); drawStar(g, 105, 90); drawStar(g, 90, 205); drawStar(g, 88, 275); drawStar(g, 225, 200); drawStar(g, 185, 285); drawConstName(g, x + 10, y + 325); } } //filename: BigDipperApplet.java import java.awt.*; import java.applet.Applet; public class BigDipperApplet extends Applet { BigDipper bd1; public void init() { bd1 = new BigDipper(); } public void paint(Graphics g) { setBackground(Color.black); g.setColor(Color.white); bd1.englishName = "Big Dipper"; bd1.latinName = "Ursa Major"; bd1.drawBigDipper(g, 5, 5); } } //filename: Movie.java import java.applet.Applet; import java.awt.*; import java.awt.event.*; public class Movie extends Applet implements ActionListener { Button b1, b2, b3, b4; TextArea ta1; Panel p1; String selection; public void init() { b1 = new Button("Star Wars"); b2 = new Button("Empire Strkes Back"); b3 = new Button("Return of the Jedi"); b4 = new Button("Phantom Menace"); ta1 = new TextArea("Select a Movie"); p1 = new Panel(new GridLayout(2, 2, 5, 5)); b1.setBackground(Color.red); b2.setBackground(Color.green); b3.setBackground(Color.lightGray); b4.setBackground(Color.gray); b1.addActionListener(this); b2.addActionListener(this); b3.addActionListener(this); b4.addActionListener(this); p1.add(b1); p1.add(b2); p1.add(b3); p1.add(b4); setLayout(new GridLayout(2, 1, 5, 5)); add(p1); add(ta1); } public void actionPerformed(ActionEvent ae) { selection = ae.getActionCommand(); ta1.setText(selection); repaint(); } }