Window Decoration - Basics and Title Pane(21:58, 10. Mär. 2010)

Synthetica comes along with window decoration support which is enabled by default. This means that instead of the native window decoration the window decoration of the active theme/skin appears for your dialogs and frames.

In case that you prefer the native decoration you can simply disable Synthetica's window decoration by setting the UI-property "Synthetica.window.decoration" to false - see customization.

UIManager.put("Synthetica.window.decoration", false);
UIManager.setLookAndFeel(...);

" "


No Window Decoration

Sometimes you want to completely remove window decoration. In this case you should call JRootPane#setWindowDecorationStyle(JRootPane.NONE). In the example below a red rectangular border is set instead of the window decoration.

frame.getRootPane().setWindowDecorationStyle(JRootPane.NONE);
frame.getRootPane().setBorder(new LineBorder(new Color(0xEE0000), 3));


" " " "


Decoration Without Title Pane

Ever wondered how to remove the title pane from Synthetica's window decoration?

frame.getRootPane().putClientProperty("Synthetica.titlePane.enabled", false);

" "


Title Pane Without Buttons

You want to remove some buttons from the title pane? Each title pane control has a name which can be used to set the component invisible. For your convenience Synthetica provides a method which allows you to easily find a named component within a container - #findComponent(String componentName, Container container)

Note: Please be aware that even if you made the maximize button invisible, the frame can still be maximized by user interaction through a keybord shortcut or a double click.

JRootPane root = frame.getRootPane();
SyntheticaLookAndFeel.findComponent("RootPane.titlePane.closeButton", root).setVisible(false);
SyntheticaLookAndFeel.findComponent("RootPane.titlePane.toggleButton", root).setVisible(false);
SyntheticaLookAndFeel.findComponent("RootPane.titlePane.iconifyButton", root).setVisible(false);
SyntheticaLookAndFeel.findComponent("RootPane.titlePane.menuButton", root).setVisible(false);

" "


Palette Window

By combining the techniques above you can easily create a palette window with a small title pane.

JRootPane root = frame.getRootPane();          
SyntheticaLookAndFeel.findComponent("RootPane.titlePane", root).setPreferredSize(new Dimension(14,14));
SyntheticaLookAndFeel.findComponent("RootPane.titlePane.toggleButton", root).setVisible(false);
SyntheticaLookAndFeel.findComponent("RootPane.titlePane.iconifyButton", root).setVisible(false);
SyntheticaLookAndFeel.findComponent("RootPane.titlePane.menuButton", root).setVisible(false);
rootPane.setBorder(new LineBorder(Color.BLACK));

" "


In the upcoming article we will talk about window decoration and window shapes...CU JY