상위 질문
타임라인
채팅
관점
자바FX
위키백과, 무료 백과사전
Remove ads
자바FX(JavaFX)는 데스크톱 애플리케이션과 리치 인터넷 애플리케이션(RIA)을 개발하고 배포하는 소프트웨어 플랫폼으로, 다양한 장치에서 실행 가능하다. 자바FX는 자바 SE를 위한 표준 GUI 라이브러리로서 스윙을 대체하기 위해 고안되었다.[3] 자바FX는 마이크로소프트 윈도우, 리눅스, macOS의 데스크톱 컴퓨터와 웹 브라우저를 지원한다.
Remove ads
자바FX 애플리케이션 예제
요약
관점
예제 코드
다음은 단순한 자바FX 기반 프로그램을 나타낸 것이다. 버튼이 포함된 창(stage)을 표시한다.

package javafxtuts;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
public class Javafxtuts extends Application {
@Override
public void start(Stage primaryStage) {
// Creating the java button
Button btn = new Button();
// Setting text to button
btn.setText("Hello World");
//registering a handler for button
btn.setOnAction((ActionEvent event) -> {
// printing Hello World! to the console
System.out.println("Hello World!");
});
// Initializing the StackPane class
StackPane root = new StackPane();
// Adding all the nodes to the FlowPane
root.getChildren().add(btn);
//Creating a scene object
Scene scene = new Scene(root, 300, 250);
//Adding the title to the window (primaryStage)
primaryStage.setTitle("Hello World!");
primaryStage.setScene(scene);
// show the window(primaryStage)
primaryStage.show();
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}
Remove ads
같이 보기
각주
외부 링크
Wikiwand - on
Seamless Wikipedia browsing. On steroids.
Remove ads