fxml

Using JavaFX controller without FXML

℡╲_俬逩灬. 提交于 2019-12-08 23:12:29
问题 Is there a possibility to use a controller with a JavaFX GUI without using FXML. I noticed that the FXML file contains an fx-controller attribute to bind the controller but i don't find it an easy way to work with it. Any ideas about have an MVC arch with JavaFX without using the FXML file or JavaFX Scene Builder ? 回答1: Your question isn't particularly clear to me: you just create the classes and basically tie everything together with listeners. I don't know if this helps, but here is a

How to switch javafx application controller without reloading FXML file?

我怕爱的太早我们不能终老 提交于 2019-12-08 11:58:07
问题 I have two main screens in my application build with FXML ( loginWindow and mainWindow ). User can login from loginWindow to mainWindow logout from mainWindow to loginWindow Right now I'm using this method to change scene via fxml file private Initializable replaceSceneContent(String fxml) throws Exception { FXMLLoader loader = new FXMLLoader(); InputStream in = WRMS.class.getResourceAsStream(fxml); loader.setBuilderFactory(new JavaFXBuilderFactory()); loader.setLocation(WRMS.class

JavaFX 2.0 FXML resource loading error

烂漫一生 提交于 2019-12-08 11:39:38
问题 @Override public void start(Stage primaryStage) { try { stage = primaryStage; gotoLogin(); primaryStage.show(); } catch (Exception ex) { Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex); } } enter code here public User getLoggedUser() { return loggedUser; } public boolean userLogging(String userId, String password){ if (Authenticator.validate(userId, password)) { loggedUser = User.of(userId); gotoProfile(); return true; } else { return false; } } public void userLogout(){

How to create an inner popup in JavaFX styled with FXML

女生的网名这么多〃 提交于 2019-12-08 05:34:16
问题 I have an FXML file that I'm using to allow user input when requested. Right now I just put it in a new stage and do Stage.show() . I would like to not have it appear in a new window and behave more like a ContextMenu . Looking at ContextMenu class it doesn't appear that I can set the content based off an FXML file. Is there a way to do this either with ContextMenu or Popup or some other class I am unaware of? 回答1: Although that library is quite nice, I wanted something simple that didn't

JavaFX Reusable FXML Snippets

孤人 提交于 2019-12-08 05:08:18
问题 I am implementing a tabbed section where each tab will contain a table view. Within this table view, there is a subset of columns that will be rendered regardless of which tab is selected but some tabs will include additional columns (handled programmatically). For these reasons, each tab needs to have a separate controller but I was wondering if it was possible for me to reuse the inner contents of the tab FXML in each tab without having to copy and paste the code. I am thinking along the

JavaFX Reusable FXML Snippets

可紊 提交于 2019-12-08 02:37:33
I am implementing a tabbed section where each tab will contain a table view. Within this table view, there is a subset of columns that will be rendered regardless of which tab is selected but some tabs will include additional columns (handled programmatically). For these reasons, each tab needs to have a separate controller but I was wondering if it was possible for me to reuse the inner contents of the tab FXML in each tab without having to copy and paste the code. I am thinking along the lines of a reusable component that I could define in another FXML file and just include in the tab

Mixing Swing/FX: can't dispose a dialog from fxml controller

╄→尐↘猪︶ㄣ 提交于 2019-12-07 16:33:10
问题 The scenario: the top-level container is a Swing JDialog which has some fx content, including a fx button that triggers a dispose of the button. Disposing works a expected (dialog is hidden) when the button is created and configured with the appropriate eventHandler manually. The dialog is not disposed when the button is created/configure via fxml. The example below contains both a manually configured and a fxml loaded/bound button to see the different behaviour. Questions: anything wrong

How to create tabs dynamically in JavaFX using FXML?

夙愿已清 提交于 2019-12-07 13:54:55
问题 How do you create a new tab using JavaFX/FXML? I've created a tabpane in my FXML but I want to click a button that causes a new tab to come up. Here is my FXML: <?import javafx.scene.effect.*?> <?import javafx.scene.text.*?> <?import javafx.scene.layout.*?> <?import java.lang.*?> <?import javafx.scene.control.*?> <BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx=

Combo Box JavaFx with FXML

Deadly 提交于 2019-12-07 12:08:59
问题 how can i use to Combo Box with FXML ? i need to set dynamic data.. Does anyone have an example? This is my Sample.fxml <AnchorPane id="AnchorPane" prefHeight="200" prefWidth="320" xmlns:fx="http://javafx.com/fxml" fx:controller="javafxapplication15.SampleController"> <children> <Button layoutX="126" layoutY="90" text="Click Me!" onAction="#handleButtonAction" fx:id="button" /> <Label layoutX="126" layoutY="120" minHeight="16" minWidth="69" fx:id="label" /> <ComboBox fx:id="ciudad" prefWidth=

Button with image (styling with FXML/CSS)

烂漫一生 提交于 2019-12-07 08:42:56
问题 I have problem and don't have any idea how to solve it. I have button and I need to add image next to text on right. I did it but after resizing this button, image is always next to text. There is any solution to get text toleft and image to right side of button? (like on screenshot from scenebuilder) FXML code: <Button fx:id="btn1" alignment="BASELINE_LEFT" contentDisplay="RIGHT" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="50.0" text="Text">