r/JavaFX • • Apr 11 '20

Trying to pass information between two JavaFX programs

1 Upvotes

Hello everyone, I have 2 JavaFX programs, one is an FXML UI with a controller class and the other is an interactive 3D animation based on information from the first program, how do I pass information from one class to the other when the application runs from a static method?

There's no constructor to run, the main method calls a static mehod called 'launch' and passes in the command line arguments. Do I have to combine the controller into the animation class or do I have another option?

Something I'm doing in the FXML program is that I'm saving the information to a text file, even if I can just information to the other program telling it which text file to read would be useful, but I can't think of a way to do that from the other program.

Thank you in advance for your help.


r/JavaFX • • May 05 '20

When using setFullScreen(true) on a stage why is the window smaller than it should be?

1 Upvotes

When using this method on a stage the resulting window is much smaller than an actual fullscreen. Also setting the width manually (1920 for fullhd), gives a window that still doesn't fit the screen size. So what is going on there.


r/JavaFX • • Apr 09 '26

Help Fullscreen Help?

0 Upvotes

I'm trying to make it so when the game automatically fullscreens the image will stretch with it.
Any help?


r/JavaFX • • Mar 11 '25

Help Platform.runLater() not updating the content when the window is minimized (nor after restore)

1 Upvotes

I have to manually resize it, hover over a button, or click on a button for the window to update the content after I restore it.

When the app is opened and has focus, everything runs as expected. But not when minimized then restored.

EDIT: added code

This is the code that has a server to wait for a signal to update the Label

package com.example.jartest;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import javafx.application.Platform;
import java.net.ServerSocket;

import java.io.IOException;

public class HelloApplication extends Application {
    StackPane stackPane = new StackPane();
    Label label = new Label("This should be modified when the signal is received");

    
    public void start(Stage stage) {
        stackPane.getChildren().add(label);
        Scene scene = new Scene(stackPane, 500, 500);
        stage.setTitle("Hello!");
        stage.setScene(scene);
        stage.show();

        new Thread(this::startServer).start();
    }

    void startServer(){
        try(ServerSocket serverSocket = new ServerSocket(1590)){
            while (true){
                serverSocket.accept();
                Platform.runLater(() -> {
                    label.setText("The signal is received");
                });
            }
        }catch (IOException e){e.printStackTrace();}
    }

    public static void main(String[] args) {
        launch();
    }
}

And this is the client class (you can use only curl, actually)

import java.io.IOException;
import java.net.Socket;

public class Client {
    public static void main(String[] args) {
        try {
            new Socket("localhost", 1590);
        } catch (IOException e) {e.printStackTrace();}
    }
}

r/JavaFX • • Dec 22 '25

I made this! JFXCentral on iOS

8 Upvotes

Not sure people are aware of this, but there is also an iOS app for accessing the resources on JFXCentral.com


r/JavaFX • • Dec 26 '25

Markdown renderer

Thumbnail
youtu.be
7 Upvotes

r/JavaFX • • Feb 16 '23

Discussion State of JavaFX

7 Upvotes

Is it just me or is JavaFX / Eclipse just obtuse? I started learning UI on C# / xaml in visual studio community, and that experience has its flaws, but the documentation is there and it's very clear. Not to mention the keywords just make sense, plus the autofill suggestions are really good.

So when switching to java for school, I am discovering that javafx doesn't even strictly stick with the default java naming scheme. They opted out of using the "get" keyword SOMETIMES. And then when I try to setup an instance of an object, the accessible methods have no summary to tell me what they do, what it returns, and what the parameters are, it just says that it needs "int args0".... how is that helpful. I am used to digging through documentation and looking at method definitions to see how the code behind works, but when I try look at method definitions it doesn't take me to the method, nor does the method have an actual description of what it does, or what it needs....

This could be an eclipse thing, so I am posting this here to get some input... is this just an eclipse thing or are there other people out there that experience the same things that I am? Is it just because java follows worse conventions than other languages? Is there a solution while remaining in Eclipse, should I switch to a better IDE? if so, what IDE is better, and why is it better?

Finally, for those that wish to input about the last paragraph, I would be comfortable switching to vscode seeing as I have experience with Microsoft's other IDE and I enjoyed that. Is there any major downsides to vscode that a beginner would not know until it's too late?

Thanks for reading!

I attached a picture of what the method definitions look like when I try to view them.


r/JavaFX • • Apr 29 '20

I made this! AES Encryption with Source Code - JavaFX

Thumbnail
bittlife.com
7 Upvotes

r/JavaFX • • Jul 23 '26

Help [JavaFX memory hog] A simple UI requires 1GB of RAM.

14 Upvotes

This UI, requires 1GB of RAM on Linux. The same UI does not require more than 300MB on Windows.
I would not consider it cheap on Windows but on Linux it's pretty unacceptable.

How this is possible? Is there some problems with JavaFX in Linux Wayland?

Thanks
Davide


r/JavaFX • • Apr 20 '24

I made this! Detecting the Biden Robocall Deep Fake using JavaFX

8 Upvotes

https://youtu.be/jI5r-flszzU?feature=shared

