-
Bug
-
Resolution: Incomplete
-
P4
-
None
-
8
-
jdk1.8.0b95
To reproduce:
1. Click the button 'set font'
Result: font won't change
Expected: font should increase
import javafx.application.Application;
import javafx.application.Platform;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.layout.Pane;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import javafx.stage.Stage;
public class TextFieldApp extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage stage) throws Exception {
stage.setScene(createScene());
stage.show();
}
private Scene createScene() {
final TextField textField = new TextField("2/2/2000");
final PasswordField passwordField = new PasswordField();
final TextArea textArea = new TextArea("Test");
Button setFont = new Button("Set font");
setFont.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
new Thread(new Runnable() {
@Override
public void run() {
Platform.runLater(new Runnable() {
@Override
public void run() {
textField.setFont(new Font(20));
passwordField.setFont(new Font(20));
textArea.setFont(new Font(20));
}
});
}
});
}
});
VBox root = new VBox(5);
root.getChildren().addAll(textField, passwordField, textArea, setFont);
return new Scene(root, 1200, 800);
}
}
1. Click the button 'set font'
Result: font won't change
Expected: font should increase
import javafx.application.Application;
import javafx.application.Platform;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.layout.Pane;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import javafx.stage.Stage;
public class TextFieldApp extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage stage) throws Exception {
stage.setScene(createScene());
stage.show();
}
private Scene createScene() {
final TextField textField = new TextField("2/2/2000");
final PasswordField passwordField = new PasswordField();
final TextArea textArea = new TextArea("Test");
Button setFont = new Button("Set font");
setFont.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
new Thread(new Runnable() {
@Override
public void run() {
Platform.runLater(new Runnable() {
@Override
public void run() {
textField.setFont(new Font(20));
passwordField.setFont(new Font(20));
textArea.setFont(new Font(20));
}
});
}
});
}
});
VBox root = new VBox(5);
root.getChildren().addAll(textField, passwordField, textArea, setFont);
return new Scene(root, 1200, 800);
}
}