I am trying to create a GUI class that extends JFrame. The Frame has 3 buttons with a background image. But so far I am getting nothing but a white blank frame.
public class guiOpen extends JFrame implements ActionListener {
Container c = getContentPane();
JButton database = new JButton("Database");
JButton create = new JButton("Player Creator");
JButton edit = new JButton("Player Editor");
JButton Csave = new JButton("Create/Save");
JButton Esave = new JButton("Edit/Save");
JButton back = new JButton("Back");
JTextArea infoBio = new JTextArea("");
JPanel opener = new JPanel();
JPanel db = new JPanel();
JPanel newplayer = new JPanel();
JPanel tool = new JPanel();
JLabel images ;
public guiOpen()
{
Font FUD = new Font("Comic Sans MS", 1, 32);
Font FA = new Font("Comic Sans MS", 5, 40);
Font fBtns = new Font("Comic Sans MS", 1, 25);
Color grassC = new Color(0, 100, 0);
Color cBtns = new Color(255, 255, 255);
c.add(opener);
c.add(db);
c.add(newplayer);
c.add(tool);
this.setTitle("Tatical Soccer Mania");
this.setSize(800,600);
this.setResizable(false);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setVisible(true);
images = new JLabel(new ImageIcon ("Tatical Soccer Mania\\TSM_LOGO.jpg")) ;
opener.add(images);
validate();
database.setBounds(50, 100, 240, 120);
database.setFont(fBtns);
database.setOpaque(true);
database.setBackground(grassC);
database.setVisible(true);
database.addActionListener(this);
database.setForeground(cBtns);
opener.add(database);
create.setBounds(50, 240, 240, 120);
create.setFont(fBtns);
create.setOpaque(true);
create.setBackground(grassC);
create.setForeground(cBtns);
create.setVisible(true);
create.addActionListener(this);
opener.add(create);
edit.setForeground(cBtns);
edit.setBounds(50, 380, 240, 120);
edit.setFont(fBtns);
edit.setOpaque(true);
edit.setBackground(grassC);
edit.setVisible(true);
edit.addActionListener(this);
opener.add(edit);
opener.setVisible(true);
db.setVisible(false);
newplayer.setVisible(false);
tool.setVisible(false);
}
}
If you can explain what is going on and it how to fix it would be very much appreciated. I looked around stack and nothing helped me fix my problem. I just started out programming, so please explain in terms that a beginner can understand.