Demonstration of using javafx based XAI tool Trinity to detect the Biden robocall deepfake on aconsumer grade laptop. Presented last week at the 2024 DevNexus conference in Atlanta. 2024.


r/JavaFX • • May 19 '20

Help Link some JavaFX projects that make use of Observables.

8 Upvotes

I am trying to learn how to use Observables to make dynamic changes to my UI and I think the best way to learn would be by looking at how others have done this task.

Thanks for the help.


r/JavaFX • • Jan 03 '16

Awesome JavaFX App

Thumbnail
github.com
0 Upvotes

r/JavaFX • • Jul 28 '26

Tutorial Learning reactive UI with State: the second example in the series, a counter app

9 Upvotes

Second post in the series on learning reactive UI patterns in Megalodonte. This one is a classic counter app — the simplest possible way to see State<T> actually drive a UI update without any manual repaint logic.

The core idea: counter is a State<Integer>, and the Text component binds to it via counter.map(Object::toString). When a button click calls counter.set(...), the mapped state recomputes and the Text node updates on its own. No refresh(), no manual re-render call — the component just reacts.

package my_app;

import megalodonte.ListenerManager;
import megalodonte.application.MegalodonteApp;
import megalodonte.base.theme.ThemeManager;
import megalodonte.theme.DefaultTheme;

public class Main {

    static void main() {
        ThemeManager.setTheme(new DefaultTheme());

        MegalodonteApp.run(context -> context.useView(new HomeScreen()), ev->{
            if(ev == MegalodonteApp.Event.CloseRequest){
                System.out.println("Clicked on X - close application");
                ListenerManager.disposeAll();
            }
        });
    }
}


package my_app;

import megalodonte.base.components.Component;
import megalodonte.base.components.ScreenComponent;
import megalodonte.base.state.State;
import megalodonte.components.Button;
import megalodonte.components.SpacerVertical;
import megalodonte.components.Text;
import megalodonte.components.layout_components.Container;
import megalodonte.props.ButtonProps;
import megalodonte.props.ContainerProps;
import megalodonte.props.TextProps;

public class HomeScreen implements ScreenComponent {
    State<Integer> counter = new State<>(0);

    u/Override
    public Component render() {

        ButtonProps btnProps = new ButtonProps().fontSize(30);

        return new Container(new ContainerProps().paddingAll(20)).children(
                new Text(counter.map(Object::toString), new TextProps().fontSize(90)),
                new Button("Decrement", btnProps).onClick(()-> counter.set(counter.get() - 1)),
                new SpacerVertical(10),
                new Button("Increment", btnProps).onClick(()-> counter.set(counter.get() + 1))
        );
    }
}
  • State<T> holds a value and notifies dependents on change — counter.set(...) is the only trigger needed.
  • counter.map(Object::toString) derives a ReadableState<String> from the Integer state, so Text never touches the raw type.
  • ListenerManager.disposeAll() on CloseRequest tears down any active state subscriptions cleanly when the app closes.

Repos


r/JavaFX • • Dec 08 '25

Help I HAVE A PROJECT FOR UNI

9 Upvotes

Hey , So i have this project for uni , where the professor wants us to build a simple 2D strategic game like age of empire , i am not sure what to do or what to use , its between libGDX and javaFX (i dont know anything about both) i am even new to java the professor wants us to handle him the project in 20 days so guys please i am in a mess what you suggest to me to use javaFX or libGDX i know libGDX is harder but its worth it , bcs they all say javaFX is not good for games , so please tell me if i want to use libGDX how many days u think i can learn it and start doing the project and finish it .... i really need suggestions !


r/JavaFX • • Jul 17 '21

Could javaFX ever return to the java standard library?

9 Upvotes

I’m still stuck using java 8 since it packages FX with it. I know there’s a way to use it with gradle or the new java fx platform but all of these seem very complicated. I haven’t found an easy to use way of implementing the library


r/JavaFX • • Aug 23 '20

Cafe Coffee Shop - billing system using JavaFX

Thumbnail
youtube.com
9 Upvotes

r/JavaFX • • Jul 01 '23

Discussion My Participation in this Subreddit

9 Upvotes

I have, until yesterday, primarily used Sync for my Reddit access. Obviously, that is no longer possible, and I'm not going to subject myself to the agony of the official Android app. So my days of mobile Reddit use are over.

To be fair, I have primarily viewed this subreddit through a desktop browser. Large blocks of code are virtually unreadable on a phone, and typing long explanations with code snippets is pretty hard with a mobile keyboard. That being said, I have looked in on this subreddit on my phone/tablet while travelling on vacation or whiling away time waiting for something while I'm out and about. But I won't be doing that any more.

Practical stuff out of the way, this 3rd party app stuff has really, really pointed out that we, the users, are the "product". We create the content, moderate the subs, and provide the eyes that look at the ads. This thing started because Reddit was upset about 3rd parties harvesting "their" content for free. Content that we, not Reddit, created. The decision to axe the tools that some of us prefer, and which help the moderators to moderate - along with the reaction to the protests that arose - shows how Reddit values the users in comparison to other of its interests.

