thanks for giving suggestions....
I have done sending keys in my project.
I am not a developer.I dont know how to do canvas apps in development phase..
I have used But I have tried more and more times for automation of canvas apps
can you give a canvas example for to do this automation using
invokePointerDragged,invokePointerPressed,invokePointerReleased?
Thanks & Regards,
a.t.obulreddy,
Tejasoft Innovations Pvt Ltd.
> --
> You received this message because you are subscribed to the Google Groups "jinjector" group.
> To post to this group, send email to jinj...@googlegroups.com.
> To unsubscribe from this group, send email to jinjector+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/jinjector?hl=en.
>
>
public class MySimple extends MIDlet
implements CommandListener {
private OurCanvas canv;
private boolean pause=false;
private boolean keepgoing=true;
private Display dsp;
private Command cmdq ;
public MySimple() {
cmdq = new Command("Quit", Command.EXIT, 0);
canv = new OurCanvas();
}
class OurCanvas extends Canvas implements Runnable
{
private int w, h;
OurCanvas(){
w = getWidth();
h = getHeight();
x = w/2 - 5;
y = h/2 - 5;
new Thread(this).start();
}
private int gs = 180 ;
public void paint(Graphics g) {
g.setGrayScale(255);
g.fillRect(0, 0, w, h );
g.setGrayScale(gs);
g.fillRect(x, y, 40, 20);
gs = 180 ;
}
int gx = -999;
public void keyPressed( int key ) {
gx = getGameAction(key) ;
pause=false;
}
public void keyReleased(int key) {
pause=true;
gx = -999;
}
public void run() {
while ( keepgoing ) {
if ( !pause ) {
switch ( gx ) {
case UP:
y -= dy; break;
case DOWN:
y += dy; break;
case LEFT:
x -= dx; break;
case RIGHT:
x += dx; break;
case FIRE:
gs = 104 ;
}
repaint();
}//end if
try {
Thread.sleep(40);
} catch (InterruptedException e) {}
}//end while
}
private int x;
private int y;
private int dx = 10;
private int dy = 10;
}//end canvas class
public void commandAction(Command c, Displayable s) {
if (c == cmdq) notifyDestroyed();
}
public void startApp() {
if (canv==null) canv = new OurCanvas();
canv.addCommand(cmdq);
canv.setCommandListener(this);
dsp = Display.getDisplay(this);
dsp.setCurrent(canv);
pause = false;
AlertType.INFO.playSound(dsp);
}
public void pauseApp() { pause = true; }
public void destroyApp(boolean b) { keepgoing = false; }
}import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class MySimple extends MIDlet
implements CommandListener {
private OurCanvas canv;
private boolean pause=false;
private boolean keepgoing=true;
private Display dsp;
private Command cmdq ;
public MySimple() {
cmdq = new Command("Quit", Command.EXIT, 0);
canv = new OurCanvas();
}
class OurCanvas extends Canvas implements Runnable
{
private int w, h;
OurCanvas(){
w = getWidth();
h = getHeight();
x = w/2 - 5;
y = h/2 - 5;
new Thread(this).start();
}
private int gs = 180 ;
public void paint(Graphics g) {
g.setGrayScale(255);
g.fillRect(0, 0, w, h );
g.setGrayScale(gs);
g.fillRect(x, y, 40, 20);
gs = 180 ;
}
int gx = -999;
public void keyPressed( int key ) {
gx = getGameAction(key) ;
pause=false;
}
public void keyReleased(int key) {
pause=true;
gx = -999;
}
public void run() {
while ( keepgoing ) {
if ( !pause ) {
switch ( gx ) {
case UP:
y -= dy; break;
case DOWN:
y += dy; break;
case LEFT:
x -= dx; break;
case RIGHT:
x += dx; break;
case FIRE:
gs = 104 ;
}
repaint();
}//end if
try {
Thread.sleep(40);
} catch (InterruptedException e) {}
}//end while
}
private int x;
private int y;
private int dx = 10;
private int dy = 10;
}//end canvas class
public void commandAction(Command c, Displayable s) {
if (c == cmdq) notifyDestroyed();
}
public void startApp() {
if (canv==null) canv = new OurCanvas();
canv.addCommand(cmdq);
canv.setCommandListener(this);
dsp = Display.getDisplay(this);
dsp.setCurrent(canv);
pause = false;
AlertType.INFO.playSound(dsp);
}
public void pauseApp() { pause = true; }
public void destroyApp(boolean b) { keepgoing = false; }
}
I have done this example . But i dont know how to do wrapper objects
for this example
Can you give and write a simple test case how to start For a canvas
automation ....
Thanks & Regards,
a.t.ob...@gmail.com,
Tejasoft Innovations Pvt Ltd.