Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

A doubt in setVisible() in gui  RSS feed

 
Nijin puthiya purayil
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 16007
87
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Nijin puthiya purayil
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2787
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2787
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It shouldn't cause any problems, those a valid methods found in the API.
 
Bill Krieg
Greenhorn
Posts: 9
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!