Thursday, February 3, 2011

:: Tranformers!! ::


import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class MyCribs extends MIDlet
{
public Display display;
            public MyCanvas canvas;

public MyCribs()
                {
                                display = Display.getDisplay(this);
                                canvas = new MyCanvas(this);
                }
public void startApp()
                {
                                display.setCurrent(canvas);
                }

                public void pauseApp() {}
    public void destroyApp (boolean unconditional) {}

                public void exitMIDlet ()
                {
                                destroyApp(true);
                                notifyDestroyed();
                }
}


class MyCanvas extends Canvas implements CommandListener
{
                public Command exit;
                public MyCribs finalone;
                public MyCanvas (MyCribs finalone)
                {
                                this.finalone = finalone;
                                exit = new Command ("Exit", Command.EXIT,1);
                                addCommand(exit);
                                setCommandListener(this);
                }

                public void paint (Graphics graphics)
                {
graphics.setColor (255,255,255);
                                graphics.fillRect ( 0,0,240,290); //background
                                graphics.setColor ( 255,0,0);
                                graphics.fillTriangle ( 40,100,120,260,200,100); //button triangle9
                                graphics.setColor ( 255,255,255);
                                graphics.fillTriangle ( 135,100,102,100,120,118); //button triangle9
                                graphics.setColor ( 255,255,255);
                                graphics.fillTriangle ( 63,100,100,118,75,125); // triangle1
                                graphics.setColor ( 255,255,255);
                                graphics.fillTriangle ( 75,125,100,118,105,140); // triangle2
                                graphics.setColor ( 255,255,255);
                                graphics.fillTriangle ( 130,140,165,125,140,118); // triangle3
                                graphics.setColor ( 255,255,255);
                                graphics.fillTriangle ( 140,118,165,125,175,100); // triangle4
                                graphics.setColor ( 255,0,0);
                                graphics.fillTriangle ( 42,120,50,220,82,200); //button triangle5
                                graphics.setColor ( 255,0,0);
                                graphics.fillTriangle ( 50,220,82,200,115,258); //button triangle6
                                graphics.setColor ( 255,0,0);
                                graphics.fillTriangle ( 130,258,190,220,158,200); //button triangle7
                                graphics.setColor ( 255,0,0);
                                graphics.fillTriangle ( 158,200,190,220,198,120); //button triangle8
                                graphics.setColor ( 255,0,0);
                                graphics.fillTriangle ( 20,20,40,100,102,100); //button triangle10 
                                graphics.setColor ( 255,0,0);
                                graphics.fillTriangle ( 220,20,200,100,138,100); //button triangle11
                                graphics.setColor ( 255,0,0);
                                graphics.fillTriangle ( 60,60,60,68,80,62); //button triangle12
                                graphics.setColor ( 255,0,0);
                                graphics.fillTriangle ( 60,68,80,62,82,75); //button triangle13
                                graphics.setColor ( 255,0,0);
                                graphics.fillTriangle ( 160,62,180,60,158,75); //button triangle14
                                graphics.setColor ( 255,0,0);
                                graphics.fillTriangle ( 158,75,180,68,180,60); //button triangle15
                                graphics.setColor ( 255,0,0);
                                graphics.fillRect ( 100,40,40,60); //button rec head

                               graphics.setColor ( 255,0,0);
                                graphics.fillTriangle ( 100,92,140,92,120,112); //button triangle17
        graphics.setColor ( 255,0,0);
                                graphics.fillTriangle ( 100,40,88,80,100,92); //button triangle18
                                graphics.setColor ( 255,0,0);
                                graphics.fillTriangle ( 140,40,152,80,140,92); //button triangle19
                                graphics.setColor ( 255,0,0);
                                graphics.fillTriangle ( 100,40,68,12,88,80); //button triangle20
                                graphics.setColor ( 255,0,0);
                                graphics.fillTriangle ( 172,12,152,80,140,40); //button triangle16
        graphics.setColor ( 255,255,255);
                                graphics.fillTriangle ( 102,60,138,60,120,92); //button triangle16
/* End of Line */

Font f = Font.getFont (Font.FACE_MONOSPACE,      Font.STYLE_PLAIN,Font.SIZE_SMALL);
                                f = Font.getFont ( Font.FACE_MONOSPACE, Font.STYLE_BOLD |
                                Font.STYLE_ITALIC, Font.SIZE_LARGE);
                                graphics.setColor(51,51,255);
                                graphics.setFont (f);
                                graphics.drawString ("Good Luck! Fighting2!",120,280,Graphics.HCENTER |
                                Graphics.BASELINE);
                }

                public void commandAction ( Command command, Displayable displayable)
                {
                                if ( command == exit)
                                {
                                                finalone.exitMIDlet ();
                                }
                }
}
  


:: =) ::

 p/s:: penink2




No comments: