Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JToggleButton as a Theatre Seat

 
Coq Rouge
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I've got a problem - hope anyone can help me (or ask anyone who can)!!!
Consider the following:
I'm going to create a booking system for a cinema theatre, which is going to consist of components (seats)
that's showing the text "Free" in black on a grey background.
I am to be able to cancel a reservation or reserve a seat with only one click on the respective component.
When the seat is reserved the component will show the text "Occupied" with an other color than black and the
backgroud of the component are to be in an other color than grey.
I've been trying out the JToggleButton, but I connot figure out how to change the component with a click.
The JToggleButton has properties for true and false - can I change these properties??
This is a resume from the class showing the seats i the theatre:

public Chairs ()
{
GridLayout grid = new GridLayout(Theatre.numberRows,Theatre.numberCols,5,15);
setLayout(grid);
EtchedBorder edge = new EtchedBorder (EtchedBorder.RAISED);
JToggleButton button = new JToggleButton("Free", false);
for (int i=0;i<Theatre.numberCols;i++)>
for (int j=0;j<Theatre.numberRows;j++)>
{
add(button = new JToggleButton("Free"));
button.setBorder(edge);
button.addActionListener (this);
}
}
<big>thanks</big>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic