Lesson 8 : Customizing the User InterfaceThis is the 8th part of the VLDocking Framework for Java Swing applications. This lessons describes how to change the Look And Feel of VLDocking. The new UI delegation model of VLDockingVLDocking UI DelegatesVLDocking uses UI delegate classes to paint the look and feel of many of its components. Theses classes are dynamically loaded at startup, and use many UI properties to give your application the desired appearance. Here is the list of the current UI delegates :
Replacing UI DelegatesPlease note that most UI settings are accessible with UI properties, and thus cas be changed without the need of writing a java class. The only case where you should have to write your own UI delegate class is when you want a very different rendering (non rectangular for example). So, if you need a very different rendering for your dockables, then you will have to provide your custom classes. Here is how to declare them :
Example :
public static void main(String[] args){
// first, preload the UI to avoid erasing your own customizations
DockingUISettings.getInstance().installUI();
// and start customizing...
UIManager.put("DockViewTitleBarUI", "your.own.ui.UIDelegateClassName");
// (replaced the DockViewTitleBar UI by another class)
...
}
Updating the existing UIThe easiest way to update the UI is by tweaking the UIManager properties. For example, if you want a special border for maximized dockable, use :
// declare your border
Border myBorder = ...
// put it in the UI property map.
UIManager.put("DockView.maximizedDockableBorder", myBorder);
// and that's it !
Please note that to avoid having your own UI settings beeing erased by the default ones, you will have to follow the pattern :
public static void main(String[] args){
// first, preload the UI to avoid erasing your own customizations
DockingUISettings.getInstance().installUI();
// declare your border
Border myBorder = ...
// and start customizing...
UIManager.put("DockView.maximizedDockableBorder", myBorder);
...
}
Now that you know how to proceed, here is the long list of customizable properties... Customizable propertiesBorder properties
Color properties
Icons
Labels and Fonts
Displaying buttons in title bars
KeyStrokes
UI Delegates
CursorsStarting from version 2.0.3 it is now possible to change the mouse cursor images used during drag gestures.
Other properties
The two basic VLDocking stylesVLDocking 1.0 provided a "shadowed" style (similar to the eclipse look and feel). VLDocking 2.0 comes with a default "flat style" where borders take less space. It also comes with tabs on top of tabbed containers (version 1.0 had them at bottom). You can choose select between the following provided styles (more to come) with the methods : // version 1.0 style DockingPreferences.setShadowDesktopStyle();
// or version 1.0 alternative style DockingPreferences.setDottedDesktopStyle();
// or version 2.0 default style DockingPreferences.setFlatDesktopStyle();
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||