Me desculpem, mas não consigo nem instanciar a classe.
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class tela extends MIDlet implements CommandListener {
private final int corblack = 0x000000;
private final int corwhite = 0xffffff;
private final int corred = 0xff0000;
//private final int corblue = (40,80,150);
//private final int corgreen = (100,200,180);
private final int corciano = 0xc3d9ff;
private final int corgray = 0x777777;
//private final int coryellow = (230,200,30);
private Command cmdExit;
private Command cmdCriar;
private Display display;
private Displayable tela;
public tela() {
cmdExit = new Command("Exit", Command.EXIT, 1);
cmdCriar = new Command("Criar", Command.SCREEN, 1);
}
public void startApp() {
/* O erro acontece aqui:
* # an enclosing instance that contains tela.criobj.cpo is required #
*/
tela = new criobj.cpo(25, corciano, 10, 10, 200, 80);
//criobj.cpo Razao = new criobj.cpo(25,corciano,10,10,200,80);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable d) {
if (c == cmdExit) {
destroyApp(false);
notifyDestroyed();
}
}
class criobj extends Canvas {
public int cont;
public int num_lbl, lastnum_lbl, num_cpo, lastnum_cpo;
private boolean setCPO;
private boolean setLBL;
public String cpo_s;
public int cpo_len, cpo_c, cpo_posX, cpo_posY, cpo_w, cpo_h;
public String lbl_s;
public int lbl_c, lbl_bc, lbl_posX, lbl_posY, lbl_w, lbl_h;
class cpo extends criobj {
cpo(int length, int cor, int x,
int y, int width, int height) {
cpo_len = length;
cpo_c = cor;
cpo_posX = x;
cpo_posY = y;
cpo_w = width;
cpo_h = height;
setCPO = true;
num_cpo += 1;
}
//###########################
//COR
public void setColor(int cor) {
this.cpo_c = cor;
}
public int getColor() {
return this.cpo_c;
}
//###########################
//VALUE
public void setValue(String str) {
if (str.length() <= cpo_len) {
this.cpo_s = str;
repaint();
}
}
public String getValue() {
return this.cpo_s;
}
public void setLen(int length) {
this.cpo_len = length;
}
//###########################
//POSIÇÃO X e Y
public void setX(int x) {
this.cpo_posX = x;
}
public void setY(int y) {
this.cpo_posY = y;
}
public int getX() {
return this.cpo_posX;
}
public int getY() {
return this.cpo_posY;
}
//###########################
//LARGURA e ALTURA
public void setW(int width) {
this.cpo_w = width;
}
public void setH(int height) {
this.cpo_h = height;
}
public int getW() {
return this.cpo_w;
}
public int getH() {
return this.cpo_h;
}
}
class lbl extends criobj {
lbl(int cor, int bcolor, int x,
int y, int width, int height) {
lbl_c = cor;
lbl_bc = bcolor;
lbl_posX = x;
lbl_posY = y;
lbl_w = width;
lbl_h = height;
}
// ###########################
// VALUE
public void setValue(String str) {
this.lbl_s = str;
setLBL = true;
repaint();
}
public String getValue() {
return this.lbl_s;
}
// ###########################
// COR
public void setColor(int cor) {
this.lbl_c = cor;
}
public int getColor() {
return this.lbl_c;
}
// ###########################
// COR FUNDO
public void setBColor(int cor) {
this.lbl_bc = cor;
}
public int getBColor() {
return this.lbl_bc;
}
// ###########################
// POSIÇÃO X e Y
public void setX(int x) {
this.lbl_posX = x;
}
public void setY(int y) {
this.lbl_posY = y;
}
public int getX() {
return this.lbl_posX;
}
public int getY() {
return this.lbl_posY;
}
// ###########################
// LARGURA e ALTURA
public void setW(int width) {
this.lbl_w = width;
}
public void setH(int height) {
this.lbl_h = height;
}
public int getW() {
return this.lbl_w;
}
public int getH() {
return this.lbl_h;
}
}
protected void paint(Graphics g) {
//if (num_cpo == 1) {
if (setCPO) {
g.setColor(150, 150, 255);
g.fillRect(cpo_posX, cpo_posY, cpo_w, cpo_h);
g.setColor(0, 0, 0);
g.drawString(cpo_s, (cpo_posX + 5), (cpo_posY + 5),
Graphics.LEFT | Graphics.TOP);
}
if (setLBL) {
g.setColor(150, 150, 255);
g.fillRect(lbl_posX, lbl_posY, lbl_w, lbl_h);
g.setColor(0, 0, 0);
g.drawString(lbl_s, (lbl_posX + 5), (lbl_posY + 5),
Graphics.LEFT | Graphics.TOP);
}
//}
//lastnum_cpo = num_cpo;
}
}
}
Grato.