回复 1# suckdog 的帖子
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class xing extends JFrame
{
public xing() {
super("五角星");
this.setBackground(Color.darkGray);
this.setLocation(0,0);
this.setSize(300,250);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setVisible(true);
}
public void paint(Graphics g)
{
g.setColor(Color.red);
g.drawLine(75,20,87,56);
g.drawLine(87,56,129,56);
g.drawLine(129,56,93,74);
g.drawLine(93,74,103,116);
g.drawLine(103,116,75,92);
g.drawLine(75,92,47,116);
g.drawLine(47,116,57,74);
g.drawLine(57,74,21,56);
g.drawLine(21,56,63,56);
g.drawLine(63,56,75,20);
}
public static void main(String args[])
{
new xing();
}
}
自己刚弄的一个程序。。本来想用循环来划线的。。但老是报错。。想不通