This repository has been archived by the owner on Nov 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.java
79 lines (66 loc) · 1.48 KB
/
Main.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Main {
private JFrame j;
private Drawer dr;
public static void main (String[] args) {
Main a = new Main();
a.run();
}
public void run() {
setup();
}
public void setup() {
j = new JFrame();
j.setSize(800, 800);
j.setVisible(true);
j.setResizable(false);
j.setLocation(0, 0);
j.setLayout(j.getLayout());
j.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
j.setBackground(Color.BLACK);
dr = new Drawer();
dr.setSize(210,520);
dr.setBackground(Color.BLACK);
j.add(dr);
j.addKeyListener(
new KeyListener() {
@Override
public void keyPressed(KeyEvent arg0) {
if(arg0.getKeyCode()==KeyEvent.VK_A) {
Particle.setAttraction(1);
}
if(arg0.getKeyCode()==KeyEvent.VK_S) {
Particle.setAttraction(0);
}
if(arg0.getKeyCode()==KeyEvent.VK_D) {
Particle.setAttraction(-1);
}
}
@Override
public void keyReleased(KeyEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void keyTyped(KeyEvent arg0) {
// TODO Auto-generated method stub
}
}
);
j.addMouseMotionListener(
new MouseMotionListener() {
@Override
public void mouseDragged(MouseEvent e) {
}
@Override
public void mouseMoved(MouseEvent e) {
dr.mouse.setX(e.getX());
dr.mouse.setY(e.getY());
}
}
);
}
public void loop() {
}
}