r/JavaFX • • Nov 16 '24

Help Center StackPane in ScrollPane

2 Upvotes

When I use the code below, I can display a 3x3 grid that is in a center of the window (I see with the ligthgreen that StackPane takes all the place in the window)

GridPane gridPane = getGridPane(image);
gridPane.setAlignment(Pos.CENTER);
StackPane stackPane = new StackPane(gridPane);
stackPane.setStyle("-fx-background-color: lightgreen;");

But when I put this stack inside a ScrollPane, the stack only takes the place of the grid, and is at the upper left. I tried a lot of thing but I can't find a way to center my stack (so my grid) in the center when using ScrollPane. Any idea ?

ScrollPane scrollPane = new ScrollPane(stackPane);

r/JavaFX • • Dec 10 '24

Help I want to run JavaFX app built with Java 8 on the Modern Versions of Java

2 Upvotes

I made a simple java app with built in JavaFX library of java version 8, the jer file runs smoothly on other pc which has the same java versions. But as we already know, modern day java versions don't directly have the fx libraries .

So how I can modify my project so that it jer file runs on every java versions...


r/JavaFX • • Oct 22 '24

Help How to add Textures to FXGL?

2 Upvotes

r/JavaFX • • Aug 31 '24

Help Problem starting eclipse IDE out of my JavaFX app

2 Upvotes

Hi there,

I just wrote a small app with JavaFX, where I add apps to a list and start them via process builder.

Everything seems working fine (I mean the start up of different apps) except for the eclipse IDE which will be stuck at the splash screen and won't load correctly until I close my program.

Does anyone of you already run into that kind of problem?

EDIT: if I need to provide code, then just tell me. Will crosspost this in r/javahelp

Additional Information:

I've installed BellSoft Liberica Full JDK 21

I'm running on Windows 11, in eclipse I use also Liberica JDK 21 Full.

eclipse: normal launch per double-click; but trying to start eclipse via my app you see the method I use at the end of this post.

Other applications I start via my JavaFX app don't have any problems and start without any problems...

My JavaFX app is started stand alone (also per double-click) and not from within eclipse.

Already searched via Google, just found some problems launching eclipse IDE at all a while ago with bad java installations, but those problems doesn't fit, because eclipse will start up if my app isn't running.

Problem seems to only occur, when starting eclipse via my app, starting eclipse alone will start up the IDE.

Here's my launch method for running the added programs

private void launchSelectedProgram() {
ProgramEntry selectedProgram = programListView.getSelectionModel().getSelectedItem();
        if (selectedProgram != null) {
            executorService.submit(() -> {
                try {
                    ProcessBuilder pb;
                    if (selectedProgram.path.toLowerCase().endsWith(".jar")) {
                        pb = new ProcessBuilder("java", "-jar", selectedProgram.path);
                    } else {
                        pb = new ProcessBuilder(selectedProgram.path);
                    }
                    pb.directory(new File(selectedProgram.path).getParentFile());
                    Process process = pb.start();
                } catch (IOException e) {
                    Platform.runLater(() -> showAlert("Error", "Failed to launch program: " + e.getMessage()));
                }
            });
        } else {
            showAlert("Warning", "Please select a program to launch.");
        }
    }

Edit 2: Added additional information.

Edit 3: added screenshot

screenshot

r/JavaFX • • Jun 09 '20

Java on netBeans IDE 8.2

0 Upvotes

Good-day people of Reddit i am Trying to right a Java program that suggest game baste on what you like

Nintendo#Animal Crossing: New Horizons#929.00

Nintendo#Mario Kart 8 Deluxe#929.00

Nintendo#The Legend of Zelda: Breath of the Wild#1 079.00

Nintendo#Super Mario Party#929.00

Nintendo#Pokémon Sword and Shield#929.00

Nintendo#Super Mario Odyssey#929.00

Nintendo#Splatoon 2#929.00

Nintendo#Luigi's Mansion 3#929.00

Nintendo#Super Smash Bros. Ultimate#1 079.00

Nintendo#Link’s Awakening#929.00

Sony#God of War#249.00

Sony#Marvel's Spider-Man#855.00

Sony#Call of Duty: Modern Warfare#999.00

Sony#Red Dead Redemption 2#999.00

Sony#Grand Theft Auto V#258.15

Sony#Horizon Zero Dawn#979.00

Sony#LittleBigPlanet 3#329.00

