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

Gui components disappearing

Stef Van Gils

Joined: Dec 18, 2012
Posts: 2
Hello, I made a gui, this gui containts a JTree, a JList, encapsulated in a JScrollPane and a couple of JButtons.

I thought it worked, but today I double clicked accidentally on a JTree entry and all things disappearded.
If i hover over the components, they become visible again, but it's not the intention. Is there any solution to let the other components be visible when i double click?

Here's my code:

Tony Docherty

Joined: Aug 07, 2007
Posts: 2830
That's too much uncommented code for me to look through right now so the following is a total guess but when GUI components disappear as you have described it can be down to structurally changing the GUI in some way (eg add/removing components) and not revalidating it.
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

I haven't looked at the code much either, but I can say that I have an application which uses JTrees extensively, and it used to be that my tree model didn't report changes correctly and as a result I used to get blank spaces between the rows and other undesirable mis-features.
Stef Van Gils

Joined: Dec 18, 2012
Posts: 2
And what was the solution to it?

I add the components when I create the JFrame, I only change the entries of a JList and the nodes of the JTree
I agree. Here's the link:
subject: Gui components disappearing
It's not a secret anymore!