@Override
public void keyPressed(final KeyEvent pr_Event) {
m_Tower.setTown(townTextField.getText());
}
});
townTextField.setInputVerifier(new NotEmptyValidator(this, townTextField, "You must specify a town."));
add(townTextField, fields);
labels.gridy = 1;
add(new JLabel("Area"), labels);
fields.gridy = 1;
final JTextField areaTextField = new JTextField();
areaTextField.setText(m_Tower.getArea());
areaTextField.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(final KeyEvent pr_Event) {
m_Tower.setArea(areaTextField.getText());
}
});
add(areaTextField, fields);
labels.gridy = 2;
add(new JLabel(Database.camelToWords(Tower.DB_COLUMN_COUNTY)), labels);
fields.gridy = 2;
final JTextField countyTextField = new JTextField();
countyTextField.setText(m_Tower.getCounty());
countyTextField.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(final KeyEvent pr_Event) {
m_Tower.setCounty(countyTextField.getText());
}
});
countyTextField.setInputVerifier(new NotEmptyValidator(this, countyTextField, "You must specify a county."));
add(countyTextField, fields);
labels.gridy = 3;
add(new JLabel(Database.camelToWords(Tower.DB_COLUMN_DEDICATION)), labels);
fields.gridy = 3;
final JTextField dedicationTextField = new JTextField();
dedicationTextField.setText(m_Tower.getDedication());
dedicationTextField.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(final KeyEvent pr_Event) {
m_Tower.setDedication(dedicationTextField.getText());
}
});
add(dedicationTextField, fields);
labels.gridy = 4;
add(new JLabel(Database.camelToWords(Tower.DB_COLUMN_BELLS)), labels);
fields.gridy = 4;
fields.fill = GridBagConstraints.NONE;
final JSpinner numberOfBellsSpinner = new JSpinner(new SpinnerNumberModel(m_Tower.getBells(), 2, 16, 1));
numberOfBellsSpinner.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
m_Tower.setBells(Integer.parseInt(numberOfBellsSpinner.getValue().toString()));
}
});
add(numberOfBellsSpinner, fields);
labels.gridy = 5;
add(new JLabel(Database.camelToWords(Tower.DB_COLUMN_TENOR_WEIGHT)), labels);
fields.gridy = 5;
fields.fill = GridBagConstraints.NONE;
final JTextField tenorWeightTextField = new JTextField();
tenorWeightTextField.setText(m_Tower.getTenorWeight());
tenorWeightTextField.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(final KeyEvent pr_Event) {
m_Tower.setTenorWeight(tenorWeightTextField.getText());
}
});
tenorWeightTextField.setColumns(10);
tenorWeightTextField.setInputVerifier(new NotEmptyValidator(this, tenorWeightTextField, "You must specify a tenor weight."));
add(tenorWeightTextField, fields);
JPanel buttonPanel = new JPanel();
JButton cancelButton = new JButton("Cancel");