Extended components set


I want to describe the “extended components” part of the library a bit more in this post, so let’s see what is that exactly and how You can use it.

You might find similar components in lots of other libraries, but i assure You – some of them are presented only here. And even more – the whole library is presented in the same design concept as the standart Swing-components UI’s from WebLookAndFeel.


This class offers You a small, but efficient extension to standart JList component, which is commonly not editable. Even Java developers offer to use JTable instead list if You want to add editing, but that is not possible in some cases and also breaks the list concept. So i found a small and effective solution.

All You need to do is to pass Your JList instance and ListEditor implementation into ListUtils.installEditor(…) static method and the job is done – now Your list cells are editable! Basically there is a few ready ListEditor implementations for String and File data’s. You can build Your own editor using their sources (it is pretty simple i assure You).

So that’s how the basic ListEditor setup looks like:

String[] data = { “Element 1″, “Element 2″, “Element 3″ };
WebList list = new WebList ( data );
list.setVisibleRowCount ( 4 );
list.setSelectedIndex ( 0 );
ListUtils.installEditor ( list, new WebStringListEditor () );
panel.add ( new WebScrollPane ( list ) );

Also there are setEditable and setEditor methods presented in the WebList class (which just extends JList) to keep it even more simple.

The code sample from before will look like this in demonstration:

Let’s leave the list for now and move on…


This is one of most important parts in the new extended file chooser – address field. There is a lot of different versions of this component in applications but i’ve chosen windows explorer one with some changed elements that i don’t like.

Why exactly this one? Maybe because it is most informative and comfortable in use. Though it’s not all the same as the Windows one, so let’s look at it:

In the dropdown menus You can always find current location folders:

Menu is still unstyled, so it is in native style in this preview. Soon it will be replaced by WebLookAndFeel implementation as well.

In case you go to some deep-placed folder so the whole path does not fit component width it will start hiding the top levels under first popup menu:

So, this is what You need to add this component anywhere You want:

WebPathField pathField = new WebPathField ();
panel.add ( pathField );

Pretty simple, isn’t it? Of course there is a lot of options in itm which You can try out later, but for now let’s move on…


This component is the main part of WebFileChooser dialog, but might be used separate in case You need such panel somewhere.

This is how it looks by default:


You can find next features here:

  • Few current folder files preview modes
  • File tree and path field representing current location
  • Moves history
  • Standart buttons set (home/new folder/delete/…)
  • File type filter
  • Settings button that opens additional “static” settings for panel

Also there are standart hotkeys set through HotkeyManager that is presented in the WebLookAndFeel library.

So this is what You need to use this panel anywhere You want:

WebFileChooserPanel fileChooserPanel = new WebFileChooserPanel ( false );
panel.add ( fileChooserPanel );

The boolean flag in constructor adds or removes control “Choose”/”Cancel” buttons from the panel. For now it is changeable only at panel creation.

To listen file selection changes You can add special FileSelectionListener:

fileChooserPanel.addFileSelectionListener ( new FileSelectionListener()
    public void selectionChanged ( List<File> selectedFiles )
        // Perform any actions with newly selected files here
} );

There are more optional settings in WebFileChooserPanel which You can change like filters, components layout, current directory, show parts and others.


The file chooser dialog is used more often than a standalone panel, so it is also presented for WebFileChooserPanel – WebFileChooser. It copies all the settings from the panel and adds some more that concerns dialog.

It is very easy in use:

WebFileChooser wfc = new WebFileChooser ( null, "Выбор файлов и папок" );
wfc.setVisible ( true );

And looks almost the same as the panel itself (now You can see where the contol buttons placed if they are added):


Color chooser is also a very important part of Swing components set, so i fixed some of its problems and made it more compact. You can use the standalone panel quickly like this:

panel.add ( new WebColorChooserPanel () );

And this is what you wil find in the demonstration:


Same as the WebFileChooser – WebColorChooser is an additional dialog for WebColorChooserPanel with all its settings and even some more:

WebColorChooser colorChooser = new WebColorChooser ( parent );
colorChooser.setVisible ( true );

In this code “parent” – is any component or window by which WebColorChooser will be centered (use null for screen center).

This is what You will find in demonstration: