fxml

Populate Choicebox defined in FXML

北战南征 提交于 2019-11-27 07:13:34
问题 I'm learning javaFX and my problem is that I have simple window with some choicebox and button. This window is defined via FXML which is also associated with controller class. I would like to know, how to populate this choicebox with data in the controller class, because using @FXML reference to this choicebox throws NullpointerEception EDIT - added source code FXML code <AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="240.0"

Redirect Console Output to JavaFX TextArea?

北慕城南 提交于 2019-11-27 07:04:17
问题 I want to show the console output in a JavaFX TextArea... unfortunately I cannot find any working example for JavaFX but only for Java Swing, which not seems to work in my case. EDIT: I tried to follow this example: http://unserializableone.blogspot.ch/2009/01/redirecting-systemout-and-systemerr-to.html and extended my code as shown below. However, there is no console output anymore in my Eclipse IDE but also no output in my TextArea. Any idea where I am doing wrong? public class Activity

How to reference primaryStage [duplicate]

情到浓时终转凉″ 提交于 2019-11-27 06:37:03
问题 This question already has an answer here: How do I open the JavaFX FileChooser from a controller class? 4 answers I use .fxml-Files for the view-layer of my application. Each fxml has a controller attached to it <AnchorPane fx:controller="movielistjavafx.view.MainWindowController"> Let's assume I have a mainFrame and it's controller. The mainFrame.fxml is loaded in the start(Stage) -method. Now you would like to show a fileChooser which is attached to a Stage/Window/Whatever. For that it

How to create custom components in JavaFX 2.0 using FXML?

醉酒当歌 提交于 2019-11-27 06:14:18
I can't seem to find any material on the subject. To give a more concrete example, let's say I want to create a simple component that combines a checkbox and a label. Then, populate a ListView with instances of this custom component. UPDATE: see my answer for complete code UPDATE 2: For an up-to-date tutorial, please, consult the official documentation . There was a lot of new stuff that was added in 2.2. Finally, the Introduction to FXML covers pretty much everything you need to know about FXML. UPDATE 3: Hendrik Ebbers made an extremely helpful blog post about custom UI controls. Andrey

Localdate.format, format is not applied

我是研究僧i 提交于 2019-11-27 05:39:54
I have a DatePicker in my FXML and I need the Date to insert it into my SQL-Database. I want to format my Date but it doesn't work. LocalDate localDate = purchased_at.getValue(); localDate.format(DateTimeFormatter.ofPattern("dd.mm.yyyy")); This is the Error I get. Caused by: java.time.temporal.UnsupportedTemporalTypeException: Unsupported field: MinuteOfHour I'm still kind of a beginner. I had Java for the past 3 or 4 months now. I'm trying my best to improve. Don’t format your date for insertion into your SQL database. Assuming that your database column has datatype date and you are using at

How to use font awesome in a fxml project (javafx)

点点圈 提交于 2019-11-27 05:16:50
I want to use font font awesome in my project but I have no idea how to use font awesome in my project. I had found some example but they can't be use in fxml. font awesome javafx I need help how to use it in my project using fxml Thank you. agonist_ I think this is what you need ControlFX that include font awesome support. see the javadoc for more info (But I tested it one day and it works fine) I achieved using FA Icons by adapting Jens Deters's approach . His routines target dynamic gui composition opposing fxml's declarative way. Nevertheless, his AwesomeIcon enumeration (which maps FA

How can I show an image using the ImageView component in javafx and fxml?

回眸只為那壹抹淺笑 提交于 2019-11-27 03:29:07
问题 I suppose it's a very simple thing but I just can't get behind it. All I want is to show an image over an ImageView linked to fxml. Here is my code: package application; import java.io.File; import javafx.application.Application; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.AnchorPane; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; public class Main extends Application { @FXML

How to get selected radio button from ToggleGroup

最后都变了- 提交于 2019-11-27 03:15:46
问题 I an working on JavaFX 8 and SceneBuilder . I created some radio buttons in the FXML File and specified a toggleGroup name to a radio button list in that. So, now I want to get the toggleGroup 's selected radio button in my controller, do I need to make all the radio buttons again as fields in the controller, or just the toggleGroup object will get me the selected radio button (the text of that radio button only, not the button object). 回答1: @FXML ToggleGroup right; //I called it right in

How to control the JavaFX Tooltip's delay?

左心房为你撑大大i 提交于 2019-11-27 02:09:53
问题 I was playing around with JavaFX Tooltip. I realized that for me personally the delay between hovering over something and the tooltip actually appearing is too long. A look in the API reveals: Typically, the tooltip is "activated" when the mouse moves over a Control. There is usually some delay between when the Tooltip becomes "activated" and when it is actually shown. The details (such as the amount of delay, etc) is left to the Skin implementation. After some further investigation, I was

JavaFX: Change application language on the run

核能气质少年 提交于 2019-11-27 01:24:34
问题 I am making JavaFX desktop application with core components described in FXML and I would like to offer user the option to change the language. However I have not find any direct way how to change the language once the component has been loaded from the FXML. The question is is there any standard way how to deal with switching the language in JavaFX. 回答1: You can do something like this. As in your answer, you would either want to implement this as a singleton, or use a DI framework to inject