java五子棋棋子画法

2024-07-17 23:16:07作者:饭克斯

publicclassDrawFrame{

publicstaticvoidmain(String[]args){

finalJFrameframe=newJFrame();

frame.setContentPane(newJPanel(){

@Override

publicvoidpaint(Graphicsg){

super.paint(g);

Graphics2Dg2d=(Graphics2D)g;

RadialGradientPaintpaint=newRadialGradientPaint(65,65,50,newfloat[]{0f,1f},newColor[]{Color.WHITE,Color.BLACK});

g2d.setPaint(paint);

g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);

g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION,RenderingHints.VALUE_ALPHA_INTERPOLATION_DEFAULT);

Ellipse2De=newEllipse2D.Float(10,10,100,100);

g2d.fill(e);

}

});

frame.setVisible(true);

}

}

黑白棋。

Graphics2Dg2d=(Graphics2D)g;

RadialGradientPaintpaint=newRadialGradientPaint(65,60,50,newfloat[]{0f,0.5f,1f},newColor[]{Color.WHITE,Color.BLUE,Color.BLACK});

g2d.setPaint(paint);

g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);

g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION,RenderingHints.VALUE_ALPHA_INTERPOLATION_DEFAULT);

Ellipse2De=newEllipse2D.Float(10,10,100,100);

g2d.fill(e);

这个是斯诺克球。

展开全文

热门推荐

相关攻略

猜你喜欢