fxml

Javafx fxml file TextArea line break and tab in text

一世执手 提交于 2020-01-02 03:17:12
问题 How to edit text in the TextArea in `.fxml file as such I can use line breaks and tabs . The Textarea is predefined and can not be edited. Images to support FXML File The View 回答1: If you want to directly use the text you can use something : <TextArea prefHeight="200.0" prefWidth="200.0" text="${'Multi\nLine\tTab'}" /> In case you want to use in Scene Builder, you can switch to multi-line mode. Switching to multi-line mode, scene builder will insert: for \n for \t 来源: https:/

How to listen for WindowEvent.WINDOW_SHOWN in the nodes of the scene graph?

你说的曾经没有我的故事 提交于 2020-01-02 02:26:30
问题 It seems WindowEvent.WINDOW_SHOWN never gets dispatched on any of the nodes in the scene graph, nor is there anyway (that I could find) to know when a node is visible/rendered/shown. For example: TestLauncher.java package com.example.javafx.event; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; public class TestLauncher extends Application { public static void main(String[] args) {

Associating FXML and Controller in Guice's Module configuration

那年仲夏 提交于 2020-01-01 10:47:49
问题 In my Guice Module I want to associate FXML files and their controllers, currently it looks like this: public class GuiceModule extends AbstractModule { @Override protected void configure() { // associate controllers and fxml files bind(MainController.class).toInstance((MainController)loadController("/main.fxml")); bind(SubController.class).toInstance((SubController)loadController("/content.fxml")); } protected Object loadController(String url) { InputStream fxmlStream = null; try {

JavaFX: create a vertical menu ribbon

天涯浪子 提交于 2020-01-01 05:52:27
问题 An example of what I am trying to accomplish here is: when you open an office Word 2013 file and you click file, in the left side it shows a list {Info, New, Open...}. Are there any JavaFX components like that? I am looking for a kind of List of (something) whose items are aligned vertically and you can click on to do something (in my case change the view on the right exactly like Word). 回答1: You can easily reproduce the Word like menu with a VBox and buttons with custom CSS styles. Here is a

SceneBuilder 2: Do controller classes need to necessarily be in the same folder as the view FXML files?

萝らか妹 提交于 2020-01-01 05:49:29
问题 I'm loving JavaFX and SceneBuilder, but I just can't figure out how to make SceneBuilder link my FXML views with their Java controllers when they are not in the same folder. I'd just like to have this folder structure: package |-- model |-- view | |--someElementView.fxml | \--anotherElementView.fxml \-- control |--someElementController.java \--anotherElementController.java Instead I can only make SceneBuilder recognise my controllers if I have this folder structure which I'd like to avoid:

JavaFX IllegalAccessException during FXML load()

若如初见. 提交于 2020-01-01 04:18:15
问题 I have a dialog window that is invoked by the following code ( DialogController is a helper class for using modal dialog windows; it mainly bundles together a controller reference with its window): void handleServicesEdit(ActionEvent event) throws IOException { DCServRecEditor sre = DialogController.<DCServRecEditor>loadFXML( CensusAssistant.RES_FXML_DIALOG_SERVEDIT, CensusAssistant.RES_STRING_SERVEDIT, this.getDialog()); sre.setDialogMode(DB.DBEDIT_MODE_EDIT, tbvService.getItems(),

Default JavaFX-CSS

余生长醉 提交于 2020-01-01 04:16:17
问题 Is there any way to see the applied CSS-Rules for JavaFX-Elements? Or there is a published reference with the default CSS-Rules available? I would like, for example , to know the color of Toolbar's border. 回答1: The CSS file is located in javafxrt.jar at jfxrt.jar!/com/sun/javafx/scene/control/skin/caspian/caspian.css . Unfortunately, there is no API access to the CSS styles of an element as of now, though that is apparently being discussed for JavaFX 2.2. 回答2: Here is the extracted caspian

ComboBox FXML default value

我的梦境 提交于 2019-12-31 12:42:27
问题 How can I set a default value in a ComboBox using FXML? <ComboBox fx:id="cbo_Bacteriologie_Aesculine" prefHeight="21.0" prefWidth="105.0" GridPane.columnIndex="1" GridPane.rowIndex="0"> <items> <FXCollections fx:factory="observableArrayList"> <String fx:value="NVT" /> <String fx:value="Bezig" /> <String fx:value="Positief" /> <String fx:value="Negatief" /> </FXCollections> </items> </ComboBox> I want NVT to be selected by default. I tried adding selected="selected" and such but don't seem to

ComboBox FXML default value

独自空忆成欢 提交于 2019-12-31 12:42:24
问题 How can I set a default value in a ComboBox using FXML? <ComboBox fx:id="cbo_Bacteriologie_Aesculine" prefHeight="21.0" prefWidth="105.0" GridPane.columnIndex="1" GridPane.rowIndex="0"> <items> <FXCollections fx:factory="observableArrayList"> <String fx:value="NVT" /> <String fx:value="Bezig" /> <String fx:value="Positief" /> <String fx:value="Negatief" /> </FXCollections> </items> </ComboBox> I want NVT to be selected by default. I tried adding selected="selected" and such but don't seem to

child fxml file not loading to parent fxml

有些话、适合烂在心里 提交于 2019-12-31 07:17:46
问题 hello guys i m new to fxml so please ignore my silly question here are few things which i m try for 2 day but got not success remove white space from table i.e table size should be up to number of available row(number of row varies) when user click on table row(any display value) new fxml file is open in Anchor pane(tableview is displayed) allotted for tableview but i want to display it in main view (where whole thing table and 2 text field and search button behind this main stack i want to