fxml

I want to load new FXML file with some parameters from the other Controller Files

拟墨画扇 提交于 2019-12-02 13:23:37
I already read next answers about passing parameters, but they didn't help me. passing-parameters-javafx-fxml javafx-from-the-trenches-singleton-controllers Below is my effort to open new FXML view from event handler which failes to pass parameter. Kindly looking for help. MainController.java @FXML private void handleButtonAction(ActionEvent event) throws IOException { Context currentContext = new Context(); URL url = getClass().getResource("ManageTemplateChild.fxml"); FXMLLoader fxmlloader = new FXMLLoader(); fxmlloader.setLocation(url); fxmlloader.setBuilderFactory(new JavaFXBuilderFactory()

Problems with setting TableColumn width in FXML using CSS

徘徊边缘 提交于 2019-12-02 13:13:10
Here is my .fxml code: <TableColumn id="tableColumnVertical" text=""> <graphic> <VBox> <Label text="text"/> </VBox> </graphic> </TableColumn> Here I have simplified .css code: #tableColumnVertical { -fx-background-color: Lime; -fx-min-width: 40; -fx-max-width: 40; } This doesn't set width of TableColumn but sets background. Why? I can use this code: <TableColumn id="tableColumnVertical" text="" minWidth="40" maxWidth="40"> and it works. Why inline works and .css does not? While writing this post I tried adding -fx-pref-width: 40; to .css and now it also works. 1) I would like know why inline

How to set button text in JavaFX?

送分小仙女□ 提交于 2019-12-02 13:11:38
I'm trying to set the button text using this code: public void initialize(URL location, ResourceBundle resources) { // TODO Auto-generated method stub //checking to see whether these buttons were loaded from the FXML file assert fx_btnStart != null : "fx:id=\"fx_btnStart\" was not injected: Check your FXML file 'FX-Timer.fxml'."; assert fx_btnStop != null : "fx:id=\"fx_btnStop\" INJECTION ERROR"; assert fx_btnHourUp != null : "fx:id=\"fx_btnHourUp\" INJECTION ERROR"; assert fx_btnHourDown != null : "fx:id=\"fx_btnHourDown\" INJECTION ERROR"; assert fx_btnMinuteUp != null : "fx:id=\"fx

Custom FXML component (w/ controller) doesn't appear in SceneBuilder's “Import jar” dialog

蓝咒 提交于 2019-12-02 12:38:05
问题 I am following this in creating a custom component and importing it. However, when it gets to the Import Dialog after clicking the jar file, it does not appear. When I comment out the code the tutorial used for the constructor, it appears again. However, none of the subcomponents I used to make the custom one appear. Why and how do I fix it? Also, I am using a VBox instead of an AnchorPane (as seen in the tutorial) for my own thing. Code of constructor as seen in tutorial: public

Load new fxml in borderpane center

一笑奈何 提交于 2019-12-02 10:43:00
Just started with JavaFx (also a beginner of java generally) and for a few days I've been trying to get this to work but I've been unable to solve it. I'm getting a null pointer exception which I know is covered here: What is a NullPointerException, and how do I fix it? So I hope this question doesn't get closed as duplicate since I know what npe is and (generally) know how to fix this. I also know (most of the time) how to dodge them and/or fix them if it occurs but in this case I just don't know how to sort it out. I've also checked some other questions regarding fxml but still can't figure

How to show / hide / auto hide a node

雨燕双飞 提交于 2019-12-02 10:06:27
I am doing a javafx project which if i click the button, the scene is showing, but if the scene is left open for few seconds, the scene will auto hide. The actual scene is if i left it open, it will auto hide at the below of the main scene just like the button is pressed. But i tried alot ways, the scene will either not hiding, or moving upward which if i click the button, the scene is at upward of the scene moving but not on the main scene. If the scene is not on main scene, nothing will happen.But only if the scene is on main scene, the scene will auto hide and move downward just like when I

Adding person.city.name to a TableView

烈酒焚心 提交于 2019-12-02 09:48:43
I have a TableView and some POJOs and want to bind with a property from one of them to the TableView. However, this property is also a POJO and this should get one property to show in the TableView. Here's my code: <TableView fx:id="listaDeudores" layoutX="85.0" layoutY="7.0" prefHeight="200.0" prefWidth="200.0"> <columns> <TableColumn prefWidth="75.0" text="Archivo"> <cellValueFactory> <PropertyValueFactory property="archivo" /> </cellValueFactory> <cellFactory> <FormattedTableCellFactory alignment="center" /> </cellFactory> </TableColumn> <TableColumn prefWidth="299.0" text="Nombres">

Switch between fxml files

纵饮孤独 提交于 2019-12-02 09:38:57
I have created an application using jfxPanel inside swing component. The problem I am facing is I am not being able to change the fxml files. When a button of the fxml is clicked, I want to dispose that fxml and load another fxml file there. This is what I have done till now public class NonResponsiveButtons extends JFrame { NonResponsiveButtons nrb; BottomPanelIncomingController bpic; JPanel panel; JPanel bPanel; private int applicationWidth_600 = 600; private int applicationHeight_600 = 600; private int upperPanelHeight_535 = 535; private int bottomPanelHeight_65 = (applicationHeight_600

Why am I getting a stackoverflow when loading my fxml?

可紊 提交于 2019-12-02 09:04:44
I've adjusted my controller constructor and fxml so that all setup of the fxml to the controller is in the fxml except for the FXML construction and the fxml loading. Here is my controller: public class MainOverviewTab extends Tab { @FXML private AnchorPane content; public MainOverviewTab() { FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("main_overview_tab.fxml")); // fxmlLoader.setRoot(content); // fxmlLoader.setController(this); try { fxmlLoader.load(); } catch (Exception e) { e.printStackTrace(); } } and my fxml file: <AnchorPane id="AnchorPane" fx:id="content" fx:controller

All JavaFX FXML objects null in controller

依然范特西╮ 提交于 2019-12-02 08:56:34
问题 I realise that this question has been asked before but none of the solutions have worked for me. I am starting a thread from my controller, and from there the thread gets some data from my database. The thread sends the data to my interface which is implemented in the controller. I get a null pointer exception when trying to access any of my JavaFX elements from there. Here is my controller: public class SettingsPage implements PrizeReceiver{ @FXML AnchorPane settingsAnchor; @FXML ListView