Prompt prompt = (Prompt)component;
prompt.getPromptListeners().add(this);
// Load the prompt content
WTKXSerializer wtkxSerializer = new WTKXSerializer();
Component content = null;
try {
content = (Component)wtkxSerializer.readObject(getClass().getResource("prompt_skin.wtkx"));
} catch(Exception exception) {
throw new RuntimeException(exception);
}
prompt.setContent(content);
// Set the type image
TerraTheme theme = (TerraTheme)Theme.getTheme();
ImageView typeImageView = wtkxSerializer.getObjectByID("typeImageView");
typeImageView.setImage(theme.getMessageIcon(prompt.getMessageType()));
// Set the message
Label messageLabel = wtkxSerializer.getObjectByID("messageLabel");
String message = prompt.getMessage();
messageLabel.setText(message);
// Set the body
FlowPane messageFlowPane = wtkxSerializer.getObjectByID("messageFlowPane");
Component body = prompt.getBody();
if (body != null) {
messageFlowPane.add(body);
}
// Add the option buttons
FlowPane buttonFlowPane = wtkxSerializer.getObjectByID("buttonFlowPane");
for (int i = 0, n = prompt.getOptionCount(); i < n; i++) {
Object option = prompt.getOption(i);
PushButton optionButton = new PushButton(option);