It is possible.
Here's my old code. Sorry there's a lot of unrelated junk. I cbf to clean it for you. Basically, like Villius said, you gotta wrap with JFXPanel.
Also, I dev-ed this on Linux. It is supported, if you're using Oracle JDK at least... Most Linux distros have a package for it. If not, they're probably using a less user-friendly distro, and I'd assume that means they're experienced enough to install it manually.
// Display the GUI
JFXPanel panel = new JFXPanel();
JFrame frame = new JFrame();
try {
panel.setScene(new SupremeFisherGUI().load(frame, this));
} catch (Exception e) {
e.printStackTrace();
}
frame.setUndecorated(true);
frame.setSize(328, 240);
frame.setContentPane(panel);
frame.setVisible(true);
frame.setBackground(new Color(0, 0, 0, 0));
and then I have this:
public Scene load(JFrame stage, Main script) throws Exception {
MainGUIController controller = new MainGUIController();
AnchorPane anchorPane = new AnchorPane();
anchorPane.setPrefSize(320.0, 174.0);
anchorPane.setStyle("-fx-background-color: #000");
Label welcomeLabel = new Label("Welcome to SupremeFisher!");
welcomeLabel.setTextFill(Paint.valueOf("#55acee"));
welcomeLabel.setFont(new Font("Cambria Bold", 18.0));
welcomeLabel.setLayoutX(16);
welcomeLabel.setLayoutY(6);
anchorPane.getChildren().add(welcomeLabel);
Label optionsLabel = new Label("Please configure your options below:");
optionsLabel.setFont(new Font("Cambria", 14.0));
optionsLabel.setTextFill(Paint.valueOf("#FFFFFF"));
optionsLabel.setLayoutX(18.0);
optionsLabel.setLayoutY(29.0);
anchorPane.getChildren().add(optionsLabel);
Label locationLabel = new Label("Location:");
locationLabel.setTextFill(Paint.valueOf("#55acee"));
locationLabel.setFont(new Font("Cambria", 14.0));
locationLabel.setLayoutX(18.0);
locationLabel.setLayoutY(59.0);
anchorPane.getChildren().add(locationLabel);
controller.locationBox = new ComboBox<>();
controller.locationBox.setLayoutX(87);
controller.locationBox.setLayoutY(56);
controller.locationBox.setPrefHeight(27.0);
controller.locationBox.setPrefWidth(215.0);
controller.locationBox.setPromptText("Select a Location");
controller.locationBox.setStyle("-fx-border-color: #55acee; -fx-background-color: #000000; -fx-text-fill: #FFFFFF; -fx-border-radius: 10; -fx-padding: 0 0 0 4;");
anchorPane.getChildren().add(controller.locationBox);
controller.fishLabel = new Label();
controller.fishLabel.setLayoutX(18.0);
controller.fishLabel.setLayoutY(125);
controller.fishLabel.setFont(new Font("Cambria", 14.0));
controller.fishLabel.setTextFill(Paint.valueOf("#55acee"));
anchorPane.getChildren().add(controller.fishLabel);
controller.fishView = new ListView<>();
controller.fishView.setLayoutX(18.0);
controller.fishView.setLayoutY(152);
controller.fishView.setMaxHeight(100.0);
controller.fishView.setMinHeight(0.0);
controller.fishView.setPrefHeight(0.0);
controller.fishView.setPrefWidth(285);
controller.fishView.setStyle("-fx-background-color: #000000; -fx-border-color: #55acee;");
anchorPane.getChildren().add(controller.fishView);
controller.typeBox = new ComboBox<>();
controller.typeBox.setLayoutX(87);
controller.typeBox.setLayoutY(89);
controller.typeBox.setPrefHeight(27);
controller.typeBox.setPrefWidth(215.0);
controller.typeBox.setPromptText("Select a Type");
controller.typeBox.setStyle("-fx-border-color: #55acee; -fx-background-color: #000000; -fx-text-fill: #FFFFFF; -fx-border-radius: 10; -fx-padding: 0 0 0 4;");
anchorPane.getChildren().add(controller.typeBox);
Label typeLabel = new Label("Type:");
typeLabel.setLayoutX(18.0);
typeLabel.setLayoutY(94.0);
typeLabel.setTextFill(Paint.valueOf("#55acee"));
typeLabel.setFont(new Font("Cambria", 14.0));
anchorPane.getChildren().add(typeLabel);
controller.imageView = new javafx.scene.image.ImageView();
controller.imageView.setFitWidth(285.0);
controller.imageView.setLayoutX(18.0);
controller.imageView.setLayoutY(158.0);
controller.imageView.setPickOnBounds(true);
controller.imageView.setPreserveRatio(true);
anchorPane.getChildren().addAll(controller.imageView);
controller.reducedAntiban = new CheckBox("Reduced antiban mode (not recommended)");
controller.reducedAntiban.setTextFill(Paint.valueOf("#55acee"));
controller.reducedAntiban.setFont(new Font("Cambria", 14.0));
controller.reducedAntiban.setLayoutX(18.0);
controller.reducedAntiban.setLayoutY(141);
anchorPane.getChildren().addAll(controller.reducedAntiban);
controller.startButton = new Button("START");
controller.startButton.setDisable(true);
controller.startButton.setLayoutX(12.0);
controller.startButton.setLayoutY(176);
controller.startButton.setMnemonicParsing(false);
controller.startButton.setPrefHeight(27.0);
controller.startButton.setPrefWidth(297.0);
controller.startButton.setStyle("-fx-background-color: #000000; -fx-border-color: #55acee; -fx-border-radius: 10;");
controller.startButton.setTextFill(Paint.valueOf("#FFFFFF"));
anchorPane.getChildren().add(controller.startButton);
controller.locationBox.setOnAction(new EventHandler<ActionEvent>() {
@[member='Override']
public void handle(ActionEvent event) {
controller.updateLocation(event);
}
});
controller.typeBox.setOnAction(new EventHandler<ActionEvent>() {
@[member='Override']
public void handle(ActionEvent event) {
controller.updateType(event);
}
});
controller.startButton.setOnAction(new EventHandler<ActionEvent>() {
@[member='Override']
public void handle(ActionEvent event) {
controller.start(event);
}
});
controller.fishView.setOnMousePressed(new EventHandler<MouseEvent>() {
@[member='Override']
public void handle(MouseEvent event) {
controller.updateFishView(event);
}
});
Scene scene = new Scene(anchorPane, Color.TRANSPARENT);
controller.registerStage(stage, script);
return scene;
}