私は2Dプログラムを書いています。私paintComponent
は円弧を作成しました。
public class Board extends Panel{
protected void paintComponent(Graphics g){
super.paintComponent(g);
Graphics2D graphics2d = (Graphics2D)g;
int x = MouseInfo.getPointerInfo().getLocation().x;//set mouses current position
int y = MouseInfo.getPointerInfo().getLocation().y;
graphics2d.setStroke(wideStroke);
graphics2d.draw(new Arc2D.Double(200, 200, 100, 100, ?, 180, Arc2D.OPEN));
}
}
私のメインではThread
、グラフを更新するために a を使用しています。の位置が?
開始角度です。これを変更するたびに、円弧は車の車輪の半分のように円を描くように移動します。円弧の動きをマウスに追従させることは可能ですか? 例えば? = 270
どうすればいいですか?(塗装下手ですみません!)