This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information

--Custom IFactory implementation

Documents for the development of and with JVx.

--Custom IFactory implementation

Postby Development@SIB » Tue Jul 24, 2012 4:40 pm

This article is outdated - please use our new system at

Sometimes you need additional methods in your UI factory, e.g. create custom controls, preconfigure existing controls.

The UI factory is one of the first classes that is instantiated from a launcher. If you need a custom factory, use an application parameter to configure it.

A custom factory:

Code: Select all
package apps.firstapp;

import javax.rad.genui.UIImage;
import javax.rad.ui.IAlignmentConstants;
import javax.rad.ui.component.IButton;

import com.sibvisions.rad.ui.swing.impl.SwingFactory;

public class CustomSwingFactory extends SwingFactory
   public IButton createButton()
      IButton button = super.createButton();
      return button;

Our factory extends the default SwingFactory and overwrites createButton. All created buttons have a default icon, no border and the text is left aligned.

Now we configure our custom factory via commandline:

Code: Select all
java -cp... apps.firstapp.FirstApplication "" Launcher.uifactory=apps.firstapp.CustomSwingFactory

The second parameter defines a config file, but we don't use one. It is also possible to put the factory parameter in a config file together with other parameters. All configuration options are described in this article.

A preview of an application with our custom factory:

button.png (48.3 KiB) Viewed 2410 times
User avatar
Posts: 321
Joined: Mon Sep 28, 2009 1:54 pm

Return to Documentation