Question

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

Was it helpful?

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top