2个回答
展开全部
public class DrawFrame {
public static void main(String[] args) {
final JFrame frame = new JFrame();
frame.setContentPane(new JPanel() {
@Override
public void paint(Graphics g) {
super.paint(g);
Graphics2D g2d = (Graphics2D) g;
RadialGradientPaint paint = new RadialGradientPaint(65, 65, 50, new float[]{0f, 1f}, new Color[]{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);
Ellipse2D e = new Ellipse2D.Float(10, 10, 100, 100);
g2d.fill(e);
}
});
frame.setVisible(true);
}
}
黑白棋。
Graphics2D g2d = (Graphics2D) g;
RadialGradientPaint paint = new RadialGradientPaint(65, 60, 50, new float[]{0f, 0.5f, 1f}, new Color[]{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);
Ellipse2D e = new Ellipse2D.Float(10, 10, 100, 100);
g2d.fill(e);
这个是斯诺克球。
public static void main(String[] args) {
final JFrame frame = new JFrame();
frame.setContentPane(new JPanel() {
@Override
public void paint(Graphics g) {
super.paint(g);
Graphics2D g2d = (Graphics2D) g;
RadialGradientPaint paint = new RadialGradientPaint(65, 65, 50, new float[]{0f, 1f}, new Color[]{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);
Ellipse2D e = new Ellipse2D.Float(10, 10, 100, 100);
g2d.fill(e);
}
});
frame.setVisible(true);
}
}
黑白棋。
Graphics2D g2d = (Graphics2D) g;
RadialGradientPaint paint = new RadialGradientPaint(65, 60, 50, new float[]{0f, 0.5f, 1f}, new Color[]{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);
Ellipse2D e = new Ellipse2D.Float(10, 10, 100, 100);
g2d.fill(e);
这个是斯诺克球。
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询