How to Design properly. AppStates, JME+Swing?

Hello guys, I’m back for an another dumb question ! Are you ready ? Well, I’m currently making my own scene explorer and editor for “Learning Purpose” and after bunch of hours on it. I managed to make something that work and do the basics of what I wanted. But I’m stuck with a problem, a design problem.

So I have my application which look like this :

And my problem is that it became so messy that adding a new features would become a real nightmare, so I just created a new project and start a big refractoring process.

So my question, you see the button bar on the top ? Right now each one of them correspond to a custom class I’ve created. But every time I click on one of them I have to disable and change everything to merge the conflict in terms of interaction between them. Such as “Brush” for the terrain and transform selection etc… Which is starting to get really annoying. I never used AppState before, but do you think It would help judging my application and what I want to do ?

Next is Swing… I never used anything else in terms of GUI with JMonkey than Swing, and encapsulate everything I want to do is starting to make me crazy. Do you think I should try to learn one of the “integrated” JMe GUI or do you think that Swing can keep up with a bigger scale application ?

I can share the source if you want to see what it look like.

To clarify what I’m saying here is a little explanation of my current design :

Main.Debug.EditorDebug → Singleton to debug with function as EditorDebug.showPoint(Vector3f)
Main DoEnqueue.DoAddObject->Add object to the scene
Main.DoEnqueue.DoBrushChange->Change the terrain editor brush

Main.Editor.AssetsHandler->The class that correspond to the assets button handling
Main.Editor.TerrainHandler->The same for the terrain

Main.UI->All the swing interfaces

Look into “asynchronous multithreading”, you’ll have to decide which of your threads (AWT or the jME runloop) is authoritative.

1 Like

Thanks for the answer @normen ! I might use one of the embedded GUI (Threading problems are the worst), I’ll have to learn it anyway.

By the way :stuck_out_tongue:, do you think that one AppState by functionality is relevant ?

An AppState is basically a callback for the update loop, you’ll have to decide how that helps you to properly design your code.