javafx-8

Using fx:id as CSS id in FXML

江枫思渺然 提交于 2019-12-01 04:01:46
It seems that in FXML if you don't specify a ID (CSS) then the fx:id value is used by default. My previous understanding was the two were completely disjoint, ID for CSS and only CSS. fx:id for @FXML bindings in the controller. This can be demonstrated with a small test - three buttons, first with ID, second with FX:ID, third with both types of ID. <VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"> <children> <Button id="cssid0" mnemonicParsing=

FXML Load exception

。_饼干妹妹 提交于 2019-12-01 03:27:08
I got a problem that I absolutely can't solve on my own because I have just started using JAVA FX. I get a nasty javafx.fxml.LoadException: , but I have done exactly like a guide, but I cant get my Main to run. This is the the exception output: apr 07, 2014 4:06:37 EM application.Main start ALLVARLIG: null javafx.fxml.LoadException: /C:/Users/Jakob/Dropbox/java_kurser/Project%20Timeline/bin/application/LoginGUI.fxml at javafx.fxml.FXMLLoader.constructLoadException(Unknown Source) at javafx.fxml.FXMLLoader.loadImpl(Unknown Source) at javafx.fxml.FXMLLoader.loadImpl(Unknown Source) at javafx

JavaFX SceneBuilder 2.0 doesn't open FXML for custom components with fx:root as main layout tag

蓝咒 提交于 2019-12-01 02:55:56
问题 I have custom component with layout on FXML file which containts line <fx:root type="javafx.scene.layout.VBox" spacing="10.0" xmlns:fx="http://javafx.com/fxml"> I create this file on SceneBuilder 1.0, but then i try open this file on SceneBuilder 2.0 i got Exception java.io.IOException: javafx.fxml.LoadException: Root hasn't been set. Use method setRoot() before load. /Users/dmitrynelepov/Development/SogazGit/smpb/SMProjectBrownRelease/SMPBProxy/engine/fxml/component_daemon_viewer.fxml:14

Starting on JavaFX - JavaFX version and “development patterns” questions [closed]

馋奶兔 提交于 2019-12-01 02:49:38
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . I am planning on starting the development of a desktop app, but until now, for me, desktop = swing. I did a little research about it and found myself under some questions: I found that there are a lot of JavaFX versions: There is JavaFX 1.0 that people say is old and outdated;

How does FXMLLoader load the FXML's controller?

五迷三道 提交于 2019-12-01 01:55:00
问题 What happens when I call FXMLLoader#load() in JavaFX? Suppose the FXML controller extends a class that has a constructor. Will there be assurance that the constructor will be called? And if not, how will a new instance of the object be created? For example, in the code below, will the TextField() constructor be called? import java.net.URL; import java.util.ResourceBundle; import javafx.fxml.Initializable; import javafx.scene.control.TextField; public class FXMLController extends TextField

How to convert an observableset to an observablelist

[亡魂溺海] 提交于 2019-12-01 01:28:22
问题 I am trying to set items to a tableview but the setitems method expects an observablelist while I have an observableset in my model.The FXCollections utility class does not have a method for creating an observable list given an observable set.I tried casting but that caused a class cast exception (as expected). Currently I am using this kind of code new ObservableListWrapper<E>(new ArrayList<E>(pojo.getObservableSet())); And I have some problems with it: Will editing this in the table update

Set border size

元气小坏坏 提交于 2019-12-01 00:32:12
I want to make the border of a borderpane more round and bold. I tested this code: bpi.setStyle("-fx-background-color: linear-gradient(to bottom, #f2f2f2, #d4d4d4);" + " -fx-border: 12px solid; -fx-border-color: white; -fx-background-radius: 15.0;" + " -fx-border-radius: 15.0"); I get this result: How I can fix this? Why your current approach doesn't work Don't use -fx-border (it doesn't even currently exist in JavaFX CSS). Though there are other fx-border-* attributes such as -fx-border-color , -fx-border-width and -fx-border-radius , I wouldn't recommend them either. Suggested Approach

How to center the content of a javafx 8 scrollpane

房东的猫 提交于 2019-11-30 21:33:42
I have a ScrollPane, which contains a GridPane, which contains an ImageView, which contains an Image. What I want is for the Image to be centered in the GridPane. Without the ScrollPane I was able to accomplish this with setAlignment(Pos.TOP_CENTER), however once I added the GridPane to the ScrollPane the Image was displayed in the upper-left corner. How do I either get the ScrollPane to use the setAlignment() value or manually center the Image? ---example edit--- code without scrollpane: public class ImageDB extends Application { @Override public void start(Stage root) { Image image = new

JavaFX 8 Dynamic Node scaling

 ̄綄美尐妖づ 提交于 2019-11-30 20:17:53
I'm trying to implement a scene with a ScrollPane in which the user can drag a node around and scale it dynamically. I have the dragging and scaling with the mouse wheel working as well as a reset zoom, but I'm having trouble with the calculations to fit the node to the width of the parent. Here is my code as an sscce . (works) Mouse wheel will zoom in and out around the mouse pointer (works) Left or right mouse press to drag the rectangle around (works) Left double-click to reset the zoom (doesn't work) Right double-click to fit the width If I zoom in or out or change the window size, the fit

Callback and extractors for JavaFX ObservableList

你说的曾经没有我的故事 提交于 2019-11-30 19:51:43
Here is the code: package sample; import javafx.beans.Observable; import javafx.beans.property.IntegerProperty; import javafx.beans.property.SimpleIntegerProperty; import javafx.collections.FXCollections; import javafx.collections.ListChangeListener; import javafx.collections.ObservableList; import javafx.util.Callback; import java.util.List; /** * Created by IDEA on 28/07/15. */ public class ListUpdateTest { public static void main(String[] args) { Callback<IntegerProperty, Observable[]> extractor = (IntegerProperty p) -> { System.out.println("The extractor is called."); Observable[] res =