Okay so far this is what i have, i havent really gotten very far but id like to get the layout all set before i try to tie things together. The problem im having is getting the JButtons colored. In order for my game to be like the game simon with the four colors, i have the make the JButtons those colors. I have tried to use setBackRound but it didnt work. Any help will do.
public class Project extends JFrame {
public Project() {
super();
JPanel works = new JPanel();
JButton red = new JButton("RED");
JButton green = new JButton("GREEN");
JButton blue = new JButton("BLUE");
JButton white = new JButton("WHITE");
red.addActionListener(new ButtonHandler());
add(new JLabel());
setLayout(new GridLayout(3,2));
works.setBackground(Color.yellow);
add(red);
add(green);
add(blue);
add(white);
add(works);
}
private class ButtonHandler implements ActionListener {
public void actionPerformed(ActionEvent e){
}
}
}
As yo can see i can add color to the panel but not the button