| 
        
        
        
       
        
        Gui
       
                  
        I am getting a start of illegal expression error for my public class event implements actionlistener my code is/*
 bryan argueta
 12/16/2016
 this program will be a guess the number game
 */
 import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
 public class RandomGame extends JFrame
 {
 //declare variables
 int randomNum, guess;
 //add button
 private JButton button;
 //text field to display instructions
 private JTextfield textfield;
 //label that asks user to enter number
 private JLabel promptlabel;
 //display won or loss
 private JLabel resultlabel;
 //display how close the user was
 private JLabel randonlabel;
 //contstructor
 public RandomGame();
 
 public static void main (String args[]);
 {
 RandomGame gui = new RandomGame();
 gui.setDefuaultCloseOperation(JFrame.EXIT_ON_CLOSE  );
 gui.setvisible(true);
 gui.setSize(300,150);
 gui.setTitle("Guess the random number game");
 
 {
 
 //set layout
 setLayout(new FlowLayout());
 //display instructions for user and display results
 promptlabel = new JLabel("Ener a number between 1 to 10");
 add(promptlabel);
 
 textfield = new JTextField(5);
 add(textfield);
 
 button = new JButton("guess:");
 add(button);
 
 resultlabel = new JLabel("");
 add(resultlabel);
 
 randomlabel = new JLabel("");
 add(randomLabel);
 
 event e = new event();
 button.addActionListener(e);
 
 
 public class event implements ActionListener
 {
 public void actionPerformed(ActionEcent e);
 {
 
 randomNum = (int)(Math.random() * 10 + 1);
 
 //catch block to stop user from entering invalid
 //display the win
 if(guess == randomNum)
 {
 resultlabel.setText("woo you won");
 
 {
 if (guess != randomNum)
 resultlabel.setText("Sorry you have lost");
 
 randomlabel.setText("the correct number was: " + randomNum);
 
 
 
 
 
 }
 }
 }
 }
 }
 }
 }
 |