scenebuilder

Using command line arguments in Java with JavaFX

落爺英雄遲暮 提交于 2019-11-28 02:59:19
问题 I have the following code: public class Main extends Application { @Override public void start(Stage primaryStage) throws Exception{ Parent root = FXMLLoader.load(getClass().getResource("hive.fxml")); primaryStage.setTitle("Hive-viewer"); primaryStage.setScene(new Scene(root, 1600, 900)); primaryStage.show(); } public static void main(String[] args) { launch(args); } } I want to know how you would use a file (given with the command line) in the Controller or in a method in the Main class 回答1:

How to set custom fonts in JavaFX Scene Builder using CSS

♀尐吖头ヾ 提交于 2019-11-27 23:01:15
问题 I'm making a GUI in JavaFX Scene Builder and would like all text (Labels, Text Fields, Comboboxes) to use the same font. The problem is it's a custom font that likely won't be on every client's computer. I've tried CSS: @font-face { font-family: DIN; src: url(DIN.tff); } .text { -fx-font-family: DIN; -fx-font-style: bold; } Saved the above code to file Font.css and tried applying it to each GUI element through Scene Builder's JavaFX CSS fields, but it's not working. Have I made a mistake in

How to add a CSS stylesheet in FXML

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 22:59:44
I'd like to link a css file to my application. In my fxml file I use this: <stylesheets> <URL value="@../stylesheet1.css" /> </stylesheets> ...and I can see a styled preview when I open the fxml file in scenebuilder. But when I try to run the application I get an error: java.net.MalformedURLException: no protocol: ../stylesheet1.css So I tested it this way: <stylesheets> <String fx:value="stylesheet1.css" /> </stylesheets> and now it's other way round - the application starts and applies the css, but I don't see the preview in scenebuilder. The error message: "The file stylesheet1.css doesn't

SceneBuilder crashed upon startup

别来无恙 提交于 2019-11-27 22:32:53
I performed the installation of SceneBuilder 8.3.0 on Ubuntu Gnome 17.04 with Java Hotspot 1.8.0_131 installed, but when trying to start it, an error occurs, making it impossible to initialize. I've already tried installing Oracle's SceneBuilder 2.0, but the same error occurs. Do you know what that can be and how I can solve it? Thank you very much in advance! I noticed that calling directly the SceneBuilder jar "dist.jar" with the java Hotspot, the application launches smoothly ("java - jar /opt/SceneBuilder/app/dist.jar"). So one way to solve this problem palliatively is to edit the file "

How to switch scenes in JavaFX

↘锁芯ラ 提交于 2019-11-27 16:21:40
问题 I have looked on many pages to try and find out how to switch scenes but I have been unsuccessful. I have a calculator and my goal is to select a menu option to change Calculators(ie: basic and scientific). Right now I am just testing so here is my code relevant to this question thus far (I am using Scene Builder): @FXML private MenuItem basic; @FXML private MenuItem testSwitch; public static void main(String[] args) { Application.launch( args ); } @Override public void start(Stage

The table cells are empty in my tableview. JavaFX + Scenebuilder

穿精又带淫゛_ 提交于 2019-11-27 15:52:45
I am trying to get the table cells to show the string when i create new rows. But all the rows are just empty. Do anyone know what i am doing wrong? Here is the main class: package application; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Cursor; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; public class Main extends Application { @Override public void start(Stage primaryStage) throws Exception{ Parent root = FXMLLoader.load(getClass().getResource("/fxml/BasketCase_GUI_0.3.fxml")); Scene scene = new Scene(root

Include Controls FX in Scene Builder?

半腔热情 提交于 2019-11-27 14:35:48
问题 Is it possible to include the component of Controls FX in Scene Builder ? If yes, can you tell me how, if no can you tell me if there're alternatives ? 回答1: Yes you can. But unfortunately all ControlsFX controls are not supported by scene builder. An issue titled, "All controls should be supported by SceneBuilder" is currently opened with the ControlsFX team. Update Since SceneBuilder 8.2.0 you can directly search for an artifact from SceneBuilder and include them using the brand new Library

Styling a JavaFX 2 button using FXML only - How to add an image to a button?

我的梦境 提交于 2019-11-27 07:49:09
I want to change the styling of a button, most of the threads here and the articles on the internet show how to do it using Java code, which I don't see it as a real good solution, is there any way for example to set a button with some text and an image inside it all by using FXML only (no Css) ? jewelsea Solution using only fxml As tarrsalah points out, css is the recommended way of doing this, though you can also do it in fxml if you prefer: <?import java.lang.*?> <?import java.util.*?> <?import javafx.scene.control.*?> <?import javafx.scene.image.*?> <?import javafx.scene.layout.*?> <

Switch between panes in JavaFX

Deadly 提交于 2019-11-27 04:17:54
问题 I'm trying to make a Java program in JavaFX using FXML. However i'm having trouble with the layout management. I want to switch between Panes, just as i'm used to with CardLayout in swing, but i can't seem to get it. I googled around and didn't find any answers. Is there any CardLayout equivalent in JavaFX? and if so, can you provide me of an example? That would help my evening a lot! Here is my FXML code <AnchorPane id="anchorPane" prefHeight="324.0" prefWidth="530.0" xmlns:fx="http://javafx

How to right align a button in Java FX toolbar

北城以北 提交于 2019-11-27 04:11:35
I am building a UI using Java FX scene builder and I want a button in a toolbar to float towards the right side of the toolbar. I have tried changing the node orientation of the parent(toolbar) and also the button but both seem to be ignored. Add a pane with no content which always grows to fit available space between the left aligned tools in the bar and right aligned ones. <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.control.*?> <?import javafx.scene.layout.*?> <ToolBar prefHeight="40.0" prefWidth="318.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8">