Meaningless Drivel is fun!*
The moose likes Swing / AWT / SWT and the fly likes complicated code, 900 labels. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "complicated code, 900 labels." Watch "complicated code, 900 labels." New topic
Author

complicated code, 900 labels.

Nicky Eng
Ranch Hand

Joined: Mar 26, 2005
Posts: 378
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 ]

From NickyEng
Diploma in Computer Studies
SCJP 1.4
SCWCD 1.4
Formula 1 app by Maxis (Playbook)
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
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

Joined: Mar 26, 2005
Posts: 378
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

Joined: Mar 26, 2005
Posts: 378
esp thanks to Micheal.
helped me lot.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: complicated code, 900 labels.
 
Similar Threads
JComboBox in panel
Adding JLabels to JPanel as user creates Shapes
Applet won't work in web page!
Problem With GUI of Net Beans
Center a JPanel in JScrollPane and add a JToolBar