×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor
    Join Date
    Sep 2009
    Posts
    353

    Drawing and components in Canvas

    Is it possible for me to draw lines and shapes on canvas and also use components or custom components on the same Canvas, Can the MIDP2.0 api achieve this?

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Drawing and components in Canvas

    No, Canvas is not a "container" for other components. It provides a low-level user interface (drawing, painting, key presses, screen touches, etc.).

    That said, you can create your own component model, by creating a custom subclass of Canvas to act as a container. This is what the LWUIT library does. Obviously, it's a bit of work to build something like this...

    Graham.

  3. #3
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,073

    Re: Drawing and components in Canvas

    Is it possible for me to draw lines and shapes on canvas and also use components or custom components on the same Canvas, Can the MIDP2.0 api achieve this?
    Kevin, directly give LWUIT a try... it works in a similary pattern, where you hace Canvas as a container on which you place all highlevel custom components which are all extendable (i.e. you can overwrite their paint() and other methods if required).

    thanks,
    ~Amitabh

  4. #4
    Regular Contributor
    Join Date
    Sep 2009
    Posts
    353

    Re: Drawing and components in Canvas

    @Amitabh
    @Graham

    I have had it look at LWUIT and J2MEPolish, these seem to be heavyweight, and at this point of time I wouldn't want to construct my own UI library either.
    Is there any 3rd party UI library based on canvas that supports container-component architechture and also allows me to work with primitives like line, arc etc.
    I found MWT seems to be lightweight with a container implementation, any better ones out there?

Similar Threads

  1. Problem while drawing on canvas
    By knights123 in forum Mobile Java General
    Replies: 31
    Last Post: 2009-08-27, 12:12
  2. submenu
    By felixksp in forum Mobile Java General
    Replies: 9
    Last Post: 2008-04-22, 20:24
  3. Should I extend Canvas or Screen?
    By jigsaw_echo in forum Mobile Java General
    Replies: 2
    Last Post: 2002-12-27, 07:13

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •