Apache NetBeans IDE 22 (上方 Help -> about)
Learn More →
NetBeans 版本為 22
JDK 為 22.0.1
File -> New Project -> Java with Maven -> SimpleJavaFX Maven Archetype -> Next
Learn More →
改名後-> Finish
Learn More →
創建完之後會有四個檔案
Source Packages
裡面Source Packages
裡面可以發現會有 com.mycompany.你的專案名子
(如果你在創建專案的地方有改名或是Group id的話可能會和我的不一樣)com.mycompany.你的專案名子
中會有兩個範例的java檔案import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.stage.Stage;
public class MyJavaFX extends Application {
@Override // Override the start method in the Application class
public void start(Stage primaryStage) {
// Create a button and place it in the scene
Button btOK = new Button("OK");
Scene scene = new Scene(btOK, 200, 250);
primaryStage.setTitle("MyJavaFX"); // Set the stage title
primaryStage.setScene(scene); // Place the scene in the stage
primaryStage.show(); // Display the stage
}
/**
* The main method is only needed for the IDE with limited
* JavaFX support. Not needed for running from the command line.
*/
public static void main(String[] args) {
launch(args);
}
}
Main
類來運行我的 Main
類import javafx.application.Application;
public class run {
public static void main(String[] args) {
MyJavaFX.main(args);
}
}
Learn More →
Learn More →
請先去下載javaFX Support
Learn More →
創建專案,並搜尋javaFX
Learn More →
此時的終端機跑一下之後會出現這個,請按enter
Learn More →
請輸入Y然後按enter
Learn More →
稍等一下後就可以看到demo的程式碼了
Learn More →
此時我們直接在這裡創建上面的範例MyJavaFX.java
按照圖片的方法創建選擇class並輸入檔名MyJavaFX
Learn More →
然後執行MyJavaFX(點擊右上角即可執行)
結果會如下,可以發現英文會跑掉,但如果用中文就不會
Learn More →
這時只需要在程式碼新增一行,直接在按鈕上設置明確的字體即可
然後再重新執行
btOK.setFont(Font.font("Arial"));
Learn More →
Learn More →
助教姓名:徐聖哲郵箱: 613630242@o365.tku.edu.tw
Apr 17, 202515.29 package com.example; import javafx.animation.KeyFrame; import javafx.animation.Timeline; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.input.KeyCode; import javafx.scene.layout.Pane; import javafx.scene.paint.Color; import javafx.scene.shape.Circle;
Mar 19, 202516.13 及 16.14 的範例(MediaDemo.java 及 FlagAnthm.java)
Mar 11, 2025科技接受模式是由理性行為理論所演變出來的一個以科技為主的採用理論,也是過去在資管領域被使用最廣泛的一個理論。主要用來預測使用者接受新科技的程度,後來陸續有些修正,是少數在資管領域內所發展出來的理論,並且是資管領域中被使用最多的一個理論。
Mar 11, 2025or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up