Blackberry (Java) - Drawing graphics on top of rendered text/buttons etc
Posted
by paullb
on Stack Overflow
See other posts from Stack Overflow
or by paullb
Published on 2010-06-15T05:37:49Z
Indexed on
2010/06/15
6:32 UTC
Read the original article
Hit count: 259
Based off the one of the demos I have the following code.
Currently what displays in the simulator is just hte contents of the paint function, however the ObjectChoiceField is still selectable if one happens to click in the right location. I would like both the text contents and the paint function contents to appear. Is this possible?
public CityInfoScreen()
{
//invoke the MainScreen constructor
super();
//add a screen title
LabelField title = new LabelField("City Information Kiosk",
LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);
setTitle(title);
//add a text label
add(new RichTextField("Major U.S. Cities"));
//add a drop-down list with three choices:
//Los Angeles, Chicago, or New York
//...
String choices[] = {"Los Angeles","Chicago","New York"};
choiceField = new ObjectChoiceField("select a city", choices);
add(choiceField);
Manager man = this.getMainManager();
}
...
public void paint(Graphics g){
super.paint(g);
// g.drawRect(0,left,500,500+left);
g.setGlobalAlpha(0);
g.drawRect(100-left,100-top,200,200);
String text = new Integer(left).toString();
String text2 = new Integer(top).toString();
g.drawText(text + " " + text2,120-left,120-top);
}
© Stack Overflow or respective owner