Last active
January 30, 2026 03:55
-
-
Save MikuroXina/8501f9197cdab6bfc69b3655912b07bc to your computer and use it in GitHub Desktop.
きゅうりvsプログラミング言語 from https://www.youtube.com/watch?v=30AFanVLKos
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| plugins { | |
| id 'application' | |
| id 'org.openjfx.javafxplugin' version '0.1.0' | |
| } | |
| repositories { | |
| mavenCentral() | |
| } | |
| javafx { | |
| version = "25.0.2" | |
| modules = ['javafx.controls', 'javafx.graphics', 'javafx.media'] | |
| } | |
| application { | |
| mainClass = 'cucumbersaregood.CucumbersAreGood' | |
| applicationDefaultJvmArgs = ['--enable-native-access=javafx.graphics'] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package cucumbersaregood; | |
| import java.io.File; | |
| import javafx.application.Application; | |
| import javafx.scene.Scene; | |
| import javafx.scene.layout.StackPane; | |
| import javafx.scene.media.Media; | |
| import javafx.scene.media.MediaPlayer; | |
| import javafx.scene.media.MediaView; | |
| import javafx.stage.Stage; | |
| public class CucumbersAreGood extends Application { | |
| // 🥒🥒🥒🥒🥒🥒🥒🥒🥒 本日の主役 🥒🥒🥒🥒🥒🥒🥒🥒🥒 | |
| public boolean canPlantCucumbers; | |
| // 🥒🥒🥒🥒🥒🥒🥒🥒🥒🥒🥒🥒🥒🥒🥒🥒🥒🥒🥒🥒🥒🥒 | |
| @Override | |
| public void start(Stage questionStage) { | |
| System.out.println("キュウリ植えてもいいですか?"); | |
| playQuestionVideo(questionStage); | |
| String answerPath; | |
| if (canPlantCucumbers) { | |
| answerPath = "C:/Users/Hierarch/Desktop/良い.mp4"; | |
| } else { | |
| answerPath = "C:/Users/Hierarch/Desktop/ダメ.mp4"; | |
| } | |
| playAnswerVideo(answerPath); | |
| } | |
| private void playVideoCore(Stage stage, String path, String title) { | |
| var videoFile = new File(path); | |
| var media = new Media(videoFile.toURI().toString()); | |
| var player = new MediaPlayer(media); | |
| var viewer = new MediaView(player); | |
| viewer.setPreserveRatio(true); | |
| var root = new StackPane(); | |
| var scene = new Scene(root); | |
| root.getChildren().add(viewer); | |
| stage.setTitle(title); | |
| stage.setScene(scene); | |
| stage.show(); | |
| player.play(); | |
| } | |
| private void playQuestionVideo(Stage questionStage) { | |
| playVideoCore( | |
| questionStage, | |
| "C:/Users/Hierarch/Desktop/キュウリ植えてもいいですか?.mp4", | |
| "キュウリ植えてもいいですか?" | |
| ); | |
| } | |
| private void playAnswerVideo(String answerPath) { | |
| var answerStage = new Stage(); | |
| playVideoCore(answerStage, answerPath, "判定結果"); | |
| } | |
| public static void main(String[] args) { Application.launch(args); } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment