开发者

Draw olympic circles. Java ME does not support certain imports! Please help

Hello i am trying to draw an olympic symbol into my screen for my mobile app. I know how to do it in java applet. Im not able to do in java ME. Please help.

Since the packages

    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;

Is not supported by java ME. T The follwing code to draw the olympic symbol works for java. But does not work for java ME

    public void paint (Graphics g)
    {
    //Draw the First Circle and make it red 
    g.drawOval (1,0,40,40); g.setColor(Color.red);

    //Draw the Second Circle and make it blue
    g.drawOval (21,20,40,40);g.setColor(Color.blue);

    //Draw the Third Circle and make it yellow
    g.drawOval (41,0,40,40);g.setColor(Color.yellow);

    //Draw the Fourth Circle and make it black
    g.drawOval (61,20,40,40);开发者_开发知识库g.setColor(Color.black);

    //Draw the Fifth Circle and make it green
    g.drawOval (81,0,40,40);g.setColor(Color.green);
    }

Please help thanks.


AWT and Applets aren't available for Java ME. Due to the screen size limitations and restricted user interactions, the MIDP UI API is designed for mobile devices comprising of the high level and low level UI. Look at Java ME documentation.

You can use Canvas and draw the circle. Refer more info look at following links,

  • MIDP GUI Programming: Programming the Phone Interface
  • MIDP user interface
  • MIDP Programming with J2ME

FYI: You can use LWUIT framework. LWUIT provides many useful Swing-like features.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