Repaint question on j2me midp 2.0

Hi,
Is there a way to force repaint() happens at the time you want to call it instead of queueing it in an event queue? If I do that, what are the drawbacks?
And on a real phone, what is the performance difference before repaint() a region verus repaint() the whole screen? And does setting up clipping rect help performance?
Thank you.

I think that you can call repaint() whenever you want in GameCanvas. The good thing is that you have the full control. The bad thing is that you will see the screen "flashing" if you call repaint() too frequently.
The performance is dependent on the MIDP 2.0 implementation of the phone. MIDP 2.0-compatible phones might have different performance but they must have the same functionality.
I have tried on Motorola V300 and V600, repainting on the clipped region is faster than repainting the whole screen.

Similar Messages

  • J2ME/MIDP GUI development issues

    Hello,
    I'm newbie to J2ME/MIDP development .
    And I'm curoius about main GUI issues when developing games for mobile phones.
    Such as different screen sizes, sprites, etc.
    How ppl target for different screen sizes and resolution?
    Links for usefull reading is appriciated very much.
    Thank you.
    Alexei.

    There are two configuration
    1.CDC
    2.CLDC
    and Following profiles for the developers to choose from while developing the application for a wireless deveice
    for CLDC-
    1.MIDP
    2.PDAP
    for CDC-
    1.Foundation Profile
    2.Personal basis Profile
    3.Personal Profile
    Apart from these profiles (JAVA APIs) development can be done in
    1.c/c++
    2.net
    Now my questions or rather the issues that i always face or rather i always get confused over it
    1.How to know that a particular device supports which Configuration
    Check the device Specifications, Nokia supports maybe java, while motorola supports may be .NET
    2.After the configuration is known, which profile is to be used.
    Depends on what you want to develop, once you know that then you will read the profile spec. and then go for development, let say if you wanted to develop a simple game, it can be done in MIDP only, while if you need advanced multimedia, u need implementation of MMAPI also, on the other hand if you want to develop diary of contact managment software you will yous PIM.You should know the wanter in pool before taking of your clothes and going for a swim.
    3.For developing the application in c++, do different device category give different set of APIs for development.,plz explain.
    Most of the C++ api's are devices specific(after all that is when java wins)
    4.What about the development platform for PALM and POCKET PC devices.what profiles from the above listing do they use .
    they use the CDC configuration, and Personal Profile
    5.can development on POCKET PC be done only on compact .net framework???
    No, Commercial JVM are available, infact a free one is also available, search this forum you will find out.
    Hope this help

  • Basic Documentation for J2ME MIDP?

    Hi,
    I am new to developing for J2ME/MIDP and have not been successful in finding any language documentation to help me further my knowledge.
    As a case in point, I have a sample app that I have been playing with, it is very simple and uses an object of type TextBox as follows...
      private TextBox t;
        t = new TextBox("Heya!",  "Welcome to MIDP development", 256, 0);Now I want to append some more text to this TextBox at from another method in the app, but I can't find any documentation on TextBox to show me how to do this.
    (I have tried "t.append(new StringItem(null, "More text"));" but it doesn't work).
    Where is the documentation for MIDP? Is there something similar to the J2SE documentation here -
    http://java.sun.com/j2se/1.4/docs/api/index.html
    If there is, then that would be the answer to a lot of my questions!
    Also, I have difficulty understanding how MIDP and J2ME relate, what is their relationship? Is MIDP a part of J2ME? And how does CLDC relate to them both?
    Well, thanks very much for any help you can offer!
    Warm regards,
    - Peter

    The documentation is part of the SDK when you download it.
    If you downloaded the Wireless Toolkit or any other SDK, there should be a docs directory there with all the documentation (and if you don't have any SDK you can't do much development in any case).
    As for the TextBox issue you would need something like:
    t.setString(t.getString() + " some more text");And about those general J2ME questions, there's a good FAQ on this site.
    shmoove

  • J2ME, MIDP,CLDC, ...

    Hi all,
    i'm new to this "micro Java tech" and i would like to have clear some general concepts ;-)
    right now i've got an application written in "waba" for running it in a Palm device, i just needed waba VM, waba classes and some applications for creating the prc files.
    Now i would like to "translate" and walk into the sun philosophy...
    i've been reading around and i've found KVM what is quite clear, and then J2ME, MIDP and CLDC... do i need all this for writting my java application and running it in a Palm device?
    Which is the minimal set for doing it?
    Which API is the correct one for what i want CLDC API or Java2ME API?
    my messy brains would thank any help....
    thanks,
    Laura.

    hi, if you want to develop and run your apps on Palm devices, I think what you need are J2ME Wireless ToolKit and MIDP for Palm from Sun Microsystems. These tools can help you.

  • Playback Video (format 3GPP) on j2me midp 2.0

    Hi all,
    By now all recent mobile phone should playback many video type included le format 3GP.
    But I can't playback any Video from J2me midp 2.0 API.
    Are there someone here who know a solution independent of device to playback video on j2me midp platform ?
    Thank you,
    Tien
    (www.tranthuong.com)

    Something like this:
    private void playFile( String filename ) {
      try
        InputStream is = getClass().getResourceAsStream(filename);
        m_player = Manager.createPlayer(is, "video/3gpp");
        m_player.prefetch();
        m_player.start();
      catch (Exception ex)
        System.out.println(ex.toString());
    } Also in MIDP 2 check VolumeControl
    If your mobile support JSR-135:
    try {
         Player p = Manager.createPlayer("http://abc.mpg");
         p.realize();
         VideoControl vc;
         if ((vc = (VideoControl)p.getControl("VideoControl")) != null)
             add((Component)vc.initDisplayMode(vc.USE_GUI_PRIMITIVE, null));
         p.start();
    } catch (MediaException pe) {
    } catch (IOException ioe) {
    }In this case you also can
    InputStream is = getClass().getResourceAsStream(filename);
    Player p = Manager.createPlayer(is, "video/3gpp");

  • J2me midp help

    Hi All!
    I'm new to java, but i want to build J2ME (MIDP) applications.
    I can write *.java files and run it after compiling.
    But i want to write low-level APIs (games) and i have an example from
    which i can start. It's a dog animation and it consists a Doggy.java and a DoggyMIDlet.java and some *.pngs. Now how can i compile thesse files into one .jar??? I have an Ant, and a Wireless Tollkit but i cant use any of them :(( Where can i find some tutorials to j2me midp (game) writing?Thanks for the replies in advance.
    Wolf

    In the "wireless toolkit(wtk104 - last version)" dir there are 3 games which you can study.
    catalin

  • J2ME MIDP 2.0  start on boot midlet on Nokia 6600

    Hi All
    I wish to auto-start my J2ME application on Nokia 6600, using PushRegistry.
    However, every time when the application auto-starts, it asks user
    "Allow application xxxx to start automatically when needed?". This is
    annoying, because I wish
    my application started quietly in the background.
    It makes sense for the question to be asked for the first time after
    installation (just like
    the question for unsigned jar). But it is unnecessary to ask this question
    every time.
    Anyone has suggestion on how to mute this question? Thanks.
    Atul Gajbhiye

    Seems as if Nokia 6600 does not supports CLDC 1.1, right click on project properties, change CLDC version to 1.0 & things will start working :)
    makuchaku

  • A question about j2me game

    I want to make a programme with this function:
    a small dot in the middle, if I click one button "draw",it will draw the line, if I click the "move", it will move without the line
    but now , what I can do is the dot just can move , I don't know how it can draw the line...
    Can anyone help me?
    Ps: here is the code
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    public class main extends MIDlet implements CommandListener
         Display display;
         MyCanvas myCanvas;
         public main(){
              display = Display.getDisplay(this);
              myCanvas = new MyCanvas();
         public void startApp(){
              myCanvas = new MyCanvas();
              display.setCurrent(myCanvas);
              myCanvas.start();
              myCanvas.setCommandListener(this);
         public void pauseApp(){}
         public void destroyApp(boolean unconditional){}
         public void commandAction(Command c, Displayable d){
              if (c == myCanvas.exitCmd)
                   destroyApp(true);
                   notifyDestroyed();
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import com.nokia.mid.ui.*;
    import java.util.Random;
    class MyCanvas extends Canvas implements Runnable
         int gameAction;
         Command exitCmd;
         int status = release;
         int k;
         int getKeyCode;
         final static int press = 1;
         final static int release = 2;
         private CommandListener listener;
         int Width = getWidth();
         int Height = getHeight();
         public int x = getWidth()/2;
         public int y = 0;
         public int x_auto;
         public int y_auto;
         int ok;
         int r;
         Random rnd = new Random();
         Image image;
         public MyCanvas(){
              exitCmd = new Command("Exit",Command.EXIT,1);
              addCommand(exitCmd);
              ok = Math.abs(rnd.nextInt()) % 10;
              r = Math.abs(rnd.nextInt()) % 6;
         public void paint(Graphics g){
              g.setColor(0xff8080);
              g.drawRect(2,2,Width-4,Height-4);
              g.setColor(0x000000);
              g.fillArc(x,y+4,2,2,0,360);
              g.fillArc(x+x_auto,Height-4+y_auto,3,3,0,360);
         public void keyPressed(int keyCode){
              getKeyCode = keyCode;
              status=press;
         public void keyReleased(int keyCode){
              status=release;
         public void run(){
              while (true)
                   try{
                        Thread.sleep(30);
                        if (getKeyCode == -1 && status == press && y > 2)
                             y--;
                        if (getKeyCode == -2 && status == press && y < Height - 4)
                             y++;
                        if (getKeyCode == -3 && status == press && x >2)
                             x--;
                        if (getKeyCode == -4 && status == press && x < Width - 4)
                             x++;
                        repaint();
                   }catch(Exception ex){}
         public void start(){
              Thread runner = new Thread(this);
              runner.start();
         public void setCommandListener(CommandListener l) {
              super.setCommandListener(l);
              listener = l;

    Try making the main loop change x_auto and y_auto rather than x and y. At the moment x_auto and y_auto are never initialised, so they're always 0.

  • Question about j2me bluetooth lack of documentation!

    I don't know if I am searching in the wrong places. I am coding a simple (at least for now) java application that communicates through bluetooth.
    I have been using the j2me api available at http://java.sun.com/javame/reference/apis/jsr082/
    But it lacks all sort of information! The API is there... the class and methods are there but nothing is explained....
    For example, if you follow the link above to the api, then click in the DiscoveryAgent, then go to the definition of the method searchServices, this is what it tells you:
    public int searchServices(int[] attrSet, UUID[] uuidSet, RemoteDevice btDev, DiscoveryListener discListener) throws BluetoothStateException
    I can see the declaration, I even deduce what each argument is supposed to be, but..... attrSet???? what is this.... there is a complete lack of information on everything, I find myself googling for everything and finding magic numbers that sometimes make things work. Is there any online resources for bluetooth j2me programming?
    By the way... this thing about the attrSet is my latest doubt... if you know what values can be used in there please let me know:)
    But my problem is not about this particular method... is about all of the documentation.
    If anyone can point me into some place where a good specification can be found i would much appreciate it

    http://www.jcp.org/aboutJava/communityprocess/final/jsr082/
    found this :) I think it's the answer to my problems.

  • Help for J2ME MIDP

    Hello,
    I'm working for a project on MIDP. And i wish to call another MIDlet from the main MIDlet. But while calling it gives a Security exception. Can anybody suggest me any way to do it.
    Also i wish to get the Text to Speech conversion. How can this be implemented?
    Please help me out with this....

    ANYONE?
    There will be Dukes Dollars avaliable!!!

  • Strategic question about J2ME program

    I'm quite new to J2ME and am just working through trying to get a small program working between two phones - they communicate fine but I seem to be stuck more on a conceptual overview of some things I don't quite understand yet. Mainly because event driven seems to not sit well with me yet I don't think.
    I have 2 phones and I have them basically enter an insult to each other in challenge before they move into a series of rounds (small game). They do this part fine. What does happen though is the moment the insult is sent from phone A then it goes directly to the next display on phone A- and the same with phone B. The messages are sent but they both need to be able to view each other's insult / challenge before moving to the next displayable.
    I'm really just wondering in general terms how I go about creating stages where each phone has to complete something - a round in a game for example. I know it sounds kind of dumb but I'm just looking for some advice.

    http://www.jcp.org/aboutJava/communityprocess/final/jsr082/
    found this :) I think it's the answer to my problems.

  • Bitmap font on J2ME/MIDP devices

    Hi!
    I want to develop an application that can display my own langue on a mobile phone. I have known that there is a posibility to use a bitmap font(new_font.png) but I dont know how we can do with that.
    Does anyone know where can I find some documentation related to that? Or if you have some sample code that can solve my problem, that would be great.
    There is not yet unicode for my langue so it would be hard for me to do it this project.
    Best regards,

    I found an API on the web but don't remember which one - it is not free, though - but it uses the low-level API of MIDP to create those buttons and boxes.

  • Jframe blues ( another validate, repaint question )

    i can use validate() or repaint() just fine when i use it via a JButton or a JOptionPane.
    but when i use it via an event ( any event ) it doesnt work.
    the background changes to the background color but no components are showing
    when i click over where they're supposed to be they suddenly appear....
    even better, i use an option in my jmenu that pops a JOptionPane, click on the ok button and
    suddenly, all the components of me jframe suddenly appear!
    well, can somebody tell me what to do after
    frame.validate();
    so that all the components shows?
    thx
    PoPo

    ok all is well .....
    resolved the problem by starting a new thread
    SwingUtilities.invokeLater(new Runnable()
    public void run()
    // insert the code that updates the UI here.
    });

  • Repainting question for my syntax highlighter

    Hello there,
    I have a syntax highlighter which reuses much of the very useful code developed by Claude Dugauy, which can be found at http://www.fawcette.com/javapro/2003_07/magazine/columns/visualcomponents/default_pf.aspx
    . The syntax highlighting uses regular expressions, so its easily extendable to meet your needs.
    However, there is one problem: whenever the user presses a key, the whole of the TextPane containing the highlighted text, is repainted in its entirety. This is fine for small amounts of text to be highlighted, but is very slow when it comes to 1000+ lines.
    Please could someone be so excellent as to tell me how to go about addressing this problem, so that only a small amount of text is repainted whenever the user types something into the TextPane e.g. that inside the current viewport, or just the last typed word - thus removing this problem of inefficiency.
    Thanks in advance,
    Edd.

    I don't think it's going to be that easy. Every time a change is made, the default style is applied to the whole document, then the whole document is copied into a String so it can be reparsed and have the syntax styles applied again. Even if you could limit what actually gets painted, you'd still have all that unnecessary work going on.
    You could try forcing the highlighter to only reparse a portion of the document--like,say, a hundred lines before and after the point where the edit occurred--but deciding exactly where to start and stop can be pretty tricky.

  • [J2ME MIDP 2.0] Alert, how to use fonts and colors?

    good morning,
    does anyone know in which way I can use colors in an alert pop-up?
    I've done my on using the code below. I would like to have text and images centered in the screen display and I would also like to use the colors I'm using in the application I'm writing.
    thx in advice,
    Omar
    private void alertDisplay(String s){   
        Alert a = new Alert("Location set to " + s.toUpperCase());   
        if(s.startsWith("H"))
          a.setImage(hOn);
        else
          a.setImage(oOn); 
        a.setString("Actual Location: " + s.toUpperCase());
        a.setTimeout(2000);
        a.setType(AlertType.INFO);
        Display.getDisplay(this).setCurrent(a);
        Display.getDisplay(this).vibrate(1000);
        Display.getDisplay(this).flashBacklight(1000);
      }

    Hi,
    The way how an Alert looks like cannot be influenced. When setting an image, you cannot indicate where that image should be placed. When setting a certain message text, you cannot influence its colour, its font and its allignment...
    The colour and font properties are theme / skin dependent on your mobile. When switching your mobile to another theme, then you will notice that your Alerts (and Forms and Lists, etc etc...) are coloured (titlebar, command softkeys, textfields) according to that theme.
    Cheers,
    Jasper

Maybe you are looking for

  • Issue in deleting the old batches in SARA

    Hi, I need to delete few old batches inorder to convert the batch from plant level to material level. I tried tcode SARA. I have run the write portion and system shows the number of objects selected in the job log. I can see the archive sessions also

  • Dead Video?

    When I attempt to boot I get the normal chime and feel the HDD running, but the screen has this burning look. A large area is black that's surrounded by green and magenta and it grows slowly to the bottom left corner and eventually turns completely b

  • Why cant i made the payment on clash of clans

    why cant i made the payment on clash of clans game??

  • How to Open PPro CS4 project in PPro CS3?

    I have to make hundreds of individual avis from a Ppro CS4 project. In CS4 the Media Encoder has to open up for each one and then I must wait til it loads the clip and then I can keep them in queue and do many at once but it takes forever. Is there a

  • [vmware] Virtual machine communication interface failed

    hello, on a fresh install of archlinux, i have installed vmware workstation 11.0 but when i execute this command : vmware-modconfig --console --install-all i have this error Virtual machine communication interface failed full log vmware-modconfig --c