Guess The Number Game using Java Swing #javacode03
Guess The Number Game using Java Swing
JavaCode3
New Update v1.3:
*Added New Button of Instruction which displays the instruction frame of the game.
*Removed the Guess The Number Image from previous frame.
*Added Name input Dialog box on opening of game window.
Updated on 7/02/2022
Introduction : Made Guess the Number game in which you have to enter any number between 1 to 100 and also computer selects some number and you number should be equal to the computer number then only you can win.
Made a gui with the help of Eclipse IDE 2021-12 and JDK 17.
Made a gui with the help of Eclipse IDE 2021-12 and JDK 17.
Working : First it will launch the frame then only you can play here i have used 5 Button which are Exit, Guess, Play again, Quit and Click here to set the username.
- Click Here to set Username = lets talk about "Click Here to set Username" Button if You click on it ,it will show a dialog box which asks to enter your name after entering you name it will set your name in the label as Welcome Name.This button calls the name method in respective class. if users enter no name then it will appear same dialog box. After that the button gets Invisible.
- Exit = This Button closes the game and exits the frame.
- Play Again = When clicked on this button this button resets all the textfield, score label, rounds label, also the results.
- Quit = When clicked on this button it shows the answer in the result label. Then the Guess button gets disabled.
- Guess = When this Button is clicked it will first check that the user is entering the correct number or not using if condition, and also it sets the results on the results label. Then it will check that the Entered Number is Greater or Lesser or equals then it will set the result according to it and also displays the Round. If the Number is equals to Computer Number Then it will show a dialog box of congratulating and also gives how many rounds you required, also display the Score in Score label. From here Quit Button Disable and also the guess button gots disable.
About Game : The user should put input between Number 1-100.
Score is equals to Rounds*5, so this game required less score less score is the winner.
Score is equals to Rounds*5, so this game required less score less score is the winner.
There is no limit for Rounds you can play with unlimited Rounds.
Conclusion : Made a game for all age Students and Adults. Simple UI.
I have Attached some Screenshots of my Output. I have made a jar file also which you can run anywhere on any pc but you should have Installed JDK or JRE.
When Window Opens This Dialog Box Appears |
After Entering Your Name |
After clicking On New Button Instruction Frame Appears |
1st Round Of The Game |
After Winning |
Comments
Post a Comment