TinyLaF beta 1.3.8  (2007-6-17)

The latest version of TinyLaF can be found at http://www.muntjak.de/hans/java/tinylaf/


Content

License
Required JRE
Ant build file
Running the TinyLaF control panel
Making TinyLaF the current LookAndFeel
The default theme
Decorated frames and dialogs
How to bundle tinylaf.jar with your packed application
TinyLaF and Java Web Start
Sortable table data with TinyLaF
History     1.3.8   1.3.7   1.3.6   1.3.5   1.3.4   1.3.3   1.3.2   1.3.1   1.3.0   1.2.1   1.2.0   1.1.0
Known issues
The future
Thanks ...
Contact the author


License      Top of page

The source code of the TinyLaF look and feel is released under the LGPL (GNU Lesser General Public License), which you can view at http://www.gnu.org/copyleft/lesser.html. Please read the file license.txt for additional information.


Required JRE      Top of page

1.4.0 or later.


Ant build file      Top of page

The source distribution contains an Ant buildfile (build.xml).
To build an executable tinylaf.jar, cd to the TinyLaF directory and execute:

> ant

(the jar will contain no debug information)


Running the TinyLaF control panel      Top of page

Using the control panel you can create and save your own themes.
To start the control panel, either double-click tinylaf.jar (Windows only) or cd to the TinyLaF directory and execute:

> java -jar tinylaf.jar


Making TinyLaF the current LookAndFeel      Top of page

To make TinyLaF the current LAF of your application, include this line:

UIManager.setLookAndFeel("de.muntjak.tinylookandfeel.TinyLookAndFeel");

at the beginning of your main method (you will have to catch any exceptions).
(Additional ways to define the LAF can be found in the Sun API docs: api/javax/swing/UIManager.html)


The default theme      Top of page

TinyLaF looks for a default theme file named 'Default.theme' (case-sensitive). If it finds one, this file will be loaded at startup.
(The 'Default.theme' file is an ordinary TinyLaF .theme file, just with a special name, you can take any .theme file and rename it to 'Default.theme').

TinyLaF will search the following URLs:

    1) TinyLookAndFeel.class.getResource("/Default.theme");
        - finds 'Default.theme' if it is inside tinylaf.jar
    2) Thread.currentThread().getContextClassLoader().getResource("Default.theme");
        - finds 'Default.theme' if it is inside the application's JAR
    3) new File(System.getProperty("user.home"), "Default.theme").toURI().toURL();
        - finds 'Default.theme' if it is inside the home directory
    4) new File(System.getProperty("user.dir"), "Default.theme").toURI().toURL();
        - finds 'Default.theme' if it is inside the working directory

NOTE: The de.muntjak.tinylookandfeel classes have some public static methods and flags. Do not call any of those methods and do not change any of those flags.


Decorated frames and dialogs      Top of page

To try the 'Decorated Frames' feature, include the following two lines (or maybe just one) in your source code before the first frame is made visible:

    JFrame.setDefaultLookAndFeelDecorated(true); // to decorate frames
    JDialog.setDefaultLookAndFeelDecorated(true); // to decorate dialogs

To eliminate flickering on resize (decorated frames only), include this code before you set the LAF:

    // continuous layout on frame resize
    Toolkit.getDefaultToolkit().setDynamicLayout(true);
    // no flickering on resize
    System.setProperty("sun.awt.noerasebackground", "true");


How to bundle tinylaf.jar with your packed application      Top of page

When JARing your application you should specify the relative path to tinylaf.jar as (one) value of the manifest's Class-Path attribute.

If you are new to manifest files:

