GrowingRedRoseApplet
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class GrowingRedRoseApplet extends JApplet implements ActionListener {
JButton button;
RedRose redRose ;
Graphics g;
Container container;
public void init() {
redRose = new RedRose();
redRose.backGroundColor = Color.lightGray;
container = getContentPane();
container.setBackground(Color.lightGray);
g = getGraphics();
button = new JButton("Click to Grow");
container.add(button,BorderLayout.EAST);
button.addActionListener( this );
}
public void actionPerformed( ActionEvent actionEvent ) {
g.setColor(Color.lightGray);
g.fillRect(10,10,200,500);
for (int height=200;
--height > 0;
redRose.paintRose(g,10,height))
for (int i=0; i++<10000000;);
}
}