开发者

Is there something like "Anchors" (javax.microedition.lcdui.Graphics) in java.awt.Graphics?

Need to rewrite JavaME application for JavaSE. (source co开发者_如何学JAVAde is not mine) There are "draw*" methods using anchors, but how can I implement this in awt?


it depends on what kind of anchors your are interested in. If your are wanna just use three lines do something like this

public void paintAnchor( Point start, Point end, Graphics g ) {
  g.drawLine( start.x, start.y, end.x, end.y);
  g.drawLine( end.x - ( end.x / 10 ), end.y - 5, end.x, end.y );
  g.drawLine( end.x - ( end.x / 10 ), end.y + 5, end.x, end.y );
}

this ist the simplest approach i can think about. And you will see it will only work good for a horizontal anchor. So what you have to do is, you have to implement it for different angles, maybe different thicknesses and for each quadrant of the coordinate system.

An alternative could be to select a specific font with anchors and just paint them. So it depends on what you trying to do.

sincerely

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