javafx-8

JavaFX - getScene() returns null

独自空忆成欢 提交于 2019-12-18 07:33:45
问题 I just started using JavaFX Scene Builder to build a small application. It is made up of a controller class 'Login.java' which belongs to 'login.fxml', in which the FXML file 'registrierung.fxml' is loaded via a method called 'registrationClicked(ActionEvent event)': public class Login { @FXML private void registrationClicked(ActionEvent event){ try{ ((Node) (event.getSource())).getScene().getWindow().hide(); FXMLLoader loader = new FXMLLoader(getClass().getResource("/view/fxml/registrierung

Drag and Drop from ListView to TreeView

放肆的年华 提交于 2019-12-18 07:21:57
问题 I just want to drag and drop an item from my ListView to a specific position in my TreeView . I know how to handle DragEvent s. But how can I get the dropped position of my treeView? With "position" I mean "on which treeview-item dropped (get reference from this treeview-item)". package main; import javafx.application.Application; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.Event; import javafx.event.EventHandler; import javafx.event

JavaFx WebEngine - Overwriting a website's stylesheet with (local) files

一笑奈何 提交于 2019-12-18 07:18:54
问题 I'd like to customise the appearance of a website that I am loading, so I created a little test.css file that does nothing but changing the look of all table rows: tr { height: 22px; background-image: url("test.png"); } How do I get he WebEngine to load this file and replace the page's own CSS rules with mine? Also, i'd like to be able to load page-specific css files and not one huge file for all pages. I found this page, but it only shows how to run through the DOM and assign a new style to

Wait before Reacting to a Property Change JavaFX 8

不羁的心 提交于 2019-12-18 07:02:40
问题 Is there a way to keep listening to a property change, for a few seconds, then fire an event (call a method)? For example, when the user enter data in a text field: textField.textProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> arg0, String arg1, String arg2) { //before calling a method to do something.. wait for a few seconds ... } }); A scenario would be firing an action based on the string value. For example, hitting "M"

How to convert css into bss

天涯浪子 提交于 2019-12-18 06:57:19
问题 I found this post http://docs.oracle.com/javafx/2/deployment/packaging.htm#BABCACBD Can you tell me how I can use this tool to convert css files into bss files? From the information on the web site it's not very clear how I can use it for JavaFX application. Any help will be highly appreciated. 回答1: Let's imagine your jdk 8 home bin directory is on your shell path. Create Love.java : import javafx.stage.*; import javafx.application.*; import javafx.scene.control.*; import javafx.scene.*;

Populate combo box list dynamically for each row in javaFx table view

▼魔方 西西 提交于 2019-12-18 06:56:16
问题 I have created a table view in java Fx, one of the columns in table view consists of ComboBoxTableCell.Please find below the code for table view public class TabViewController { @FXML private TabPane cnfmTab; @FXML private TableView<TabVO> partsTable; @FXML private TableColumn<TabVO, String> column1; @FXML private TableColumn<TabVO, String> column2; @FXML private TableColumn<TabVO, String> column3; private ObservableList<TabVO> tableData = FXCollections.observableArrayList(); private

Make individual cell editable in JavaFX tableview

巧了我就是萌 提交于 2019-12-18 06:54:43
问题 I am writing a program that displays a JavaFX table. I understand how to make all the data in a specific column editable via "Column.setCellFactory(TextFieldTableCell.forTableColumn());" However I would like to make some of the cells editable and others immutable. Is this possible? Moreover, I would like editable cells to either have a border or have a unique font color. 回答1: Yes, this is possible: the TableCell has an editable property inherited from the Cell class. You need to arrange that

Tooltip on Line Chart showing Date

橙三吉。 提交于 2019-12-18 05:59:14
问题 I want to add Tooltip when I move cursor over a chart line. I found this example: import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ThreadFactory; import java.util.logging.Level; import java.util.logging.Logger; import javafx.animation.AnimationTimer; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.chart.AreaChart; import javafx.scene.chart

FXML Load exception

早过忘川 提交于 2019-12-18 05:49:07
问题 I got a problem that I absolutely can't solve on my own because I have just started using JAVA FX. I get a nasty javafx.fxml.LoadException: , but I have done exactly like a guide, but I cant get my Main to run. This is the the exception output: apr 07, 2014 4:06:37 EM application.Main start ALLVARLIG: null javafx.fxml.LoadException: /C:/Users/Jakob/Dropbox/java_kurser/Project%20Timeline/bin/application/LoginGUI.fxml at javafx.fxml.FXMLLoader.constructLoadException(Unknown Source) at javafx

How to access parent member controller from child controller

核能气质少年 提交于 2019-12-18 05:06:16
问题 This question is similar to this, but I need to access parent member (not control). I don't know if is possible to do without using Dependency Injection. For example, I have a Parent with have a member calls User, I need to access from child controller to User. 回答1: Just pass the reference from the parent controller to the child controller in the parent controller's initialize() method: ParentController.java: public class ParentController { @FXML private ChildController childController ;