Results 1 to 6 of 6
Thread: setVisible does not work
- 04-09-2011, 07:59 AM #1
Member
- Join Date
- Mar 2011
- Posts
- 17
- Rep Power
- 0
setVisible does not work
Hi all,
I have a strange problem i cannot solve for days. Pls have a look on this code:
Nothing interesting going on, but this tableAccounts.setVisible(false); does not do anything it should hide the swing component but it does not. I have also try repaint, invalidate(), revalidate, nothing works. But for example panel is working just fine. Any idea, it is mistery i dont understand. From my point of view it is a hure BUG in java it self.Java Code:private void treeAccountsMouseClicked(java.awt.event.MouseEvent evt) { DefaultMutableTreeNode node = (DefaultMutableTreeNode)treeAccounts.getLastSelectedPathComponent(); String output = treeAccounts.getLastSelectedPathComponent().toString(); //System.out.println(output); if ("Accounts".equals(output)) { tableAccounts.setVisible(true); } else { tableAccounts.setVisible(false); } }
Regards
- 04-09-2011, 04:08 PM #2
Senior Member
- Join Date
- Jul 2009
- Posts
- 1,158
- Rep Power
- 5
Post your Short, Self Contained, Correct Example that demonstrates the problem.
-
I second that. I'll bet that he has shadowed the tableAccounts variable so that the one being set visible and invisible is not the one being displayed, but again, since the problem is not in the code posted, I again strongly second the recommendation that the OP create and post an SSCCE.
To the OP, please read the link as we don't want to see all of your code or even code snippets as folks often post the wrong snippet and not the one that shows the problem (as you've done here). Better to create a new small compilable runnable program that demonstrates the problem. Again, the link will explain all.
- 04-10-2011, 09:34 AM #4
Member
- Join Date
- Mar 2011
- Posts
- 17
- Rep Power
- 0
Well. What i want to archive is to hide jTable component during the click button event. It simple does not hide it! It does not do anything. My guess when i use setVisible false it should hide it but it wont. There is no any example needed. I found this on java as a major bug and it is case by treading. I was wonder there might be some workaround?
-
- 04-10-2011, 10:35 PM #6
The first question that comes in my mind is, Are you sure that method is even called??
Similar Threads
-
IndexOutOfBoundsException when jDialog.setVisible(true)
By madcloud in forum AWT / SwingReplies: 4Last Post: 12-27-2010, 03:43 PM -
.setVisible(false); not working... grr...
By Roclemir in forum New To JavaReplies: 8Last Post: 05-29-2010, 12:22 AM -
can't get setVisible(false) to work
By alexander.s in forum AWT / SwingReplies: 0Last Post: 04-27-2010, 08:33 PM -
Question regarding JButton .setVisible() and .setEnabled()
By JFReturns in forum Java AppletsReplies: 4Last Post: 02-26-2009, 11:46 PM -
setVisible(true) does not work
By Gajesh Tripathi in forum AWT / SwingReplies: 2Last Post: 10-27-2007, 07:32 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks