fxml

JavaFX tableview resize to fit window

六眼飞鱼酱① 提交于 2019-12-04 02:19:05
I am just trying out JavaFX and am forcing my way into it because it is suppose to be the future. I am trying to create a table with 4 columns. The columns AND THE TABLE should resize to fill the parent pane. I cannot for the life of me get this to work. I have been trying for over 4 hours now and the tableview does not resize. Here is my FXML file. <?xml version="1.0" encoding="UTF-8"?> <?import java.lang.*?> <?import java.util.*?> <?import javafx.scene.*?> <?import javafx.scene.control.*?> <?import javafx.scene.layout.*?> <?import java.net.*?> <?import javafx.geometry.*?> <?import javafx

JavaFX Circle and ImageView

℡╲_俬逩灬. 提交于 2019-12-04 02:15:48
问题 I need to use javaFX2 to do the following: 1-) Load an image and display it using imageView. [OK] 2-) Right click and choose the "Add Node" option and a black circle will appear in the screen and you can Drag the circle to any place of the image. [OK] 3-) Use the scroll wheel fo the mouse to scale up or down the imageView, giving the "Zoom Sensation" on the image. [OK] 3.1-) However, every time I scale the image I want my circles to follow the scale proportion, which means they cant stay in

Subcontroller not being injected into main controller

自古美人都是妖i 提交于 2019-12-04 01:06:37
问题 I have a BorderPane (associated with a MainController), the FXML for the BorderPane uses <fx:include> to include a Label (with a controller StatusBarController) into the bottom region of the BorderPane. Unfortunately the the StatusBarController is not injected into the MainController class instance and I can't understand why. main.fxml: BorderPane with the included statusbar <fx:root type="javafx.scene.layout.BorderPane" fx:id="borderPane" xmlns:fx="http://javafx.com/fxml" fx:controller="com

Is it possible to reload the same FXML/Controller instance?

给你一囗甜甜゛ 提交于 2019-12-03 22:32:45
问题 Goal: Implement a standard "Settings" GUI window. Categories in a ListView on the left and the corresponding options in a Pane on the right. (please ignore the obvious bug with repeated categories; still working on it) I have a main window for the overall Settings window that contains a ListView with all the categories of settings. The right side of the window has an AnchorPane which is used to load separate FXML files for each category when one is selected from the list. When a user selects

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

青春壹個敷衍的年華 提交于 2019-12-03 16:39:30
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: package |-- model \-- view |--someElementView.fxml |--anotherElementView.fxml |--someElementController

Is there a way to modularize a JavaFX application?

前提是你 提交于 2019-12-03 15:43:50
I've started toying with JavaFX 2 and I really like the ease with which one can create a UI with FXML. However, once you get past the basic examples and you need a UI with many windows, it seems illogical to have the definition for the whole application's UI in a single FXML file. Is it possible to write separate components in separate FXML files and then include them as needed? Say for example that I wanted a window to popup when the user clicks on an item from the main menu; could I write the definition for that window in a separate FXML file, load it at runtime and add it to the node tree?

Classpath resolution with hierarchical custom JavaFx components in Scenebuilder

那年仲夏 提交于 2019-12-03 14:10:47
问题 I'm creating custom components using FXML. The custom components are designed in a hierarchical fashion. When I design a custom component B that uses another custom component A, a classpath problem dialog pops up in scenebuilder and I simply fix this by setting the appropriate classpath. However when I create three components, say C containing B containing A, and try to open top-level component C in Scenebuilder it fails. It asks me for classpaths which I duly specify. It finds B but does not

What is the “mnemonicParsing” attribute in Java FX

。_饼干妹妹 提交于 2019-12-03 12:35:09
I have been working with SceneBuilder and I observe that it applies the attribute of mnemonicParsing and equates it to false for every Node that I make. What exactly is it? What difference does it make in Layout.xml ? This refers to the Labeled.mnemonicParsing property . It registers a keyboard shortcut to activate the element (using the letter following _ in the text + Alt (Windows, don't know if it's the same key on other OS too)). E.g. Button btn = new Button(); btn.setText("_Say 'Hello World'"); btn.setMnemonicParsing(true); btn.setOnAction(new EventHandler<ActionEvent>() { @Override

Can I automatically generate controller classes from FXML?

我的梦境 提交于 2019-12-03 11:46:48
问题 As I understand it, when using FXML to describe a Java FX scene, the controller class is written manually and it's member variables and methods can then be referenced from the .fxml file. When loading the scene using the FXMLLoader , member variables are set to the corresponding scene elements and methods are wired up to the corresponding events automatically. This works but is very cumbersome as changes need to be done in two places and any mistakes will only show up at runtime. I've seen

JavaFX screen resolution scaling

 ̄綄美尐妖づ 提交于 2019-12-03 11:07:30
I have been searching for a method to do this, but I only found This question without answers . I am developing in a 1366x768 laptop, I use JavaFX to create a GUI (I am sorry, but I can't post the code, it's basically an AnchorPane containing a couple GridPanes, which contain more GridPanes, which contain Labels, TextFields and a couple Charts). The problem comes when I load the project on another resolution (1920x1080 or 1600x900). I am using stage.setMaximized(true); , but this only Scales the background, the stage itself, so all the elements and containers (Panels, Labels, TextFields.....)