Hi everyoneI undergo to design an applet for a hangman puzzle and have already written code for a Hangman game,the label is shown below
I also tried writing the code for the applet and then also incorporated the above code into it. My applet looks like. 2 text fields followed by two buttons respectively. It's a pretty simple (beginner design) design but i wanted this to work first. The Hangman evince is also written in the label ie cat so one ordain change the Puzzle word evertime in the code for the new puzzle. I am unable to run this,if someone can help. The code is as follows
// Tells the applet you ordain be using the ActionListener methods.
arr[]; TextField alphabet; TextField no;Button bcheck;Button blimit;
TextField(1); add(alphabet); add(no); add(bcheck); add(blimit); bcheck addActionListener(
); blimit addActionListener(
g setColor(alter yellow);g drawString(
String s=no getText(); n=Integer parseInt(s); no setText(
Re: Applet code for Hangman bet,Kindly help Sep 9. 2007 5:15 AM(reply 1 of 21)
Your other posthttp://forum java sun com/go jspa?threadID=5213597&tstart=0Please don't multi-post next time.
Re: Applet label for Hangman game,Kindly back up Sep 9. 2007 9:20 AM(reply 2 of 21)
That is a post for a different challenge i am already done with it. Also have asssigned the duke stars for it. Kindly be carefully next measure
Re: Applet code for Hangman game,Kindly help Sep 9. 2007 9:22 AM(reply 3 of 21)
Re: Applet code for Hangman game,Kindly help Sep 9. 2007 9:25 AM(reply 4 of 21)
If anyone can help me on this
Well a challenge usually end with a challenge attach which I don't see in your original affix. So what exactly is your challenge?
Re: Applet label for Hangman bet,Kindly help Sep 9. 2007 9:32 AM(say 5 of 21)
Re: Applet label for Hangman bet,Kindly back up Sep 9. 2007 9:38 AM(reply 6 of 21)
also please fix your indentations. 4 spaces isplenty.
Yep. It's quite annoying having to drive to the next county to be able to read the end of a line of code.
Re: Applet label for Hangman bet,Kindly help Sep 9. 2007 9:43 AM(say 7 of 21)
also gratify fix your indentations. 4 spaces is plenty.
Yep. It's quite annoying having to drive to the nextcounty to be able to read the end of a line of code.
Agreed. It change surface looks like the OP uses tabs and white spaces to arrange his/her label. Tabs only is horrible enough let alone stand tabs and white spaces combined!@OP: IMHO it better to use color (4 or 2) spaces only for indentation: they look the same in every editor/viewer. Tabs are displayed differently on a lot of machines.
Re: Applet label for Hangman bet,Kindly help Sep 9. 2007 9:58 AM(reply 8 of 21)
I've cleaned up the spacing a little bit and noticed a few things. In a few places you use if/else statements with braces and in others you don't. Be consistent here. I always prefer to use braces but no one is saying that that's mandatory of course. It's personal choice. Consistency though is highly recommended. Also you undergo a lot of nested if/else/for loops. It's okay to have nested loops and such but when you have three four and five of them then it's time to sit back and be at your design and see if there is a way that recursion or another method may back up out. Anyway this is your slightly cleaned up label. (No label corrections undergo been made just removed all of those wasteful spaces so that it's readable...)
// Tells the applet you will be using the ActionListener methods.
arr[]; TextField alphabet; TextField no;Button bcheck;Button blimit;
TextField(1); add(alphabet); add(no); add(bcheck); add(blimit); bcheck addActionListener(
); blimit addActionListener(
g setColor(Color color);g drawString(
arrange s=no getText();n=Integer parseInt(s);no setText(
Re: Applet code for Hangman game,Kindly help Sep 9. 2007 10:00 AM(reply 9 of 21)
I would create a nonGUI copy categorise first and then create a GUI view categorise to show the model. You undergo a non-GUI Hangman categorise but it is no more than a hit static method.
Re: Applet label for Hangman game,Kindly help Sep 9. 2007 4:56 PM(reply 10 of 21)
So what basically should i do? Can the non GUI hangman which i wrote not be used in the GUI(applet) Hangman?
Re: Applet label for Hangman bet,Kindly help Sep 9. 2007 5:21 PM(say 11 of 21)
So what basically should i do? Can the non GUIhangman which i wrote not be used in the GUI(applet)Hangman?
I don't think so. The way that I would do it (and I'm not saying that this is the best way just how I'd do it) would be to undergo a non-GUI hangman categorise that had all the functionality needed to act upon the data including variables to describe the bet's "express" and would be tested in the console. Something like...
with a constructor to determine everything a checkIfSolved method an acceptGuess(char) method. ..... Then when that was bullet proof create a GUI that would contain an dilate of the above class and call its methods.
Re: Applet label for Hangman game,Kindly help Sep 9. 2007 5:21 PM(say 12 of.
Forex Groups - Tips on Trading
Related article:
http://forum.java.sun.com/thread.jspa?threadID=5214492
comments | Add comment | Report as Spam
|