diff options
author | Stephan Knitelius <stephan@knitelius.com> | 2017-08-23 08:49:45 +0200 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-08-23 09:49:45 +0300 |
commit | 5b13a397d86a20686d0052cfdec9d39696477655 (patch) | |
tree | bc9c4185acba6879b404baa296c05b7c8fcd205b /server | |
parent | cfb110403b2d3c62f79dec6d38bc6f131a5bd894 (diff) | |
download | vaadin-framework-5b13a397d86a20686d0052cfdec9d39696477655.tar.gz vaadin-framework-5b13a397d86a20686d0052cfdec9d39696477655.zip |
Button icon constructor (#9857)
Added utility constructor for Button(Icon, ClickActionListener):
new Button(VaadinIcons.AIRPLANE, e -> { ... });
Diffstat (limited to 'server')
-rw-r--r-- | server/src/main/java/com/vaadin/ui/Button.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/server/src/main/java/com/vaadin/ui/Button.java b/server/src/main/java/com/vaadin/ui/Button.java index bb1f544622..e768831e33 100644 --- a/server/src/main/java/com/vaadin/ui/Button.java +++ b/server/src/main/java/com/vaadin/ui/Button.java @@ -124,6 +124,20 @@ public class Button extends AbstractFocusable } /** + * Creates a new push button with a click listener. + * + * @param icon + * the Button icon. + * @param listener + * the Button click listener. + * @since 8.2 + */ + public Button(Resource icon, ClickListener listener) { + setIcon(icon); + addClickListener(listener); + } + + /** * Click event. This event is thrown, when the button is clicked. * * @author Vaadin Ltd. |