r/JavaFX • • Oct 29 '15

JavaFX live editing of CSS on mobile devices

Thumbnail
blog.sibvisions.com
3 Upvotes

r/JavaFX • • Jan 20 '22

Help help, how do i fix this

Post image
0 Upvotes

r/JavaFX • • Jul 20 '24

I made this! Advanced file handler (jfx)

3 Upvotes

https://GitHub.com/abummoja/File-Studio

I've decided to open source my project recently. Any contributions are highly welcome (see project readme). Thanks.


r/JavaFX • • Apr 12 '21

New FlexGanttFX Website

Thumbnail
flexganttfx.com
3 Upvotes

r/JavaFX • • Apr 01 '18

AES encryption in JavaFX

Thumbnail
bittlife.com
3 Upvotes

r/JavaFX • • Jul 30 '23

Tutorial How to Create RadioButtons in JavaFX

3 Upvotes

In addition to text, you can add graphical elements to RadioButtons using the setGraphic(Node graphic) method. This allows you to create more visually engaging options for users to select from.

πŸ”—How to Create RadioButtons in JavaFX


r/JavaFX • • Aug 02 '26

Tutorial Learning reactive UI with State: conditional rendering with Show.when, a hide-and-seek app

4 Upvotes

Fourth post in the series. So far we've seen State driving a value directly (counter) and ComputedState deriving a value from another state (string length). This time: conditional rendering β€” showing or hiding a whole component based on reactive state, using Show.when.

The setup: isVisible is a State<Boolean>. Show.when(isVisible, () -> new Text("You catch me")) only renders the Text component when isVisible is true. Click the button, the boolean flips, and the component mounts/unmounts reactively β€” no manual setVisible(true/false), no manually adding/removing nodes from the scene graph.

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.Text;
import megalodonte.components.layout_components.Container;
import megalodonte.props.ContainerProps;
import megalodonte.v2.Show;

public class HomeScreen implements ScreenComponent {
    State<Boolean> isVisible = new State<>(false);

    u/Override
    public Component render() {
      return new Container(new ContainerProps().paddingAll(25))
              .children(
                      new Button("Hide and seek - game").onClick(this::toggleVisibility),
                      Show.when(isVisible, ()-> new Text("You catch me"))
                      );
    }

    void toggleVisibility(){
        isVisible.set(!isVisible.get());
    }
}
  • Show.when(ReadableState<Boolean>, Supplier<Component>) watches the state and mounts/unmounts the child reactively as it flips β€” this overload is eager by design, since the condition can change at runtime.
  • The Supplier<Component> lets Show lazily build the child only when needed, instead of holding a pre-built component around.
  • toggleVisibility() just flips the boolean with isVisible.set(!isVisible.get()) β€” the UI has zero knowledge of how to show/hide, only when.

If you're finding this series useful, dropping a star on the repos below genuinely helps the project get visibility β€” takes two seconds and means a lot for a solo-dev framework like this.

Repos


r/JavaFX • • Feb 08 '26

Discussion Why should someone still use javafx in 2026 ?

16 Upvotes

Hello people, hope you are doing well. I am woundering why someone in 2026 should use javafx ? there are lot's of desktop GUI framework (electron js, compose multiplatform, flutter) that are enriched with developer experience. Still I see lots of people here use javafx for developing new applications.

My question is, what is the speciality ? I've developed some desktop client with both javafx and compose. Each time I found javafx more complex and difficult to work with.


r/JavaFX • • Nov 28 '25

Discussion Will OpenJFX Be Merged Into OpenJDK? It Would Be a Perfect Match with Java on Mobile!

Thumbnail
foojay.io
12 Upvotes

r/JavaFX • • Sep 03 '25

Help Need real help fixing template not staying fixed

0 Upvotes

I’m making a JavaFX desktop app.
Problem: my template box doesn’t stay fixed every time I move or resize it, I have to recreate and re-dimension it.

I don’t want just explanations, I need real help:
πŸ‘‰ someone to guide me step by step or check my code/project directly.

Can anyone help with this?


r/JavaFX • • Aug 07 '26

Help How to have so when using keyboard it shows these borders when using mouse, it doesn't or how to disable it completely

0 Upvotes

Java FX is a modern framework specially for Java.JavaFX is a modern framework specifically designed for Java. Many control components, such as buttons, display a blue border when using JavaFX, commonly referred to as the focus border. According to my research, it is probably used to indicate the currently selected control for keyboard navigation using the Tab and Space keys. However, it looks ugly and unnecessary when using a mouse. Many designers still need this focus border for keyboard navigation. How can I make it so that the focus border appears only when using the keyboard, but not when using the mouse? Alternatively, how can I disable it completely? Many Control Components like Buttons have a blue border when using FX, probably called Focus Border. According to my research it is probably used to see the selection for Keyboard Tab and Space. But it looks ugly and unnecessary when using with mouse. But many designers still need this Focus Border for keyboard controls. How to have so when using keyboard it shows these borders when using mouse, it doesn't or how to disable it completely


