added missing files
[mjncalc:origin.git] / src / main / java / org / gitorious / mjncalc / MjncalcView.java
1 /*
2  * MjncalcView.java
3  */
4
5 package org.gitorious.mjncalc;
6
7 import org.jdesktop.application.Action;
8 import org.jdesktop.application.ResourceMap;
9 import org.jdesktop.application.SingleFrameApplication;
10 import org.jdesktop.application.FrameView;
11 import org.jdesktop.application.TaskMonitor;
12 import java.awt.event.ActionEvent;
13 import java.awt.event.ActionListener;
14 import java.util.HashMap;
15 import javax.swing.Timer;
16 import javax.swing.Icon;
17 import javax.swing.JDialog;
18 import javax.swing.JFrame;
19
20 /**
21  * The application's main frame.
22  */
23 public class MjncalcView extends FrameView {
24
25     public MjncalcView(SingleFrameApplication app) {
26         super(app);
27
28         initComponents();
29         
30         // status bar initialization - message timeout, idle icon and busy animation, etc
31         ResourceMap resourceMap = getResourceMap();
32         int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
33         messageTimer = new Timer(messageTimeout, new ActionListener() {
34             public void actionPerformed(ActionEvent e) {
35                 statusMessageLabel.setText("");
36             }
37         });
38         messageTimer.setRepeats(false);
39         int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate");
40         for (int i = 0; i < busyIcons.length; i++) {
41             busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");
42         }
43         busyIconTimer = new Timer(busyAnimationRate, new ActionListener() {
44             public void actionPerformed(ActionEvent e) {
45                 busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
46                 statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
47             }
48         });
49         idleIcon = resourceMap.getIcon("StatusBar.idleIcon");
50         statusAnimationLabel.setIcon(idleIcon);
51         progressBar.setVisible(false);
52
53         // connecting action tasks to status bar via TaskMonitor
54         TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
55         taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
56             public void propertyChange(java.beans.PropertyChangeEvent evt) {
57                 String propertyName = evt.getPropertyName();
58                 if ("started".equals(propertyName)) {
59                     if (!busyIconTimer.isRunning()) {
60                         statusAnimationLabel.setIcon(busyIcons[0]);
61                         busyIconIndex = 0;
62                         busyIconTimer.start();
63                     }
64                     progressBar.setVisible(true);
65                     progressBar.setIndeterminate(true);
66                 } else if ("done".equals(propertyName)) {
67                     busyIconTimer.stop();
68                     statusAnimationLabel.setIcon(idleIcon);
69                     progressBar.setVisible(false);
70                     progressBar.setValue(0);
71                 } else if ("message".equals(propertyName)) {
72                     String text = (String)(evt.getNewValue());
73                     statusMessageLabel.setText((text == null) ? "" : text);
74                     messageTimer.restart();
75                 } else if ("progress".equals(propertyName)) {
76                     int value = (Integer)(evt.getNewValue());
77                     progressBar.setVisible(true);
78                     progressBar.setIndeterminate(false);
79                     progressBar.setValue(value);
80                 }
81             }
82         });
83         for(int j=0; j<winds.length; j++){
84             winnerCombobox.addItem(winds[j]);
85         }
86
87     }
88
89     @Action
90     public void showAboutBox() {
91         if (aboutBox == null) {
92             JFrame mainFrame = MjncalcApp.getApplication().getMainFrame();
93             aboutBox = new MjncalcAboutBox(mainFrame);
94             aboutBox.setLocationRelativeTo(mainFrame);
95         }
96         MjncalcApp.getApplication().show(aboutBox);
97     }
98
99     /** This method is called from within the constructor to
100      * initialize the form.
101      * WARNING: Do NOT modify this code. The content of this method is
102      * always regenerated by the Form Editor.
103      */
104     @SuppressWarnings("unchecked")
105     // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
106     private void initComponents() {
107
108         mainPanel = new javax.swing.JPanel();
109         eastScore = new javax.swing.JTextField();
110         southScore = new javax.swing.JTextField();
111         westScore = new javax.swing.JTextField();
112         northScore = new javax.swing.JTextField();
113         labelEast = new javax.swing.JLabel();
114         labelSouth = new javax.swing.JLabel();
115         labelWest = new javax.swing.JLabel();
116         labelNorth = new javax.swing.JLabel();
117         runButton = new javax.swing.JButton();
118         winnerCombobox = new javax.swing.JComboBox();
119         labelWinner = new javax.swing.JLabel();
120         resultSouth = new javax.swing.JLabel();
121         resultEast = new javax.swing.JLabel();
122         jLabel2 = new javax.swing.JLabel();
123         resultWest = new javax.swing.JLabel();
124         resultNorth = new javax.swing.JLabel();
125         menuBar = new javax.swing.JMenuBar();
126         javax.swing.JMenu fileMenu = new javax.swing.JMenu();
127         javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();
128         javax.swing.JMenu helpMenu = new javax.swing.JMenu();
129         javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem();
130         statusPanel = new javax.swing.JPanel();
131         javax.swing.JSeparator statusPanelSeparator = new javax.swing.JSeparator();
132         statusMessageLabel = new javax.swing.JLabel();
133         statusAnimationLabel = new javax.swing.JLabel();
134         progressBar = new javax.swing.JProgressBar();
135
136         mainPanel.setName("mainPanel"); // NOI18N
137
138         eastScore.setFont(eastScore.getFont());
139         eastScore.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
140         org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(MjncalcApp.class).getContext().getResourceMap(MjncalcView.class);
141         eastScore.setText(resourceMap.getString("eastScore.text")); // NOI18N
142         eastScore.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR));
143         eastScore.setMaximumSize(new java.awt.Dimension(50, 28));
144         eastScore.setName("eastScore"); // NOI18N
145
146         southScore.setFont(eastScore.getFont());
147         southScore.setHorizontalAlignment(eastScore.getHorizontalAlignment());
148         southScore.setText(resourceMap.getString("southScore.text")); // NOI18N
149         southScore.setMaximumSize(labelEast.getMaximumSize());
150         southScore.setName("southScore"); // NOI18N
151
152         westScore.setFont(eastScore.getFont());
153         westScore.setHorizontalAlignment(eastScore.getHorizontalAlignment());
154         westScore.setText(resourceMap.getString("westScore.text")); // NOI18N
155         westScore.setMaximumSize(eastScore.getMaximumSize());
156         westScore.setName("westScore"); // NOI18N
157
158         northScore.setFont(eastScore.getFont());
159         northScore.setHorizontalAlignment(eastScore.getHorizontalAlignment());
160         northScore.setText(resourceMap.getString("northScore.text")); // NOI18N
161         northScore.setMaximumSize(eastScore.getMaximumSize());
162         northScore.setName("northScore"); // NOI18N
163
164         labelEast.setText(resourceMap.getString("labelEast.text")); // NOI18N
165         labelEast.setName("labelEast"); // NOI18N
166
167         labelSouth.setText(resourceMap.getString("labelSouth.text")); // NOI18N
168         labelSouth.setName("labelSouth"); // NOI18N
169
170         labelWest.setText(resourceMap.getString("labelWest.text")); // NOI18N
171         labelWest.setName("labelWest"); // NOI18N
172
173         labelNorth.setText(resourceMap.getString("labelNorth.text")); // NOI18N
174         labelNorth.setName("labelNorth"); // NOI18N
175
176         javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(MjncalcApp.class).getContext().getActionMap(MjncalcView.class, this);
177         runButton.setAction(actionMap.get("runCalculations")); // NOI18N
178         runButton.setText(resourceMap.getString("runButton.text")); // NOI18N
179         runButton.setName("runButton"); // NOI18N
180
181         winnerCombobox.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
182         winnerCombobox.setMaximumSize(new java.awt.Dimension(52, 28));
183         winnerCombobox.setName("winnerCombobox"); // NOI18N
184         winnerCombobox.setNextFocusableComponent(eastScore);
185
186         labelWinner.setText(resourceMap.getString("labelWinner.text")); // NOI18N
187         labelWinner.setName("labelWinner"); // NOI18N
188
189         resultSouth.setText(resourceMap.getString("resultSouth.text")); // NOI18N
190         resultSouth.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true));
191         resultSouth.setFocusable(false);
192         resultSouth.setName("resultSouth"); // NOI18N
193
194         resultEast.setText(resourceMap.getString("resultEast.text")); // NOI18N
195         resultEast.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true));
196         resultEast.setFocusable(false);
197         resultEast.setName("resultEast"); // NOI18N
198
199         jLabel2.setName("jLabel2"); // NOI18N
200
201         resultWest.setText(resourceMap.getString("resultWest.text")); // NOI18N
202         resultWest.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true));
203         resultWest.setFocusable(false);
204         resultWest.setName("resultWest"); // NOI18N
205
206         resultNorth.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true));
207         resultNorth.setFocusable(false);
208         resultNorth.setName("resultNorth"); // NOI18N
209
210         org.jdesktop.layout.GroupLayout mainPanelLayout = new org.jdesktop.layout.GroupLayout(mainPanel);
211         mainPanel.setLayout(mainPanelLayout);
212         mainPanelLayout.setHorizontalGroup(
213             mainPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
214             .add(mainPanelLayout.createSequentialGroup()
215                 .add(11, 11, 11)
216                 .add(mainPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
217                     .add(labelEast)
218                     .add(labelSouth)
219                     .add(labelWest)
220                     .add(labelNorth)
221                     .add(labelWinner))
222                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
223                 .add(mainPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
224                     .add(runButton)
225                     .add(org.jdesktop.layout.GroupLayout.TRAILING, winnerCombobox, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
226                     .add(eastScore, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 161, Short.MAX_VALUE)
227                     .add(southScore, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
228                     .add(westScore, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
229                     .add(org.jdesktop.layout.GroupLayout.TRAILING, northScore, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
230                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 32, Short.MAX_VALUE)
231                 .add(mainPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
232                     .add(mainPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
233                         .add(resultNorth, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
234                         .add(resultWest, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
235                         .add(resultSouth, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 97, Short.MAX_VALUE))
236                     .add(resultEast, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 97, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
237                 .add(50, 50, 50))
238             .add(mainPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
239                 .add(mainPanelLayout.createSequentialGroup()
240                     .add(257, 257, 257)
241                     .add(jLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 97, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
242                     .addContainerGap(49, Short.MAX_VALUE)))
243         );
244         mainPanelLayout.setVerticalGroup(
245             mainPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
246             .add(mainPanelLayout.createSequentialGroup()
247                 .add(20, 20, 20)
248                 .add(mainPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
249                     .add(mainPanelLayout.createSequentialGroup()
250                         .add(resultEast, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 22, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
251                         .add(18, 18, 18)
252                         .add(resultSouth, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 22, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
253                     .add(mainPanelLayout.createSequentialGroup()
254                         .add(mainPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
255                             .add(winnerCombobox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
256                             .add(labelWinner))
257                         .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
258                         .add(mainPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
259                             .add(labelEast)
260                             .add(eastScore, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
261                         .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
262                         .add(mainPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
263                             .add(southScore, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
264                             .add(labelSouth))))
265                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
266                 .add(mainPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
267                     .add(mainPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
268                         .add(westScore, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 28, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
269                         .add(labelWest))
270                     .add(resultWest, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 19, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
271                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
272                 .add(mainPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
273                     .add(mainPanelLayout.createSequentialGroup()
274                         .add(mainPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
275                             .add(northScore, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
276                             .add(labelNorth))
277                         .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 28, Short.MAX_VALUE)
278                         .add(runButton))
279                     .add(resultNorth, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 20, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
280                 .addContainerGap())
281             .add(mainPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
282                 .add(mainPanelLayout.createSequentialGroup()
283                     .add(67, 67, 67)
284                     .add(jLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 25, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
285                     .addContainerGap(175, Short.MAX_VALUE)))
286         );
287
288         menuBar.setName("menuBar"); // NOI18N
289
290         fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N
291         fileMenu.setName("fileMenu"); // NOI18N
292
293         exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
294         exitMenuItem.setName("exitMenuItem"); // NOI18N
295         fileMenu.add(exitMenuItem);
296
297         menuBar.add(fileMenu);
298
299         helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N
300         helpMenu.setName("helpMenu"); // NOI18N
301
302         aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N
303         aboutMenuItem.setName("aboutMenuItem"); // NOI18N
304         helpMenu.add(aboutMenuItem);
305
306         menuBar.add(helpMenu);
307
308         statusPanel.setName("statusPanel"); // NOI18N
309
310         statusPanelSeparator.setName("statusPanelSeparator"); // NOI18N
311
312         statusMessageLabel.setName("statusMessageLabel"); // NOI18N
313
314         statusAnimationLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
315         statusAnimationLabel.setName("statusAnimationLabel"); // NOI18N
316
317         progressBar.setName("progressBar"); // NOI18N
318
319         org.jdesktop.layout.GroupLayout statusPanelLayout = new org.jdesktop.layout.GroupLayout(statusPanel);
320         statusPanel.setLayout(statusPanelLayout);
321         statusPanelLayout.setHorizontalGroup(
322             statusPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
323             .add(statusPanelSeparator, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 403, Short.MAX_VALUE)
324             .add(statusPanelLayout.createSequentialGroup()
325                 .addContainerGap()
326                 .add(statusMessageLabel)
327                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 207, Short.MAX_VALUE)
328                 .add(progressBar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
329                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
330                 .add(statusAnimationLabel)
331                 .addContainerGap())
332         );
333         statusPanelLayout.setVerticalGroup(
334             statusPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
335             .add(statusPanelLayout.createSequentialGroup()
336                 .add(statusPanelSeparator, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
337                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
338                 .add(statusPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
339                     .add(statusMessageLabel)
340                     .add(statusAnimationLabel)
341                     .add(progressBar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
342                 .add(3, 3, 3))
343         );
344
345         setComponent(mainPanel);
346         setMenuBar(menuBar);
347         setStatusBar(statusPanel);
348     }// </editor-fold>//GEN-END:initComponents
349
350     public Wind getWinner(){
351         return (Wind) winnerCombobox.getSelectedItem();
352     }
353
354     public Integer getEastScore(){
355         return Integer.valueOf(eastScore.getText());
356     }
357
358     public Integer getWestScore(){
359         return Integer.valueOf(westScore.getText());
360     }
361
362     public Integer getNorthScore(){
363         return Integer.valueOf(northScore.getText());
364     }
365
366     public Integer getSouthScore(){
367         return Integer.valueOf(southScore.getText());
368     }
369
370
371     @Action
372     public void runCalculations(){
373         HashMap <Wind, Integer> results = runCalculationsAction(
374                 getWinner(),
375                 new HashMap<Wind, Integer>(){{
376             put(Wind.EAST,  getEastScore());
377             put(Wind.SOUTH, getSouthScore());
378             put(Wind.WEST, getWestScore());
379             put(Wind.NORTH, getNorthScore());
380         }}
381         );
382         resultEast.setText(String.valueOf(results.get(Wind.EAST)));
383         resultSouth.setText(String.valueOf(results.get(Wind.SOUTH)));
384         resultWest.setText(String.valueOf(results.get(Wind.WEST)));
385         resultNorth.setText(String.valueOf(results.get(Wind.NORTH)));
386     }
387
388     public HashMap <Wind, Integer> runCalculationsAction(Wind winner, HashMap<Wind, Integer> scores) {
389         HashMap<Wind, Integer> results = new HashMap<Wind, Integer>(scores);
390         System.out.println(winner.getDescription());
391         for(int j=0; j<winds.length-1; j++){
392             for(int i=j+1; i<winds.length; i++){
393                 Wind iWind = winds[i];
394                 Wind jWind = winds[j];
395                 System.out.println(
396                      iWind.getDescription() + ", " + jWind.getDescription()
397                 );
398
399                 int iScore = scores.get(iWind);
400                 int jScore = scores.get(jWind);
401                 int delta;
402                 if(iWind == winner){
403                     delta = iScore;
404                 } else if (jWind == winner){
405                     delta = -jScore;
406                 } else {
407                     delta = iScore - jScore;
408                 }
409                 if (iWind == Wind.EAST || jWind == Wind.EAST){
410                     delta *= 2;
411                 }
412                 // Scores for winner are counted, using other procedure
413                 if (iWind != winner){
414                     results.put(iWind, results.get(iWind) + delta);
415                 }
416                 if (jWind != winner) {
417                     results.put(jWind, results.get(jWind) - delta);
418                 }
419             }
420         }
421         
422         if(winner == Wind.EAST){
423             results.put(winner, scores.get(winner) * 6);
424         } else {
425             results.put(winner, scores.get(winner) * 4);
426         }
427
428        return results;
429     }
430
431
432     // Variables declaration - do not modify//GEN-BEGIN:variables
433     private javax.swing.JTextField eastScore;
434     private javax.swing.JLabel jLabel2;
435     private javax.swing.JLabel labelEast;
436     private javax.swing.JLabel labelNorth;
437     private javax.swing.JLabel labelSouth;
438     private javax.swing.JLabel labelWest;
439     private javax.swing.JLabel labelWinner;
440     private javax.swing.JPanel mainPanel;
441     private javax.swing.JMenuBar menuBar;
442     private javax.swing.JTextField northScore;
443     private javax.swing.JProgressBar progressBar;
444     private javax.swing.JLabel resultEast;
445     private javax.swing.JLabel resultNorth;
446     private javax.swing.JLabel resultSouth;
447     private javax.swing.JLabel resultWest;
448     private javax.swing.JButton runButton;
449     private javax.swing.JTextField southScore;
450     private javax.swing.JLabel statusAnimationLabel;
451     private javax.swing.JLabel statusMessageLabel;
452     private javax.swing.JPanel statusPanel;
453     private javax.swing.JTextField westScore;
454     private javax.swing.JComboBox winnerCombobox;
455     // End of variables declaration//GEN-END:variables
456
457     private final Timer messageTimer;
458     private final Timer busyIconTimer;
459     private final Icon idleIcon;
460     private final Icon[] busyIcons = new Icon[15];
461     private int busyIconIndex = 0;
462     public enum Wind {
463         EAST("East"), SOUTH("South"), WEST("West"), NORTH("North");
464
465         private final String description;
466         
467         Wind(String desc){
468             this.description = desc;
469         }
470         public String getDescription(){
471             return this.description;
472         }
473         
474         @Override
475         public String toString(){
476             return description;
477         }
478     };
479     private JDialog aboutBox;
480     private static final Wind[] winds = {
481         Wind.EAST,
482         Wind.SOUTH,
483         Wind.WEST,
484         Wind.NORTH
485     };
486
487 }