Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
hhessel
Posts: 33
Registered: ‎04-25-2009

Removing White Noise Pixel around Rounded Shape

As you can see, I'm using a ToolTip with my Custom Buttons.

And I'm trying and trying to remove these white pixels around my "Favoriten" tooltip?

 

 

The Code to generate the tooltip is:

 

 

VerticalFieldManager manager = new VerticalFieldManager(Manager.FIELD_VCENTER |Manager.NON_FOCUSABLE) { protected void paint(Graphics graphics) { graphics.setBackgroundColor(16777215); graphics.clear(); graphics.setGlobalAlpha(200); graphics.setColor(Color.BLACK); graphics.drawRoundRect(0,0,getWidth(),getHeight(), 4, 4); graphics.fillRoundRect(0,0,getWidth(),getHeight(), 4, 4); graphics.setGlobalAlpha(255); super.paint(graphics); } };

 

 Any ideas, how to fix this? thanks!

 

 

 

Please use plain text.
Developer
haagmm
Posts: 178
Registered: ‎07-29-2008

Re: Removing White Noise Pixel around Rounded Shape

you set the background to be white and then clear.  thats why you can see the white pixels.

 

if you just draw over it it will show what ever is underneath, rather than the white you put there. 

 

 

Please use plain text.
Developer
hhessel
Posts: 33
Registered: ‎04-25-2009

Re: Removing White Noise Pixel around Rounded Shape

Nope, that's not the solution.

 

I added this snippet later, because I read here that 16777215 is the value for a transparent background.

graphics.setBackgroundColor(16777215); graphics.clear();

 


 

Please use plain text.
Developer
haagmm
Posts: 178
Registered: ‎07-29-2008

Re: Removing White Noise Pixel around Rounded Shape

No, Color.WHITE = 16777215;

 

if you remove both lines it doesn't help?  Graphics.clear() deletes everything underneath the clipping rect of the graphics object and paints it the background color, its doing the oposite of what you want.

 

Do you call the clear() method further up the paint stack? 

Please use plain text.
Developer
hhessel
Posts: 33
Registered: ‎04-25-2009

Re: Removing White Noise Pixel around Rounded Shape

Hello haagmm, thanks for your input. Removing the two line doesn't help though :/

 

 

public static ToolTip addToolTip(UiApplication uiApp, String toolTipString, int x, int y, int displayTime) { VerticalFieldManager manager = new VerticalFieldManager(Manager.FIELD_VCENTER |Manager.NON_FOCUSABLE) { protected void paint(Graphics graphics) { // graphics.setBackgroundColor(16777215); // graphics.clear(); graphics.setGlobalAlpha(200); graphics.setColor(Color.BLACK); graphics.drawRoundRect(0,0,getWidth(),getHeight(), 4, 4); graphics.fillRoundRect(0,0,getWidth(),getHeight(), 4, 4); graphics.setGlobalAlpha(255); super.paint(graphics); } }; ToolTip toolTip = new ToolTip(manager); LabelField label = new LabelField(' ' + toolTipString + ' ', LabelField.NON_FOCUSABLE) { public void paint(Graphics _g) { _g.setColor(Color.WHITE); super.paint(_g); }; }; label.setFont(Font.getDefault().derive(Font.ANTIALIAS_NONE, 14)); toolTip.add(label); toolTip.display(uiApp, x, y, displayTime); return toolTip; }

 

 

 

Please use plain text.
Developer
haagmm
Posts: 178
Registered: ‎07-29-2008

Re: Removing White Noise Pixel around Rounded Shape

I'm somewhat confused by what ToolTip subclasses, I'm going to guess PopupScreen and that you put the manager into it as the deligate and then the display method calls pushScreen() and sets its location?

 

 The ToolTip class doesn't override paint or subpaint does it?  If your making any calls to ToolTip.setBackground() or ToolTop.setBoarder() are you?

 

Please use plain text.
Developer
hhessel
Posts: 33
Registered: ‎04-25-2009

Re: Removing White Noise Pixel around Rounded Shape

Hi haagm, I found the tooltip class here in the forum.

 

Full Source http://paste-it.net/public/l77ab78/

Please use plain text.
Developer
haagmm
Posts: 178
Registered: ‎07-29-2008

Re: Removing White Noise Pixel around Rounded Shape

hmm interesting, have not seen that.

 

If your interested in targeting 4.6 and higher i would recomend removing the apply theme overload and removing the paint overload and adding

 

toolTip.setBorder(BorderFactory.createRoundedBorder(new XYEdges(1,1,1,1),Border.STYLE_TRANSPARENT));

that should result in something very similar to what your looking for on 4.6 and higher.  in 4.5 and < devices your kinda stuck with either a theme border or those white dots.

 

 

Please use plain text.
Developer
hhessel
Posts: 33
Registered: ‎04-25-2009

Re: Removing White Noise Pixel around Rounded Shape

Unfortuanly I targeting the 4.5 Platform in my Company. Only about 1 Percent of all Blackberry phones are 4.6+ now :/ Thanks!
Please use plain text.
Developer
haagmm
Posts: 178
Registered: ‎07-29-2008

Re: Removing White Noise Pixel around Rounded Shape

It's not that bad, but I understand.  If it helps, That number is old, I believe from last fall, before the Bold was released in the US. 

 

 If you look at the data of PodTrapper's users it shows about 60% or higher in 4.6 or higher : http://www.versatilemonkey.com/story.html though that may not match your business targets.

Please use plain text.