Back Home

The Customizer Framework

The Customizer Framework is a framework to customize Swing components with a GUI. Thus it can be used as a base for applications like layout editors. Currently you can move and resize components with the mouse, snap-to-grid feature is supported and many things more covered in this trail.

JCustomizer and JCustomizerPane

JCustomizer wraps a JComponent and allows customization of the following properties: To move and resize the JCustomizer with the mouse you have to add it to a JCustomizerPane.
Double-clicking on a JCustomizer will fire an ActionEvent. You can register an ActionListener to get notified about these events.

Here's a picture of an application that uses a single JCustomizer added to a JCustomizerPane:

A snapshot of the SimpleSingleCustomizerSample



Try this:
  1. using Java Web Start.
  2. Select the JCustomizer by clicking it. Then the handles appear. You can move and resize the component with the mouse. When you release the JCustomizer it snaps to the grid. If you resize the frame the grid adjusts to its size.

Below is the code from SimpleSingleCustomizerSample.java that creates and configures the JCustomizer and the JCustomizerPane.
            
    

Text Customizers

AbstractTextCustomizer is a base class to write customizers for components, which can display texts, with inline-editing support. The framework provides 3 implementations:



A snapshot of the TextCustomizersSample



Try this:
  1. using Java Web Start.
  2. Double-click a text editor to edit its text and resize the JHtmlCustomizer to see how the text wraps automatically!

Below is the code from TextCustomizersSample.java that creates and configures the text customizers.
            
    

Implementing your own text customizer can be quite easy. Have a look at the source code of JLabelCustomizer for an example. (The source code gets shipped with the library or can be retrieved from the Subversion repository of the SoftSmithy project).

Icon Customizers

The JXIconCustomizer allows visual scaling of icons. (See here for more information about the Extended Icon Framework.) JLine2DCustomizer is specialized JXIconCustomizer to customize a line.

Selection Manager

JCustomizerPropertyTable

Customizer Actions

CustomizerBar

Customize Appearance

Back Home