0
パネルをセクターに分割するような複数の線を描く方法を知りたいと思います。以下はパネルJavaのセクタを分割するような複数行の線を描くにはどうすればよいですか?
This is the example of lines that I wanted to draw
のコードは、これまでのところ、私はそれを考え出したされているが、それは唯一の「X」の行とパネル上の1本の水平ラインを描くことができます。私は上記のイメージのような線をどのように描くことが可能か知りたい。
public void paintComponent(Graphics g){
super.paintComponent(g);
Graphics2D graphic = (Graphics2D)g;
Insets insets = getInsets();
graphic.setStroke(new BasicStroke(5.0f));
graphic.draw(new Line2D.Double(insets.left, insets.top,getWidth()-insets.right, getHeight()-insets.bottom));
graphic.draw(new Line2D.Double(insets.left,getHeight()-insets.bottom,getWidth()-insets.right,insets.top));
graphic.drawLine(0,200,800,200);
}
ありがとうございます。
私の最初の考えは基本的に与えられた角度に基づいて、円の周りのポイントを計算し、それらの間に線を描く、あるペイント前
paintComponent
方法にを追加することを検討してdはプロセスの基本的な制御をより良くすることができます。概念的には、[これはたとえば]のようなものです(http://stackoverflow.com/questions/30228146/drawing-a-line-maximum-point/30228270#30228270) – MadProgrammer