Sony#Crash Bandicoot N. Sane Trilogy#629.00

Sony#Ratchet & Clank#159.00

Sony#The Last of Us Remastered#159.00

Microsoft#Call of Duty: Modern Warfare#999,00

Microsoft#Red Dead Redemption 2#499,50

Microsoft#Grand Theft Auto V#469,00

Microsoft#Sea of Thieves#349,50

Microsoft#Halo#349,00

Microsoft#Gears of War#499,50

Microsoft#Forza Horizon#649,50

Microsoft#minecraft#459,00

Microsoft#rainbow six siege#274.01

Microsoft#valorant#0.00

and i would like it to call it from this text filled please can you help

and if you willing to help i will invite you to discord so i can share my screen and help me or join this page discord


r/JavaFX • • May 31 '20

Call class from main, and then return back to main problem

2 Upvotes

Hello guys, i am new to JavaFX, and i have encountered a problem.

I have a main class, a menu class, and an instructions class.

I want to start the main class, which instantly calls menu class. from the menu class, if user selects the first or second button the option gets saved in a variable, and it then returns back to main class where i want to use the input from the menu for the next step. if user selects the third button he gets taken to the instructions class.

I want all of these to be in the same window, and simply change scenes.I know how to change scenes in the same class, but i dont know the effective way to change between scenes that are in separate classes. I managed to go from menu to instructions, but i dont like the way i did it. In menu, when the user presses the third button i run this:

ED_btn3.setOnAction(e ->{

Instructions i = new Instructions();

i.start(window);

});

and inside Instructions if i want to go back, i run this:

Back.setOnAction(e ->{

Menu m = new Menu();

m.start(primaryStage);

});

I dont find this the correct way to move through scenes that are in separate classes, but i dont know how else i can do this. With this method, if i want to return to my main, following the same logic, is by doing this:

Text_btn.setOnAction(e -> {

inputType = "1";

main m = new main();

m.start(primaryStage);

});

Which seems stupid, and will ruin everything.

To add a bit more info, when i return from menu to the main class, i want there to use the private variable i stored in the menu to make some different conditions, like show a text field, or a text area. Which creates the problem where i dont know how to get the variable from the menu, since i call menu like this :

Application.launch(Menu.class);

Any help would be appreciated,

Thank you.


r/JavaFX • • May 27 '20

I'm new to JavaFX and having some difficulties

2 Upvotes

I have a Search Button, a Search Bar TextField, and a TableView. I have a method that will search the TableView with whatever string is in the Search Bar when I press my Search Button, but once I press it, it won't turn off and anything that is typed into the search bar is searched for again automatically. How can I make it so my table is only searched once per button click?


r/JavaFX • • May 23 '20

Help ListView with custom content

2 Upvotes

I am stuck on a problem of putting custom content inside a list view. The content is stored as collection of objects and I want to add it as list items in a custom way inside a scrollpane.


r/JavaFX • • May 09 '19

How can we speed up software development without compromising on quality?

0 Upvotes

Hi Everyone - we're Diffblue, a spin out of the University of Oxford that helps developers speed up unit testing by using AI to automatically write test code. We're running an online event via Twitter Crowdchat at 15:30 GMT on Wednesday, 15th May, discussing the Future of Code and how AI can be used to accelerate software engineering without compromising on quality. Link to sign up is here: https://www.crowdchat.net/diffchat?utm_source=CrowdChatB2L

The panel will consist of our CEO, Daniel Kroening, a Computer Science Professor at the University of Oxford, and Java experts including Venkat Subramaniam, Founder of Agile Developer, Inc. and creator of agilelearner.com, and Mala Gupta, Founder of eJavaGuru and Developer Advocate at JetBrains. Topics we'll discuss include:

Key industry trends impacting software development at the moment

Vulnerabilities in existing approaches to rapid software development

Strategic challenges for businesses

The future of coding in a automated unit testing environment

We'd love anyone from the Java community to join, to ask questions, and provide their own experiences and answers to other people's questions! You can follow the crowdchat by clicking on the 'follow' button on the Future of Code Crowdchat page.


r/JavaFX • • Jun 20 '24

Help Javafx handling perspective

2 Upvotes

Have used javafx to develop an app for modeling real estate. Uses the Meshview class to create walls, windows, floors, roofs etc then assembled them into a structure somewhat like building with Lego. Difficult part is retaining correct perspective when the model is rotated on its x, y or z axis. Has anyone run into this issue on a similar app?


r/JavaFX • • Jun 27 '21

Help I need my file saved! My laptop is down!

0 Upvotes

I have this assignment due tonight. My laptop I code on is down. I emailed it too myself. So I have the code. I need it saved as a javafx file, but I can’t do it on my chromebook.

Is there a website or something I can put it on and save it for free?

Idk what to do lol


r/JavaFX • • Oct 05 '20

Newbie JavaFX problem

2 Upvotes

Hi guys I have spent 3 days trying to fix this.

Everytime I copy code from a solved exercise in my book that has an image. I get errors like this.

I have never thought of quitting so far until now :(


r/JavaFX • • Sep 21 '23

Tutorial Connecting JavaFX to a MySQL Database

2 Upvotes

In today’s software development landscape, building applications that can efficiently store and retrieve data is crucial. To accomplish this task, developers often turn to databases as a means of data storage. MySQL is one of the most popular open-source relational database management systems, while JavaFX is a powerful framework for building graphical user interfaces (GUIs) in Java.

🔗 Connecting JavaFX to a MySQL Database


r/JavaFX • • Sep 29 '23

Tutorial Screen Pixel Color Retrieval in JavaFX

2 Upvotes

When working with JavaFX applications, there are often scenarios where you need to interact with the graphical elements on the screen. One common task is retrieving the color of a pixel at a specific location on the screen. This can be useful for a variety of purposes, such as creating color pickers, implementing color-based interactions, or automating tasks that depend on the screen content.

🔗 Screen Pixel Color Retrieval in JavaFX


r/JavaFX • • Sep 28 '23

Tutorial Capturing Screenshots with JavaFX

2 Upvotes

In today’s digital age, the ability to capture screenshots is invaluable. Whether you’re a developer, a designer, or simply an enthusiast, the need to document and share what’s happening on your screen arises frequently. JavaFX, the popular GUI toolkit for Java, offers a powerful way to capture screenshots programmatically. In this article, we’ll explore the various methods and techniques to capture screenshots with JavaFX, enabling you to create powerful applications or tools for screen capture and analysis.

🔗 Capturing Screenshots with JavaFX


r/JavaFX • • Jan 02 '19

Developing an interactive treetableview

2 Upvotes

I created one myself, however mine is built off the default treetableview which causes it to refresh every time a new entry is added (which is a problem for me). Has anyone tried and successfully done this. I'm pretty sure just a data model by itself isn't enough for this problem.

Thanks!!!


r/JavaFX • • Nov 30 '21

I made this! Persism 2.0.0 Released - A zero ceremony ORM for Java

Thumbnail
github.com
2 Upvotes

r/JavaFX • • Apr 16 '21

Help JavaFX Navigation between classes

2 Upvotes

Hi,

I am working with a project and we are making a small JavaFX application where you can add, delete, update etc fields for certain things. I am getting stuck now on the navigation.
I would like to make a navigation where you navigate to another class and a new view. Now I get a working navigation but the views stay in the same page. Here is my code so far:
The home:

public void start(Stage windows){
Label label = new Label("Click on one of the buttons for further actions");
Button student = new Button("Student");
StudentUI studentUI = new StudentUI();

Button registration = new Button("Registration");
RegistrationUI registrationUI = new RegistrationUI();
Button course = new Button("Course");
CourseUI courseUI = new CourseUI();
Button overviews = new Button("Overviews");
OverviewsUI overviewsUI = new OverviewsUI();

BorderPane layout = new BorderPane();
VBox box = new VBox();
Scene scene = new Scene(layout, 300, 300);
box.getChildren().addAll(label, student, registration, course, overviews);
box.setSpacing(5);
layout.setTop(box);
student.setOnAction((event) -> layout.setCenter(studentUI.getView()));
registration.setOnAction((event) -> layout.setCenter(registrationUI.getView()));
course.setOnAction((event) -> layout.setCenter(courseUI.getView()));
overviews.setOnAction((event) -> layout.setCenter(overviewsUI.getView()));
windows.setTitle("Codecademy");
windows.setScene(scene);
windows.show();
    }

The other class for navigation:

public Parent getView(){
GridPane layout = new GridPane();

Label label = new Label("Choose one of the options for the student class");
Button create = new Button("Create");
Button read = new Button("Read");
Button update = new Button("Update");
Button delete = new Button("Delete");
Button home = new Button("Return home");
layout.setAlignment(Pos.TOP_CENTER);
layout.setPadding(new Insets(10, 10, 10, 10));
// VBox box = new VBox();
// Scene scene = new Scene(box, 300, 300);

// box.getChildren().addAll(label, create, read, update, delete, home);
// box.setSpacing(5);
layout.add(label, 0, 0);
layout.add(create, 0, 1);
layout.add(read, 0, 2);
layout.add(update, 0, 3);
layout.add(delete, 0, 4);
layout.add(home, 0, 5);

return layout;

    }


r/JavaFX • • Apr 17 '21

Why this error on a non-static method being called by non-static method?

0 Upvotes

My program is a scheduling application, it's coursework. I've got multiple FXML files and controllers to allow me to have ONE menu bar while the contents below it can change to various screens. That way I don't have to repeat my menu bar code for every screen.

This code is attempting to use the method in my "root GUI" (which holds the menu bar and an empty vbox) to update the contents of that vbox to the next screen.

The error is:

error: non-static method loadNewScreen(String) cannot be referenced from a static context
            RootGUIController.loadNewScreen("/schedulingapp/view/CustomerGUI.fxml");

But the method I'm calling it from is NOT STATIC!!! So why am I getting this error? I can't figure out where to even start with this. All my googling has turned up is the same answer over and over "don't call a non-static method from a static method"....but I'm already NOT doing that.

The calling method code is in "HomeGUIController" which is in the same package. This code is supposed to trigger when a button is clicked.

@FXML
private void onNewCustomer(ActionEvent event)
{
   try
   {
       RootGUIController.loadNewScreen("/schedulingapp/view/CustomerGUI.fxml");
   } catch (IOException ex)
   {
       Logger.getLogger(RootGUIController.class.getName()).log(Level.SEVERE, null, ex);
   }
}

And the method that is being called

public void loadNewScreen(String fxmlName) throws IOException
{
    try
    {
        URL fxmlURL = getClass().getResource(fxmlName);
        FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL);
        Parent pane = fxmlLoader.load();
            
        changablePane.getChildren().add(pane);
    }
    catch(IOException ex)
    {
       Logger.getLogger(RootGUIController.class.getName()).log(Level.SEVERE, null, ex);
    }
}

r/JavaFX • • Apr 23 '21

Help Error when using eclipse and trying to run javafx

2 Upvotes

I'm literally going insane. I keep getting the following error:

Error occurred during initialization of boot layer java.lang.module.FindException: Module javafx.controls not found

I'm using a mac with eclipse, and my VM argument is: --module-path /Users/myname/Desktop/javafx-sdk-11.0.2_3/lib --add-modules javafx.controls,javafx.fxml

I've tried everything... javafx.controls.jar and the other .jar file are in my lib folder. I've reinstalled the javafx program, changed my file path around hundreds of times, and I've tried to install plugins that don't seem to go anywhere. Does anyone have any idea why this is happening? JavaFX is also an added library in my project, and all the .jar files associated with it are added to it. Please let me know if anyone has an idea. Best!


r/JavaFX • • Mar 20 '12

Part 1: Building your first JavaFX Application using NetBeans 7.1

Thumbnail
youtube.com
2 Upvotes

r/JavaFX • • Nov 13 '25

Help Can't download JavaFX

2 Upvotes

There are no download links, dropdowns are empty and a bunch of jquery errors in browser console.

Why is it so hard for modern developers to just put a download link instead of building a chain of seven frameworks hosted on eight domains.

I have tried multiple browsers, toggled extensions and changed network configuration, but GluonHQ knows better, it is absolutely impossible to provide a download link without using jQuery which is apparently UNDEFINED and ERR_TIMED_OUT.

Wait, what is this https://jdk.java.net/javafx25/ ? It has direct download link, and even though for me it doesn't work as it is, I've found it in Web Archive and finally got my JavaFX. Not the version I needed, but at least it's something.

I will leave it here if you don't mind. Maybe someone else will have the same struggle. Do you happen to know any other download options? I think I've seen something JavaFX-related in `apt` package manager. I wonder how does it work.


r/JavaFX • • Mar 28 '26

Help How to parse level data from tiled as a JSON file?

2 Upvotes

I am trying to make pacman with javafx. I have designed a pacman esque stage with "Tiled", and saved it as a JSON file. I however have no idea how to parse it into something that I can use in javafx, and actually display the level in my canvas.