Questions tagged [javafx-2]

OUTDATED - DO NOT USE FOR GENERAL JAVAFX QUESTIONS! JavaFX 2 provides a Java-based UI platform for creating standalone or browser-based Rich Client Applications. Its Java API enables Java developers to leverage existing skills and tools. The next version - JavaFX-8 was released March 18, 2014.

Useful resources:

JavaFX links :

Testing JavaFX-2 applications :

OpenJavaFX links :

JavaFX Scene Builder links :

Blogs and news sites about JavaFX :

Projects, complementing and extending basic functionality of JavaFX :

Books about JavaFX 2 :

Personal blogs, by people, who write about JavaFX :

Use javafx-8 tag for questions, related to javafx-8 (or javafx-3 - previous name), which will be released as part of JDK-8 - the sequel of javafx-2.

4858 questions
28
votes
6 answers

How to make an OS X menubar in JavaFX

I'm unable to make a JavaFX MenuBar show as a standard OS X menu bar, at the top of the screen. Here's what I've tried in my subclass of Application: public void start(Stage primaryStage) throws Exception { final Menu menu1 = new Menu("File"); …
Steve McLeod
  • 51,737
  • 47
  • 128
  • 184
28
votes
2 answers

Javafx combobox with custom object displays object address though custom cell factory is used

I have a combobox which shows list of User objects. I have coded a custom cell factory for the combobox: @FXML ComboBox cmbUserIds; cmbUserIds.setCellFactory(new Callback,ListCell>(){ @Override …
developer
  • 463
  • 2
  • 9
  • 19
28
votes
11 answers

JavaFX: How to change the focus traversal policy?

Is it possible in JavaFX to change the focus traversal policy, like in AWT? Because the traversal order for two of my HBoxes is wrong.
Sonja
  • 505
  • 1
  • 7
  • 15
28
votes
1 answer

Passing parameters to a controller when loading an FXML

I have a login screen, and I want to pass the login ID from the LoginController to the MainController, so I can access some functions to change password and whatnot. I load the controller like this: FXMLLoader fxmlLoader = new…
Dynelight
  • 2,072
  • 4
  • 25
  • 50
28
votes
5 answers

Declaring Variable In JavaFX CSS File

I've been inspecting the "caspian.css" distributed by Oracle in the JavaFX runtime library, and I see they have declared some color values as variables. Eg: -fx-base: #d0d0d0; // Caspian.css, Line 47 ...and then they used it as value of some other…
a.b
  • 9,414
  • 5
  • 26
  • 22
27
votes
5 answers

Compile code using JavaFX 2.0 (using command line)

I wonder how to compile code using JavaFX, from a Windows shell. I have this code in fxservidor.java: public class Fxservidor extends Application { /** * @param args the command line arguments */ public static void main(String[]…
Jhuaraya
  • 271
  • 1
  • 3
  • 3
27
votes
2 answers

MVC with javaFX

I'm struggling with the MVC concept using javaFX. I am building an javaFX application using fxml files. Each fxml file has a controller assigned, but I don't think that this controller is one as the MVC pattern states. I think of it like some sort…
priojewo
  • 937
  • 2
  • 11
  • 22
27
votes
13 answers

Allow user to resize an undecorated Stage

I am working on making a screen recorder in JavaFX and one utility that is mandatory in the screen recorder is to let the user define how much area to record. I managed to make an undecorated , semi-transparent Stage that can be dragged around to…
An SO User
  • 24,612
  • 35
  • 133
  • 221
27
votes
3 answers

How to swap screens in a JavaFX application in the controller class?

If there are 3 files in a JavaFX project; an FXML file, a controller for the FXML, and an application class; how can the controller respond to a button click (which works perfectly fine) with changing the screen on that click (which is normally done…
B Y E
  • 315
  • 1
  • 4
  • 11
27
votes
2 answers

JavaFX 2 vs Swing for a pure Windows desktop app

I need to write a desktop app and its been a while since I started used Swing so will have a learning curve with either technology. Are there any advantages in doing my app using JavaFX 2?
DD.
  • 21,498
  • 52
  • 157
  • 246
26
votes
5 answers

How to handle ListView item clicked action?

I have my JavaFX 2.0 application, where i need to make some action, after user clicked an item in ListView element. To construct user GUI i'm using FXML, in which i have something like this:
Victoria Agafonova
  • 2,048
  • 10
  • 33
  • 50
26
votes
4 answers

Prevent/Cancel closing of primary stage in JavaFX 2.2

As the title says, my question is, how can I prevent/cancel closing of primary stage in JavaFX 2.2? I have done some research on Google, and the following two links seemed to address the issue: Prevent or cancel exit JavaFX 2 Thread: JavaFX 2.0…
Jomoos
  • 12,823
  • 10
  • 55
  • 92
26
votes
1 answer

How to get parent Window in FXML Controller?

For example, I want open a DirectoryChooser when clicking on the button:
nvcnvn
  • 4,991
  • 8
  • 49
  • 77
26
votes
5 answers

Moving an undecorated stage in javafx 2

I've been trying to move an undecorated stage around the screen, by using the following mouse listeners: onPressed onReleased onDragged These events are from a rectangle. My idea is to move the undecorated window clicking on the rectangle and…
Antonio J.
  • 1,750
  • 3
  • 21
  • 33
26
votes
1 answer

How can I avoid a SplitPane to resize one of the panes when the window resizes?

I want to resize the pane only manually dragging the splitter with the mouse. But when the window is resized, I would like that pane to keep the exact size that I chose. Allowing the other pane to change size freely. Do you think of any way to…
betaman
  • 1,865
  • 5
  • 25
  • 30