Skip navigation.

UIState

UIState is a non-intrusive user interface state manager for java Swing rich client applications.

UIState allow application to restore their gui state during application use and between multiple application session.
For example, if your application use JInternalFrame to present MDI interface, UIState will manage for you the position and the size of the frame.
Moreover UIState will also recover, if needed, the state of the widgets inside this frame.
For example, if your frame display JSplitPane, UIState will also restore the exact position of the separator.

UIState is extensible and allow you to handle "home made" component via external handler registration. You only need to implement two methods to fit UIState requirement.
UIState is easy to integrate in existing application only one code line is needed.
Just locate where you create JFrame, JDialog, JWindow,... any of Window subclasses and add the following code UIStateManager.manage(..).

UIState comes with handler for common swing components JFrame, JWindow, JInternalFrame, JTree, JTable, JList, JSplitPane and theirs respectives properties.(size, position, selection, ..).
Note that UIState do not handle data model. You still have to open internal frame, build tableModel, etc.

Features

  • easy to use and integrate
  • powerfull
  • non-intrusive
  • easily extensible
  • based on java.util.Preference
  • swing component ready!
  • free and open source!

Status

The current version of uistate is 0.6. Even if it is already used in our development, it should still be considered as a beta version.
Please report any bug in the forum, and feel free to check the it for help and suggestions.

Simple usage example

You can webstart this sample application here.

1. Download and install uistate

Download the latest version here, unpack the downloaded zip file wherever you want, and copy the uistate jar file in your program's classpath.

2. Usage

1- Specify the Preference node we want to use. it's optional and must be done only one time. (You can use whatever you want for the preferences folder name).
        UIStateManager.setPreferences(Preferences.userRoot().node("myapp/uistate"));

2- Create your frame and its contents
        JFrame frame = new JFrame("test");
        frame.getContentPane().add(....);

3- Tag your frame (optional)
        By default UIStateManager use the title of the Frame as id.
        But you can specify any object you want as id.

4- Call UIManager just before displaying the window.
        UIStateManager.manage(frame);
        frame.show();