The first line should specify the manifest version (until now there's only version 1.0):
Manifest-Version: 1.0

The second line specifies the main class of your application, providing its fully-qualified class name:
Main-Class: package1.package2.YourMainClass

The third line should read like this (tinylaf.jar resides in lib directory):
Class-Path: lib/tinylaf.jar

The fourth (last) line MUST be a blank line.

When JARing your application, you say:
> jar cmf nameOfManifestFile nameOfJar contentsOfJar ...

What you get is an executable JAR which automatically finds tinylaf.jar if the directory layout is as follows:
  .../applicationDirectory/nameOfJar.jar
  .../applicationDirectory/lib/tinylaf.jar


TinyLaF and Java Web Start      Top of page

TinyLaF should work with Java Web Start without tinylaf.jar needing to be signed (but note: if one of your JARs needs to be signed, you must also sign tinylaf.jar).

Because, in general, the 'Default.theme' file will not be inside tinylaf.jar you may want to give tinylaf.jar the attribute download="lazy" in your JNLP file (so the JAR including the 'Default.theme' file loads before tinylaf.jar).


Sortable table data with TinyLaF      Top of page

Since version 1.3.6 TinyLaF supports sortable table data (user can sort column values by clicking inside the column header). Sortable column headers visualize rollovers and display up/down arrows. TinyLaF supports single-column sort and multi-column sort.

To make table data sortable, a TableModel must implement de.muntjak.tinylookandfeel.table.SortableTableData, here are the interface methods:

boolean isColumnSortable(int column)
Returns true if the specified column is sortable, false otherwise. Non-sortable column headers will not react to mouse clicks or rollovers.

Parameters:
column - a column index
Returns:
true if the specified column is sortable, false otherwise

boolean supportsMultiColumnSort()
Returns true if the table model supports multiple sorted columns, false otherwise. (Supporting multi column sort makes sense only with columns containing some equal values.)

The TinyLaF user gestures concerning multi column sort are:

  • Ctrl-Click: If clicked column was already sorted, change sorting direction, else add clicked column to sorted columns.
  • Alt-Click: If clicked column was already sorted, remove from sorted columns. Ignore if clicked column was not sorted.
  • Click (without Ctrl or Alt): The clicked column becomes the only sorted column. If the clicked column already was sorted, change sorting direction.

Returns:
true if the table model supports multiple sorted columns, false otherwise

void sortColumns(int[] columns, int[] sortingDirections, javax.swing.JTable table)
Sorts the data according to the given arguments. If argument arrays are empty, the original state of the data will be restored, if there is no original state then no action will be performed.

Note for implementors: If your data is dynamically changing you should think about storing copies of the arguments so you can re-sort data after each change. It may also be a good idea to call fireTableDataChanged() after sorting (this makes sure that the table is updated).

Parameters:
columns - array of column indices sorted by priority (highest priority first).
sortingDirections - array containing the sorting direction for each sorted column. Values are either
  • SORT_ASCENDING - sort column data in ascending order, or
  • SORT_DESCENDING - sort column data in descending order
table the table displaying the data. Might be useful, for example, to restore selected cells after sorting

The source distribution contains two implementations of this interface: In class de.muntjak.tinylookandfeel.TinyTableHeaderUI there are two further methods related to sorting.

void sortColumns(int[] columns, int[] sortingDirections, javax.swing.JTable table)
Call this method to programmatically initiate sorting on (sortable) table models. Especially if your data is sorted by default, you should call this method before the table is displayed the first time.

Parameters:
columns - array of column indices sorted by priority (highest priority first)
sortingDirections - array containing the sorting direction for each sorted column. Values are either
  • de.muntjak.tinylookandfeel.table.SortableTableData.SORT_ASCENDING or
  • de.muntjak.tinylookandfeel.table.SortableTableData.SORT_DESCENDING
table the table displaying the data
Throws:
java.lang.IllegalArgumentException - If any of the arguments is null or if columns argument and sortingDirections argument are of different length

void setHorizontalAlignments(int[] alignments)
Sets horizontal alignments of table header renderers where an index in the argument array corresponds to a column index.
Note: If the length of the argument array is less than the number of columns, unspecified columns default to CENTER alignment. If the length of the argument array is greater than the number of columns, surplus information will be ignored.

Parameters:
alignments - array of the following constants defined in SwingConstants: LEFT, CENTER, RIGHT, LEADING or TRAILING

Each table header has its own instance of de.muntjak.tinylookandfeel.TinyTableHeaderUI. You can retrieve it with code like this:
JTable table = new JTable(new MySortableTableModel());
TableHeaderUI headerUI = table.getTableHeader().getUI();
if(headerUI instanceof TinyTableHeaderUI) {
    // do your thing ...
}


V 1.1.0  (2003-6-9)      Top of page

Fixed JProgressBar.getFont() returning null. Aditionally one can now set the font of JProgressBar.
Fixed JProgressBar now displays strings even when in indeterminate mode.
Fixed Defining TinyLaF as the standard LAF in swing.properties threw exceptions (PanelUI not found).
Fixed ButtonUI now honours isBorderPainted and isContentAreaFilled properties.
Fixed Border of JToolBar now isn't painted if set to null or isBorderPainted resolves to false.
Fixed Border of JTextField and JComboBox now isn't painted if set to null.
Fixed Due to a bug in BasicProgressBarUI (unfortunately in a private method, caused by a private member) sometimes a NullPointerException was thrown soon after the ControlPanel started. Because this exception is harmless, I decided to catch it.
Changed Removed Popup Font.
Changed Added ProgressBar Font together with two additional text colors in Decoration/ProgressBar.
Changed File format changed slightly due to previous changes. 1.0-themes can still be loaded, but saved themes are not compatible with TinyLaF-1.0



V 1.2.0  (2003-8-23)      Top of page

Fixed Icons for JMenuItems were painted disabled when menu item was selected.
Fixed The selection background and selection foreground for text components were both set to white.
Fixed Double-clicking the title bar of a frame maximized the frame without respect to the screen insets (while clicking the maximize button did respect screen insets).
Changed Simplified the paint routine for progress bar border to be faster so it doesn't conflict with the animation speed in javax.swing.plaf.basic.BasicProgressBarUI.



V 1.2.1  (2003-9-29)      Top of page

Fixed Bug in Launcher calling wrong LAF class.
Fixed Now changing to TinyLookAndFeel from another LAF works - changing from TinyLookAndFeel to another LAF still causes problems (certain properties are not updated, I guess this will never be fixed)
Changed Before searching "user.dir" for a 'Default.theme' file, TinyLaF searches "user.home", e.g. you can set a global default theme if you put it in "user.home".



V 1.3.0  (2004-6-14)      Top of page

Fixed Bug with scrollbar button arrows not changing direction when scrollbar orientation changes.
Fixed ArrayIndexOutOfBoundsException thrown in TinyTabbedPaneUI when trying to remove a tab by manipulating the tab.
Fixed Sub-menus painting partially above children.
Fixed JTabbedPane now honours tab background color set with setBackgroundAt(int, Color).
Fixed Menus and menu items now honour background and foreground properties set with setBackground(Color) resp. setForeground(Color). Additionally menus and menu items now are displayed with foreground colors defined in 'Menu Font' resp. 'Menu Item Font' by default.
Fixed Windows 98 style only: Arrowbuttons of JSpinner now draw themselves correctly.
Fixed Button margins were calculated without respect to the button border, so a margin of 0 made the button text obscure the border.
Fixed JToggleButton displayed the default icon instead of the selected icon if model was both selected and rollover.
Fixed JFormattedTextField of JSpinner editor did loose focus with each click on arrow buttons. Therefore, with SpinnerDateModel, it was not possible to select distinct date fields.
Fixed If the JFrame.setDefaultLookAndFeelDecorated property is true and the frame is maximized, the frame border now is supressed. This is also true for internal frames.
Fixed JOptionPane.showInternalXXXDialog() bringing up dialogs which painted no decorations at all.
Fixed JComboBox now updates its display size as the model changes.
Fixed Usage in applets: the theme is now reloaded as the applet is reloaded.
Fixed Editable text fields in ColorChooser now work as expected.
Changed The Windows XP style mutated to YQ style, the Windows 98 style mutated to 99 style. The YQ style is now the default style and will run with every operating system. To get rid of copyright issues I decided to replace both Windows 98 and XP icons with a custom icon set. Therefore I improved the algorithm to colorize icons.
Changed On startup TinyLaF now displays a message via System.out, reporting the version and the path to the 'Default.theme' file.
Changed In the past, radio buttons and check boxes painted rather slow. Though both paint more aesthetically now, painting speed increased drastically (by painting icons only once and caching the result - this speeds up painting by a factor of 80 and more).
Changed Radio buttons and checkboxes now have an editable margin. Please note: A Metal checkbox (or radio button) has border insets of (2, 2, 2, 2) which adds to the margin of (2, 2, 2, 2), so, if you want a TinyLaF checkbox to behave as a Metal checkbox, you must set its margin to (4, 4, 4, 4).
Changed The thumb of a scrollbar now has a minimum height/width of 17 pixels.
Changed JComboBox now calculates its preferred size more realistic (and less space-consuming). The rollover border for JComboBox is now disabled by default.
Changed The rollover border for JSpinner is now disabled by default.
Changed If frames or dialogs are decorated, they now have a minimum width of 104 pixels. Internal frames now have a minimum width of 32 px. Internal frames defined as palettes now can additionally display an iconify and a maximize button. Palette buttons are smaller now than internal frame buttons.
Changed You can now define separate title bar fonts for (decorated) frames, internal frames and internal palettes.
Changed Buttons are now opaque by default (this was a trick of the XPLookAndFeel). This change doesn't affect rendering of buttons, just the value of the opaque property.
YQ-Buttons now shift their text if the button is pressed.
There is an additional flag: "ENTER 'presses' focused button". If it is selected, the ENTER key triggers the buttonPressed action on JButton, JToggleButton, JCheckBox and JRadioButton (same as SPACE key).
JButton, JToggleButton, JCheckBox and JRadioButton now support a focused border. You can disable this by deselecting 'Paint Focus Border'.
Changed Toolbar buttons now have a definable margin and separate backgrounds and borders for their deselected-, rollover-, pressed- and selected state which makes them much more flexible to use.
Changed JProgressBar now looks like a WinXP progress bar.
Changed Added a SeparatorUI (see Decoration | Separator).
Changed Added a PasswordFieldUI (that just duplicates the settings from JTextFieldUI).
Changed Added the following UIs which support a default background color: EditorPaneUI, TextPaneUI and DesktopPaneUI (see Decoration | Miscellaneous).
Changed JSplitPane now has a divider size of 7 pixels (instead of 6 as before), oneTouchButtons have become smaller.
Changed JTree now supports arbitrary text colors. (Note: A JTree's text color is NOT its foreground color (and not a JTree property at all)). Additionally you can now adjust the line color (see Decoration | Tree).
Changed JComboBox now has its own background and foreground colors (see Decoration | ComboBox).
Changed Lists now support a background and a foreground color (see Decoration | List).
Changed Added support for floatable tool bars (see Decoration | ToolBar).
Changed You can now set the colors of toolbar separators (see Decoration | ToolBar).
Changed You can now set the colors of popup menu borders (see Decoration | Menu).
Changed Added borders for table and table headers (see Decoration | Table). The header border adds an inset of 1 pixel in each direction.
Changed Added some colors for disabled tabbed panes (see Decoration | TabbedPane).
The 'Paint Focus' flag disappeared, instead there is a 'Ignore Selected Bg' flag. If this flag is on, a selected tab will not change background color.
Tab insets and tab area insets now are editable.
Added a 'Fixed Tab Positions' flag - it switches from Java-Metal behaviour (the selected tab is always in the lowest tab row) to Windows behaviour (tabs never change positions).
Changed Text components now additionally support a caret color.
Changed Now you can specify the border, background and foreground colors for disabled tool tips.
Changed Combobox button, spinner previous/next buttons and window buttons now are non-focusable. This means, they will not be included in a FocusTraversalPolicy.
Changed The JFileChooser dialog is now opened at a larger size so you see more files at a time.
Changed File format changed. Pre-1.3-themes can still be loaded, but saved themes are not compatible with TinyLaF versions prior to 1.3.



V 1.3.1  (2004-12-13)      Top of page

Fixed Fixed a memory leak introduced in 1.3.0.



V 1.3.2  (2005-6-22)      Top of page

Fixed The fix for reloading themes as an applet is reloaded didn't work in 1.3.0 and 1.3.1.



V 1.3.3  (2006-2-6)      Top of page

Fixed Popup menu width was too wide when icons were displayed.



V 1.3.4  (2006-4-15)      Top of page

Fixed Code for calculating the clicked tab of JTabbedPane (SCROLL_TAB_LAYOUT mode only) didn't work with JRE 1.5. (The only way to make it work was to execute different code dependent on JRE version).
Fixed Internal frames used a special DesktopManager, now the default DesktopManager is used and DesktopManager methods will be called as expected.
Fixed JButton text is shifted one pixel right/down as the button is pressed. Now a test is performed if the button's text is null or of zero length and, if it is an icon-only button, no shifting occurs.
New The control panel has a new checkbox (Decoration | Button | Shift button text) allowing you to disable text shifting for JButton.
New Added an Ant buildfile to the source distribution (build.xml).



V 1.3.5  (2007-1-28)      Top of page

Fixed Bug introduced in 1.3.1 where JProgressBar was not set to opaque and therefore setting the track color had no effect.
Fixed The "armed" thing of JCheckBox and JRadioButton (click the component, then drag the mouse outside the component's bounds, then drag it back again...) - wonder why noone reported this as being a bug.
New JSlider now paints a focus indicator. Additionally the shape of the slider thumb now changes dependent on whether ticks are painted or not.
New JTabbedPane now paints a focus indicator.
New Added 'Help |Check for Updates...' menu.
Changed Improved antialiasing of JRadioButton symbol.
Changed JTabbedPane: The default tab font is now plain instead of bold.
Changed Font size selectors now display font sizes up to 24 pt.
Changed File format changed. Pre-1.3.5 themes can still be loaded, but saved themes are not compatible with TinyLaF versions prior to 1.3.5.



V 1.3.6  (2007-5-6)      Top of page

Fixed Problems with menu item mnemonics. If a menu contained at least on sub-menu, it could happen that mnemonics of menu items following the sub-menu were not recognized.
Fixed In TinyProgressBarUI.installDefaults() i did use a method new in Java 1.5, making TinyLaF non-Java-1.4-compliant. (Introduced in 1.3.5).
Fixed JSpinner now fires a ChangeEvent each time the user inputs a new value and presses Return.
New 'Alt' key closes opened menus and context menus (not only with Java 1.6 but also with Java 1.4 and 1.5).
New Implemented support for sortable table data. Three new properties control the appearance of sortable table headers: 'Header Rollover Background', 'Header Rollover Color' and 'Header Arrow Color' (see Decoration | Table).
Changed Border of table headers in YQ style now look more like those in WinXP.
Changed File format changed. Pre-1.3.6 themes can still be loaded, but saved themes are not compatible with TinyLaF versions prior to 1.3.6.



V 1.3.7  (2007-6-3)      Top of page

Fixed The "armed" thing of toolbar buttons (click the button, then drag the mouse outside the button's bounds, then drag it back again...) now works as expected.
Fixed JComboBox: Arrow buttons were included in focus traversal.
Fixed ControlPanel: Since v1.3.6 changing border colors of JCheckBox and JRadioButton seemed to have no effect.
Fixed ControlPanel: Tooltip texts of color fields ("Main Color", "Background Color", "Disabled Color" and "Frame Color") were not updated as themes were switched.
New On Linux OS, the "FileChooser.readOnly" UIManager property will now be set to true (this disables editing of file names).
New JFileChooser: The details table now is sortable. Removed the file attributes column.
Changed JFileChooser: The icon-only buttons now look and behave like toolbar buttons.
Changed Toolbar buttons: The default margin has changed from Insets(4, 4, 4, 4) to Insets(5, 5, 5, 5). Also border colors have changed.
Changed JProgressBar border (JProgressBar is non-opaque again).



V 1.3.8  (2007-6-17)      Top of page

Fixed Editable JComboBox: Due to a change in Java 1.5, editable combo box was too high (24 pixels instead of 20 pixels).



Known issues      
Top of page

A tabbed pane in SCROLL_TAB_LAYOUT mode doesn't respect client components' preferred sizes (4 pixels at the bottom of the client area are cut). This is a bug in BasicTabbedPaneUI.TabbedPaneScrollLayout (which is declared private) and fixing it would require too much effort on my side.


The future      
Top of page

Note: In the next major release the 99 style will have been disappeared.

My ideas for the future are:
Create a TinyLaF runtime version without the control panel.
Add undo/redo capabilities to the control panel.
Further optimize painting code (but don't expect too much).


Thanks ...      
Top of page

... to everybody who helped me improve TinyLaF by sending bug reports and feature requests.
Have fun creating your own themes.

17.6.2007 Hans Bickel


Contact the author      Top of page

To send bug reports, questions, suggestions, feedback please use the contact form at www.muntjak.de.