parent
6ad9836444
commit
40e3b09cfb
@ -0,0 +1,21 @@
|
||||
package com.demo.tank.coruse1;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
|
||||
public class FrameTest {
|
||||
public static void main(String[] args) {
|
||||
Frame frame = new Frame();
|
||||
frame.setVisible(true);
|
||||
frame.setSize(800, 600);
|
||||
frame.setResizable(false);
|
||||
frame.setTitle("tank war");
|
||||
frame.addWindowListener(new WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(WindowEvent e) {
|
||||
System.exit(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.demo.tank.coruse2;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
new TankFrame();
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.demo.tank.coruse2;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
|
||||
public class TankFrame extends Frame {
|
||||
int x = 200, y = 200;
|
||||
public TankFrame(){
|
||||
setVisible(true);
|
||||
setSize(800, 600);
|
||||
setResizable(false);
|
||||
setTitle("tank war");
|
||||
addWindowListener(new WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(WindowEvent e) {
|
||||
System.exit(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(Graphics g){
|
||||
g.fillRect(x,y,50,50);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue