Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-06-2008, 04:36 PM
iuna's Avatar
Member
 
Join Date: Sep 2008
Posts: 16
iuna is on a distinguished road
deprecated method.. help!
Can someone please help me in converting the deprecated method handleEvent() to processEvent() in this program? I don't know how..

attached is the program I'm working on.. thanks for the help
Attached Files
File Type: zip Game.zip (28.5 KB, 8 views)
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 09-06-2008, 05:50 PM
Norm's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Heredia, Costa Rica
Posts: 2,223
Norm is on a distinguished road
What have you tried so far?
What does the doc say for the new method?
Why are you using such low level methods? This must be a VERY old program.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 09-07-2008, 08:45 AM
iuna's Avatar
Member
 
Join Date: Sep 2008
Posts: 16
iuna is on a distinguished road
it says that I have to use protected void processEvent(AWTEvent e)..

seems like I have to create an AWTEvent method.. does it mean that I just have to copy all the contents of handleEvent into the AWTEvent?

waa.. O_O
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 09-07-2008, 04:37 PM
Norm's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Heredia, Costa Rica
Posts: 2,223
Norm is on a distinguished road
There is a problem with Game.zip file. I can't open it after its downloaded.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 09-07-2008, 06:02 PM
Fubarable's Avatar
Senior Member
 
Join Date: Jun 2008
Posts: 870
Fubarable is on a distinguished road
I opened it with 7-zip, but it was created using AWT which I don't know:
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 09-07-2008, 06:23 PM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 4,545
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Did you read the Java document? It should be clearly explain what you have to do.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 09-07-2008, 06:47 PM
Norm's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Heredia, Costa Rica
Posts: 2,223
Norm is on a distinguished road
Quote:
Why are you using such low level methods?
You should rewrite the code to use current techniques such as Listeners.
What events does the code handle?
Bookmark Post in Technorati
Reply With Quote
  #8 (permalink)  
Old 09-08-2008, 12:42 PM
iuna's Avatar
Member
 
Join Date: Sep 2008
Posts: 16
iuna is on a distinguished road
sorry for the corrupted file..

it can be downloaded at mediafire[dot]com/download[dot]php?2scvqbhzg6x

(seems like I can't post links here)
Bookmark Post in Technorati
Reply With Quote
  #9 (permalink)  
Old 09-08-2008, 12:46 PM
iuna's Avatar
Member
 
Join Date: Sep 2008
Posts: 16
iuna is on a distinguished road
Quote:
Originally Posted by Norm View Post
You should rewrite the code to use current techniques such as Listeners.
What events does the code handle?
I think it handles the "Start", "Submit" and "Accept" events
Bookmark Post in Technorati
Reply With Quote
  #10 (permalink)  
Old 09-08-2008, 12:51 PM
iuna's Avatar
Member
 
Join Date: Sep 2008
Posts: 16
iuna is on a distinguished road
Quote:
Originally Posted by Eranga View Post
Did you read the Java document? It should be clearly explain what you have to do.
yes I've read it but I'm still new to Java so I'm still lost with the API..
Bookmark Post in Technorati
Reply With Quote
  #11 (permalink)  
Old 09-08-2008, 04:07 PM
Norm's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Heredia, Costa Rica
Posts: 2,223
Norm is on a distinguished road
Quote:
"Start", "Submit" and "Accept" events
Those don't sound like events. Are they the labels on buttons?
Buttons create ActionEvents which are handled by actionListeners.

The deprecation messages are only warnings. You can ignore them for now. The program should execute. As you learn java you will learn about events and listeners and will be able to rewrite the program to use them instead of using handleEvent
Bookmark Post in Technorati
Reply With Quote
  #12 (permalink)  
Old 09-08-2008, 10:38 PM
Senior Member
 
Join Date: Jul 2007
Posts: 1,222
hardwired is on a distinguished road
Code:
//import java.applet.*; import java.awt.*; import java.awt.event.*; //import java.lang.Math; public class BotNav extends Panel implements ActionListener, ItemListener { Matches parent; TextField counter; Label lcounter; Label lchoice; Choice choice; Button submit; Button start; Button accept; int selected = 1; String content; BotNav(Matches contr) { super(); parent = contr; counter = new TextField(3); counter.setEditable(false); lcounter = new Label(" Counter:"); lchoice = new Label(" Your turn:"); choice = new Choice(); choice.addItem("1"); choice.addItem("2"); choice.addItem("3"); choice.addItemListener(this); start = new Button("Start"); submit = new Button("Submit"); accept = new Button("Accept"); start.addActionListener(this); submit.addActionListener(this); accept.addActionListener(this); setLayout(new GridLayout(1,7)); add(start); add(lcounter); add(counter); add(accept); add(lchoice); add(choice); add(submit); } public int getSelected() { return this.selected; } public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { int result = parent.getCount(); if (result > 1) { selected = choice.getSelectedIndex() + 1; if ((result - selected) < 1) { parent.textField.setText("EEEEK ! Are you crazy ?"); } else { parent.textField.setText("Your choice is " + selected + ", you can submit it !"); } } } } public void actionPerformed(ActionEvent e) { Button button = (Button)e.getSource(); String ac = button.getActionCommand(); if (ac.equals("Start")) { parent.setCount(0); parent.board.repaint(); parent.textField.setText("Ok...now choose count of matches"); counter.setEditable(true); counter.requestFocus(); } if (ac.equals("Accept")) { boolean edit = counter.isEditable(); if (edit) { content = counter.getText(); int count = Integer.valueOf(content).intValue(); if ((count > 60) || (count < 2)) { parent.textField.setText("Choose min. 2 and max. " + "60 matches"); counter.requestFocus(); } else { counter.setEditable(false); counter.transferFocus(); parent.setCount(count); parent.board.repaint(); parent.textField.setText("Now it's your turn"); } } } if (ac.equals("Submit")) { int newcount = parent.getCount(); if (newcount > 1) { if ((newcount - selected) < 1) { if (newcount == 3) { parent.textField.setText("Take 2 !!!"); } else { parent.textField.setText("Take 1 !!!"); } } else { newcount -= selected; parent.setCount(newcount); parent.board.repaint(); counter.setText((String.valueOf(newcount).toString())); parent.myTurn(); } } } } }
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deprecated annotation JavaForums Java Blogs 0 07-16-2008 03:40 PM
I need help with a deprecated program mikau New To Java 0 02-13-2008 11:34 AM
getYear deprecated method ravian New To Java 1 01-28-2008 12:35 PM
Using Deprecated Methods ravian New To Java 3 11-23-2007 09:58 PM
method size is deprecated oregon New To Java 4 08-05-2007 07:59 PM


All times are GMT +3. The time now is 07:46 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org