javafx-8

FXMLLoader cannot find running controller instance and creates new one

佐手、 提交于 2020-01-16 07:07:52
问题 I'm a newcomer when it comes to JavaFX and I recently encountered a problem which really confuses me alot. I'm using a class called "MainController" which controlls an FXML-File containing a TabPane. Each tab is controlled by another controller. But there is one situation in which a tab needs to be deleted, so I need access to the MainController instance to remove the currently active tab from the pane. Whenever I'm using this code to get an instance of the currently running MainController, I

JavaFx: How to make 'Tooltip' bigger?

不问归期 提交于 2020-01-16 03:03:10
问题 I set tooltip for buttons,but it looks so small(font size),how can I make it bigger?I have tried myTooltip.setFont(new Font(20)) ,but it dosen't work,why?And how can I make the font bigger? Thank you all guys! 回答1: Set the style in a stylesheet, or directly, e. g.: tooltip.setStyle("-fx-font-size: 20"); 来源: https://stackoverflow.com/questions/32420960/javafx-how-to-make-tooltip-bigger

How to set Default CSS for all Buttons in JAVAFx

巧了我就是萌 提交于 2020-01-16 01:18:14
问题 I have over 100 Buttons in my JAVAfx application and I want to give a DEFAULT styling[given below] to all buttons in the programme. Please help ! :) -fx-background-color:#3c7fb1; -fx-text-fill: black; -fx-font-size: 14px; -fx-padding: 3 30 3 30; 回答1: Create a new CSS file. Attach the CSS file to your Scene . Put your button styles to .button {} . 回答2: It's easy to set default Style for all JavaFX Button in an application. Just give a id to the style sheet which you want to set as default for

Update TreeView on custom TreeItem property change

Deadly 提交于 2020-01-15 15:57:27
问题 I have extended TreeCell and TreeItem class. MyTreeItem contains a custom property which I use inside MyTreeCell to render graphics/font etc. The problem is when I set MyTreeCell.customProperty I'm not sure how to make the TreeView/Cell redraw. For example: public class MyTreeItem extends TreeItem { Object customProperty public void setCustomProperty(Object customProperty) { this.customProperty = customProperty // how to fire a change event on the TreeView? } } Any comments on the solution or

how to repeat a node in same scene in javafx

☆樱花仙子☆ 提交于 2020-01-15 15:40:07
问题 I want to repeat one node in scene . Is it possible ? for example I have an anchorpane and 3 panes on it . I have one button on pane(1) and I want to add it to pane(2) after some process in program ... . I want to repeat that node exactly like the old one( with same properties) 回答1: No, you cannot repeat the same node in a scene. From the Node Javadocs : A node may occur at most once anywhere in the scene graph. Specifically, a node must appear no more than once in all of the following: as

JavaFX: BooleanBindings in bind with multiple EasyBind maps

末鹿安然 提交于 2020-01-15 12:29:27
问题 This question goes further where JavaFX: Disable multiple rows in TableView based on other TableView stops. I want to generate a more general topic, of which other people could also benefit. I also have the two tableviews. I also want to disable a row in table2 when table1 contains the same object. This is achieved with the code below: //Check if a row needs to be disabled: this is achieved with a rowfactory ObservableList<String> listOfSKUs = EasyBind.map(table1.getItems(),Product::getSKU);

How to set a TableRow's background colour based on whether or not it's selected and/or a value in the data model, in a JavaFX8 TableView?

强颜欢笑 提交于 2020-01-15 12:15:21
问题 A relative Java newbie question. I'm trying set a TableRow 's background colour based on whether or not it's selected and/or whether or not a boolean value in the data model is true. I've found ways of doing each but not both together in the same setRowFactory . What I would like to end up with is this (albeit with horrible colours for example purposes only!): How would I go about achieving that? This is what I found wrt changing row colour based on selection. It's adapted from user James_D's

How to set a TableRow's background colour based on whether or not it's selected and/or a value in the data model, in a JavaFX8 TableView?

ぐ巨炮叔叔 提交于 2020-01-15 12:15:20
问题 A relative Java newbie question. I'm trying set a TableRow 's background colour based on whether or not it's selected and/or whether or not a boolean value in the data model is true. I've found ways of doing each but not both together in the same setRowFactory . What I would like to end up with is this (albeit with horrible colours for example purposes only!): How would I go about achieving that? This is what I found wrt changing row colour based on selection. It's adapted from user James_D's

How to serialize JavaFX Nodes preferably in XML?

扶醉桌前 提交于 2020-01-15 09:47:11
问题 I have some kind of drawpane, where the user can draw different kinds of Shapes, like Pathes, Rectangles, Texts, etc. Now I´d like to persist the DrawState, so that I can recreate it at any time. I just tried it with xstream, but like usual I get a whole lot of dependencies within these Shapes when persisting it in XML. After some research I found this Thread here: Serialize JavaFX components I liked the idea of jewelsea using the SceneBuilder API to serialize my shapes, since they are all

how snapshot the entire scene in javafx?

百般思念 提交于 2020-01-15 09:07:09
问题 have this fully working code but i don't know how snapshot the entire scene in JAVAFX as PNG format ? i try to export pie Chart as snapshot it work but i couldn't figure how to add another chart to be snapshot also . this is my code package javaapplication5; import java.io.File; import java.io.IOException; import javafx.application.Application; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.embed.swing.SwingFXUtils; import javafx.scene.Group;