Improve file/volume name editing in create wizard.

This commit is contained in:
John B. Matthews 2008-08-24 10:00:21 +00:00
parent e0b0cb5d8b
commit f378b7f586

View File

@ -125,8 +125,13 @@ public class DiskImageNamePane extends WizardPane {
* @return the modified name
*/
private String edit(String name, Event e) {
if (e.character != '\b') return name + e.text;
else return name.substring(0, name.length() - 1);
if (e.character == '\b') {
return name.substring(0, e.start)
+ name.substring(e.end);
} else {
return name.substring(0, e.start)
+ e.text + name.substring(e.end);
}
}
/**
* Enable the Next button when data has been entered into all fields.