Hey, I had to edit this short code for a class I'm taking and add a few things. I already added my changes, but even before I did, when I clicked "run" it would pop up with a menu asking me to choose the class I'd like to use, but there are no options to choose from. Why can't it load my class? Thanks in advance for your help!
package etchasketchjacob; import java.awt.*; import java.awt.event.KeyEvent; import javax.swing.JFrame; public class EtchASketch extends Canvas { int x, y; Color cur; public static void main( String[] args ) { JFrame win = new JFrame("Use the arrow keys!"); win.setSize(1024,768); win.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); win.add( new EtchASketch() ); win.setVisible(true); } public EtchASketch() { enableEvents(java.awt.AWTEvent.KEY_EVENT_MASK); requestFocus(); x = 500; y = 400; cur = Color.black; } public void paint( Graphics g ) { g.setColor(cur); g.fillOval(x, y, 30, 30); } public void update( Graphics g ) { paint(g); } public void processKeyEvent(KeyEvent e) { // this method automatically gets called with they press a key if ( e.getID() == KeyEvent.KEY_PRESSED ) { if ( e.getKeyCode() == KeyEvent.VK_UP ) y -= 10; if ( e.getKeyCode() == KeyEvent.VK_DOWN ) y += 10; if ( e.getKeyCode() == KeyEvent.VK_LEFT ) x -= 10; if ( e.getKeyCode() == KeyEvent.VK_RIGHT ) y += 10; //My Macbook does not have F1, F2, or anything like that, //so I had to use different buttons. Hope that's okay. if ( e.getKeyCode() == KeyEvent.VK_Q ) cur = Color.RED; if ( e.getKeyCode() == KeyEvent.VK_W ) cur = Color.GREEN; if ( e.getKeyCode() == KeyEvent.VK_E ) cur = Color.BLUE; if ( e.getKeyCode() == KeyEvent.VK_R ) cur = Color.BLACK; // and we manually call paint() again to redraw repaint(); } } public boolean isFocusable() { return true; } }