10-28-2008 09:54 AM
Hi,
I've got a problem with the new decor features of OS 4.6 What I try is to get the "bubble look" for TextFields, just like RIM introduced with OS 4.5 in e.g. the mail application. Headers are in one bubble, the body has its own, etc... The iPhone look & feel... ;-)
Now, from reading the examples, it should go like this (starting inside a MainScreen):
Background backBackground = BackgroundFactory.createSolidBackground(Color.STEE
getMainManager().setBackground(backBackground);
XYEdges padding = new XYEdges(5, 5, 5, 5);
Border roundedBorder = BorderFactory.createRoundedBorder(padding, Color.GRAY, Border.STYLE_SOLID);
Background solidBackground = BackgroundFactory.createSolidBackground(Color.WHIT
RichTextField articleField = new RichTextField(article, RichTextField.USE_ALL_WIDTH);
articleField.setBorder(roundedBorder);
articleField.setBackground(solidBackground);
add(articleField);
Looks kind of ok, BUT: the white background in the TextField DOES NOT have rounded edges, rather, it is a plain rectangle.
What I need is a text box with rounded borders, where inside the border all is white, and outside the border all is steelblue.
Must be easy?!
Thanks for help,
Benjamin
10-29-2008 07:33 AM
Anyone? --If this is a private, hidden API (like with configuring the BIS gateway), to get a rounded white background inside a rounded border, I will also be happy to learn that. I just don't want to waste time searching for a solution. --Thanks much!
10-29-2008 08:21 AM
10-29-2008 04:53 PM
I am also in the same position. I have been using the BorderFactory in 4.7.0 to try and create a border and set this on a VerticalFieldManager. Please tell me that I don't have to start messing around with graphics.fillRoundRect just to get a white rounded rectange inside a gray box (like the tasks app - screenshot below)?! ![]()

There seems to be very little point to the BorderFactory if this is case...?
10-29-2008 05:41 PM
Thank you. Same thoughts on my side. This must (should) just be one dedicated Java object to instantiate... Why to hack around with low level stuff for such a basic functionality.
I just cannot believe that RIM was doing it the low level way for all the rebrushed core applications in OS >= 4.5. So, what's the secret here?
10-30-2008 04:43 AM
10-31-2008 02:27 PM
11-03-2008 04:40 AM
MSohm wrote:
You can set the background colour of the manager holding the RichTextField. This can give a rounded look to the field and allow a different background colour.
Unfortunately, when I set the background colour (via setBackground) of either the MainScreen subclass I am using or the VerticalFieldManager I am adding my fields to, the background colour stops at the end of the fields (i.e. when I set a grey background, there is a white area shown below my fields).
The problem is as described here: http://www.jonathanhfisher.co.uk/b2/?p=96
Managed to get rounded boxes by making my own FieldManager subclass and directly painting it.
I knew there was a reason for the lack of UI-consistency on BlackBerry devices, and these kind of problems appear to be it!
01-02-2009 12:16 AM
I am not sure about anything < 4.6, I have not checked, but there is a method in BorderFactory called createBitmapBorder which takes two parameters. The first is an XYEdges object which defines the padding for the border. Basically anything that is outside of the padding and not in the corners will be repeated as the border expands, and the corners will remain the same. The second parameter is the bitmap which will be used for the border, make sure you use a try-catch block when you load the bitmap in order handle the exception that it could possibly throw.
Here is some (albeit sloppy) code that wrote while I was playing around with it...
try {
container.setBorder(BorderFactory.createBitmapBorder(new XYEdges(14,14,14,14),
Bitmap.getBitmapResource("box.png")));
}
catch (IllegalArgumentException e) {
System.out.println(e.getMessage());
}
...where container is a VerticalFieldManager.
Here is what the border looks like...

And here is the image for the border (*note: tinypic changed the file name)

What is neat about this, is that you can "skin" your application to make it look any way you want. I think this is the way they make the newer applications look the way they do.
Let me know if this helps, and feel free to use the image for your borders. (Though it would be nice if you would let me know)
12-04-2009 02:07 PM
Very nice! After all the complaining in this thread I thought it wasn't possible with the new Border class. Works wonderfully.