| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
- html5 new tag
- html id
- 토큰경제
- #android activity
- #1차원배열
- html youtube
- border-box
- #binary
- #성적관리프로그램
- html video
- #3차원배열
- html multimedia
- mac terminal command
- #C++ 연산자함수오버로딩
- relative path
- #JAVASCRIPT
- #다차원포인터
- html plug-in
- docker example
- html code
- #2차원배열
- html object
- hyperledger transaction
- 하이퍼레저패브릭
- #자바상속#자바이즈어#is~a
- #bubbleSort
- #CallByAddress
- #C++ has~a
- git flow
- html charset
- 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 |