1 19 20 package data; 21 22 import java.awt.*; 23 import java.io.Serializable ; 24 25 30 public class TestVisualBean extends Canvas implements Serializable { 31 32 private Color textColor = Color.blue; 33 private String text = "Lancia Lybra"; 35 36 public TestVisualBean() { 37 resize(100,40); 38 } 39 40 public void paint(Graphics g) { 41 g.setColor(Color.blue); 42 g.drawString(text,10, 10); 43 } 44 45 49 public Color getColor() { 50 return textColor; 51 } 52 53 57 public void setColor(Color newColor) { 58 textColor = newColor; 59 repaint(); 60 } 61 62 66 public String getText() { 67 return text; 68 } 69 70 74 public void setText(String newText) { 75 text = newText; 76 repaint(); 77 } 78 } | Popular Tags |