Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.google.gwt.sample.jribble.client;
- import com.google.gwt.core.client.EntryPoint;
- import com.google.gwt.event.dom.client.ClickEvent;
- import com.google.gwt.event.dom.client.ClickHandler;
- import com.google.gwt.user.client.ui.Button;
- import com.google.gwt.user.client.Window;
- import com.google.gwt.user.client.ui.RootPanel;
- class Hello extends EntryPoint {
- def onModuleLoad() {
- val numbers = List(1, 2, 3, 4)
- val strings = numbers map (_.toString + "...")
- val a = foo(1)
- val s = a.toList.toString
- val b = new Button("Click me", (_: ClickEvent) => Window.alert("Hello, AJAX, said Scala\nThose numbers are coming from list!\n" + s));
- RootPanel.get().add(b);
- }
- def foo[T: ClassManifest](x: T): Array[Array[T]] = foo2(Array.tabulate(2)(_ => x))
- def foo2[T: ClassManifest](x: T): Array[T] = Array.tabulate(2)(_ => x)
- implicit def clickHandler(f: ClickEvent => Unit): ClickHandler = new ClickHandler {
- def onClick(event: ClickEvent) = f(event)
- }
- }
Add Comment
Please, Sign In to add comment