KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > calipso > reportgenerator > userinterface > UPIntegerTextField


1 package com.calipso.reportgenerator.userinterface;
2
3 import com.calipso.reportgenerator.reportcalculator.SharedInteger;
4
5 import javax.swing.text.Document JavaDoc;
6
7 /**
8  * Representa un componente <code>JTextField</code> a incluirse en una instancia
9  * de <code>UPRangePanel</code> o <code>UPValuePanel</code>.
10  * Devuele el texto del componente en un objeto <code>SharedInteger</code>
11  */

12
13 public class UPIntegerTextField extends UPTextField {
14
15   public UPIntegerTextField() {
16   }
17
18   public UPIntegerTextField(String JavaDoc text) {
19     super(text);
20   }
21
22   public UPIntegerTextField(int columns) {
23     super(columns);
24   }
25
26   public UPIntegerTextField(String JavaDoc text, int columns) {
27     super(text, columns);
28   }
29
30   public UPIntegerTextField(Document JavaDoc doc, String JavaDoc text, int columns) {
31     super(doc, text, columns);
32   }
33
34   public boolean isLessThan(UPTextField upTextField) {
35     SharedInteger integer = (SharedInteger) getComponentValue();
36     int result = integer.compareTo(upTextField.getComponentValue());
37     if(result > 0) {
38       return false;
39     } else {
40       return true;
41     }
42   }
43
44   public Object JavaDoc getComponentValue() {
45     String JavaDoc text = super.getText();
46     return SharedInteger.newFrom(Integer.valueOf(text));
47   }
48 }
49
Popular Tags