

Ask YC: Multiple UI screen configurations in Java? - aj

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?<p>For example, under different conditions, different components might be enabled/disabled.<p>The problem is that with increase in the configurations, the config file might get unwieldy.<p>The other option is to create multiple screens with the components themselves hardcoded disabled  and display the appropriate screen based on the qualifying condition.<p>There are about 10 screens in the set each changeable based on the condition
======
babul
Hardcoded 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
There 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
That 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?

