]> dxcluster.net Git - spider.git/blob - spider-web/IntTextField.java
fix mrtg to not use /var/* tree in debian/ubuntu
[spider.git] / spider-web / IntTextField.java
1 import java.awt.*;
2
3 public class IntTextField extends TextField
4 {
5
6         public IntTextField()
7         {
8                 ;
9         }
10         
11         public IntTextField(String s) 
12         {
13                 this.setText(s);
14         }
15         
16         public boolean isValid()
17         {
18                 int value;
19                 try
20                 {
21                         value = Integer.valueOf(getText().trim()).intValue();
22
23                 }
24                 catch (NumberFormatException e)
25                 {
26                         requestFocus();
27                         return false;
28                 }
29                 return true;
30         }
31         
32         public int getValue()
33         {
34                 return Integer.parseInt(getText().trim(),10);
35         }
36 }