Created
August 6, 2013 21:07
-
-
Save KowalczykBartek/6168646 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SomeJavaApp extends Application { | |
ListView<String> list = new ListView<>(); | |
ObservableList<String> items = FXCollections.observableArrayList(); | |
@Override | |
public void start(Stage primaryStage) { | |
StackPane root = new StackPane(); | |
root.getChildren().add(list); | |
Scene scene = new Scene(root, 400,400); | |
primaryStage.setTitle("I can use JavaFX LIST"); | |
primaryStage.setScene(scene); | |
primaryStage.show(); | |
Thread t = new Thread(new Runnable(){ | |
@Override | |
public void run() { | |
for(int i=0; i<10; i++){ | |
items.add(Integer.toString(i)); | |
} | |
Platform.runLater(new Runnable() { | |
@Override public void run() { | |
list.setItems(items); | |
} | |
}); | |
} | |
} | |
); | |
t.start(); | |
} | |
public static void main(String[] args) { | |
launch(args); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment