home *** CD-ROM | disk | FTP | other *** search
- package sunw.demo.transitional;
-
- import java.awt.Canvas;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Event;
- import java.awt.Graphics;
- import sunw.io.Serializable;
-
- public class TransitionalBean extends Canvas implements Serializable {
- private Color ourColor;
-
- public TransitionalBean() {
- this.ourColor = Color.orange;
- ((Component)this).resize(60, 40);
- }
-
- public void paint(Graphics var1) {
- var1.setColor(this.ourColor);
- var1.fillArc(5, 5, 30, 30, 0, 360);
- var1.fillArc(25, 5, 30, 30, 0, 360);
- var1.fillRect(20, 5, 20, 30);
- }
-
- public Color getColor() {
- return this.ourColor;
- }
-
- public void setColor(Color var1) {
- this.ourColor = var1;
- ((Component)this).repaint();
- }
-
- public boolean handleEvent(Event var1) {
- if (var1.id == 502) {
- if (this.ourColor == Color.orange) {
- this.setColor(Color.green);
- } else {
- this.setColor(Color.orange);
- }
- }
-
- return false;
- }
- }
-