Insert below source code in the start() function of main class.
메인 클래스의 start() 함수내에 다음 코드를 삽입하여, fxml 파일을 로딩한다.
Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml")); Scene scene = new Scene(root);
Full Source (line 13~14)
다음은 전체 소스 이다
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | package bloggerpostsnippet; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; public class BloggerPostSnippet extends Application { @Override public void start(Stage stage) throws Exception { Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml")); Scene scene = new Scene(root); stage.setScene(scene); stage.show(); } public static void main(String[] args) { launch(args); } } |
댓글 없음:
댓글 쓰기