File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT / JFace and the fly likes A doubt in setVisible() in gui Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT / JFace
Reply Bookmark "A doubt in setVisible() in gui" Watch "A doubt in setVisible() in gui" New topic
Author

A doubt in setVisible() in gui

Nijin puthiya purayil
Ranch Hand

Joined: Nov 09, 2011
Posts: 32
Hai,
I have a simple doubt...i created a GUI application in java, a complex one with NetBeans IDE..and is running perfectly without any problems...here i used the setVisible method a number of times for the components like JList, JLayeredPane etc...
can there be any problem in future in my application because of this setVisible method...if so is there any solution for that....
any help will be appreciated...thanks in adcance
Jesper de Jong
Java Cowboy
Bartender

Joined: Aug 16, 2005
Posts: 11642

Why do you suspect that there might be a problem with the setVisible() method, did somebody tell you that or did you read something somewhere? Please tell us more about why you think this might be a problem.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Nijin puthiya purayil
Ranch Hand

Joined: Nov 09, 2011
Posts: 32
Jesper de Jong wrote:Why do you suspect that there might be a problem with the setVisible() method, did somebody tell you that or did you read something somewhere? Please tell us more about why you think this might be a problem.


Yes one person told me that he had a problem in developing some gui application...but not in java..actually i was developing an application for him and when i was discussing with him then he told me like that
since i was a beginner and he is an experienced person i had that doubt...but again he does not know java but knows oop very well...this is just a doubt,, i'm not sure whether it is foolish to ask..if so pardon me..
thanks again
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 1652
There is no need to use setVisible() on a JList or JLayeredPane etc. Those components are always visible (assuming you add them to a window).

You only use setVisible() on JFrame, JDialog, etc.
Nijin puthiya purayil
Ranch Hand

Joined: Nov 09, 2011
Posts: 32
Rob Camick wrote:There is no need to use setVisible() on a JList or JLayeredPane etc. Those components are always visible (assuming you add them to a window).

You only use setVisible() on JFrame, JDialog, etc.



Thanks for your reply.....here i know these components are always visible...but i made them invisible through some actionListeners like KeyTyped, KeyReleased etc using setVisible(false)...and made visible for some other actionListeners using setVisible(true)...
and again i'm telling you that my application is working perfectly without any problems....actually i meant to say whether this can make any problems in future in my application...
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 1652
It shouldn't cause any problems, those a valid methods found in the API.
Bill Krieg
Greenhorn

Joined: Jul 31, 2011
Posts: 9
Let's see. Some guy who doesn't know java had problems writing a GUI. He was writing it in a language other than Java. Because of this you're wondering if you should be worried about a Java application you wrote which appears to run just fine.

Stop thinking that this guy is raising valid issues.

Start believing you're a better developer than he is in spite of his experience.
Nijin puthiya purayil
Ranch Hand

Joined: Nov 09, 2011
Posts: 32
Bill Krieg wrote:Let's see. Some guy who doesn't know java had problems writing a GUI. He was writing it in a language other than Java. Because of this you're wondering if you should be worried about a Java application you wrote which appears to run just fine.

Stop thinking that this guy is raising valid issues.

Start believing you're a better developer than he is in spite of his experience.


Thanks for your reply Bill Krieg and Rob Camick...
So now i believe i'm a better developer than him...
Thanks again
 
 
subject: A doubt in setVisible() in gui
 
Threads others viewed
Doubt
criteriaFind() doubt
doubt ........
doubt
Doubt
IntelliJ Java IDE