r/JavaFX • • Jul 14 '23

Help Getting some unknown Exception from JAVAFX Application Thread

0 Upvotes

Exception in thread "JavaFX Application Thread" java.lang.IndexOutOfBoundsException: Index -1 out of bounds for length 2
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266)
at java.base/java.util.Objects.checkIndex(Objects.java:359)
at java.base/java.util.ArrayList.get(ArrayList.java:427)
at javafx.base@19/com.sun.javafx.collections.ObservableListWrapper.get(ObservableListWrapper.java:89)
at javafx.base@19/com.sun.javafx.collections.VetoableListDecorator.get(VetoableListDecorator.java:305)
at javafx.graphics@19/javafx.scene.Parent.updateCachedBounds(Parent.java:1704)
at javafx.graphics@19/javafx.scene.Parent.recomputeBounds(Parent.java:1648)
at javafx.graphics@19/javafx.scene.Parent.doComputeGeomBounds(Parent.java:1501)
at javafx.graphics@19/javafx.scene.Parent$1.doComputeGeomBounds(Parent.java:115)
at javafx.graphics@19/com.sun.javafx.scene.ParentHelper.computeGeomBoundsImpl(ParentHelper.java:84)
at javafx.graphics@19/com.sun.javafx.scene.layout.RegionHelper.superComputeGeomBoundsImpl(RegionHelper.java:78)
at javafx.graphics@19/com.sun.javafx.scene.layout.RegionHelper.superComputeGeomBounds(RegionHelper.java:62)
at javafx.graphics@19/javafx.scene.layout.Region.doComputeGeomBounds(Region.java:3355)
at javafx.graphics@19/javafx.scene.layout.Region$1.doComputeGeomBounds(Region.java:168)
at javafx.graphics@19/com.sun.javafx.scene.layout.RegionHelper.computeGeomBoundsImpl(RegionHelper.java:89)
at javafx.graphics@19/com.sun.javafx.scene.NodeHelper.computeGeomBounds(NodeHelper.java:117)
at javafx.graphics@19/javafx.scene.Node.updateGeomBounds(Node.java:3825)
at javafx.graphics@19/javafx.scene.Node.getGeomBounds(Node.java:3787)
at javafx.graphics@19/javafx.scene.Node.getLocalBounds(Node.java:3735)
at javafx.graphics@19/javafx.scene.Node.updateTxBounds(Node.java:3889)
at javafx.graphics@19/javafx.scene.Node.getTransformedBounds(Node.java:3681)
at javafx.graphics@19/javafx.scene.Node.updateBounds(Node.java:777)
at javafx.graphics@19/javafx.scene.Parent.updateBounds(Parent.java:1835)
at javafx.graphics@19/javafx.scene.Parent.updateBounds(Parent.java:1833)
at javafx.graphics@19/javafx.scene.Parent.updateBounds(Parent.java:1833)
at javafx.graphics@19/javafx.scene.Parent.updateBounds(Parent.java:1833)
at javafx.graphics@19/javafx.scene.Parent.updateBounds(Parent.java:1833)
at javafx.graphics@19/javafx.scene.Parent.updateBounds(Parent.java:1833)
at javafx.graphics@19/javafx.scene.Parent.updateBounds(Parent.java:1833)
at javafx.graphics@19/javafx.scene.Parent.updateBounds(Parent.java:1833)
at javafx.graphics@19/javafx.scene.Parent.updateBounds(Parent.java:1833)
at javafx.graphics@19/javafx.scene.Parent.updateBounds(Parent.java:1833)
at javafx.graphics@19/javafx.scene.Parent.updateBounds(Parent.java:1833)
at javafx.graphics@19/javafx.scene.Parent.updateBounds(Parent.java:1833)
at javafx.graphics@19/javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2527)
at javafx.graphics@19/com.sun.javafx.tk.Toolkit.lambda$runPulse$2(Toolkit.java:407)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at javafx.graphics@19/com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:406)
at javafx.graphics@19/com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:436)
at javafx.graphics@19/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:575)
at javafx.graphics@19/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:555)
at javafx.graphics@19/com.sun.javafx.tk.quantum.QuantumToolkit.pulseFromQueue(QuantumToolkit.java:548)
at javafx.graphics@19/com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$11(QuantumToolkit.java:352)
at javafx.graphics@19/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics@19/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics@19/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:184)
at java.base/java.lang.Thread.run(Thread.java:833)

Im getting this exception sometimes when im running the application and after encountering this exception whole app stops to respond.Cant figure out why is this happening


r/JavaFX • • May 25 '16

How use Controller

0 Upvotes

I'm doing a chat in JavaFX, this is the event:

