1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package net.sf.dexterim.ui;
20
21 import java.text.NumberFormat;
22
23 import javax.swing.JFormattedTextField;
24 import javax.swing.JPanel;
25
26
27 /***
28 * @author christoph
29 *
30 */
31 public class JIndexPanel extends JPanel {
32
33 private JFormattedTextField startIndexField;
34 private JFormattedTextField endIndexField;
35
36 public JIndexPanel() {
37 this(0, 0);
38 }
39
40 public JIndexPanel(int startIndex, int endIndex) {
41 super();
42
43 startIndexField = new JFormattedTextField(NumberFormat.getIntegerInstance());
44 startIndexField.setValue(new Integer(startIndex));
45 add(startIndexField);
46
47 endIndexField = new JFormattedTextField(NumberFormat.getIntegerInstance());
48 endIndexField.setValue(new Integer(endIndex));
49 add(endIndexField);
50 }
51
52 /***
53 * @return Returns the endIndex.
54 */
55 public int getEndIndex() {
56 return new Integer(endIndexField.getValue().toString()).intValue();
57 }
58
59 /***
60 * @param endIndex The endIndex to set.
61 */
62 public void setEndIndex(int endIndex) {
63 endIndexField.setValue(new Integer(endIndex));
64 }
65
66 /***
67 * @return Returns the startIndex.
68 */
69 public int getStartIndex() {
70 return new Integer(startIndexField.getValue().toString()).intValue();
71 }
72
73 /***
74 * @param startIndex The startIndex to set.
75 */
76 public void setStartIndex(int startIndex) {
77 startIndexField.setValue(new Integer(startIndex));
78 }
79 }