if (backgroundColor != null) {
origColor = display.getBackgroundColor();
display.setBackgroundColor(backgroundColor);
}
RegionsContainer regionsContainer = ContainerUtils.getRegionsContainer();
// add all defined content panels
for (Region region : contents.keySet()) {
JPanel panel = contents.get(region);
regionsContainer.setRegionContent(region, panel, false);
}
// setup the timer (if applicable)
if (displayDuration > 0) {
timeoutHandler = new DefaultTimeoutHandler();
timeoutHandler.setDefaultTimerDuration(displayDuration);
}
// check whether the user is allowed to finish by hitting a button
if (finishOnInput) {
// action panel
ActionPanelListener myListener = new ActionPanelListener() {
public void actionTriggered(ActionPanel source, Object actionValue) {
if (getFinishExecutionLock()) {
doCleanup();
finishExecution();
}
}
};
KeyActionPanel actionPanel = new KeyActionPanel();
actionPanel.addKey(KeyEvent.VK_SPACE, "", null);
actionPanel.addActionPanelListener(myListener);
actionPanel.enableActionPanel();
regionsContainer.setRegionContent(Region.SOUTH, actionPanel, false);
}
// display the information
regionsContainer.setAllContentVisibility(true);
// start the timer (if applicable)
if (timeoutHandler != null) {
timeoutHandler.startTimeout(getExecutionContext());
}