BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 06-19-2008, 02:47 AM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Jun 2008
Model: 8310
PIN: N/A
Carrier: Developper
Posts: 43
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Extends HorizontalFieldManager problems

Please Login to Remove!

Hi,

I want to create my own class which extends from in order to get a HorizontalFieldManager with a specific color.

I have this :
Code:
public class tabManager extends HorizontalFieldManager {

    public tabManager() {
    }

    protected void paint(Graphics graphics) {
        graphics.setColor(Color.LIGHTBLUE);
        super.paint(graphics); // ERROR
    }
            
}
i don't undersant the error.

Thanks for your help.
Offline  
Old 06-19-2008, 08:35 AM   #2 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Apr 2008
Location: Germany, BW
Model: -
PIN: N/A
Carrier: -
Posts: 310
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

no need to create own extended calss if you just want to change the color. Override paint() directly on object creation.

PHP Code:
HorizontalFieldManager hfmMyHManager = new HorizontalFieldManager()
{

   ...                       
   protected 
void paint(Graphics g)
   {
       
// Background color if necessary
       
g.setBackgroundColor(Color.LIGHTBLUE);
       
g.clear();

       ... 
here your own drawing ...

       
super.paint(g);
   }
   ...
}; 
P.S. which error do you get?

Last edited by Ivanov : 06-19-2008 at 08:38 AM.
Offline  
Old 06-19-2008, 09:42 AM   #3 (permalink)
Knows Where the Search Button Is
 
Join Date: Jun 2008
Model: 8310
PIN: N/A
Carrier: Developper
Posts: 43
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

in fact, i want to create an HorizontalMenu for all my App, so i want to create a Class.

I have solved the my problem (an import was missing) now, it works perfectly with this code :

Code:
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.Color;
import net.rim.device.api.ui.container.HorizontalFieldManager;

public class tabManager extends HorizontalFieldManager {

    public tabManager() {
        
    }
    
    public tabManager(long style){
       
    }

    public void paint(Graphics g) {
        g.setBackgroundColor(Color.VIOLET);
        g.clear();
        super.paint(g);
    }
}
But i don't know what i need to put in order to support the STYLE directive in the constructor. I don't see any method like setStyle().
Offline  
Old 06-19-2008, 10:40 AM   #4 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Apr 2008
Location: Germany, BW
Model: -
PIN: N/A
Carrier: -
Posts: 310
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Code:
    public tabManager(long style){
       super(style);

       // do other initializations
    }

Last edited by Ivanov : 06-19-2008 at 10:42 AM.
Offline  




Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.