DrawingArea canvas = new DrawingArea(200, 200); RootPanel.get().add(canvas); Rectangle rect = new Rectangle(10, 10, 100, 50); canvas.add(rect); rect.setFillColor("blue"); rect.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { Rectangle rect = (Rectangle) event.getSource(); if (rect.getFillColor().equals("blue")) { rect.setFillColor("red"); } else { rect.setFillColor("blue"); } } });@author Henri Kerola / IT Mill Ltd
|
|
|
|
|
|
|
|
|
|