level 8
kanonmoon
楼主
public class Practice5 extends JPanel {
public static void main(String[] args) {
System.out.println("111");
Practice5 panel = new Practice5();
JFrame application = new JFrame();
application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
application.add(panel);
application.setSize(250, 250);
application.setVisible(true);
}
public void paintComponent(Graphics g) {
System.out.println("222");
super.paintComponent(g);
int width = getWidth();
int height = getHeight();
g.drawLine(0, 0, width, height);
g.drawLine(0, height, width, 0);
System.out.println("333");
}
}
2012年07月31日 03点07分
1
public static void main(String[] args) {
System.out.println("111");
Practice5 panel = new Practice5();
JFrame application = new JFrame();
application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
application.add(panel);
application.setSize(250, 250);
application.setVisible(true);
}
public void paintComponent(Graphics g) {
System.out.println("222");
super.paintComponent(g);
int width = getWidth();
int height = getHeight();
g.drawLine(0, 0, width, height);
g.drawLine(0, height, width, 0);
System.out.println("333");
}
}