class Spots
public class Frog
1: //: frogbean:Frog.java
2: // From 'Thinking in Java, 2nd ed.' by Bruce Eckel
3: // www.BruceEckel.com. See copyright notice in CopyRight.txt.
4: // A trivial JavaBean.
5: package frogbean;
6: import java.awt.*;
7: import java.awt.event.*;
9: class Spots {}
11: public class Frog {
12: private int jumps;
13: private Color color;
14: private Spots spots;
15: private boolean jmpr;
16: public int getJumps() { return jumps; }
17: public void setJumps(int newJumps) {
18: jumps = newJumps;
19: }
20: public Color getColor() { return color; }
21: public void setColor(Color newColor) {
22: color = newColor;
23: }
24: public Spots getSpots() { return spots; }
25: public void setSpots(Spots newSpots) {
26: spots = newSpots;
27: }
28: public boolean isJumper() { return jmpr; }
29: public void setJumper(boolean j) { jmpr = j; }
30: public void addActionListener(
31: ActionListener l) {
32: //...
33: }
34: public void removeActionListener(
35: ActionListener l) {
36: // ...
37: }
38: public void addKeyListener(KeyListener l) {
39: // ...
40: }
41: public void removeKeyListener(KeyListener l) {
42: // ...
43: }
44: // An "ordinary" public method:
45: public void croak() {
46: System.out.println("Ribbet!");
47: }
48: } ///:~