Company News

<< Previous PageNext Page >>

Window Decoration, Part 6 - TitlePane Layout(10:29, 02. May. 2012)

Everybody knows the commonly used title panel layout for frames which is used by most desktop applications - see sketch below.

regular title pane

The screenshot below demonstrates how it can look in a real application with the SyntheticaAluOxide theme.
Note: In the screenshot the title panel background is not distinguishable from the toolBar even if the toolBar isn't part of the title panel. The visual behavior depends on the active theme.

SyntheticaTunes screenshot

In Synthetica V2.15 we support an additional layout called SECONDARYMENU which is useful to make an application more unique. The sketch below outlines the title panel elements. As you can see the menu button is spanned across two rows and a user component can be directly set for the second row.

Lets take a closer look at each step to enable this layout/style for the SyntheticaTunes application. The first step is to create a custom XML-file which holds the new window style. Because in most cases you want to change the appearance for the main frame only, Synthetica supports specifying a separate style for a named window.

<!--
*******************************************************************************
MainFrame style
*******************************************************************************
-->
  <style id="MainFrame">
    <defaultsProperty key="Synthetica.rootPane.titlePane.title.visible.MainFrame" type="boolean" value="false" />
    <defaultsProperty key="Synthetica.rootPane.titlePane.layoutStyle.MainFrame" type="string" value="SECONDARYMENU" />
    <defaultsProperty key="Synthetica.rootPane.titlePane.showMenuBarInTitlePane.MainFrame" type="boolean" value="true" />
    <defaultsProperty key="Synthetica.rootPane.titlePane.clipMenuBarWidth.MainFrame" type="boolean" value="true" />
    
    <defaultsProperty key="Synthetica.rootPane.titlePane.title.alignment.MainFrame" type="integer" value="11" />
    <defaultsProperty key="Synthetica.rootPane.titlePane.menuButton.alignment.MainFrame" type="integer" value="11" />
    <defaultsProperty key="Synthetica.rootPane.titlePane.iconifyButton.alignment.MainFrame" type="integer" value="11" />
    <defaultsProperty key="Synthetica.rootPane.titlePane.toggleButton.alignment.MainFrame" type="integer" value="11" />
    <defaultsProperty key="Synthetica.rootPane.titlePane.closeButton.alignment.MainFrame" type="integer" value="11" />
    
    <defaultsProperty key="Synthetica.rootPane.titlePane.menuBar.insets.MainFrame" type="insets" value="4 8 0 0"/>
    <defaultsProperty key="Synthetica.rootPane.titlePane.menuButton.insets.MainFrame" type="insets" value="0 0 0 0"/>
    <defaultsProperty key="Synthetica.rootPane.titlePane.iconifyButton.insets.MainFrame" type="insets" value="2 0 0 0"/>
    <defaultsProperty key="Synthetica.rootPane.titlePane.toggleButton.insets.MainFrame" type="insets" value="2 0 0 0"/>
    <defaultsProperty key="Synthetica.rootPane.titlePane.closeButton.insets.MainFrame" type="insets" value="2 0 0 2"/>
  </style>

The most important settings are in the first four entries - the rest covers alignment (set to top - GridBagConstraints.NORTH) and insets. In the next step we have to load the XML-file when the look and feel is set.

UIManager.setLookAndFeel(new SyntheticaAluOxideLookAndFeel(){
      @Override
      protected void loadCustomXML() throws ParseException
      {
        loadXMLConfig("/resources/custom.xml");
      }
    });

To apply the style to the window set the window name and update the rootPaneUI.

setName("MainFrame");
getRootPane().updateUI();

The menu button is ued for the application logo - for this take a lookup for the button and set the logo as icon.

JButton b = (JButton)SyntheticaLookAndFeel.findComponent("RootPane.titlePane.menuButton", this);
b.setIcon(new ImageIcon(this.getClass().getResource("/resources/icons/menuButton.png")));

The menu bar is set a usual - only the tool bar has to be set in a specific way.   

