• Post Reply Bookmark Topic Watch Topic
  • New Topic

difference between java.awt.Window.show() and java.awt.Component.setVisible(true)

 
Axel Janssen
Ranch Hand
Posts: 2166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
is there any real difference between the two methods. java.awt.Window.show() overrides a deprecated method in java.awt.Component without being deprecated itself.
I ask, because until recently I only knew the setVisible(true) method. But the form editor of my brandnew NetBeans-IDE uses java.awt.Window.show().
Axel
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
show() does a bit more work. It will make both the Window and its owner visible. If it's already visible it'll come to the front. In either case, it also gets validated.
That behavior matters lots in Forte CE; setVisible() is "just" show or hide. Setting it to true repeatedly, for example, has no effect.
------------------
Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!