rendered paste bodypackage saucerlander;import java.awt.*;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JButton;import javax.swing.JPanel;public class CorrectSaucerLander extends JPanel implements ActionListener{ public CorrectSaucerLander() { step = 10; slowStep = 1; ht = 10; wd = 20; scale = 1.2D; slowScale = 1.02D; near = new JButton("Fast"); slow = new JButton("Slow"); quit = new JButton("Quit"); fontSize = 8; setPreferredSize(new Dimension(750, 600)); add(near); near.addActionListener(this); add(slow); slow.addActionListener(this); add(quit); quit.addActionListener(this); } public void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.green); g.fillRect(0, 400, 750, 200); if(x + ht < 400) g.setColor(Color.pink); else g.setColor(Color.red); g.fillOval(x, y, wd, ht); g.setColor(Color.black); if(wd > 80) { fontSize = wd / 12; g.setFont(new Font("TimesRoman", 0, fontSize)); g.drawString("JavaShip 17", x + wd / 4, y + ht / 2); g.fillRect(x + wd / 4, y + ht / 2 + 10, wd / 20, wd / 20); g.fillRect(x + wd / 4 + wd / 16, y + ht / 2 + 10, wd / 20, wd / 20); g.fillRect(x + wd / 4 + wd / 8, y + ht / 2 + 10, wd / 20, wd / 20); g.fillRect(x + wd / 4 + (3 * wd) / 16, y + ht / 2 + 10, wd / 20, wd / 20); g.fillRect(x + wd / 4 + wd / 4, y + ht / 2 + 10, wd / 20, wd / 20); if(x + ht >= 400) g.drawLine(x + (3 * wd) / 4, y + (3 * ht) / 4, x + (4 * wd) / 5, 400); } } public void actionPerformed(ActionEvent e) { if(e.getSource() == near) { x += step; y += step; ht = (int)(scale * (double)ht); wd = (int)(scale * (double)wd); repaint(); } else if(e.getSource() == slow) { x += slowStep; y += slowStep; ht = (int)(slowScale * (double)ht); wd = (int)(slowScale * (double)wd); repaint(); } else if(e.getSource() == quit) System.exit(0); } private int x; private int y; int step; int slowStep; int ht; int wd; double scale; double slowScale; JButton near; JButton slow; JButton quit; int fontSize;}