开发者

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

开发者 https://www.devze.com 2023-03-16 23:49 出处:网络
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 anch

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

精彩评论

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

关注公众号