KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > swingwt > awt > event > AdjustmentEvent


1 /*
2    SwingWT
3    Copyright(c)2003-2004, Tomer Bartletz
4  
5    For more information on distributing and using this program, please
6    see the accompanying "COPYING" file.
7  
8    Contact me by electronic mail: tomerb@users.sourceforge.net
9
10    $Log: AdjustmentEvent.java,v $
11    Revision 1.2 2003/12/22 08:48:17 bobintetley
12    Fixed up DnD to build temporarily
13
14
15  */

16 package swingwt.awt.event;
17
18 import swingwt.awt.Adjustable;
19 import swingwt.awt.AWTEvent;
20
21 /**
22  * The adjustment event emitted by Adjustable objects.
23  *
24  * @author Tomer Barletz, tomerb@users.sourceforge.net
25  * @version 0.1
26  */

27 public class AdjustmentEvent extends AWTEvent {
28     public static final int ADJUSTMENT_FIRST=601;
29     public static final int ADJUSTMENT_LAST=601;
30     public static final int ADJUSTMENT_VALUE_CHANGED=ADJUSTMENT_FIRST;
31     public static final int UNIT_INCREMENT=1;
32     public static final int UNIT_DECREMENT=2;
33     public static final int BLOCK_DECREMENT=3;
34     public static final int BLOCK_INCREMENT=4;
35     public static final int TRACK=5;
36
37     Adjustable adjustable; //The adjustable object that fired the event.
38

39     int value; //the new value of the adjustable object.
40

41     int adjustmentType; //describes how the adjustable object value has changed.
42

43     boolean isAdjusting; //true if the event is one of the series of multiple adjustment events.
44

45      private static final long serialVersionUID = 5700290645205279921L;
46
47
48     /**
49      *
50      * @param source the Adjustable object where the event originated
51      * @param id the event type
52      * @param type the adjustment type
53      * @param value the current value of the adjustment
54      */

55     public AdjustmentEvent(Adjustable source, int id, int type, int value) {
56         this(source, id, type, value, false);
57     }
58
59     /**
60      *
61      * @param source the Adjustable object where the event originated
62      * @param id the event type
63      * @param type the adjustment type
64      * @param value the current value of the adjustment
65      * @param isAdjusting true if the event is one of a series of multiple adjusting events,
66      */

67     public AdjustmentEvent(Adjustable source, int id, int type, int value, boolean isAdjusting) {
68         super(source, id);
69         adjustable = source;
70         this.adjustmentType = type;
71         this.value = value;
72         this.isAdjusting = isAdjusting;
73     }
74
75     /**
76      *
77      * @return the Adjustable object where this event originated
78      */

79     public Adjustable getAdjustable() {
80         return adjustable;
81     }
82
83     /**
84      *
85      * @return the current value in the adjustment event
86      */

87     public int getValue() {
88         return value;
89     }
90
91     /**
92      *
93      * @return one of the adjustment values listed above
94      */

95     public int getAdjustmentType() {
96         return adjustmentType;
97     }
98
99     /**
100      *
101      * @return true if this is one of multiple adjustment events
102      */

103     public boolean getValueIsAdjusting() {
104         return isAdjusting;
105     }
106
107 }
108
Popular Tags