public void startup(final Display display, Map<String, String> properties)
throws Exception {
Picture picture = (Picture)Image.load(getClass().getResource("IMG_0767_2.jpg"));
picture.resample(120);
PushButton windowContent = new PushButton(picture);
windowContent.setPreferredSize(480, 360);
frame = new Frame(windowContent);
frame.getStyles().put("padding", 0);
frame.open(display);
final TablePane tablePane = new TablePane();
tablePane.setPreferredSize(320, 240);
tablePane.getColumns().add(new TablePane.Column(1, true));
tablePane.getRows().add(new TablePane.Row(1, true));
tablePane.getRows().add(new TablePane.Row(-1));
final Label sheetContent = new Label("Sheet Content");
sheetContent.getStyles().put("wrapText", true);
sheetContent.getStyles().put("horizontalAlignment", HorizontalAlignment.CENTER);
sheetContent.getStyles().put("verticalAlignment", VerticalAlignment.CENTER);
tablePane.getRows().get(0).add(sheetContent);
Label promptBody = new Label("Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.");
promptBody.getStyles().put("wrapText", true);
final Prompt prompt = new Prompt(MessageType.INFO, "Prompt", new ArrayList<String>("OK"), promptBody);
prompt.setTitle("Prompt");
Label alertBody = new Label("Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.");
alertBody.getStyles().put("wrapText", true);
final Alert alert = new Alert(MessageType.INFO, "Alert", new ArrayList<String>("OK"), alertBody);
alert.setTitle("Alert");
BoxPane boxPane = new BoxPane();
tablePane.getRows().get(1).add(boxPane);
boxPane.getStyles().put("horizontalAlignment", HorizontalAlignment.RIGHT);
final PushButton closeButton = new PushButton("Close");
closeButton.getStyles().put("minimumAspectRatio", 3);
boxPane.add(closeButton);
sheet = new Sheet(tablePane);
closeButton.getButtonPressListeners().add(new ButtonPressListener() {
@Override
public void buttonPressed(Button button) {
button.getWindow().close();
}
});
windowContent.getButtonPressListeners().add(new ButtonPressListener() {
@Override
public void buttonPressed(Button button) {
// sheet.open(frame);
prompt.open(frame);
// alert.open(frame);
}
});
sheet.getWindowStateListeners().add(new WindowStateListener() {
@Override
public Vote previewWindowOpen(Window window, Display display) {
return Vote.APPROVE;
}
@Override
public void windowOpenVetoed(Window window, Vote reason) {
}
@Override
public void windowOpened(Window window) {
closeButton.requestFocus();
}
@Override
public Vote previewWindowClose(Window window) {
return Vote.APPROVE;