import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
+import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JDialog;
panel.setLayout(new BorderLayout());
// Create GUI layout for point name editor
JPanel centrePanel = new JPanel();
- centrePanel.add(new JLabel(I18nManager.getText("dialog.pointnameedit.name") + ":"));
+ centrePanel.setLayout(new BorderLayout(8, 8));
+ centrePanel.add(new JLabel(I18nManager.getText("dialog.pointnameedit.name") + ": "), BorderLayout.WEST);
// Make listener to react to ok being pressed
ActionListener okActionListener = new ActionListener() {
public void actionPerformed(ActionEvent e)
}
});
_nameField.addActionListener(okActionListener);
- centrePanel.add(_nameField);
- panel.add(centrePanel);
+ centrePanel.add(_nameField, BorderLayout.CENTER);
+ // holder panel to stop the text box from being stretched
+ JPanel holderPanel = new JPanel();
+ holderPanel.setLayout(new BorderLayout());
+ holderPanel.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
+ holderPanel.add(centrePanel, BorderLayout.NORTH);
+ panel.add(holderPanel, BorderLayout.CENTER);
JPanel rightPanel = new JPanel();
rightPanel.setLayout(new BoxLayout(rightPanel, BoxLayout.Y_AXIS));
JButton upperButton = new JButton(I18nManager.getText("dialog.pointnameedit.uppercase"));
}
});
rightPanel.add(lowerButton);
- JButton sentenceButton = new JButton(I18nManager.getText("dialog.pointnameedit.sentencecase"));
- sentenceButton.addActionListener(new ActionListener() {
+ JButton titleButton = new JButton(I18nManager.getText("dialog.pointnameedit.titlecase"));
+ titleButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
- _nameField.setText(sentenceCase(_nameField.getText()));
+ _nameField.setText(titleCase(_nameField.getText()));
_okButton.setEnabled(true);
_nameField.requestFocus();
}
});
- rightPanel.add(sentenceButton);
+ rightPanel.add(titleButton);
panel.add(rightPanel, BorderLayout.EAST);
// Bottom panel for OK, cancel buttons
JPanel lowerPanel = new JPanel();
}
/**
- * Turn a String into sentence case by capitalizing each word
+ * Turn a String into title case by capitalizing each word
* @param inString String to convert
* @return capitalized String
*/
- private static String sentenceCase(String inString)
+ private static String titleCase(String inString)
{
// Check first for empty strings
if (inString == null || inString.equals(""))