Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 12 of 12

Thread: Hide/Show Form?

  1. #1
    Junior Member
    Join Date
    Jun 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Hide/Show Form?

    I've taken on a project making a program written in Java, with no prior training in Java. I know VB .net, C++, and even SQL, but for the life of me I can't figure out how to implement the same functionality in Java as I can in VB .net.

    All I want to do (to start with) is (using VB .net terminology) hide and show forms. In VB .net I just used "me.hide" and "formx.show" but I don't see how to implement stuff like that in Java and would like some help with that, to begin with.


  2. #2
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: Hide/Show Form?

    What are you talking about: a Java application, a Java Applet or a webpage with Javascript?

  3. #3
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: Hide/Show Form?

    You can use .isVisible() on a JPanel
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Hide/Show Form?

    For more info about this problem: See cross post at The Java Equivalent? - Dev Shed

  5. #5
    Forum old-timer
    Join Date
    Nov 2008
    Location
    Faversham, Kent, UK
    Posts
    472
    My Mood
    Mellow
    Thanks
    4
    Thanked 58 Times in 54 Posts

    Default Re: Hide/Show Form?

    Quote Originally Posted by Norm View Post
    For more info about this problem: See cross post at The Java Equivalent? - Dev Shed
    Good grief!

  6. #6
    Junior Member
    Join Date
    Jun 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Hide/Show Form?

    Ah, no please do NOT see that post. That guy Norm has wasted my time over on that site and now he's hijacking my thread here too.

    Look, all I want to do is get a Java program to show/hide forms, that's it! Please, someone other than Norm help me out!

  7. #7
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Hide/Show Form?

    Post the code that is the problem. There are no forms in Java.

  8. #8
    Junior Member
    Join Date
    Jun 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Hide/Show Form?

    Quote Originally Posted by Junky View Post
    What are you talking about: a Java application, a Java Applet or a webpage with Javascript?
    A Java application

  9. #9
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Hide/Show Form?

    That guy Norm has wasted my time over on that site and now he's hijacking my thread here too.
    Not a great way to try and get help...Norm is a valuable contributor here (and the website in the link), and has been quite patient with you - asking the same questions that we all have as you have not presented your questions clearly at all. I personally have no idea what you mean by a form...in Swing, things are components combined together, so if you are talking about this (I'm guessing here) you can use a particular layout, remove them from the layout, or have a separate from which is disposed of.
    Last edited by copeg; June 30th, 2011 at 03:20 PM.

  10. The Following 2 Users Say Thank You to copeg For This Useful Post:

    JavaPF (June 30th, 2011), Norm (June 30th, 2011)

  11. #10
    Forum old-timer
    Join Date
    Nov 2008
    Location
    Faversham, Kent, UK
    Posts
    472
    My Mood
    Mellow
    Thanks
    4
    Thanked 58 Times in 54 Posts

    Default Re: Hide/Show Form?

    Quote Originally Posted by chickenhawk View Post
    Ah, no please do NOT see that post. That guy Norm has wasted my time over on that site and now he's hijacking my thread here too.
    You're going to get on everyone's ignore list if you carry on like this. Norm has been surprisingly patient, considering how little information you seem prepared to divulge.

    Look, all I want to do is get a Java program to show/hide forms, that's it! Please, someone other than Norm help me out!
    The standard GUI classes supplied with Java are the AWT and Swing classes - Swing is the most recent and widely used. With Swing windows/frame components (presumably the equivalent of 'forms'), you show and hide them with setVisible(true) and setVisible(false). However, you have said you're using a class that isn't part of Swing or AWT, and you can't tell us anything about it other than it doesn't have a setVisible method. From this, you expect us to be able to tell you how to show and hide it? Are we supposed to be clairvoyant?

    Either tell us what library this class comes from, or provide a link to the API docs for this class so we can help you, or go to wherever you got it from and ask them.

  12. #11
    Forum old-timer
    Join Date
    Nov 2008
    Location
    Faversham, Kent, UK
    Posts
    472
    My Mood
    Mellow
    Thanks
    4
    Thanked 58 Times in 54 Posts

    Default Re: Hide/Show Form?

    Update - I did a quick Google for the org.jmat.io.gui package, which contains the FrameView class in question, and it is a direct subclass of javax.swing.JFrame... so it does have a setVisible(..) method.

    See the FrameView API docs.

  13. #12
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Hide/Show Form?

    I think the OP doesn't understand OOP and inheritance. The bit of code he posted looked like he was trying to call setVisible as a static method. But I could never get him to post the code and the error message.

Similar Threads

  1. Show files name in JFrame
    By altisw5 in forum AWT / Java Swing
    Replies: 15
    Last Post: November 30th, 2011, 08:30 AM
  2. "Static method cannot hide instance method from implemented Interface"
    By Gthoma2 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: June 21st, 2011, 03:03 AM
  3. Beginner: Show Image in Label when Results Show Up
    By Big Bundy in forum Java Theory & Questions
    Replies: 3
    Last Post: April 4th, 2011, 02:43 PM
  4. J2ME-Show RMS data in tabular form
    By Sunil Raghuvanshi in forum Java ME (Mobile Edition)
    Replies: 1
    Last Post: January 24th, 2011, 08:06 AM
  5. Java Swing :Back Button from one form to another form
    By srinivasan_253642 in forum AWT / Java Swing
    Replies: 1
    Last Post: December 26th, 2009, 09:51 AM