3 ms·
Ask YC: Multiple UI screen configurations in Java?
Are there any good design patters/frameworks which will allow me to reconfigure a Java/Swings UI screen by reading the component state from a config file?
For example, under different conditions, different components might be enabled/disabled.
The problem is that with increase in the configurations, the config file might get unwieldy.
The other option is to create multiple screens with the components themselves hardcoded disabled and display the appropriate screen based on the qualifying condition.
There are about 10 screens in the set each changeable based on the condition
- babul 18y agoHardcoded multiple screens with bits enabled/disabled is a very bad idea for many reasons and is worth avoiding simply to be able to manage complexity and coupling/cohesion issues in your system.
- babul 18y agoThere is a good example I used a while back to build-up a java GUI with appropriate-state java actions and views which I shall retrieve when I get home. It is pure java without any third-party libraries needed. It basically load/saves configuration data to/from an XML file and is particularly useful for (re)building GUIs/Views on the fly without having to recompile classes etc. (so you can change icons/layouts/components). I think I even have it setup in a simplified worked example that can used immediately. Otherwise, a bit of Google always seems to help :)
- aj 18y agoThat was the first thing I tried. But Google was of not much help. Maybe I was searching wrong.. Can you explain how you achieved the mutable views in the UI?
- aj 18y agoI agree. That is why I want to use screen-map/xml definition to define the screen properties.