Results 1 to 7 of 7
  1. #1
    yonghan is offline Member
    Join Date
    Aug 2008
    Posts
    7
    Rep Power
    0

    Default [SOLVED] how to hide jframes

    Hi all,i want to ask,i've created a jdialog for login form,and a jframe for main app using netbeans.I've suceed in hiding the login form and displaying the main form,what i want to ask is how to show the login form again when i use a logout action on the main form?Thanks a lot guys.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    I assume that when you were done with your JDialog, you called setVisible(false) on it to make it invisible. To redisplay this, you have one of two options:

    1) You could reinstantiate your JDialog object from the class code, the same way that you instantiated it to begin with, or
    2) You can redisplay the same JDialog that was used initially, and in fact, you'd display it the same way you displayed it previously:
    Java Code:
    MyJDialog.setVisible(true);
    For more specific information, you may wish to post some compilable code.

  3. #3
    yonghan is offline Member
    Join Date
    Aug 2008
    Posts
    7
    Rep Power
    0

    Default I'll ty it

    Thanks,i'll try it..As i have tested before,it doesn't work..

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    This is another example of a tool repressing learning. I think that you're over-riding problem is relying on NetBeans to create your Swing code without first having a solid understanding of Swing. You are far better off creating your own Swing code and going through the Sun Swing tutorials and not using NetBeans to generate your code until you know more about Swing. Else you'll get stuck like this again and again.

  5. #5
    yonghan is offline Member
    Join Date
    Aug 2008
    Posts
    7
    Rep Power
    0

    Default It works with jframe

    Ok,i solved the problem with using 2 jframes..

  6. #6
    HosHos's Avatar
    HosHos is offline Member
    Join Date
    Aug 2009
    Posts
    10
    Rep Power
    0

    Lightbulb An Urgent Request

    Hi,
    Will you tell me how to use two jframes, and switch between them using a button in the first one to open the second and hide the first.

  7. #7
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    1. Are you absolutely sure that you want to do this? For most questions of this type, we ultimately see the coder using a CardLayout and swapping one JPanel for another, all within the same Window. This is how most commercial apps work.
    2. What have you got so far? Can you show us code from your program (compilable would be preferred) that shows your current set up? Non-NetBeans-generated code is preferred here as it is much more readable then the dreck that comes out of NetBeans.
    3. Please re-ask this question in your own new thread rather than hijack an old thread. This is a new question, this is your question, so it should be in your thread. You may link to this thread or any other thread that you feel may help clarify your quesiton.

    Also, when posting code here, please use code tags so that your code will retain its formatting and thus will be readable -- after all, your goal is to get as many people to read your post and understand your code as possible, right?

    To do this, highlight your pasted code (please be sure that it is already formatted when you paste it into the forum; the code tags don't magically format unformatted code) and then press the code button, and your code will have tags.

    Another way to do this is to manually place the tags into your code by placing the tag [code] above your pasted code and the tag [/code] below your pasted code like so:

    Java Code:
    [code]
      // your code goes here
      // notice how the top and bottom tags are different
    [/code]
    Best of luck!

Similar Threads

  1. How to Hide cursor
    By priya in forum Java Software
    Replies: 1
    Last Post: 12-09-2010, 10:39 PM
  2. Adding JPanels to JFrames based on x-y co-ordinates
    By aneesahamedaa in forum AWT / Swing
    Replies: 4
    Last Post: 07-24-2008, 11:41 PM
  3. problem with getting new JFrames
    By geork in forum New To Java
    Replies: 0
    Last Post: 02-09-2008, 01:46 PM
  4. To hide browser heading
    By priyanka_t in forum JavaServer Pages (JSP) and JSTL
    Replies: 4
    Last Post: 01-09-2008, 08:56 AM
  5. Handling Two JFrames
    By hiranya in forum AWT / Swing
    Replies: 2
    Last Post: 11-05-2007, 08:23 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
  •