scenebuilder

Clone JavaFX Node?

笑着哭i 提交于 2019-11-29 13:13:38
I have created a Node ( AnchorPane ) in the JavaFX scene builder and was wondering how to clone it. I saw Duplicate/Clone Node in JavaFX 2.0 but I need to clone the Node without re-loading the fxml. Is there any way to achieve this in JavaFX 2? You can place the component that needs to be duplicated in a separate .fxml file. Then you can load the separate file as many times as needed adding the nodes to the appropriate root in the main scene. Additionally you can edit an <fx:include source="..."/> element to the main .fxml file and include the separate .fxml file. You can then still work with

Can't import custom components with custom cell factories

♀尐吖头ヾ 提交于 2019-11-29 13:04:43
In JavaFX 2.2 I've been having trouble importing custom components that have a custom cell factory defined in the FXML. Lets say my custom component is the following public class CustomComponent extends VBox{ public CustomComponent() { try { FXMLLoader loader = new FXMLLoader(getClass().getResource("CustomComponent.fxml")); loader.setRoot(this); loader.setController(this); loader.load(); } catch (IOException e ){ throw new RuntimeException(e); } } } And the corresponding FXML is <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.control.*?> <?import java.lang.*?> <?import javafx

Using command line arguments in Java with JavaFX

a 夏天 提交于 2019-11-29 09:35:59
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 Clayn Try getParameters . This should give you the command line arguments As wished a small example (i took

How do I get rid of the border around a split pane in JavaFX?

夙愿已清 提交于 2019-11-29 06:51:42
I'm using the JavaFX SceneBuilder, but I'll paste the FXML below since it's short. I have a very simple window with a split pane inside an anchor pane. Here is the FXML: <?xml version="1.0" encoding="UTF-8"?> <AnchorPane id="AnchorPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml"> <children> <SplitPane id="main-split-pane" dividerPositions="0.25" focusTraversable="true" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="-1.0" prefWidth="-1.0" style=""

table column won't take full size of the table view in javaFX

白昼怎懂夜的黑 提交于 2019-11-29 06:40:32
问题 i am trying to create a table with two columns. i am using the scene builder included in netbeans 7.2. in all the examples i have seen all you need to do is drag the table column to the table and it will take the full size, this is not true in my case. this is the fxml file generated by the scene builder. just to be clear i am not changing the table properties from the java. the fxml: <?xml version="1.0" encoding="UTF-8"?> <?import java.lang.*?> <?import java.net.*?> <?import java.util.*?> <

How to set custom fonts in JavaFX Scene Builder using CSS

牧云@^-^@ 提交于 2019-11-29 05:19:25
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 the CSS? Or is there a better way to go about this? I'd prefer not to have to load the font and set it

How to switch scenes in JavaFX

Deadly 提交于 2019-11-29 04:08:29
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 primaryStage) throws Exception { Parent pane = FXMLLoader.load( getClass().getResource( "calculator.fxml" ) );

Login Application with 1 stage and multiple scene in JavaFX

橙三吉。 提交于 2019-11-29 02:25:52
I am doing a timeline project. I have successfully created a login system and menus for everything, but when I press the buttons I have done so it will open a new window(with stage, scenes). I have read that it isn't the best approach. The best way would be to only have 1 primary stage, and that one would be when I launch the application, the login. But I have looked for information about multiple scenes with one stage but I have not found any good solutions. Would really really appreciate some help ;) Hopefully you understand what I want to achieve. Worth mentioning, i=I'm dealing with

setting up Scene Builder with NetBeans 8.0.2

泄露秘密 提交于 2019-11-29 01:18:30
问题 I am using: Mac OS X 10.10.1 NetBeans 8.0.2 SceneBuilder 8.0.0 downloaded from gluonhq.com I dragged SceneBuilder to Applications folder. When I go to Options>Java>JavaFX and set Scene Builder path to the Applications folder, I get the error: Selected location does not represent a valid JavaFX Scene Builder installation Kindly guide me. 回答1: Add Scene Builder to Netbeans 8.2 Here are the steps that I went through to setup Scene Builder: You can download Scene Builder 8.2 here Install the

FXMLLoader how to access the components by FXID?

筅森魡賤 提交于 2019-11-28 23:54:32
I'm trying to figure out how to work with JavaFx. I built the application interface in Scene Builder. But I can not get access to the component, since all loaded into the Parent. Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml")); If I change "Parent" on "Pane" I can get access to the getChildren(), but it is not clear how to get control if i know fx:id... The question is even simpler. I added Label or TextField in Scene Builder. How do I change it's text from the code if I know the fx:id? I am in despair. You should create a controller class for your FXML document, in