setJMenuBar(new AppMenuBar());    
toolBar = new TunesToolBar();
toolBar.setFloatable(false);
((SyntheticaTitlePane)((SyntheticaRootPaneUI)getRootPane().getUI()).getTitlePane()).setUserComponent(toolBar);

That's all, the new appearance is more unique and gives your app a cool, modern look. Note: With the new style the application header needs a bit more horizontal space but less vertical space - this fits pretty well with current display ratios (16:9, 16:10).

SyntheticaTunes screenshot tweaked

WebStart Demo

The complete application source code is available for SyntheticaAddons customers only and can be downloaded from the SyntheticaAddons download page.

Sometimes you have to keep the menu bar at it's regular position i.e. to use the whole herizontal space. This can be simply achieved by setting the UI-property "Synthetica.rootPane.titlePane.showMenuBarInTitlePane" to false - see custom XML. The result is also appealing but of course needs some extra vertical space.

SyntheticaTunes Screenshot regular menubar

Related Posts

Synthetica V2.15 and SyntheticaAddons V1.7 is released!(12:42, 30. Apr. 2012)

We are pleased to announce the release of Synthetica V2.15.0 and SyntheticaAddons V1.7.0. Please find all major improvements below - a complete list of changes can be found at Synthetica changelog and SyntheticaAddons changelog.

New Synthetica Features

Synthetica AluOxide Theme Screenshot

  • New frame header layout to support a user component within the title panel
  • Java 7 support for Mac OSX
  • Corner painter support for ScrollPanes
  • Opened-state support for ComboBoxes
  • Hover style support for top level menus
  • New UI-property to horizontally flip JTabbedPane appearance in RTL mode
  • JButton, JToggleButton, JCheckBox, JRadioButton - new UI-properties to specify default icon text gap
  • JList, JTable - hover style support for rows
  • JPopupMenu - new UI-property to preserve icon space for icons
  • Improved default scrollPane border setting for JTable
  • Improved list cell renderer for JFileChooser to respect default renderer and F2 key binding to rename files
  • Improved focus state support
  • Improved opacity setting for components
  • Improved control to handle custom colored text components
  • Improved insets handling for TitledBorderPainter
  • Updated SyntheticaClassy theme (fine tuning)

New SyntheticaAddons Features

  • SyntheticaAluOxide theme support
  • JYTabbedPane - new UI-property to modify close button placement within a tab
  • New JYDocking features
    • support to specify a custom docking strategy for floating windows
    • new UI-property to define the default splitpane divider size
  • New JYSwitchButton features
    • modified foreground color for disabled state (switch lables)
    • new UI-property to support dynamic switch between ON/OFF foreground color
  • StatusBar - new UI-property to disable visibility of the resize handle
  • DateComboBox - new UI-properties to specify X/Y-offset for the date popup
  • Improved customizability of JYTaskPane and TitledPane
  • DropDownButton
    • new UI-properties to specify custom arrow icon and arrow icon gap
    • improved RTL support
  • Updated SwingX library to V1.6.3
Product Links

Synthetica + NetBeans 7.1(10:29, 19. Jan. 2012)

As of NetBeans 7.1 non-document windows in the same docking spot are organized into a tab group and are no longer stretched by default. To support this new feature SyntheticaAddons V1.6.2 provides an updated NetBeans plugin. The new plugin is backwards compatible and works fine with NetBeans 6.9/7.0.

non-stretching view tabs

To enable the old appearance/behavior NetBeans supports the system property winsys.stretching_view_tabs. By setting the system property to true you can force NetBeans using the old streched tabs appearance.

stretching view tabs

Related Links

Synthetica V2.14.2 and SyntheticaAddons V1.6.2 have been released!(21:36, 17. Jan. 2012)

The maintenance releases Synthetica V2.14.2 and SyntheticaAddons V1.6.2 are available. The updates provide support for NetBeans 7.1 and some minor bug fixes. See also Synthetica changelog and SyntheticaAddons changelog.

Synthetica + NetBeans RCP, Part II(19:08, 25. Nov. 2011)

This Article describes how to integrate Synthetica, Themes and SyntheticaAddons in your Netbeans Platform application (RCP). Instead of extending the classpath as described here, let's create two additional modules and add these modules to our NetBeans RCP application.

The first module covers Swing core components only. For this we create a module called Synthetica which provides Synthetica's core library and all needed theme libraries. We additionally create a LAFInstall class to install the look and feel on application startup. The "--laf" parameter, mentioned in the first article, is therefore no longer needed.

Create Module Synthetica

  • Create a new module
    • Name: Synthetica
    • Code Name Base: myrcp.synthetica
    • Finish
  • Select Module Synthetica / Properties
    • Select Libraries / Module Dependencies
    • Add Dependency: Module System API, Utilities API
    • Select 'Wrapped JARs'
    • Add JAR: core library synthetica.jar and your preferred theme e.g syntheticaSimple2D.jar, Note: the Standard theme is already part of synthetica.jar
    • Select API Versioning, select modul type eager and make myrcp.synthetica and all listed packages public
  • Create class myrcp.synthetica.LAFInstall and override the method #restored()
    public class LAFInstall extends ModuleInstall 
    {
      @Override
      public void restored() 
      {
        try 
        {
          UIManager.setLookAndFeel(
            "de.javasoft.plaf.synthetica.SyntheticaSimple2DLookAndFeel");
        } 
        catch (Exception e) 
        {
          Exceptions.printStackTrace(e);
        }    
      }  
    }
    
  • Edit Important files / Module Manifest
    • add the line below to the manifest file
      				OpenIDE-Module-Install: myrcp/synthetica/LAFInstall.class
      

The second module is used to provide all SynteticaAddons libraries and covers UI-support for Netbeans components. In this example configuration we assume that SyntheticaSimple2D is used as preferred theme, which also means that the theme extension syntheticaSimple2DAddon.jar has to be added to your module.

Create Module SyntheticaAddons

  • Create a new Module
    • Name: SyntheticaAddons
    • Code Name Base: myrcp.syntheticaaddons
    • Finish
  • Select Module SyntheticaAddons / Properties
    • Select Libraries / Module Dependencies
    • Add Dependency: Look & Feel Customization LibraryNodes API, Synthetica, Tab Control, UI Utilities API, Window System API
    • Select 'Wrapped JARs'
    • Add JAR: de-javasoft-synthetica-netbeans.jar, syntheticaAddons.jar, syntheticaSimple2DAddon.jar, jywidgets.jar, swingx-1.6.2.jar
    • Selet API Versioning, select modul type eager and make all packages public

Modify your Main/Core Module

  • Select your Main/Core Module / Properties
    • Select Libraries / Module Dependencies
    • Add Dependency: Synthetica, SyntheticaNetbeans

Modify your Netbeans Platform Application

  • Select Important Files / Project Properties
    • add app.conf=myrcp.conf
  • create new file myrcp.conf to provide basic configuration
    # ${HOME} will be replaced by user home directory according to platform
    default_userdir="${HOME}/.${APPNAME}/dev"
    default_mac_userdir="${HOME}/Library/Application Support/${APPNAME}/dev"
    
    # options used by the launcher by default, can be overridden by explicit
    # command line switches
    default_options="--branding testrcp -J-Dnb.forceui=de.javasoft.synthetica.netbeans.SyntheticaLFCustoms -J-Xms24m -J-Xmx64m"
    # for development purposes you may wish to append: -J-Dnetbeans.logger.console=true -J-ea
    
  • make sure that -J-Dnb.forceui=de.javasoft.synthetica.netbeans.SyntheticaLFCustoms has been added to the default options of the config file

Related Links

Synthetica maintenance release V2.14.1 is available(12:51, 25. Nov. 2011)

Synthetica V2.14.1 is available - see changelog for more details.

SyntheticaAddons maintenance release V1.6.1 is available(12:27, 17. Nov. 2011)

SyntheticaAddons V1.6.1 is available - see changelog for more details.

<< Previous PageNext Page >>