PDA

View Full Version : Changing background color


balaji6969
03-14-2007, 01:27 AM
hi
I am using mainscreen, and in the header part only i want to paint.I want to use gradient.But i dont know whether it is posiible or not.
So,i want to paint half of it with green and rest with red.Then i added button.
When i run it i am not able to see the color at header part.
Can any say how to solve this problem.
the bellow is code.

ms=new MainScreen(){
public void paint(Graphics g)
{
g.setColor(0x0000ff00);
g.fillRect(0,0,super.getWidth()/2,10);
g.setColor(0x00ff0000);
g.fillRect(super.getWidth()/2,0,super.getWidth()/2,10);
g.clear();

super.paint(g);
}
};

b=new ButtonField("enter"){
public void paint(Graphics g)
{

g.clear();
super.paint(g);

}
};
b.setChangeListener(this);
ms.add(b);
pushScreen(ms);


Regards,
Balaji.K

bdowling
03-14-2007, 04:10 AM
It looks to me like you're painting the header, then clearning it, then getting the superclass to paint over it. You want to make your changes after the super class paints, and don't clear.