-
Notifications
You must be signed in to change notification settings - Fork 0
/
SpaceWarrior.java
51 lines (43 loc) · 1.27 KB
/
SpaceWarrior.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
public class SpaceWarrior {
public static JFrame window;
public static int WIDTH;
public static int HEIGHT;
static {
Toolkit tk = Toolkit.getDefaultToolkit();
Dimension screen = tk.getScreenSize();
WIDTH = screen.width;
HEIGHT = screen.height;
window = new JFrame();
window.setSize(WIDTH, HEIGHT);
window.setLayout(null);
window.setFocusable(false);
window.setUndecorated(true);
window.setAlwaysOnTop(true);
BufferedImage cursorImage = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB);
Cursor blankCursor = tk.createCustomCursor(cursorImage, new Point(0,0), "Blank Cursor");
window.getContentPane().setCursor(blankCursor);
}
public static void exit() {
window.dispose();
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
SpaceWarriorPanel swp = new SpaceWarriorPanel();
swp.setBounds(0, 0, window.getWidth(), window.getHeight());
swp.setFocusable(true);
swp.requestFocusInWindow();
window.add(swp);
window.setVisible(true);
}
});
}
}