title: error in quiz game using swings
body: <p>I am having some problem in my quiz game. i am using netbeans. in my game i have two classes 1st is my driver class ie Quiz and second is non driver class ie RadioQuestion. i am posting my code for both the classes. i am having two errors in my RadioQuetion class. </p>
  
  <p><strong><em>my error message in Quiz.java is "cannot find symbol class: RadioQuestion location: class Quiz.quiz" and in RadioQuestion is "total is not public in Quiz.quiz; cannot be accessed from outside package" and "wrong is not public in Quiz.quiz; cannot be accessed from outside package"
  and one warning is "implements: java.awt.event.ActionListeneractionPerformed(ActionEvent e)".</em></strong></p>
  
  <p>Quiz.quiz class</p>
  
  <pre><code>package Quiz;
  
  import java.awt.CardLayout;
  import java.util.Random;
  import javax.swing.JFrame;
  import javax.swing.JOptionPane;
  import javax.swing.JPanel;
  
  public class Quiz extends JFrame{
      JPanel p=new JPanel();
      CardLayout cards=new CardLayout();
      int numQs;
      int wrongs=0;
      int total=0;
      //RadioQuestion[8] questions=new RadioQuestion();
  
      String[][] answers={
          {"a","b","c","d"},
          {"e","f","g","h"},
          {"i","j","k","l"},
          {"m","n","o","p"},
          {"True","False"},
          {"True","False"},
          {"4","5","6","7"},
          {"q","r","s","t"},
      };
  
      RadioQuestion questions[]={
  
          new RadioQuestion("what",answers[0],1,this),
          new RadioQuestion("what",answers[1],3,this),
          new RadioQuestion("what",answers[2],0,this),
          new RadioQuestion("what",answers[3],1,this),
          new RadioQuestion("what",answers[4],1,this),
          new RadioQuestion("what",answers[5],0,this),
          new RadioQuestion("what",answers[6],0,this),
          new RadioQuestion("what",answers[7],2,this),
          new RadioQuestion("what",answers[8],1,this),
      };
      public static void main(String[] args) {
          //line missing
          //line missing
          //line missing
       new Quiz();
  
  
      }
          public Quiz(){
              super("quiz game");
              setResizable(true);
              setSize(500,400);
              setDefaultCloseOperation(EXIT_ON_CLOSE);
  
              p.setLayout(cards);
  
                  numQs=questions.length;
                  for(int i=0;i&lt;numQs;i++){
                      p.add(questions[i],"q"+i);
                  }
                      Random r=new Random();
                      int i=r.nextInt(numQs);
                      cards.show(p,"q"+i);
  
  
              add(p);
              setVisible(true);
  
  
          }
  
          public void next(){
          if((total-wrongs)==numQs){showSummary();}
          else{Random r=new Random();
          boolean found=false;
          int i=0;
          while(!found){
          i=r.nextInt(numQs);
          if(!questions[1].used)
          {
              found=true;
          }}
          cards.show(p,"q"+i);
          }
          }
  
          public void showSummary(){
          JOptionPane.showMessageDialog(null,"all done your result"+"\nincorrect: \t"+wrongs+"\n correct ans: \t"+(total-wrongs)+"\n avg inc ans per ques: \t"+((float)wrongs/numQs)+"\n percentage correct: \t\t"+(int)(((float)(total-wrongs)/total)*100)+ "%");
          System.exit(0);
  
  
  
  
  
  
  
  
  
  
  
          }
  }
  
  
  RadioQuestion class
  
  import Quiz.Quiz;
     import javax.swing.JButton;
      import javax.swing.JRadioButton;
      import javax.swing.JPanel;
      import javax.swing.JLabel;
      import javax.swing.ButtonGroup;
      //import javax.swing.JFrame;
      import javax.swing.JOptionPane;
      import javax.swing.BoxLayout;
  
      import java.awt.event.ActionListener;
      import java.awt.event.ActionEvent;
  
      public class RadioQuestion extends JPanel implements ActionListener {
         // private static int EXIT_ON_CLOSE;
  
          //RadioQuestion=new RadioQuestion(String q, String[] options, int ans, Quiz quiz);
          int correctAns;
  
          Quiz quiz;
          int selected;
          boolean used;
  
          //question
          JPanel qPanel=new JPanel();
          //answers
          JPanel aPanel=new JPanel();
          JRadioButton[] responses;
          ButtonGroup group=new ButtonGroup();
          //bottom
          JPanel botPanel=new JPanel();
          JButton next=new JButton("next");
  
          JButton finish=new JButton("finish");
  
          /*public static void main(String args[]){
          JFrame frame=new JFrame("radio button test");
          frame.setResizable(true);
                  frame.setSize(500,400);
                  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  
          String[] answers={"wrong1","right","wrong2"};
          frame.add(new RadioQuestion("whats right",answers,1));
          frame.setVisible(true);
      }*/
          public RadioQuestion(String q, String[] options, int ans, Quiz quiz){
              //dought
              this.quiz=quiz;
              //dought
          setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));
          correctAns=ans;
          //question
          qPanel.add(new JLabel(q));
          //answer
          responses=new JRadioButton[options.length];
          for(int i=0;i&lt;options.length;i++){
          responses[i]=new JRadioButton(options[i]);
          responses[i].addActionListener(this);
          group.add(responses[i]);
          aPanel.add(responses[i]);
          }
          add(aPanel);
          //bottom
          next.addActionListener(this);
          finish.addActionListener(this);
          botPanel.add(next);
          botPanel.add(finish);
          add(botPanel);
          }
  ////////////////////////////////////////////////////////////////////////////////
          public void actionPerformed(ActionEvent e){
          Object src=e.getSource();
          //next button
          if(src.equals(next)){
          showResult();
          if(selected==correctAns){
          used=true;
          quiz.next();}}
          //finish button
          if(src.equals(finish)){
          quiz.showSummary();}
  
          //radio buttons
          for(int i=0;i&lt;responses.length;i++){
          if(src==responses[i]){
          selected=i;}
          }}
          public void showResult(){
          String text=responses[selected].getText();
          quiz.total++;
          if(selected==correctAns){
          JOptionPane.showMessageDialog(null,text+"is correct\nwell done");
          }else{
          quiz.wrongs++;
          JOptionPane.showMessageDialog(null,text+" is wrong\nSorry:(");}
          }
  
  
  
  
  
  
  
  
  
  
  
  
          //public stataic void main(String[] arg);
  
      }
  </code></pre>