javafx

How to populate TableView with String Arraylist in JavaFX

自古美人都是妖i 提交于 2019-12-31 03:31:09
问题 I want to populate TableView with String, String I have only two columns. I couldn't do it. What I tried so far is: ObservableList<String> data = FXCollections.observableArrayList(); for (blabla){ data.addAll(Id,Name); } tableView.getItems().addAll(data); and nothing shows on table. But when I do tableView.getItems() and print it, I see the data I've added. But on table, nothing is shown. I create my columns as follows: TableColumn idColumn = new TableColumn("Id"); TableColumn nameColumn =

custom jre with javaFX 11

天大地大妈咪最大 提交于 2019-12-31 03:04:36
问题 I'm Using JDK11 and JavaFX11. I created a custom JRE for my sample FX module program using Jlink, but when I try to run with the custom JRE, it renders errors as below: This is how I created my custom JRE (no errors) jlink --module-path ..\jmods;%PATH_TO_FX% --add-modules java.base,java.desktop,jdk.unsupported,javafx.graphics --output FXJRE This is how I tried to run (with errors) FXJRE\bin\java --module-path %PATH_TO_FX%;mods -m com.javafxdemo/com.javafxdemo.JavaFXDemo The error messages:

How to force Java FX scene refresh?

荒凉一梦 提交于 2019-12-31 02:58:13
问题 I have an Java FX scene with a start button and several rectangles which represent the tiles of a map. I also have drawn a sphere which represents my explorer (it has to explore the map), but I am having difficulties with running the animation. In my OnMouseClicked handler for the start button, I start an algorithm for exploring the map which changes the position of the sphere and the colors of the tiles which have been visited. The problem is that the scene won't update itself while the

Running JavaFX app without main method

£可爱£侵袭症+ 提交于 2019-12-31 02:56:32
问题 This material says on page 10 that it is possible to run a JavaFX app without writing main . I suppose there is some predefined main inside jfxrt.jar which looks for a class extending Application and runs it. Is that so? How to do that? 回答1: I suppose there is some predefined main inside jfxrt.jar which looks for a class extending Application and runs it. This isn't really what's meant by that comment, and isn't how it works. All it is saying is that the "main class" doesn't need to define a

Why is `Stage#show` so slow, and what can be done to accelerate it

淺唱寂寞╮ 提交于 2019-12-31 02:51:05
问题 In JavaFX, the first time a stage is shown with Stage#show takes a long time. I'm not talking about the time it takes to load FXML (which is a different issue altogether), but simply the time it takes between calling Stage#show and the call returning (and the window shown to the user). I have created this sample application, which creates a random scene with a few tabs, grid panes and table views, then times how long it takes to call Stage#show : package sample; import javafx.application

JavaFX TableView Objects with Maps

China☆狼群 提交于 2019-12-31 02:32:05
问题 So I have done some digging around on the JavaFx TableView and I have found some nice solutions to simple situations. This article provides a nice explanation of how to create a Table with a Person object and also shows how to create a Table using a Map. Here is my problem, let's say I have an Object Person that contains some simple member data and also a Map of Assignments to Grades. Example: public class Person { String firstName; String lastName; String age; Map<Assignment, Grade> map; } I

JavaFX: Set Scene min size excluding decorations

这一生的挚爱 提交于 2019-12-31 02:26:08
问题 I know that with JavaFX you can set the Stage min size using stage.setMinWidth() and stage.setMinHeight() , however, this will include the window border (with the minimize, maximize, and close buttons). How can I exclude this when setting the minimum size? 回答1: You can show the Stage undecorated, which will remove all the borders: primaryStage.initStyle(StageStyle.UNDECORATED); If you want to have it decorated If you want to have it decorated you can set the size of the Scene to the preferred

JavaFX WebView / WebEngine show on-screen-keyboard automatically for each text input

荒凉一梦 提交于 2019-12-31 02:25:08
问题 Background/Context: I am developing touch screen based kiosk application with JavaFX. The app integrates browser – WebView. The problem is that all user inputs have to be made through on screen keyboard (SW keyboard) It would be nice to have an option to register an event-handler on WebView/WebEngine for any HTML text input element got/lost focus, so that I could show/hide on-screen-keyboard. Even though I searched the Internet, I did not find this kind of feature. My questions: Does JavaFX /

JavaFx, event interception/consumption

我是研究僧i 提交于 2019-12-31 02:10:09
问题 I've got this partial scenegraph tree : CustomPane (with onMouseClicked Handler) → ChildNode (with onMousePressed Handler) When I catch the MousePressed event in the ChildNode, I can consume it, so that the parent doesn't receive a MousePressed event. But I would like to consume the associated MouseClicked event. So that pressing the mouse on the Child doesn't fire a MouseClicked event on the Parent. 回答1: You can add specific ChildNode#onMouse... handlers which will consume all events. or

JavaFx, event interception/consumption

混江龙づ霸主 提交于 2019-12-31 02:10:08
问题 I've got this partial scenegraph tree : CustomPane (with onMouseClicked Handler) → ChildNode (with onMousePressed Handler) When I catch the MousePressed event in the ChildNode, I can consume it, so that the parent doesn't receive a MousePressed event. But I would like to consume the associated MouseClicked event. So that pressing the mouse on the Child doesn't fire a MouseClicked event on the Parent. 回答1: You can add specific ChildNode#onMouse... handlers which will consume all events. or