File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Displaying panels... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Displaying panels..." Watch "Displaying panels..." New topic

Displaying panels...

celine mcgowan
Ranch Hand

Joined: Nov 22, 2003
Posts: 36
Hi Everyone,

Sorry to bother you all again. I am again having probs with an accursed LED panel thingy. I have finally got it to compile etc - thanks everyone for your help with that (see post here:Non-default constructor problem)! Anyway, I have a method which updates the gifs which are in an LEDPanel:

I am calling the above method 8 times in another class in order to output 8 LED displays. Here's that code:

When i run LEDPanel, i only get one panel displaying. It seems to be the last panel, but i'm not sure! Does anyone know why there is only one LED displaying, and not all 8?

Thanks again all.

We've heard that a million monkeys at a million keyboards would eventually reproduce the entire works of Shakespeare. Now, thanks to the Internet, we know this is not true.<br />- Robert Wilensky
Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823
Read up about layout managers in your Swing reference. You need to use one.

Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
If it's the size, possible this line
setBorder( BorderFactory.createEmptyBorder( 20, 20, 20, 20 ) );

should be
ledPanel.setBorder( BorderFactory.createEmptyBorder( 20, 20, 20, 20 ) );
celine mcgowan
Ranch Hand

Joined: Nov 22, 2003
Posts: 36
Hi All,

Thanks for your help. I have changed the code in LEDPanel so that there is a GridLayout manager (one row, eight columns) on the main Panel:

This still only outputs one LED... Am i doing something really silly?

Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
Moving this to the Swing / JFC / AWT forum...
[ August 20, 2004: Message edited by: Dirk Schreckmann ]

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
I agree. Here's the link:
subject: Displaying panels...
It's not a secret anymore!