r4 - 09 Aug 2004 - 22:53:20 - KrasnaHalopti?You are here: SuperWaba >  Main Web  > PortingJ2meToSuperWaba

Porting from com.sun.kjava

The basics

  • Instead of extending Spotlet you extend %JAVADOC{SW:waba.ui.MainWindow}%
  • Instead of static main( String[] ) the method you use is onStart()

Dealing with Graphics.getGraphics()

One of the more common things I have seen in J2ME is the use of direct painting vs the use of Controls. While this can provide performance gains this operation is different in SuperWaba. To use this code:
   static Graphics g = Graphics.getGraphics();
You can easily change it to:
   static Graphics g = MainWindow.getMainWindow().createGraphics();
This will allow you to have direct access to paint the screen.

Converting containers size and position

J2me allows you to specify x,y coordinates for a control. Like:
   Button b = new Button( "Some Text", x, y);
In SuperWaba, the control must be added to its container before it can be sized so you need to do the following:
   Button b = new Button("Some Text");
   add(b);
   b.setRect(x,y,PREFERRED,PREFERRED);
or
   Button b = new Button("Some Text");
   add(b,x,y);

-- IanGeiser - 02 Apr 2004

Edit | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r4 < r3 < r2 < r1 | More topic actions
 
SuperWaba home
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding SuperWaba? Send feedback