import java.awt.*; public class Message { private String text; private int x, y; private Color color = Color.ORANGE; public Message(String text, int x, int y) { this.text = text; this.x = x; this.y = y; } public void draw(Graphics g) { g.setColor(color); g.drawString(text, x, y); } public void move() { x += (int) (Math.random() * 7) - 3; y += (int) (Math.random() * 7) - 3; } public Color getColor() { return color; } public void setColor(Color color) { this.color = color; } public String toString() { return "Message[text=" + text + ",x=" + x + ",y=" + y + "color=" + color + "]"; } }