• Post Reply Bookmark Topic Watch Topic
  • New Topic

JPanel only displays one component  RSS feed

 
Rachel Thornton
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When user clicks on a button, it creates a new JDialog component which should have several components on it. However, no matter which components i add to the JDialog, when the JDIalog becomes visible, it only displays the first component to be added. The other components will show up if the mouse is moved over them. I'm creating the JDIalog using the SwingWorker class that I got from the Sun website, and I've tried to validate()/repaint() the JDIalog after it becomes visible, but nothing seems to have any effect.
Any ideas?
Thanks
Rachel
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rachel Thornton:
However, no matter which components i add to the JDialog, when the JDIalog becomes visible, it only displays the first component ...
Any ideas?
Thanks
Rachel

Hy Rachel,
I know this problem when I forgot to set up a LayoutManager.
Could this be your reason?
 
Rachel Thornton
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've tried several different LayoutManagers, Grid, Border, VerticalFlow etc. This morning I've also tried to display a JColorChooser dialog, and again, only one component displays (the blank tabbed pane, titled "Swatches"). I'm sure it must be a painting problem, but can't work out what.
I'm a bit stuck with this one!
Thanks
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not post the code.
 
Abhik Sarkar
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rachel,
If you are creating and displaying your dialog in the construct method of the SwingWorker, maybe you could try to create the dialog in the construct and displaying it in the finished method.
HTH,
Abhik.
[ August 05, 2003: Message edited by: Abhik Sarkar ]
 
Garandi Garandi
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this.

Hope this will help
[ August 05, 2003: Message edited by: Garandi Garandi ]
 
Rachel Thornton
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've found my problem, eventually! Narrowed the problem down to one line, where I was setting the default renderer for a JTable. I'd written my own default renderer, and it had somehow got corrupted, although I'm not entirely sure why!
Anyway, it works fine now.
Thanks for the help.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!