scenebuilder

What are JavaFX, FXML and Scene Builder?

允我心安 提交于 2019-12-18 12:28:28
问题 I am new to JavaFX, and am trying to do a project in it. In some tutorials they mention FXML. What is the difference between the two? I am using NetBeans IDE to develop my project, and heard about using Scene Builder when working with FXML. What exactly is Scene Builder? Should I use JavaFX, FXML and Scene Builder to develop my project smoothly? Please answer the above questions in simple language. If possible, provide me some good tutorials on how to use JavaFX. 回答1: Think of JavaFX as a

JavaFX Table Cell Editing

谁说胖子不能爱 提交于 2019-12-18 12:27:57
问题 I am trying to make a program in Java to manage my bookie accounts. I'm new to java, so I thought I would chose something simple to see how things work. I decided to use a tableview and make the individual cells editable. I've been following this tutorial http://java-buddy.blogspot.co.uk/2012/04/javafx-2-editable-tableview.html. It details how to do it using java code, and copying that into a new class works perfectly. I decided to try and tweak it to work with FXML, since I like Sceneviewer.

JavaFX2 - very poor performance when adding custom made (fxml)panels to gridpane dynamically

人走茶凉 提交于 2019-12-18 11:12:00
问题 Problem I want to add custom made panels, built via javafx scene builder, to a gridpane at runtime. My custom made panel exsits of buttons, labels and so on. My Attempt I tried to extend from pane... public class Celli extends Pane{ public Celli() throws IOException{ Parent root = FXMLLoader.load(getClass().getResource("Cell.fxml")); this.getChildren().add(root); } } ... and then use this panel in the adding method of the conroller @FXML private void textChange(KeyEvent event) { GridPane g =

Login Application with 1 stage and multiple scene in JavaFX

和自甴很熟 提交于 2019-12-18 03:43:53
问题 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

JavaFX scene builder 2: controller class

寵の児 提交于 2019-12-17 23:38:29
问题 Hi im building a JavaFX project and am using JavaFX Scene Builder 2. I wanted to link my controller to my fxml file but i can't see the possibility to add a controller to my fxml file in Scene Builder 2. I was wondering if someone could help me out. Thank you. 回答1: As you see on the image the controller menu moved on the left , below the Library List. 回答2: I found the controller attributes by accident in SceneBuilder 2. When closing the hierarchy menu on the left side the Controller menu will

How to add a CSS stylesheet in FXML

不打扰是莪最后的温柔 提交于 2019-12-17 16:27:59
问题 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

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

放肆的年华 提交于 2019-12-17 14:22:27
问题 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 =

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

谁说胖子不能爱 提交于 2019-12-17 09:32:46
问题 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) ? 回答1: 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.*?> <

javafx textarea background color not css

天涯浪子 提交于 2019-12-14 02:18:12
问题 I want to change the background color of the textarea in SceneBuilder. I failed to change in the style menu :-fx-background-color. So I found to change the background color by using the CSS file. .text-area .content{ -fx-background-color: red; } But I want to change the other way except for the css file. Please give me a hint . 回答1: You can change it in Java code: @Override public void start( Stage stage ) { TextArea area = new TextArea(); Scene scene = new Scene( area, 800, 600 ); stage

Scene builder event handler ( Key listener)

痞子三分冷 提交于 2019-12-13 22:55:12
问题 hello guys i have a problem, i am using eclipse , javafx and scene builder i want to move the ellipse( the circle) when i use arrow ( right left....) here is my code ( i tried like 10 things but nothing seems to work ) this is the last think i tried if any one can help thank :) This is my Main class : package application; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Scene; import javafx.stage.Stage; public class Main extends Application { @Override