1 |
|
//---PACKAGE DECLARATION--- |
2 |
< |
uk.ac.ukc.iscream.conient.datacomponents; |
2 |
> |
package uk.ac.ukc.iscream.conient.datacomponents; |
3 |
|
|
4 |
|
//---IMPORTS--- |
5 |
|
import javax.swing.JLabel; |
27 |
|
/** |
28 |
|
* The default length of the JTextField |
29 |
|
*/ |
30 |
< |
private final int DEFAULT_DISPLAY_LENGTH = 20; |
30 |
> |
private final int DEFAULT_TEXT_LENGTH = 20; |
31 |
|
|
32 |
|
//---STATIC METHODS--- |
33 |
|
|
41 |
|
* @param attribute the data attribute we look after |
42 |
|
*/ |
43 |
|
public StringDataComponent(String name, String attribute) { |
44 |
– |
this(name, attribute, DEFAULT_DISPLAY_LENGTH); |
45 |
– |
} |
46 |
– |
|
47 |
– |
/** |
48 |
– |
* Creates the component with a friendly name to be |
49 |
– |
* used as label |
50 |
– |
* |
51 |
– |
* @param name the friendly name |
52 |
– |
* @param attribute the data attribute we look after |
53 |
– |
* @param displayLength the length of the JTextField |
54 |
– |
*/ |
55 |
– |
public StringDataComponent(String name, String attribute, int displayLength) { |
44 |
|
_name = name; |
45 |
|
_attribute = attribute; |
46 |
< |
_displayLength = displayLength; |
59 |
< |
_item = new JTextField("", _displayLength); |
46 |
> |
_item = new JTextField("", DEFAULT_TEXT_LENGTH); |
47 |
|
_item.setEditable(false); |
48 |
|
_label = new JLabel(_name + ": "); |
49 |
|
_label.setHorizontalAlignment(JLabel.RIGHT); |