• Post Reply Bookmark Topic Watch Topic
  • New Topic

downsides omitting getContentPane()  RSS feed

 
Peter Karp
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
AFAI found out getContentPane() is not longer needed since Java 1.5. Are there problems when I don't have lecacy 1.4 or older code and strictly will use 1.5+?

Thanks for your help!
Peter
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you problem will be trying to run the code on any machine that uses a JRE version < 1.5
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The 1.4 implementation of JFrame.add() throws an exception. The 1.5 implementation calls getContentFrame().add(). As long as you're not running on 1.4 or earlier (i.e., if you're using other 1.5 features) then there's no downside to using this shortcut. Frankly, the old behavior was a silly mistake and they should have done the shortcut in the first place.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!