// Ryan Kightlinger

            import java.awt.*;

            import java.applet.Applet;

            import java.awt.event.*;

 

            public class Elevator extends Applet implements ActionListener {

 

                        private Button up, down;


                        private int xCoord = 300, yCoord = 300;

 

                        public void init ( ) {

 

                                    up = new Button("Up");

                                    add(up);

                                    up.addActionListener(this);

 

                                    down = new Button("Down");

                                    add(down);

                                    down.addActionListener(this);

 

 

                        }

                        public void paint (Graphics g) {

                                    g.setColor(Color.red);

                                    g.fillRect(xCoord, yCoord, 50, 50);

                        }

                        public void actionPerformed(ActionEvent e) {

                                    if(e.getSource ( ) == up) {

                                                yCoord -= 10;

                                    }

                                    if(e.getSource ( ) == down) {


                                                yCoord += 10;

                                    }

                                    repaint ( );

                        }

            }


