blob: 4ec0d3a19836e3f189e7b4e27f15de0704cb4a11 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
/*
@ITMillApache2LicenseForJavaFiles@
*/
package com.itmill.toolkit.tests.book;
import com.itmill.toolkit.terminal.Resource;
import com.itmill.toolkit.ui.Button;
import com.itmill.toolkit.ui.CustomComponent;
public class EmbeddedButton extends CustomComponent implements
Button.ClickListener {
Button thebutton;
public EmbeddedButton(Resource icon) {
/* Create a Button without a caption. */
thebutton = new Button();
/* Set the icon of the button from a resource. */
thebutton.setIcon(icon);
/*
* Set the style to link; this leaves out the button frame so you just
* have the image in the link.
*/
thebutton.setStyle("link");
/* Listen for ClickEvents. */
thebutton.addListener(this);
setCompositionRoot(thebutton);
}
/** Handle button click events from the button. */
public void buttonClick(Button.ClickEvent event) {
thebutton.setIcon(null);
thebutton.setCaption("You successfully clicked on the icon");
}
}
|