parent
7e1bedfa3f
commit
ef93249b91
@ -0,0 +1,37 @@
|
||||
package com.msb;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
|
||||
/**
|
||||
* @Author bingor
|
||||
* @Date 2022-09-29 16:24
|
||||
* @Description: com.msb
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class TankFrame extends Frame {
|
||||
|
||||
private int x = 200;
|
||||
private int y = 200;
|
||||
|
||||
public TankFrame() {
|
||||
setTitle("Tank war");
|
||||
setSize(800, 600);
|
||||
setResizable(true);
|
||||
setVisible(true);
|
||||
addWindowListener(new WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(WindowEvent e) {
|
||||
super.windowClosing(e);
|
||||
System.exit(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(Graphics g) {
|
||||
super.paint(g);
|
||||
g.fillRect(x, y, 50, 50);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue