Java-LAF: How to create Decoration using Synth-XML?

I'm trying to create a custom Look-And-Feel using the Synth-Framework.

I successfully used a tutorial ( Look-And-Feel Tutorial by Oracle/Sun ) to experiment,and managed to skin Buttons, Panels etc.

The problem i have now is,that i want to decorate the Window/JFrame.

I read some things about it and tried it out with the MetalLookAndFeel and this Code,that works:

        UIManager.setLookAndFeel(new MetalLookAndFeel());
    }catch(UnsupportedLookAndFeelException e){

    new SFframe().setVisible(true);

Now i try to use my own LAF:

<?xml version="1.0" encoding="UTF-8"?>
    <!-- Style that all regions will use -->
    <style id="backingStyle">
        <opaque value="TRUE"/>
        <font name="Dialog" size="14"/>
            <color value="#04688D" type="BACKGROUND"/>
            <color value="#FFFFFF" type="FOREGROUND"/> 
        <defaultsProperty key="Synthetica.window.decoration" type="boolean" value="true"/>
    <bind style="backingStyle" type="region" key=".*"/>
    <style id="button">
        <!-- Shift the text one pixel when pressed -->
        <property key="Button.textShiftOffset" type="integer" value="1"/>
        <!-- set size of buttons -->
        <insets top="4" left="4" bottom="4" right="4"/>
            <imagePainter method="buttonBackground" path="/synth/images/Button.png" sourceInsets="4 4 4 4"/>
            <font name="Dialog" size="16"/>
            <color type="TEXT_FOREGROUND" value="#FFFFFF"/>
        <state value="PRESSED"> 
            <imagePainter method="buttonBackground" path="/synth/images/Button_pressed.png" sourceInsets="4 4 4 4"/>
        <state value="MOUSE_OVER">    
            <imagePainter method="buttonBackground" path="/synth/images/Button_over.png" sourceInsets="4 4 4 4"/>
    <bind style="button" type="region" key="Button"/>

The code i use to load the LAF looks like this:

    SynthLookAndFeel laf = new SynthLookAndFeel();
        InputStream in = SFframe.class.getResourceAsStream("/synth/synth.xml");
        laf.load(in, SFframe.class);
    }catch(ParseException | UnsupportedLookAndFeelException e){
    new SFframe().setVisible(true);

The Buttons and Panels get skinned, but of course, the Window/JFrame doesn't.

I just can't find a source on how to skin/decorate a Window/JFrame with Synth-XML. Can someone help me there?


  • AFAIK isn't possible to decorating JFrame/JDialog/JWindow with own L&F

  • JFrame/JDialog/JWindow is based on peers came from native OS, by default has the same decorations type color, font, font size as rest of windows invoked from Native OS

  • AFAIK Substance can do that, have look at its code source, ref. post by (-:forked new Owner:-)

Well, it is possible to decorate JFrame, JDialog and even JWindow with your own L&F, but i am not sure that Synth can do that. Atleast i didn't find any information about that.

L&F like Substance, Synthetica and others use a small cheat to decorate JFrame and JDialog - when setDefaultLookAndFeelDecorated is set to true JRootPane UI disables native frame/dialog decoration and simply displays its own styling. Also some native features like non-opaque frames/dialogs are very handy in that case and makes you feel that window is actually decorated with a different style (you cannot create a good window shade effect without those features).

Need Your Help

Extracting multiple colors from a TextView Android

java android robotium

So I know that to extract a color from the TextView you would use getCurrentTextColor() but my textView contains multiple colors in it. How can I preserve and extract this data? I need the color to...

How to get cursor position or location from RichTextArea in GWT?

java gwt cursor textarea richtextbox

I want to get cursor position or the location from RichTextArea.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.