0

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

1
Contributor
1
Reply
2
Views
8 Years
Discussion Span
Last Post by Laidler
0

sorry about this... i know whats wrong now, i forgot that i had a test file for the older program which is why the it woudnt run.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.