I tried to make a simple game with Javafx ① "Let's find happiness game" (unfinished)

I made a simple game with Javafx ①

"Let's find happiness game" (unfinished)


package happy_unhappy_game;

import java.util.Random;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.TilePane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

	public class Sample extends Application {

		public static void main(String[]args) {

		 public static Scene scene1 = null;
		 public static Scene scene2 = null;

		 public static String txt=null;
		 public static String txt2=null;
    	 public static Label status=new Label();
    	 public static Button btn2 =null;
    	 public static VBox root=new VBox();
    	 public static TilePane pane=new TilePane();

    public void start(Stage stage) throws Exception {

    	  //Creating a stage


    public static void initScene1(Stage stage){

    	Random rnd=new Random();

    	Button button[]=new Button[144];
    	for(int i=0;i<144;i++) {
    		button[i]=new Button("Spicy");
    		String txt=String.format("that is\"Spicy\"is.");

    		int number=rnd.nextInt(144);
			button[number]=new Button("Fortunately");
    		txt2=String.format("\"Fortunately\"Was clicked.");

    	pane=new TilePane();

    	root=new VBox();

    	scene1=new Scene(root);

    public static void initScene2(Stage stage) {

    	Button btn = new Button("Scene change completed! !! !!");
    	    btn.setOnMouseClicked(event -> setScene2(stage,scene1));

    	    AnchorPane root = new AnchorPane();
    	    scene2 = new Scene(root);


    public static void push(Stage stage) {
    	btn2 = new Button("next");
		btn2.setOnMouseClicked(event -> setScene(stage,scene2));

    public static  void setScene(Stage stage,Scene changeScene) {

    public static  void setScene2(Stage stage,Scene changeScene) {


Outline of the game and problems at this stage

A game that searches for one "good luck" button from a large number of "spicy" buttons. At the moment, I am struggling because the screen transition is not good. In the future, we have added a time limit and a counting function.


Recommended Posts

I tried to make a simple game with Javafx ① "Let's find happiness game" (unfinished)
I tried to make a simple game with Javafx ① "Let's find happiness game" (unfinished version ②)
[Beginner] Try to make a simple RPG game with Java ①
I tried to make a group function (bulletin board) with Rails
I tried to make a simple face recognition Android application using OpenCV
[iOS] I tried to make a processing application like Instagram with Swift
I tried to make Basic authentication with Java
java I tried to break a simple block
A simple rock-paper-scissors game with JavaFX and SceneBuilder
I tried to break a block with java (1)
I tried to make a machine learning application with Dash (+ Docker) part3 ~ Practice ~
[Android] I tried to make a material list screen with ListView + Bottom Sheet
I tried to decorate the simple calendar a little
I tried to make a login function in Java
I tried to make an introduction to PHP + MySQL with Docker
I tried to create a java8 development environment with Chocolatey
I tried to modernize a Java EE application with OpenShift.
[Rails] I tried to create a mini app with FullCalendar
I want to make a list with kotlin and java!
I want to make a function with kotlin and java!
Let's make a simple API with EC2 + RDS + Spring boot ①
I tried using Hotwire to make Rails 6.1 scaffold a SPA
I tried to make a client of RESAS-API in Java
I tried to create a padrino development environment with Docker
[Java] I tried to make a rock-paper-scissors game that beginners can run on the console.
Try to make a simple callback
Make a slideshow tool with JavaFX
I tried to interact with Java
Make a typing game with ruby
I tried to create a simple map app in Android Studio
I want to make a button with a line break with link_to [Note]
I tried to illuminate the Christmas tree in a life game
[Unity] I tried to make a native plug-in UniNWPathMonitor using NWPathMonitor
I tried to build a simple application using Dockder + Rails Scaffold
I tried to make an Android application with MVC now (Java)
I wanted to make JavaFX programming easier with the Spring Framework
[Java] I tried to make a maze by the digging method ♪
[Rails] Implementation of multi-layer category function using ancestry "I tried to make a window with Bootstrap 3"
I tried to make a machine learning application with Dash (+ Docker) part2 ~ Basic way of writing Dash ~
I tried to make a parent class of a value object in Ruby
Let's make a Christmas card with Processing!
I tried to make an automatic backup with pleasanter + PostgreSQL + SSL + docker
I tried to make a machine learning application with Dash (+ Docker) part1 ~ Environment construction and operation check ~
I tried to build a Firebase application development environment with Docker in 2020
I made a virtual currency arbitrage bot and tried to make money
Let's make a smart home with Ruby!
I tried playing with BottomNavigationView a little ①
[docker] [nginx] Make a simple ALB with nginx
I tried to make a talk application in Java using AI "A3RT"
I tried to implement ModanShogi with Kinx
I tried to make a program that searches for the target class from the process that is overloaded with Java
Let's create a TODO application in Java 2 I want to create a template with Spring Initializr and make a Hello world
[LINE @] I tried to make a Japanese calendar Western calendar conversion BOT [Messaging API]
I tried to implement a function equivalent to Felica Lite with HCE-F of Android
A story when I tried to make a video by linking Processing and Resolume
[Java] I tried to connect using a connection pool with Servlet (tomcat) & MySQL & Java
Rails6 I want to make an array of values with a check box
I tried to automatically generate a class to convert from a data class to a Bundle with APT
I tried to clone a web application full of bugs with Spring Boot
[Small story] I tried to make the java ArrayList a little more convenient
[Android] I want to make QA easier ... That's right! Let's make a debug menu!