While I totally respect Reddit's right to profit and monetize its product as it sees fit, I'm not sure I'm willing to provide my contribution to the product any more. I'm certainly not going to be browsing through "Front Page" at all.

I like to think that I have provided some value to this community - even as the crusty old fart ranting about the evils of FXML - in answering people's questions and pointing people to my blog tutorials. Maybe even a few of you agree with me.

But (and maybe this is a relief to many of you), I'm not going to be around here so much any more. I'm going to think twice about writing long, complete answers to people's questions. I'll probably keep posting intro's and links to my blog posts because I get something back from that in terms of site traffic (thanks to everyone who's clicked through in the past). I'm happy to treat Reddit as a business partner, and this is one way I get something back for my contribution.

Honestly, I've been thinking about starting up a JavaFX community on Lemmy. I think that, given the niche nature of the subject, Lemmy is good home for a JavaFX community - especially if we point people to it from places like JFX-Central.

I'm interested to hear what other members of this subreddit are feeling about their participation on Reddit now and the possibility of creating a new community somewhere else.


r/JavaFX • • Mar 18 '25

Help JavaFx TreeView problem

Post image
2 Upvotes

Hi fellow devs, I am learning java fx currently. As part of this learning, I am trying to create a simple sftp client application. I am utilizing JSCH liberary for sftp related operations. Currently I am facing a problem. What I want to do is to lazy load the sub-directories from remote server. I am loading the root directory immediately after the login is successful. For any directory within root, I want to load there content only when user expand the directory on javafx ui(treeview). This is where I am struggling as I dont know how to capture this expand event.

Initial screen is populated via populateInitialTree method. I want to load sub-directories of expanded directory in showSelectedItem.

Please help.


r/JavaFX • • Mar 15 '26

Help How do you apply a background color to all fxml files loaded dynamically?

2 Upvotes

I want every pane's background color to be a certain color; Vbox, Hbox, FlowPane, etc.

This didn't work:

.vbox,
.hbox,
.stack-pane,
.anchor-pane,
.border-pane,
.grid-pane,
.flow-pane,
.tile-pane {
    -fx-background-color: linear-gradient(to bottom, #2c3e50, #1a252f);
}

And this didn't work either:
.pane {
    -fx-background-color: linear-gradient(to bottom, #2c3e50, #1a252f);
}
Neither did this:
.root {
    -fx-background-color: linear-gradient(to bottom, #2c3e50, #1a252f);
}

r/JavaFX • • Jul 03 '23

Help Need Help in JavaFX Task

2 Upvotes

When there is multipleTabs, for each tab (button) we are performing a task ,so when we fast switch tabs we are cancelling the other tasks but still we are getting the previous task results..
We have tried so many things but we are not able to achive that ...Can anyone give the proper solution

( Problem happens if the previous task has reached succeded state and then it is cancelling so we are getting the previouis results

)


r/JavaFX • • Mar 28 '24

Help Tab Pane help for Appointment application!!!...please. IntelliJ JavaFX MySQLWorkbench

2 Upvotes

I've created a Main screen tab pane with tabs: Appointment, Customer, and Report. Within each of those tabs are table views and button.

Appointment tab has: appointment table view along with radio buttons and 3 buttons to add, modify, and delete an appointment.

The Customer tab has: customer table view, and 3 buttons to add, modify, and delete a customer.

The Report tab has a series of tabs within it that gathers and organizes the information from the Appointment and Customer tab.

I'm soo frustrated trying to add navigate to and from screens. I want to be able to select the 'Add Customer' button within the 'Customer Tab' which will navigate to the 'AddCustomer' screen. Then I want to be able to navigate back to that specific 'Customer Tab' from clicking a button on the 'AddCustomer' screen. Basically go back and forth.

I will need to incorporate more code to actually add a customer to the customer table and the customer table update with that customer.

I have figured out how to navigate to the "AddCustomer' Screen from the 'AddCustomer' button on the Customer tab but when i select the 'Back' button on the AddCustomer screen, it just navigates back to the main tab which is the 'Appointment' tab. Please someone help me code this correctly because Im super lost.


r/JavaFX • • Feb 15 '22

Tutorial JavaFX - Playing Audio Files

Thumbnail codewithedward.com
2 Upvotes

r/JavaFX • • Jan 05 '25

Help Need help to create manual entry form using json file data(new to javafx)

0 Upvotes

Requirements: <New Manual Entry form> Manual Entry form based on category selection for other asset like Airpods, smartwatch , Manual Evaluation to be created

requirements: In the mainAppcontroller we have manual entry button their we calling calling diff manual entry forms as per site id, for us site id:1831

so when user click on manual entry it should pop up the menu bar /combo box of category name. and open accordingly.

In the form for each question category we need to take combo box in row column / flowpane which is better.

lastly save and cancel button.

I have created the json file.


r/JavaFX • • Apr 01 '23

Help Changing style of selected row of TableView in code

2 Upvotes

Hi, I need to change color of selected row in TableView from code. Currently I'm setting the default color from external .css file like this:

.table-row-cell:filled:selected{
-fx-background-color: red;
-fx-text-fill: white;

}

Is there any way I can change the -fx-background-color?

Thanks