diff options
Diffstat (limited to 'vaadin-app/src')
-rw-r--r-- | vaadin-app/src/ch/asynk/helloworld/MainLayout.java | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/vaadin-app/src/ch/asynk/helloworld/MainLayout.java b/vaadin-app/src/ch/asynk/helloworld/MainLayout.java index 0ab997a..e04a7c4 100644 --- a/vaadin-app/src/ch/asynk/helloworld/MainLayout.java +++ b/vaadin-app/src/ch/asynk/helloworld/MainLayout.java @@ -1,6 +1,5 @@ package ch.asynk.helloworld; - import java.util.Date; import com.vaadin.terminal.UserError; @@ -23,8 +22,8 @@ public class MainLayout extends VerticalLayout { ctx = context; // final AbstractComponent ctrlPanel = buildListsPanel(); - ctrlPanel.setWidth(500,UNITS_PIXELS); - ctrlPanel.setHeight(400,UNITS_PIXELS); + ctrlPanel.setWidth(250,UNITS_PIXELS); + ctrlPanel.setHeight(300,UNITS_PIXELS); addComponent(ctrlPanel); setComponentAlignment(ctrlPanel, Alignment.MIDDLE_CENTER); // @@ -40,24 +39,25 @@ public class MainLayout extends VerticalLayout { Label label = new Label("Hello world"); layout.addComponent(label); // - layout.addComponent( new Button("What is the time?", new Button.ClickListener() { + Button clockBtn = new Button("What is the time?"); + layout.addComponent( clockBtn ); + clockBtn.setIcon(Resources.clockIcon); + clockBtn.addListener( new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { ctx.getApp().notifyError("The time is " + new Date(), "<i>italic</i> <b>bold</b> description"); event.getButton().setComponentError( new UserError("Stop pressing this button !!") ); } - })); + }); /// - Button exceptionButton = new Button("throw an exception"); - layout.addComponent(exceptionButton ); - exceptionButton.addListener( new Button.ClickListener() { + layout.addComponent( new Button("throw an exception", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { throw new RuntimeException("Wahou !! : exception"); } - }); + })); // Button nextButton = new Button("next layout"); nextButton.setDescription("Go to next layout"); |