-
Notifications
You must be signed in to change notification settings - Fork 0
/
SpiqueDataGUI.java
103 lines (80 loc) · 2.91 KB
/
SpiqueDataGUI.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
//Sam Wang
import java.io.*;
import javax.swing.*;
import java.awt.*;
import java.awt.Image;
import java.awt.event.*;
import com.leapmotion.leap.*;
import java.io.IOException;
import java.lang.Math;
import java.util.ArrayList;
import com.leapmotion.leap.*;
import com.leapmotion.leap.Frame;
import com.leapmotion.leap.Gesture.State;
public class SpiqueDataGUI extends JFrame implements ActionListener{
//LOAD/INITIALIZE.=======================================================================
SDGUIPanel gui;
SampleListener listener;
Controller controller;
Image icon=new ImageIcon("Icon.png").getImage();
javax.swing.Timer frameupdater=new javax.swing.Timer(1000/80,this);
javax.swing.Timer testaction=new javax.swing.Timer(500,this);
private String[][] freshData= {{"tmx","tmy","tmz","tpx","tpy","tpz","tix","tiy","tiz","tdx","tdy","tdz"},
{"imx","imy","imz","ipx","ipy","ipz","iix","iiy","iiz","idx","idy","idz"},
{"mmx","mmy","mmz","mpx","mpy","mpz","mix","miy","miz","mdx","mdy","mdz"},
{"rmx","rmy","rmz","rpx","rpy","rpz","rix","riy","riz","rdx","rdy","rdz"},
{"pmx","pmy","pmz","ppx","ppy","ppz","pix","piy","piz","pdx","pdy","pdz"}};
public SpiqueDataGUI(){
super("Spique Interactive");
gui=new SDGUIPanel();
gui.setPreferredSize(new Dimension(1024,576));
gui.setLocation(0,0);
setIconImage(icon); //Sets the JFrame icon.
//setIconImage(icon); //Sets the JFrame icon.
add(gui);
pack(); //Resizes window so that all panels are at their preferred size.
setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
setVisible(true);
frameupdater.start();
testaction.start();
// Create a sample listener and controller
SampleListener listener = new SampleListener();
Controller controller = new Controller();
// Have the sample listener receive events from the controller
controller.addListener(listener);
try{
freshData = listener.getList();
}
catch(NullPointerException e){
}
// Keep this process running until Enter is pressed
System.out.println("Press Enter to quit...");
try {
System.in.read();
} catch (IOException e) {
e.printStackTrace();
}
// Remove the sample listener when done
controller.removeListener(listener);
}
public String[][] getTheData(){
return freshData;
}
//ACTION PERFORMED.======================================================================
public void actionPerformed(ActionEvent evt){
try{
freshData = listener.getList();
}
catch(NullPointerException e){
}
gui.setTheList(freshData);
gui.repaint(); //Repaint here as updating is disabled on pause.
Object source=evt.getSource();
if(source==testaction){
gui.changeLetter();
}
}
public static void main(String[]args){
SpiqueDataGUI frame=new SpiqueDataGUI();
}
}