我正在拟订以下法典,该法典有6个州的欢迎形式。
在点击其中每一个县时,它打开了新的表格。
class MyAPP extends UiApplication {
public static void main(String[] args) {
UiApplication instance = new MyAPP();
instance.enterEventDispatcher();
}
private ButtonField btntest,btntest1,btntest2,btntest3,btntest4,btntest5;
public MyAPP() {
MainScreen testScreen = new MainScreen();
final LabelField field = new LabelField("Company",LabelField.FIELD_HCENTER | LabelField.NON_FOCUSABLE)
{
protected void paint(Graphics g)
{
g.clear();
g.drawRect(0,0, 50, 50);
int oldColor = g.getColor();
g.setColor(Color.DODGERBLUE);
g.fillRect(0, 0, this.getPreferredWidth(), this.getPreferredHeight());
g.setColor(oldColor);
g.drawRect(100, 100, 50, 50);
super.paint(g);
}
};
testScreen.setTitle(field);
//Add status field to bottom of screen in blue color
final LabelField field1 = new LabelField(" Copyright")
{
protected void paint(Graphics g)
{
// g.clear();
g.drawRect(0,0, 50, 50);
int oldColor = g.getColor();
g.setColor(Color.DODGERBLUE);
g.fillRect(0, 0, this.getPreferredWidth(), this.getPreferredHeight());
g.setColor(oldColor);
g.drawRect(100, 100, 50, 50);
super.paint(g);
}
};
//field1.setFontColor(Color.WHITE);
btntest1 = new ButtonField("Customer",ButtonField.FIELD_HCENTER | ButtonField.CONSUME_CLICK);
btntest = new ButtonField("Bills ",ButtonField.FIELD_HCENTER | ButtonField.CONSUME_CLICK);
btntest2 = new ButtonField("Ledger ",ButtonField.FIELD_HCENTER | ButtonField.CONSUME_CLICK);
btntest3 = new ButtonField("Receipts",ButtonField.FIELD_HCENTER | ButtonField.CONSUME_CLICK);
btntest1.setChangeListener(new FieldChangeListener()
{
public void fieldChanged(Field field,int context)
{
pushScreen(new NextScreen2());
}
});
btntest.setChangeListener(new FieldChangeListener()
{
public void fieldChanged(Field field,int context)
{
pushScreen(new NextScreen1());
}
});
btntest2.setChangeListener(new FieldChangeListener()
{
public void fieldChanged(Field field,int context)
{
pushScreen(new NextScreen4());
}
});
我也试图绘制一个形象图,该图位于形式的核心,但该图在任何地方出现。
In the present code i have added title and status fields and also i have added
- An image to the top of the screen with welcome caption.
- There are 6 buttons that are center aligned.
这是否是因为纽托邦处于中心位置,而且没有空间可以用来执行彩色,无法看到。 另外,我也未能增加整个形式背景的图像。 任何了解解决办法的人都应获得指导。 成就