• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

deprecated API

 
Akshay Reddy
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
heyy i am unable to understand this,



for this code the error message is

a deprecated API in line 32 --- that is the frame.show() is long back Deprecated it seems

my laptop has jdk1.6 and it show the deprecated warning in my laptop

while my friend has jdk 1.4 and it is fine there.....what is the alternative to remove this warning message in Jdk 1.6
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming LiftSimFrame extends java.awt.Window you need to use the setVisible(boolean) mehod. When you get a deprecation warning you need to check the JavaDocs, they wioll tell you the method that is replacing the deprecated one.
 
Akshay Reddy
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So , do you want me to do this....as you can see,
I have imported the java.awt.window package and i have changed frame.show() to frame.setvisible(true)



 
Campbell Ritchie
Sheriff
Pie
Posts: 49865
71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Abhinav Atla wrote:So , do you want me to do this
What we really want you to do is to look at the show() method documentation and see what it recommends there.
 
chandrakant karale
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to get rid of that warning only without bothering about the deprecation, just use supress warning annotation.

 
Rob Spoor
Sheriff
Pie
Posts: 20613
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which is a bad idea for deprecated code. It's deprecated for a reason, and should not be used at all unless you really, really have to. And you don't have to unless you are implementing an interface with deprecated methods (like java.sql.ResultSet).
 
Campbell Ritchie
Sheriff
Pie
Posts: 49865
71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To add to what Rob says, there are some deprecated methods which are positively harmful, so you need to know they are deprecated and not use them.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic