# with RI /opt/midp2.0fcs/bin/midp -transient -force ${URL} # with java appletviewer applet.htm java Diet3DApplet
MIDP-2.0
MIDP-1.0-nokia
MIDP-1.0
Others
If you familiar with C or C++ (or Povray) using a preprocessor, should not be a trouble for you. Else here are some basic sample code :
// file://~/MyCanva.java.in #ifdef MIDP20 #define paintTriangle(g,a,b,c,col) { \ DirectGraphics dg = DirectUtils.getDirectGraphics(g); \ dg.fillTriangle(a[0],a[1],b[0],b[1],c[0],c[1], 0xFF000000|col ); \ } #else //default #define paintTriangle(g,a,b,c,col) { \ g.drawLine( a[0] , a[1] , b[0] , b[1] ); \ g.drawLine( a[0] , a[1] , c[0] , c[1] ); \ g.drawLine( c[0] , c[1] , b[0] , b[1] ); #endif class MyCanvas { // ... protected void paint(Graphics myg) { paintTriangle(myg,mya,myb,myc,mycol); } }Then you need to "compile the file"
cpp -undef -fno-show-column -DMIDP20 -C -P -I. -I \ < MyCanvas.java.in > MyCanva.javaAnd you'll get a new file where macro was replaced :
// file://~/MyCanva.java class MyCanvas { // ... protected void paint(Graphics myg) { DirectGraphics dg = DirectUtils.getDirectGraphics(myg); dg.fillTriangle(mya[0],mya[1],myb[0],myb[1],myc[0],myc[1], \ 0xFF000000|mycol ); } }Got the Idea ? It is pretty simple , but can really be obfuscated thats why Java designers removed this feature in the language.
java.lang.OutOfMemoryError: Mesh: Maximum byte code length (32kB) exceeded