Мне нужна помощь в создании графического интерфейса вокруг этой программы.
Этот код написан на языке java. Я хотел бы построить графический интерфейс вокруг этой простой игры. Я хочу, чтобы графический интерфейс принимал входные данные, а также отображал то, что обычно было бы на терминале.
Что я уже пробовал:
import java.util.Scanner; import java.util.Random; /* The purpose of this game is to guess the same number as the number as the computer comes up with. * When you guess the right number your money is multiplied by your bet, when you lose you bet is take from you money. * When your completely out of money the game ends. the point in this game is not to get into betting, * this program was made for practice and fun only. Although if anyone reading this wants to give me money feel free (; */ public class Maingame { static int money = 100; static int userguess; static int computernumber; public static void main(String[] args) { System.out.println("Welcome to Isaac's Guessing Game Attempt number two"); System.out.println("Pick a number between 1 and 10"); playgame(); } public static void playgame() { Scanner in = new Scanner(System.in); userguess = in.nextInt(); computernumber = new Random().nextInt(5) + 1; System.out.println(" Make a bet."); Scanner bet = new Scanner(System.in); int Bet = bet.nextInt(); int ng = 0; if (computernumber == userguess) { money *= Bet; ++ng; System.out.println("Well done You guessed the right number."); System.out.println("Your money is now £" + money + ". Don't spend it all in one place."); System.out.println("your number of guess is " + ng + "."); System.out.println("Make a new guess."); } else { money -= Bet; ++ng; System.out.println("Oh no you guessed the wrong number."); System.out.println("You have lost £" + Bet + ". You only have £" + money + " left."); System.out.println("Guess again"); } if (money >= 0) { playgame(); } else { System.out.println("Your out of " + "money. Game Over!!!!!!!!!!"); } } }