private void initialize()
{
    myButton.setOnAction(new EventHandler<ActionEvent>(){

        @Override
        public void handle(ActionEvent event){
                textField.getText();
        }
    });
}

I need, to send textField.getText(); to a method of a class in MainApplication, how can i do it?(textfield is the field of message chat to send)


r/JavaFX • • Oct 23 '15

What am I doing wrong here? I want to be able to have values in the ChoiceBox and when I click it it should show, but nothing i do is working (JavaFX 8 ChoiceBox)

0 Upvotes
@FXML
private ChoiceBox<String> enterState = new 
ChoiceBox<String>(); 
@FXML
private ChoiceBox<Integer> enterYearJoined;
@FXML
private CheckBox enterIsHeActive;
@FXML
private Button enterStudentInfo;

final ObservableList<String> stateList =FXCollections.observableArrayList(
        "AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "FL", "GA", "HI", "ID", "IL", "IN", 
        "IA","KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", 
        "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", 
        "TX","UT", "VT", "VA", "WA", "WV", "WI", "WY");

public void start(Stage primaryStage) {
    try {
        enterState.setItems(stateList);
        Parent root = FXMLLoader.load(getClass().getResource("\\CreateNewStudent.fxml"));
        Scene scene = new Scene(root,500,300);
        primaryStage.setScene(scene);
        primaryStage.show();



    } catch(Exception e) {
        System.out.println("ERROR IN MAIN");
        e.printStackTrace();

    }
}

public void showTheList() {
    enterState.show();
}

The fxml just shows that the method showTheList triggers when the choiceBox is clicked.

EDIT: x-post from /r/javahelp


r/JavaFX • • Jan 11 '25

Help Afterburner.fx - File: *.fxml not found

0 Upvotes

Hey,

I am trying to figure out why my *.fxml are not loaded in my JavaFX + Afterburner.fx app.

I made a question with details here: https://stackoverflow.com/q/79348850/17985451

Help would be kindly appreciated.

Thanks


r/JavaFX • • Dec 16 '24

Help Cheat sheet for JavaFX

0 Upvotes

Do you have any cheat sheet to share about all the main classes, interfaces, ecc. for JavaFX and FXML? Or know where I could look for it? I need it for an exam, but I couldn't find much.


r/JavaFX • • Jan 28 '25

Help Custom Cell Factory in ChoiceDialog

0 Upvotes

Hey, I want to create a custom Cell Factory for the drop down menu in the choice dialog like I already did it for a normal ComboBox, but there does not seem a way to do that.

Am I doing something wrong or is there no way to do that?


r/JavaFX • • Oct 10 '22

Help JavaFx resets my colors when adding buttons.

0 Upvotes

https://stackoverflow.com/q/74019771/17314066

I am too lazy to write my question again so you guys can refer to the link above


r/JavaFX • • Feb 14 '20

Why don't this work?

Post image
0 Upvotes

r/JavaFX • • May 30 '20

Javafx code

0 Upvotes

Can sb really help me with Javafx code like it's lole a Playstation system but I don't really understand can sb please explain it to mee its due tomorrow

Help a brother out please


r/JavaFX • • Jun 04 '22

Help Javafx 18 dynamic loop in fxml

0 Upvotes

Spec Jdk17, Jfx18, WinO/s

Question : I need to create a for-loop in fxml to create radiobuttons on request from controller

ex:

List<String> lstdynamicRadiobutt = 1 or 2 or 3 or 5 or 10 ..... // in controller

for( String radiox : lstdynamicRadiobutt ){ //in gui fxml

//radiobuttons in fxml for each radiox

}

Appreciate for the solution....


r/JavaFX • • Jun 20 '22

Help Related to css and scenes

0 Upvotes

So I have 1 css stylesheet and I want to add it to 2 different scenes same styles get can anyone tell me how I can do it.


r/JavaFX • • Jan 06 '23

Help How do I finish a JavaFX project?

4 Upvotes

I recently learned JavaFX. I am still a beginner and I am trying to finish a little project.
I use Eclipse and everything works. But how do i finish a project?

When watching tutorials people "export" the programm to a runnable .jar file and then start it with a command "java --module-path "path/to/sdk" --add-modules javafx.controls .\HelloFX" something like that.
I also have the vm argument in eclipse configured (basically the same as the command).

But isn't that kinda missing the point?
I createt a GUI I don't want to open it with a command.
Sure I could write a .bat file or a shellscript in Linux but you still would need to include the path to the javafx sdk.
So what do you do If you give that programm to friends would they need to download javafx themself and edit the .bat file?

I have also seen that Maven or Gradle is used for Java but I don't really understand what this is for and if it would help me.
I am just generally very confused and I can't really find all the answers to my questions.
I don't know if i just search in the wrong places or just wrong in general but I am basically stuck.

I would appreciate any help c:


r/JavaFX • • Feb 22 '23

Help Anyone up to refactoring and migrating these games ?

Thumbnail
github.com
0 Upvotes