Source code: com/robrohan/fangorn/Thinker.java
1 /*
2 * Treebeard: an xml xslt transfomer
3 * Copyright (C) 2002 Rob Rohan
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 675 Mass Ave, Cambridge, MA 02139, USA.
17 *
18 * Email: me@robrohan.com
19 * Thinker.java
20 *
21 * Created on September 17, 2002, 7:14 PM
22 */
23
24 package com.robrohan.fangorn;
25
26 /**
27 * the please wait / busy graphic
28 * @author rob
29 */
30 public class Thinker extends javax.swing.JLabel {
31
32 private static javax.swing.ImageIcon wait;
33 private static javax.swing.ImageIcon think;
34
35 /** Creates a new instance of Thinker */
36 public Thinker() {
37 wait = new javax.swing.ImageIcon(
38 getClass().getResource("/com/robrohan/treebeard/images/idle.gif")
39 );
40
41 think = new javax.swing.ImageIcon(
42 getClass().getResource("/com/robrohan/treebeard/images/busy.gif")
43 );
44
45 /*this.setBorder(
46 new javax.swing.border.EtchedBorder(
47 javax.swing.border.EtchedBorder.LOWERED
48 )
49 );*/
50 this.setPreferredSize(new java.awt.Dimension(20,20));
51 setThink(false);
52 }
53
54 /** Makes the graphic move or not
55 * @param run true=animate; false=stop
56 */
57 public void setThink(boolean run){
58 if(run){
59 this.setIcon(think);
60 }else{
61 this.setIcon(wait);
62 }
63 }
64
65 }