javafx

JavaFx: In TreeView Need Only Scroll to Index number when treeitem is out of View

雨燕双飞 提交于 2020-01-04 03:50:11
问题 I need to do a simple thing. I have a large TreeView. and a menu item Next and Previous. on Next I have to select next Tree Item. Tree List Look like this -Root(set visible hide is true for root) --Parent 1 ----Child 1 ----Child 2 ----Child 3 --Parent 2 ----Child 1 ----Child 2 Now By pressing Next or previous menu item i call myTreeView.getSelectionModel().clearAndSelect(newIndex); By This I have manage to select next item and by myTreeView.getSelectionModel().scrollTo(newIndex) i have manage

How to add class or pseudoclass programmatically to custom control in JavaFX?

末鹿安然 提交于 2020-01-04 02:42:24
问题 In JavaScript world it is often set element class to denote it's appearance, which is later defined by CSS. Is this so in JavaFX? For example, what if I want to color negative value in red in TableView cells? I would not code color directly, but assigned some class to a cell, like "negative" and later would color it into red with CSS . I found PseudoClass class. Is it intended for this? It is marked "since 8", so is there any more mature API for this? 回答1: If you want to add a style to a Node

How to use a FontAwesomeIconView object as a Stage's icon?

风流意气都作罢 提交于 2020-01-04 02:38:45
问题 I am using FontAwesomeFX for many icons throughout my application. I would like to use them as icons for my Stage as well. Since FontAwesomeIconView extends GlyphIcon which extends Text , I can not use it as an Image directly. Is there a way to create a usable Image from a Text object? I have tried to use snapshot , but I am not familiar with that method and end up with the standard "empty" icon on my stage. Here is the MCVE I have so far: import de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon

JavaFX Stage close event handler

守給你的承諾、 提交于 2020-01-04 02:18:49
问题 I have a Stage in JavaFX that can be closed in multiple ways, either by clicking the red (X) or by a Button which calls stage.close() Regardless of how the Stage is closed, I would like to perform an action before (or as) it is closed. If I use the following code: myStage.setOnCloseRequest( event -> {System.out.println("Closing Stage");} ); then the handler is called when I click the (X) but not when I call myStage.close() This is the same issue that this question talks about (with a key

How to make object in List eligible for garbage collection?

只愿长相守 提交于 2020-01-03 20:02:40
问题 I understand that when an object is added to a List, the List retains a reference to that object based on answer from this question Is this java Object eligible for garbage collection in List How then how do you make the object in the List eligible for garbage collection so that it's removed from the heap and not taking up memory? I ask because in JavaFX, a Vboxs getChildren method returns observable list containing the children nodes of the vbox. If a UI element is removed but not eligible

Change virtual keyboard to AZERTY

时光总嘲笑我的痴心妄想 提交于 2020-01-03 19:18:48
问题 I have a javafx application that is supposed to run in fullscreen mode on a Windows tablet. My problem is, when the keyboard appears, it's in QWERTY whereas my tablet is in AZERTY. So the question is : Is there a way to use the system virtual keyboard or to switch the javafx virtual keyboard to AZERTY? 回答1: I found you question while trying to accopllish the same thing. I spent a day trying to make javafx display an AZERTY keyboard and i found a solution! Well let me be clear : javafx gave no

Change virtual keyboard to AZERTY

馋奶兔 提交于 2020-01-03 19:18:05
问题 I have a javafx application that is supposed to run in fullscreen mode on a Windows tablet. My problem is, when the keyboard appears, it's in QWERTY whereas my tablet is in AZERTY. So the question is : Is there a way to use the system virtual keyboard or to switch the javafx virtual keyboard to AZERTY? 回答1: I found you question while trying to accopllish the same thing. I spent a day trying to make javafx display an AZERTY keyboard and i found a solution! Well let me be clear : javafx gave no

ComboBox strange behaviour (JavaFX 8)

扶醉桌前 提交于 2020-01-03 18:19:23
问题 I have this code in start method: ObservableList<StringBuilder> list = FXCollections.observableArrayList(); list.add(new StringBuilder("0")); list.add(new StringBuilder("1")); list.add(new StringBuilder("2")); list.add(new StringBuilder("3")); list.add(new StringBuilder("4")); list.add(new StringBuilder("5")); list.add(new StringBuilder("6")); list.add(new StringBuilder("7")); list.add(new StringBuilder("8")); list.add(new StringBuilder("9")); ComboBox<StringBuilder> combo = new ComboBox<>

JavaFX Scene loses color when a button is created

这一生的挚爱 提交于 2020-01-03 18:02:43
问题 Can anyone explain why my scene loses color the moment I create a button in JavaFX? The following code works, with the background of the scene changing to red @Override public void start(Stage primaryStage){ //Set Primary stage title and create a rootNode primaryStage.setTitle("Hello World"); FlowPane rootNode = new FlowPane(); //Create a scene and add it to the rootNode Scene myScene = new Scene(rootNode, 300, 200, Color.RED); //Add the scene to the stage primaryStage.setScene(myScene); /

How to set the size of a svgPath in JavaFx

大城市里の小女人 提交于 2020-01-03 15:19:29
问题 I have a ListView that contains ListCells, which contain an icon defined by a SvgPath. private class CustomCell extends ListCell<String> { private SVGPath icon = new SVGPath(); public CustomCell() { icon.setContent("..."); } @Override public void updateItem(String value, boolean empty) { super.updateItem(value, empty); if(empty || value == null) { setGraphic(null); setText(null); } else { setGraphic(icon); setText(value); } } } I want the icon to fill the height of the list cell (which is