JavaFx PropertyPanel


#1

A JavaFx version of the Lemur PropertyPanel.

Originally written for the Lemur GUI framework by @pspeed - this is a straight rip to work for the JavaFx framework.

The propertyPanel is a JavaFx GridPane that automatically adds properties or fields from a class and binds them to a control. Changes made to the controls are set on the fields automatically.

So if you bind a float you get a slider. If you change the slider the float will also be changed.

JavaFxPropertyPanel propertyPanel = new JavaFxPropertyPanel();

propertyPanel.addBooleanProperty("Boolean", this, "testBool");
propertyPanel.addFloatProperty("Float", this, "testFloat", 0, 10, 0.1f);
propertyPanel.addDoubleProperty("Double", this, "testDouble", 0, 20, 0.1d);
propertyPanel.addIntProperty("Int", this, "testInt", 0, 30, 1);
propertyPanel.addEnumProperty("Enum", this, "testEnum");

The image below shows me binding property panels to two terrain noise filters so I can adjust the settings to get the terrain how I want it.


#2

A small video to illustrate the value (to someone like me) would be perfect :smiley:


#3

Thanks you, this will be great for testing.

Also, one of these days I want to pick your brain on what performance you are seeing. I am seeing noticeable drops in my fps when I have JavaFX running inside JME3. (JavaFX 11, JDK11)


#4

I mean there’s frame drop, but I don’t really notice it. What’s more noticeable is that they aren’t synced. They run on separate timelines. I guess it depends on how you set it up. I spent the first day I used jfx on a clean integration.


#5

Yes, I have cleaned up the integration I am using. There were a couple bugs that needed fixed. I am seeing framerate drops that are very significant, in the range of 80 to 90%. I can only get 150 fps on a RTX Titan with an empty scene right now.


#6

I get the same frame rate as I normally would when the GUI is static. From what I have seen in the code the gui is only updated when it’s being interacted with or animating - i.e. updating. I use the @javasabr implementation in an appstate.


#7

I am using the same setup. I have made a couple changed to @javasabr’s implementation to fix some bugs in JavaFX 11, but nothing that effects how it is drawn or updated. I also have an issue when I show a new UI, the old one appears for a second. I will build a test case to look into this further.


#8

Set the scene to null, null first. That’s what i do. I know the second input says @NotNull but it doesn’t throw any exception.


#9

That is what I have done. I also set the group to not visible. Did not help.


#10

I can share my implementation. Seems to work fine for me. I’ll send it to github tomorrow.


#11

Sounds good. I will work on finding where the slowdown is in mine.


#12

I’ve posted my implementation here: JavaFx Integration & Utilities

If you run the tests - for me at least - the frame rate isn’t even affected.


#13

Thinking about it, maybe on the line below in your implementation you limit the update cycle to 60fps or something lower than max fps. The thinking here is that for one javafx operates at 60fps anyway and secondly not so much garbage is being generated needlessly for no gain. It might be the GC slowing the cycle down. It’s worth a shot.

float limit = 1.0f / 60;
float time = 0;

@override
public void update(float tpf) {

    time += tpf;

    if (time < limit) {
        return;
    }

    time = 0;

    if (container.isNeedWriteToJme()) {
        container.writeToJme();
    }
} 


#14

Will keep this in mind for later… reminds me of a ControlsFX PropertySheet, but I assume this has some special integration going on for JME.

https://controlsfx.bitbucket.io/org/controlsfx/control/PropertySheet.html


#15

I haven’t seen dropped fps when I used javaFX inside jME.