Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

complicated code, 900 labels.

 
Nicky Eng
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have 2 problems.
1st --> i want the blue color label(seat) retrieved from seatNumber.txt cannot be mouseClick and etc. But the one i run the seat normally display as blue color. first text in my searNumber.txt is 1, so the 1st label in the panel cannot be mouseClick and etc, it ONLY be blue color, but the rest blue color label can be mouseClick...
i want all the blue color label cannot be mouseClick...
maybe something wrong about my arrangement of coding, but i still cannot figure out, and tried so many times swapping them.

2st --> once i click on the "confirm" button, it can saved the name of labels(i given them a name for each label) into seatNumber.txt, but it keep repeating the name,for example:

i click 2 labels(named "3" and "4") on the panel, and click confirm button. It save the name of "3" 5 times, and "4" 5 times as well.

so i think is my looping problem but i keep chaging the arrangement,still nothing works.

so i'm here to ask for help.
here is my files:





here is the txt file:
seatNumber.txt

[ October 17, 2006: Message edited by: Nicky Eng ]
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the basis of you program should be a class called Seat (extends JLabel).
your program can then interact with 'seat' variables (whatever you want to include)

here's a simple demo.
click a square - turns red, click it again - reverts to green.
click confirm - any red turns to blue.

 
Nicky Eng
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
its good. but i need to retrieve from a text file, that's a requirement for my project.

yahooo...my problem 1 has been solved. i just need to cut this:


and paste to :


and i been forgot to close the bufferedReader b4 catch statement.

Tonite i will look at the problem 2.
[ October 18, 2006: Message edited by: Nicky Eng ]
 
Nicky Eng
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
esp thanks to Micheal.
helped me lot.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic