일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
- 토큰경제
- #binary
- #다차원포인터
- html code
- html charset
- #android activity
- #자바상속#자바이즈어#is~a
- 하이퍼레저패브릭
- #C++ has~a
- mac terminal command
- html object
- html id
- border-box
- html youtube
- #CallByAddress
- #C++ 연산자함수오버로딩
- docker example
- html multimedia
- #3차원배열
- #2차원배열
- html plug-in
- #JAVASCRIPT
- html5 new tag
- #1차원배열
- #성적관리프로그램
- html video
- git flow
- #bubbleSort
- hyperledger transaction
- relative path
- Today
- Total
A sentimental robot
Platform.runLater( ) 본문
package Pack01;
import javafx.scene.control.Button;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class Hello extends Application {
@Override
public void start(Stage arg0) throws Exception {
VBox vbox = new VBox();
vbox.setPrefSize(300, 300);
Button btn1 = new Button("Button");
btn1.setOnAction(new EventHandler<>() {
@Override
public void handle(ActionEvent arg0) {
new Thread() {
@Override
public void run() {
Platform.runLater(() -> {
btn1.setText("앵무새");
});
}
}.start();
}
});
vbox.getChildren().addAll(btn1);
Scene scene = new Scene(vbox);
arg0.setScene(scene);
arg0.setTitle("server");
arg0.show();
}
public static void main(String[] args) {
launch();
}
}
// Thread로 UI 만질 때 error발생 하면 Platform.runLater 함수 쓰기
'Java' 카테고리의 다른 글
1:1 채팅 (0) | 2018.09.06 |
---|---|
NullPointerException (0) | 2018.06.30 |
Chatting UI (0) | 2018.02.07 |
UI (0) | 2018.02.07 |
진수에 대해서 (0) | 2018.01.09 |