BoxPane boxPane = new BoxPane(Orientation.VERTICAL);
section.add(boxPane);
Form.setLabel(boxPane, key);
FlowPane flowPane = new FlowPane();
flowPane.getStyles().put("alignToBaseline", true);
flowPane.getStyles().put("horizontalSpacing", 5);
boxPane.add(flowPane);
TextInput textInput = new TextInput();
textInput.setTextSize(4);
textInput.setMaximumLength(4);
textInput.setValidator(new IntValidator());
textInput.setText(String.valueOf(cornerRadii.topLeft));
flowPane.add(textInput);
textInput.getComponentStateListeners().add(new ComponentStateListener.Adapter() {
@Override
public void focusedChanged(Component component, Component obverseComponent) {
if (!component.isFocused()) {
TextInput textInput = (TextInput)component;
CornerRadii cornerRadii = (CornerRadii)dictionary.get(key);
try {
int topLeft = Integer.parseInt(textInput.getText());
dictionary.put(key, new CornerRadii(topLeft, cornerRadii.topRight,
cornerRadii.bottomLeft, cornerRadii.bottomRight));
} catch (Exception exception) {
displayErrorMessage(exception, component.getWindow());
textInput.setText(String.valueOf(cornerRadii.topLeft));
}
}
}
});
Label label = new Label("topLeft");
label.getStyles().put("font", "{italic:true}");
flowPane.add(label);
flowPane = new FlowPane();
flowPane.getStyles().put("alignToBaseline", true);
flowPane.getStyles().put("horizontalSpacing", 5);
boxPane.add(flowPane);
textInput = new TextInput();
textInput.setTextSize(4);
textInput.setMaximumLength(4);
textInput.setValidator(new IntValidator());
textInput.setText(String.valueOf(cornerRadii.topRight));
flowPane.add(textInput);
textInput.getComponentStateListeners().add(new ComponentStateListener.Adapter() {
@Override
public void focusedChanged(Component component, Component obverseComponent) {
if (!component.isFocused()) {
TextInput textInput = (TextInput)component;
CornerRadii cornerRadii = (CornerRadii)dictionary.get(key);
try {
int topRight = Integer.parseInt(textInput.getText());
dictionary.put(key, new CornerRadii(cornerRadii.topLeft, topRight,
cornerRadii.bottomLeft, cornerRadii.bottomRight));
} catch (Exception exception) {
displayErrorMessage(exception, component.getWindow());
textInput.setText(String.valueOf(cornerRadii.topRight));
}
}
}
});
label = new Label("topRight");
label.getStyles().put("font", "{italic:true}");
flowPane.add(label);
flowPane = new FlowPane();
flowPane.getStyles().put("alignToBaseline", true);
flowPane.getStyles().put("horizontalSpacing", 5);
boxPane.add(flowPane);
textInput = new TextInput();
textInput.setTextSize(4);
textInput.setMaximumLength(4);
textInput.setValidator(new IntValidator());
textInput.setText(String.valueOf(cornerRadii.bottomLeft));
flowPane.add(textInput);
textInput.getComponentStateListeners().add(new ComponentStateListener.Adapter() {
@Override
public void focusedChanged(Component component, Component obverseComponent) {
if (!component.isFocused()) {
TextInput textInput = (TextInput)component;
CornerRadii cornerRadii = (CornerRadii)dictionary.get(key);
try {
int bottomLeft = Integer.parseInt(textInput.getText());
dictionary.put(key, new CornerRadii(cornerRadii.topLeft,
cornerRadii.topRight, bottomLeft, cornerRadii.bottomRight));
} catch (Exception exception) {
displayErrorMessage(exception, component.getWindow());
textInput.setText(String.valueOf(cornerRadii.bottomLeft));
}
}
}
});
label = new Label("bottomLeft");
label.getStyles().put("font", "{italic:true}");
flowPane.add(label);
flowPane = new FlowPane();
flowPane.getStyles().put("alignToBaseline", true);
flowPane.getStyles().put("horizontalSpacing", 5);
boxPane.add(flowPane);
textInput = new TextInput();
textInput.setTextSize(4);
textInput.setMaximumLength(4);
textInput.setValidator(new IntValidator());
textInput.setText(String.valueOf(cornerRadii.bottomRight));
flowPane.add(textInput);
textInput.getComponentStateListeners().add(new ComponentStateListener.Adapter() {
@Override
public void focusedChanged(Component component, Component obverseComponent) {
if (!component.isFocused()) {
TextInput textInput = (TextInput)component;
CornerRadii cornerRadii = (CornerRadii)dictionary.get(key);
try {
int bottomRight = Integer.parseInt(textInput.getText());
dictionary.put(key, new CornerRadii(cornerRadii.topLeft,
cornerRadii.topRight, cornerRadii.bottomLeft, bottomRight));
} catch (Exception exception) {
displayErrorMessage(exception, component.getWindow());
textInput.setText(String.valueOf(cornerRadii.bottomRight));
}
}
}
});
label = new Label("bottomRight");
label.getStyles().put("font", "{italic:true}");
flowPane.add(label);
return boxPane;
}