Java Reference
In-Depth Information
Display 18.21
Using drawString (part 2 of 2)
42 public void paint(Graphics g)
43 {
44 super .paint(g);
45 g.setFont(fontObject);
46 g.setColor(penColor);
47 g.drawString(theText, X_START, Y_START);
48 }
49 public void actionPerformed(ActionEvent e)
50 {
51 penColor = Color.RED;
52 fontObject =
53 new Font("Serif", Font.BOLD|Font.ITALIC, POINT_SIZE);
54 theText = "Thank you. I needed that.";
55 repaint();
56 }
57 }
R ESULTING GUI (Start view)
R ESULTING GUI (After clicking the button)
 
 
Search WWH ::




Custom Search