2

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

gnat
  • 6,213
  • 108
  • 53
  • 73
masiboo
  • 4,537
  • 9
  • 75
  • 136

2 Answers2

1

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.

Oleh Prypin
  • 33,184
  • 10
  • 89
  • 99
0

If your target devices are Nokia than you can use drawPixels(...) and drawPolygon(...) in conjunction with MIDP graphics methods drawLine(...), drawRect(...) and drawArc(...). To achieve your goal. The drawPixels(...) is a very powerful method in the sense you can draw virtually any custom shape you would like. I know of SonyEricsson that supports nokia UI api's but with "strings attached".

More descriptive information can be found at this link.

.

If your target devices are not just Nokia than i would suggest you find / do-self port of Nokia UI class DirectGraphics. There are no ODM specific libraries the way Nokia have it.

Vimal
  • 1,266
  • 1
  • 9
  • 16