Results 1 to 2 of 2
  1. #1
    Alerhau's Avatar
    Alerhau is offline Senior Member
    Join Date
    Jun 2011
    Location
    Sweden
    Posts
    158
    Rep Power
    4

    Default Java, Reset Visibility Of An Object

    How can I make an object disappear when you click a button, then re-appear when you click it again? My current code is:

    Java Code:
    int i = 0;
    					
    					if(i == 0) {
    						GridPanel.setVisible(false);
    						i++;
    					} else {
    						GridPanel.setVisible(true);
    						Frame.add(GridPanel, BorderLayout.CENTER);
    						Frame.setVisible(true);
    						i = 0;
    					}
    What did I do wrong? Right now when you click it one time it dissapears, but does not come back when you click it again.
    Last edited by Alerhau; 08-10-2011 at 11:18 PM.

  2. #2
    Alerhau's Avatar
    Alerhau is offline Senior Member
    Join Date
    Jun 2011
    Location
    Sweden
    Posts
    158
    Rep Power
    4

Similar Threads

  1. Help! set dinamically visibility of panels
    By unkus_nob in forum JavaFX
    Replies: 5
    Last Post: 06-21-2011, 09:06 PM
  2. Replies: 0
    Last Post: 03-13-2011, 03:54 AM
  3. Java Visibility
    By efozdel in forum New To Java
    Replies: 8
    Last Post: 07-07-2010, 03:36 AM
  4. Replies: 2
    Last Post: 01-24-2010, 03:41 PM
  5. Newbie help on visibility and static final
    By tornado in forum New To Java
    Replies: 3
    Last Post: 11-28-2008, 01:32 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •