im trying to program a JAVA GUI but after i compile the code and try to run it i get an error message. i then downloaded a program i made at college and i get the same problem even though it ran at the university.
Heres the Code
import java.awt.*;
import javax.swing.*;
class fm1 extends JPanel
{
public static void main (String[]args)
{
JFrame fruitMachine = new JFrame("Fruit Machine");
fruitMachine.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
fruitMachine.setSize(300,900);
JLabel fruit1 = new JLabel();
fruitMachine.add(fruit1);
JLabel fruit2 = new JLabel();
fruitMachine.add(fruit2);
JLabel fruit3 = new JLabel();
fruitMachine.add(fruit3);
fruitMachine.pack();
fruitMachine.setVisible(true);
}
}
Is there something wrong with the code or is it my computer