tags:

views:

79

answers:

1

LWUIT ships with great Resource Editor but this doesn't allow your resources definitions to be versioned or edited easily.

So I'm using the ANT task and editor.jar to build my resource bundles from my IDE (Netbeans).

This works great for simple declarations as found in the docs and the demo application.

Example from LWUIT demo:

bgColor= 313131
fgColor= ffffff
sel#bgColor= 555555
sel#fgColor= 99cc00
font= proportionalSmall
sel#font= boldMonospace
ComboBox.bgColor= 555555
ComboBox.fgColor= ffffff
ComboBox.sel#fgColor= 99cc00
ComboBox.font= proportionalSmall
Form.bgImage=business_bg.jpg
Menu.bgColor= 555555
Menu.sel#bgColor= 555555
Menu.fgColor= ffffff
Menu.sel#fgColor= 99cc00
Scroll.bgColor= 111111
Scroll.sel#bgColor= 242627
Scroll.fgColor= AAAA00

But how do I define complex gradients and borders with images as in the Resource Editor?

Thanks! ;-)

A: 

I do not have a complete anwser to my own question yet but i've found some tips on the java.net LWUIT forums and came up with the following with lots of trial and error:

Border

Element.border= (ROUNDED,3,3,65000)

Order of parameters are: ROUNDED, Arc Width, Arc Height, Integer Color (no hex!)

Element.border= (LINE,3,ffffff)

Order of parameters are: LINE, Line Thickness, Integer Color (no hex!)

Gradient

First define background type for gradient like following:

Element.bgType= GRADIENT_LINEAR_VERTICAL

The Possible values are BACKGROUND_IMAGE_SCALED, BACKGROUND_IMAGE_TILE_BOTH, BACKGROUND_IMAGE_TILE_VERTICAL, BACKGROUND_IMAGE_TILE_HORIZONTAL, BACKGROUND_IMAGE_ALIGNED, BACKGROUND_GRADIENT_LINEAR_HORIZONTAL, BACKGROUND_GRADIENT_LINEAR_VERTICAL, BACKGROUUND_GRADIENT_RADIAL.

I've only found out howto use linear color gradients like following:

Element.bgGradient= 03a6bc,333333,0.5,0.5,0.5

Order of parameters are: start color, end color, x shift, y shift, xy ratio. To me it seems the last x, y and ratio values do not have any affect at all.

Sander Versluys