fxml

javafx automatic resizing and button padding

狂风中的少年 提交于 2019-11-26 20:50:34
I'm trying to make an on screen keyboard with Javafx for the layout. I'm using the Scene Builder to make the FXML file. <?xml version="1.0" encoding="UTF-8"?> <?import java.lang.*?> <?import java.util.*?> <?import javafx.geometry.*?> <?import javafx.scene.control.*?> <?import javafx.scene.layout.*?> <?import javafx.scene.paint.*?> <?import javafx.scene.text.*?> <AnchorPane id="AnchorPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="186.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/2.2"> <children>

Bootstrap with JavaFX

两盒软妹~` 提交于 2019-11-26 19:45:42
问题 I am creating a GUI in a java fxml project using netbeans. I wanted to use bootstrap to style the gui but I have noticed that everything in javafx is prefixed with fx- . Is there still a way to get bootstrap to work anyway for my project? Does bootstrap even work with javafx? 回答1: Rendering Bootstrap inside a JavaFX WebView Bootstrap is an HTML based framework. So to use Bootstrap in JavaFX, use JavaFX's HTML rendering component WebView to render Bootstrap HTML/CSS and JavaScript. Sample

FXMLLoader getController returns NULL?

[亡魂溺海] 提交于 2019-11-26 19:03:38
I have the main application class that does the following just fine: @Override public void start(Stage primaryStage) { try { FXMLLoader loader = new FXMLLoader(getClass().getResource( "RecordScreen.fxml")); Parent root = (Parent) loader.load(); Scene newScene = new Scene(root); Stage newStage = new Stage(); newStage.setScene(newScene); newStage.show(); } catch (Exception e) { e.printStackTrace(); } } It launches a table view that displays people. I select a person, hit the edit button, and try to launch a window that will let me edit them. @FXML public void editPerson() { try { FXMLLoader

How to connect FX controller with main app

孤街醉人 提交于 2019-11-26 18:54:36
问题 I have a main app class and a fxmlController class but I am entangled in connecting/organizing(confused how these are called and how I should organize them to make the GUI connected business logic) business logic and GUI. Can someone please tell the order in which following function are called or can anyone help how I should call them? Main class: public void Main() //constructor public static void main() // our main public void start() //I don't know what it is, what purpose it has // and

One controller to 2 fxmls (JavaFX)

强颜欢笑 提交于 2019-11-26 18:35:41
问题 Is possible to connect two FXML (JavaFX) files to one controller? I can't do this with changing "fx:controller" in each FXML file... Any ideas? 回答1: Yes, you can do this. Although, it can be done, I do not recommend this approach . Don't place a fx:controller attribute in either FXML. Create a new controller and set the same controller into separate FXMLLoader instances. CustomerDialogController dialogController = new CustomerDialogController(param1, param2); FXMLLoader summaryloader = new

How do I access a UI element from another controller class in JavaFX?

时间秒杀一切 提交于 2019-11-26 17:45:52
问题 I have a JavaFX / Java 8 application written with NetBeans 8 (no SceneBuilder ). My application has a main window that has its own FXML file (primary.fxml) and its own controller class (FXMLPrimaryController.java). One of the items in the FXML is a TextArea . Some of the methods in FXMLPrimaryController.java are about appending to that TextArea . This application now spawns a second window (another "stage") with its own FXML (second.fxml) and its own controller class (FXMLsecondController

Have multiple FXML files (created in SceneBuilder), but only one controller. Does each scene load it's own copy of the controller?

☆樱花仙子☆ 提交于 2019-11-26 16:56:17
问题 I have multiple FXML files I have created in SceneBuilder and one controller file. When I edit a value (say for instance, an integer value) in one scene, and then switch scenes, that value does not seem to have been changed in the new scene. When loading the fxml file for a scene, is my program loading a copy of the controller file just for (and used only by) that fxml file? Really appreciate any help you guys can give answering this question. 回答1: Your controller file is a Java source file

JavaFx Nested Controllers (FXML <include>)

落爺英雄遲暮 提交于 2019-11-26 16:34:14
In this tutotial, is an example of how to include custom components and use their controllers from the controller of the container. main_window_content.fxml <VBox fx:controller="com.foo.MainController"> <fx:include fx:id="dialog" source="dialog.fxml"/> ... </VBox> MainController.java public class MainController extends Controller { @FXML private Window dialog; @FXML private DialogController dialogController; .. If the component is included only once, it works fine. If the same component is included twice, the controllers are not initialized. Both controllers are null. main_window_content.fxml

How to embed .ttf fonts is JavaFx 2.2?

时间秒杀一切 提交于 2019-11-26 16:33:03
Firstly, I am quite a new guy in coding. I need to embed a font in my javaFXML-based app and don't know how to do it. I have pasted the font, fontName.ttf in a "resources" folder in the root of the sources of my project, ie App/src/app/resources . I have set the CSS for the component (text) as #text { -fx-font-family: url(resources/fontName.ttf); } I have also tried adding inverted commas in the url, ie url("resources/fontName.ttf"); , but it doesn't work. I have also set the css id for the component, so that can't be the problem. Is there any other working way to do so? I have seen http:/

Communication between two JavaFx controllers

主宰稳场 提交于 2019-11-26 16:29:35
问题 I made a structure to of Controllers and Views (fxml) to separate my code as much as I could, and I'm wondering how to communicate between 2 controllers. I mean, a controller have to call some functions of another controller to set it up to date. I think a schema of my current structure will be more explicit: Controller 1 / \ fx:include fx:include / \ Controller2 Controller3 Each controller has is own fxml view. - Controller 1 : a container controller which has a TabPane element with 2 tabs