fxml

Problems with setting TableColumn width in FXML using CSS

↘锁芯ラ 提交于 2019-12-03 00:01:50
问题 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

ComboBox FXML default value

情到浓时终转凉″ 提交于 2019-12-02 22:53:29
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 find the right syntax. Is it possible to edit the listed items using Scene Builder? I can't seem to

Javafx open another fxml in the another window with button

[亡魂溺海] 提交于 2019-12-02 22:32:34
Is it possible in javafx to open new stages (windows) from another fxml with a button? Thanks for the answers. SimplyMe Use the code below on button click: try { FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("Demo.fxml")); Parent root1 = (Parent) fxmlLoader.load(); Stage stage = new Stage(); stage.initModality(Modality.APPLICATION_MODAL); stage.initStyle(StageStyle.UNDECORATED); stage.setTitle("ABC"); stage.setScene(new Scene(root1)); stage.show(); } Sevi I had to modify the code a bit and it works fine. Thank you again for the code! public void pressButton(ActionEvent event)

JavaFX Window Changer using FXML

 ̄綄美尐妖づ 提交于 2019-12-02 22:29:13
问题 I'm currently attempting to make a Window (Scene) changer when clicking on a button. Specifically, changing the window when logging in a user. I would like to know how I can possibly reduce redundant code, and placing the methods responsible for changing windows in a centralized place. Is there a specific design pattern to follow? So far, I have this: Main.java public class Main extends Application { @Override public void start(Stage stage) throws Exception { Parent root = (Parent) FXMLLoader

How can I avoid the display of percentage values, when using the ProgressIndicator of JavaFX UI Controls

╄→尐↘猪︶ㄣ 提交于 2019-12-02 21:29:18
问题 I am pretty new to Java and would like get rid of the displayed percentage value of the ProgressIndicator in Java FX. Is there a method to disable the value display? I checked the documentation, but as far as I understand it and couldn't find the right method. Thank you for your help!! 回答1: Editing the Text value Since the Text node used for displaying the progress value is hidden in an inner class within the ProgressIndicatorSkin class, the best way to access it is using lookups, trying to

How to change sub fxml gui parts at runtime with Button Click

会有一股神秘感。 提交于 2019-12-02 19:09:29
I'm tryin to build a skeleton for a big complex gui, so the idea is to make everything with mvc like style in javafx 2.1, so every component has a fxml file and if needed css,controller and model. I'm tryin to figure out how to change sub scenes(sub fxml at runtime). Anybody know how to do it? I'm kinda stuck on this. May bee to add MainViewController? scenario: user clicks on button in taskbar and the included content1.fxml will be replaced with content2.fxml here the basic code MainApp.java Loads the MainView.fxml MainView.fxml <?import javafx.scene.control.*?> <?import javafx.scene.layout.*

JavaFX Project Structure

旧巷老猫 提交于 2019-12-02 18:16:41
JavaFX's MVC Model by using FXML sounds awesome and all but I'm having trouble find out how to organize my project packages. Every single tutorial i find about JavaFX is way too simple and unorganized: They simply create ONE package and create everything there, every controller, every fxml, every css. I dont want that. I want things to be in their right places. Still, JavaFX's "pathing" seems... "limitive". The use of URLs make it so that if I want to limit my resources to local files, I have to do the whole getClass().getResource("foo.fxml").openStream() thing. That is great, but by getting

NullPointerException load fxml

拟墨画扇 提交于 2019-12-02 17:59:57
问题 I want to load an fxml file in my application. I use the next code: try { FXMLLoader loader = new FXMLLoader(); loader.setController(null); loader.setRoot(null); loader.setResources(ResourceBundle.getBundle(BUNDLE)); Node root = null; root = (Node) loader.load(JfxUtils.class.getResource(fxml).openStream()); return root; } catch (IOException e) { throw new IllegalStateException("cannot load FXML screen", e); } With some fxml, all work fine, with others I get this exception: Caused by: java

Adding person.city.name to a TableView

笑着哭i 提交于 2019-12-02 15:59:12
问题 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

Load new fxml in borderpane center

。_饼干妹妹 提交于 2019-12-02 15:45:14
问题 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