要画多边形,每个点要变成圆角的,请问如何画,求代码
------解决方案--------------------
楼上别取笑,真的可以。。
代码如下,我只花了一个角
public class Test extends JFrame{
public static void main(String[] args) {
Test test=new Test();
test.setSize(1000, 1000);
test.add(new T(1));
test.show();
}
}
class T extends JLabel {
int i;
public T(int i) {
this.i=i;
}
@Override
public void paint(Graphics g) {
super.paint(g);
g.drawLine(30, 20, 70, 20);
g.drawArc(20, 20, 20, 20, 90,90);
g.drawLine(20, 30, 20, 70);
g.drawLine(30, 80, 70, 80);
g.drawLine(80, 30, 80, 70);
}
}
效果: