Substance look and feel JavaOne 2007 Community Corner
An application before Substance
Same application with Substance
Using Substance in you app Go to Download the latest substance.jar Use one of the three options: ◦UIManager.setLookAndFeel( new SubstanceLookAndFeel()) ◦UIManager.setLookAndFeel( “org.jvnet.substance.SubstanceLookAndFeel”) ◦-Dswing.defaultlaf= org.jvnet.substance.SubstanceLookAndFeel
Substance themes Contains information on control colors for different visual states (disabled, default, active) Base class – SubstanceTheme Use bundled core themes Use APIs to create derived themes Extend and create a custom theme
Substance simple themes SubstanceAquaThemeSubstanceBottleGreenTheme SubstancePurpleThemeSubstanceOliveTheme
Substance derived themes Invert, negate, saturate, hue-shift and color-blind Example of hue-shift: SubstanceTheme theme = SubstanceLookAndFeel.getTheme(); SubstanceTheme shifted = theme.hueShift(-0.5); SubstanceLookAndFeel.setCurrentTheme(shifted);
Substance watermarks Simple watermarks Image-based watermarks SubstanceBinaryWatermarkSubstanceWoodWatermark SubstanceImageWatermark + APP_TILE
Substance skins A collection of various settings (theme, watermark, painters, shapers etc). In org.jvnet.substance.skin package Can set as ◦SubstanceLookAndFeel.setSkin(…) ◦ Derived look and feel classes based on a specific skin (set with UIManager or VM flag)
Substance toned-down skins SubstanceBusinessLookAndFeel SubstanceCremeLookAndFeel SubstanceBusinessBlackSteelLookAndFeel SubstanceSaharaLookAndFeel
Substance dark skins SubstanceRavenGraphiteLookAndFeel SubstanceEmeraldDuskLookAndFeel SubstanceRavenLookAndFeel SubstanceChallengerDeepLookAndFeel
Substance saturated skins SubstanceOfficeBlue2007LookAndFeel SubstanceGreenMagicLookAndFeel SubstanceFieldOfWheatLookAndFeel SubstanceFindingNemoLookAndFeel
Configuring animations LafWidget.ANIMATION_KIND – controls animation speed (0.5 sec for a transition by default) FadeConfigurationManager APIs – to enable / disable animations ◦ On a specific control ◦ On control class ( JTree, for example) ◦ Globally
Custom appearance Theme – extend SubstanceTheme or use derivation APIs Watermark – implement SubstanceWatermark Skin – implement SubstanceSkin or extend SubstanceAbstractSkin (provides basic functionality) See existing core implementation and test app for examples
Additional UI elements Substance provides additional “feel” part for some Swing components These are called widgets Some widgets are turned on by default Most widgets are configurable Some widgets are not visible – behavior only
Widget examples Menu search panel on big menus Lock icon on non-editable text components Auto-completion on editable comboboxes Password strength checker Tab overview panel Tree smart scroll
Substance plugins Substance provides a plugin mechanism for third-party components No need to change the code – just drop the plugin jar in the classpath Available plugins for: ◦ NetBeans – module supports 5.0 and 5.5 ◦ SwingX at ◦ Flamingo at
SwingX plugin Provides consistent appearance (colors, fonts, animation) for ◦ Task pane container and task panes ◦ Status bar ◦ Month view ◦ Date picker ◦ Translucency on JXPanel More to come as SwingX matures and reaches the first release
Q&A Visit Mail See for a list of other third-party look and feelshttp://javootoo.com