Skip to main content

Problems creating Synth L&F

3 replies [Last post]
Anonymous

Hi all,

I've tried to make a new look and feel with the Synth l&f (the end result should look like this: http://www.emasty.de/izpack/IzPackGUI.gif )

Now, I have the following problems:

- How do I make a difference (in the Synth l&f xml configuration) between buttons on a normal panel and buttons on a ToolBar? Do I have to bind a new button definition to the ToolBar region? (But this is not working as you can see here: http://www.emasty.de/izpack/IzPackForum.gif)
What I want is that a button, placed on a JToolBar, does not look like a 'normal' button. Instead, the button should be opaque.

- How do I make a difference between an opaque element and a 'normal' element in the Synth configuration? As far as I know, there is no opaque state.
The problem is. When I set a button to opaque="false", the button background is painted even though.
My configuration is:

</p>
<p>

- How do I use the stretch="false" attribute with an image painter?
My current configuration for the arrow button:

is not working, as you can see at http://www.emasty.de/izpack/IzPackForum.gif

Thanks a lot!

Marcus

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Scott Violet

Hello,

I'm ecstatic to hear you're trying to create a look and feel based on
Synth!

On Mon, Oct 25, 2004 at 08:30:50AM -0400, swing-feedback@javadesktop.org wrote:
> Hi all,
>
> I've tried to make a new look and feel with the Synth l&f (the end result should look like this: http://www.emasty.de/izpack/IzPackGUI.gif )

Very cool!

> Now, I have the following problems:
>
> - How do I make a difference (in the Synth l&f xml configuration) between buttons on a normal panel and buttons on a ToolBar? Do I have to bind a new button definition to the ToolBar region? (But this is not working as you can see here: http://www.emasty.de/izpack/IzPackForum.gif)
> What I want is that a button, placed on a JToolBar, does not look like a 'normal' button. Instead, the button should be opaque.

Using the XML file the best way would be to name the buttons on the
toolbar and then apply a style based on name. Programatically you
could create a special SynthStyleFactory that looks at containment
hierarchy.

GTK offers a way to bind styles based on containment hierarchy, we
decided against offering that in Synth because of the added
complexity. If you feel strongly that Synth should offer this
functionality please file an RFE.

> - How do I make a difference between an opaque element and a 'normal' element in the Synth configuration? As far as I know, there is no opaque state.
> The problem is. When I set a button to opaque="false", the button background is painted even though.
> My configuration is:
> [code]

[/code]

An opaque element means that the backgrund is completely painted in
an opaque color and is applicable to the component as a whole, not
each state.

What effect are you trying to get?

> - How do I use the stretch="false" attribute with an image painter?

It's an attribute on the imagePainter element, eg:

If true, it means the top, left, bottom and right edges will be
stretched, otherwise tiled.

> My current configuration for the arrow button:
> [code][/code]
> is not working, as you can see at http://www.emasty.de/izpack/IzPackForum.gif

I see what you're after. stretch only applies to the edges, not the
center. What you really want to say is center this image and don't
scale it. Unfortunately there isn't a way to do this in the xml
file. Thankfully though it's pretty eash to create a custom painter
that does this. It would be something like:

This would create an instance of CenteredImagePainter (extends SynthPainter) and invoke it to draw the appropriate painting methods. Look at the section 'Embedding Objects' at http://www.javadesktop.org/articles/synth/index.html for a real example of this. As centering images is an obvious feature that is lacking it should be in Synth. Please file an RFE for this. Thanks, -Scott
scott.violet
Offline
Joined: 2006-02-17

I ended up filing bug 6184909 for this. It should show up on the JDC in a couple of days.
If all goes well you'll be able to do something like:

And that'll give you the behavior you're after.

-Scott

Anonymous

Hi Scott,

thank's a lot for your help!
I'll try to implement your suggestions as soon as possible.

Regards

Marcus