Search code examples
graphicsjava-melcdui

how to draw several shape (circle, line, rec, etc.) with more control?


I know there is a nice class Graphics with basic api like drawLine, drawRect. But I need more control to set pixel size, wide, thick, thin, lines in my shape. My intention is to draw a dynamic shape (similar to attached image) depending on different criteria.

I'm new in J2ME. Any other suggestion to achieve my goal is appreciated. Thanks!

enter image description here


Solution

  • There is no way to set line thickness in J2ME.

    However, you can try some workarounds:

    To simulate thick lines, you can just draw multiple lines.
    And to draw a thick circle you can draw a larger filled circle and then a smaller one inside it.

    For dotted lines use setStrokeStyle.