This repository has been archived by the owner on Dec 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwindow.clj
45 lines (40 loc) · 1.51 KB
/
window.clj
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
(ns thor.window
"A placeholder file for now - creates a window and draws nodes"
(:gen-class)
(:use thor.ui.animation thor.utils)
(:import [javax.swing JFrame JLabel JTextField JButton]
[java.awt.event ActionListener]
[java.awt GridLayout])
)
(defn main []
(let [frame (JFrame. "Project Thor")
nodenum-label (JLabel. "Number of nodes")
nodenum-text (JTextField. "20" )
minRange-text (JTextField. "50")
minRange-label (JLabel. "Minimum Range")
maxRange-label (JLabel. "Maximum Range")
maxRange-text (JTextField. "100")
duration-label (JLabel. "Duration")
duration-text (JTextField. "10")
simulate-button (JButton. "Simulate")]
(onclick simulate-button
(animation "thor"
(extract-integer nodenum-text)
(extract-double minRange-text)
(extract-double maxRange-text)
)
)
(doto frame
(.setDefaultCloseOperation (JFrame/EXIT_ON_CLOSE))
(.setLayout (GridLayout. 5 2))
(.add nodenum-label)
(.add nodenum-text)
(.add minRange-label)
(.add minRange-text)
(.add maxRange-label)
(.add maxRange-text)
;(.add duration-label)
;(.add duration-text)
(.add simulate-button)
(.pack)
(.setVisible true))))