Error warning using show() from java.awt.Window

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Dec 2006
Posts: 2,033
Reputation: Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of 
Solved Threads: 177
Aia's Avatar
Aia Aia is offline Offline
Postaholic

Error warning using show() from java.awt.Window

 
0
  #1
Dec 29th, 2007
Self-teaching Java, I am following a video tutorial about simple windows.
Encountered a warning error using the example provided in the tutorial.

Here's the piece of code.
  1. import java.awt.Frame;
  2. import java.awt.Label;
  3. import java.awt.AWTEvent;
  4. import java.awt.event.WindowEvent;
  5.  
  6. public class HowdyByeWindow extends Frame {
  7. public static void main( String[] args ) {
  8. new HowdyWindow();
  9. }
  10. HowdyByeWindow() {
  11. Label label;
  12. label = new Label( "Howdy" );
  13. add( label );
  14. pack();
  15. show();
  16. }
  17. public void processWindowEvent( WindowEvent event ) {
  18. if ( event.getID() == WindowEvent.WINDOW_CLOSING )
  19. System.exit( 0 );
  20. }
  21. }

Here's the warning when compiled without flags:
C:\Programming\JavaProg\HowdyWindow>javac HowdyByeWindow.java
Note: HowdyByeWindow.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

Followed the second note and compiled using -Xlint:deprecation:
  1. C:\Programming\JavaProg\HowdyWindow>javac -Xlint:deprecation HowdyByeWindow.java
  2.  
  3. HowdyByeWindow.java:15: warning: [deprecation] show() in java.awt.Window has been deprecated
  4. show();
  5. ^
  6. 1 warning

What do I need to do about that warning? Can I substitute show() for something else?
Don't mind if you explain to me things like if "I were a dummy", since I'm barely getting acquaint with the language.
Last edited by Aia; Dec 29th, 2007 at 5:35 pm.
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 2,415
Reputation: masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of 
Solved Threads: 256
Moderator
masijade's Avatar
masijade masijade is offline Offline
Nearly a Posting Maven

Re: Error warning using show() from java.awt.Window

 
1
  #2
Dec 29th, 2007
change from show() to setVisible(true) .... and find a better tutorial, that one's outdated.
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 794
Reputation: darkagn has a spectacular aura about darkagn has a spectacular aura about darkagn has a spectacular aura about 
Solved Threads: 110
darkagn's Avatar
darkagn darkagn is offline Offline
Master Poster

Re: Error warning using show() from java.awt.Window

 
0
  #3
Dec 29th, 2007
Originally Posted by masijade View Post
change from show() to setVisible(true) .... and find a better tutorial, that one's outdated.
Masijade's right here - find a tutorial on swing rather than awt as the swing packages have mostly overtaken the functionality of the awt packages.
There are no stupid questions, only those too stupid to ask for help.
echo is a web developer's best friend.
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 2,033
Reputation: Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of Aia has much to be proud of 
Solved Threads: 177
Aia's Avatar
Aia Aia is offline Offline
Postaholic

Re: Error warning using show() from java.awt.Window

 
0
  #4
Dec 29th, 2007
Thank you.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC