Hi,
I need to create this Carpark application that looks like this
http://i35.photobucket.com/albums/d171/rossmc/java-1.jpg
I have got the buttons to work but when I try to make the grid it is not showing with the buttons when I run it.
This is the code I have so far. Does anyone know were I am going wrong?
import java.awt.*;
import javax.swing.*;
import java.util.*;
import javax.swing.border.LineBorder;
public class Carpark extends JPanel
{
Carpark()
{
JPanel Buttons = new JPanel();
this.add(Buttons);
this.setLayout(new BorderLayout());
this.add(Buttons,BorderLayout.NORTH);
JButton Car = new JButton("Add Car");
JButton Lorry = new JButton("Add Lorry");
JButton Coach = new JButton("Add Coach");
JButton Clear = new JButton("Clear All");
JButton Save = new JButton("Save");
JButton Load = new JButton("Load");
JButton Current = new JButton("Current Total");
JButton Day = new JButton("Total For Day");
Buttons.add(Car);
Buttons.add(Lorry);
Buttons.add(Coach);
Buttons.add(Clear);
Buttons.add(Save);
Buttons.add(Load);
Buttons.add(Current);
Buttons.add(Day);
JPanel Carpark = new JPanel();
this.add(Carpark);
setLayout(new GridLayout(3,2));
this.setLayout(new BorderLayout());
this.add(Buttons,BorderLayout.CENTER);
JLabel first = new JLabel();
JLabel second = new JLabel();
JLabel third = new JLabel();
JLabel fourth = new JLabel();
JLabel fifth = new JLabel();
Carpark.add(first);
Carpark.add(second);
Carpark.add(third);
Carpark.add(fourth);
Carpark.add(fifth);
}
}