Ok. Can you post up your text files? I don't need the full thing, just 1 complete question and answer.
edit: I'm also missing a bunch of classes. I've removed the StartClassicalWindow references but in StartRockWindow there are CorrectAnswerWindow and WrongAnswerWindow. It looks like I can safely remove them for now but if there are errors in them you may still get exceptions.
You have references to variables x and correct which have no declarations that I can find. That should be preventing your code from building. Is it possible there were other parts you changed but forgot to post?
RockQuestions.txt has:
Where was the band Led Zeppelin from?
RockAnswers.txt has:
England //this is the correct answer
Ireland
USA
You can ignore the StartClassicalWindow for now.
CorrectAnswerWindow class:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class CorrectAnswerWindow extends JFrame implements MouseListener{
private JButton cont;
public CorrectAnswerWindow(){
super("Correct Answer");
build();
}
public void build(){
this.setLayout(new BorderLayout());
JPanel north = new JPanel(new FlowLayout(FlowLayout.CENTER));
JLabel title = new JLabel("Music Trivia Quiz");
title.setFont(new Font("Comic Sans",Font.BOLD,18));
north.add(title);
this.add(north,BorderLayout.NORTH);
JPanel center = new JPanel(new FlowLayout(FlowLayout.CENTER));
JLabel comment = new JLabel("CORRECT ANSWER! You get 2 points.");
comment.setFont(new Font("Comic Sans", Font.BOLD, 28));
center.add(comment);
this.add(center,BorderLayout.CENTER);
JPanel south = new JPanel(new FlowLayout(FlowLayout.RIGHT));
cont = new JButton("CONTINUE");
cont.setForeground(Color.RED);
cont.setBackground(Color.BLACK);
south.add(cont);
cont.addMouseListener(this);
this.add(south,BorderLayout.SOUTH);
this.setBounds(0,0,300,200);
this.setVisible(false);
}
public void mouseClicked(MouseEvent e) {
if (e.getSource().equals(cont)){
this.setVisible(false);
}
}
public void mouseEntered(MouseEvent e){
}
public void mouseExited(MouseEvent e){
}
public void mousePressed(MouseEvent e){
}
public void mouseReleased(MouseEvent e){
}
}
WrongAnswerWindow class:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class WrongAnswerWindow extends JFrame implements MouseListener{
private JButton cont;
public WrongAnswerWindow(){
super("Wrong Answer");
build();
}
public void build(){
this.setLayout(new BorderLayout());
JPanel north = new JPanel(new FlowLayout(FlowLayout.CENTER));
JLabel title = new JLabel("Music Trivia Quiz");
title.setFont(new Font("Comic Sans",Font.BOLD,18));
north.add(title);
this.add(north,BorderLayout.NORTH);
JPanel center = new JPanel(new FlowLayout(FlowLayout.CENTER));
JLabel comment = new JLabel("Wrong answer! You lose a point.");
comment.setFont(new Font("Comic Sans", Font.BOLD, 28));
center.add(comment);
this.add(center,BorderLayout.CENTER);
JPanel south = new JPanel(new FlowLayout(FlowLayout.RIGHT));
cont = new JButton("CONTINUE");
cont.setForeground(Color.RED);
cont.setBackground(Color.BLACK);
south.add(cont);
cont.addMouseListener(this);
this.add(south,BorderLayout.SOUTH);
this.setBounds(0,0,300,200);
this.setVisible(true);
}
public void mouseClicked(MouseEvent e) {
if (e.getSource().equals(cont)){
this.setVisible(false);
}
}
public void mouseEntered(MouseEvent e){
}
public void mouseExited(MouseEvent e){
}
public void mousePressed(MouseEvent e){
}
public void mouseReleased(MouseEvent e){
}
}
The MainMenuWindow class wasn't changed. I guess that's everything you need. Thank you very much, I really appreciate your help!
Oh and StartRockWindow class also has this code which goes before the private void build() method:
import java.io.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class StartRockWindow extends JFrame implements MouseListener{
private JButton next, exit;
private JComboBox choiceField;
public String x = new String();
public String correct;
public StartRockWindow() throws Exception{
super("Start Rock");
build();
}