javaxmlsynth

Customizing components using Java Synth xml file?


I'm developing a Java application with a custom UI and I'm using Java Synth to achieve that. Currently I'm developing the xml file manually. Do you think this is a good way to do it, or should I use specific software for that?

Anyway, I've configured some components successfully, like lists. I have this piece of code in my xml regarding lists:

<style id="listStyle">
    <insets top="1" left="1" right="1" bottom="1"/>
    <state>
        <color value="#323232" type="BACKGROUND"/>
        <color value="WHITE" type="FOREGROUND"/>
        <color value="#00BAFF" type="TEXT_BACKGROUND"/>
        <color value="BLACK" type="TEXT_FOREGROUND"/>
    </state>
</style>    
<bind style="listStyle" type="region" key="LIST"/>

This is working just fine. Next, I tried to configure my scroll bars:

<style id="scrollBarStyle">
    <insets top="2" left="2" right="2" bottom="2"/>
    <state>
      <color value="BLACK" type="BACKGROUND"/>
    </state>
    <state value="MOUSE_OVER">
      <color value="BLUE" type="BACKGROUND"/>
    </state>
</style>
<bind style="scrollBarStyle" type="region" key="SCROLLBARTHUMB"/>

I think the insets are working, but when my mouse is over the scroll bar, it just stays black.

There's also another strange thing. I have this "default style" that I apply to all regions in the first place. And the scroll bar behaves the way it is expected with the default style (mouse over included). But when I apply this particular style to the scroll bar, it stops working. And after applying this specific style, the the default region style also stops working. So the scroll bar just stays black...

Do you have any ideas why?

Any help will be greatly appreciated :)


Solution

  • I'm kind of a newb to this too, but my guess would be something related to the state value. If you do not specify a state value (ie. MOUSE_OVER), then it becomes the default. Other values will only be used if they are activated with none of the other state values. For instance if you specified the value for a button being moused over and then the value for the button being pressed, the value for the button being pressed would never be used because whenever it's being pressed, obviously it's also being moused over. I'd check to see whether or not something like this is causing the problem. I also found a thread where someone had a similar problem, but it was caused in the actual java code, not the xml. http://forums.oracle.com/forums/thread.jspa?threadID=2225033&tstart=75

    Good luck :D sorry I couldn't be more help