From cf607e8c6ab4a130f614967375d0004c792f8d95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Thu, 6 Oct 2011 10:59:36 +0200 Subject: vaadin-app: MainLayout uses Resources class --- vaadin-app/src/ch/asynk/helloworld/MainLayout.java | 18 +++++++++--------- 1 file 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(), "italic bold 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"); -- cgit v1.1-2-g2b99