I am current trying to create tab that has a check mark when the I click done and then shows an an "X" when I click cancel. Currently I have my tab written in XML. I am wondering how I would go about implementing this. I am thinking about using two labels and combining them together. One will be in XML the other one will be in java only. I am also wondering how i would space these two so they over lap and act as one tab together.
public class buttonclickers extends Composite {
private static buttonclickersUiBinder uiBinder = GWT
.create(buttonclickersUiBinder.class);
@UiField PushButton button_1;
@UiField PushButton button_2;
interface buttonclickersUiBinder extends UiBinder<Widget, buttonclickers> {
}
public buttonclickers() {
initWidget(uiBinder.createAndBindUi(this));
}
@UiHandler("button_1")
void onButton_1Click(ClickEvent event) {
AppUtils.EVENT_BUS.fireEvent(new ButtonEvent());
}
@UiHandler("button_2")
void onButton_2Click(ClickEvent event) {
}
}
This is what I have so far. Is there anyway to change the image on these xml buttons when I press it? Any idea will help thank you!
Edit: So I ran into this website http://www.javacodegeeks.com/2012/03/gwt-custom-button-using-uibinder.html and it shows how to add an image to a button. I would like to do the same thing but instead of having a static image I want the image to change every time I clicked done or cancel.
Edit: current I have a label and image. I want to be able to change that image every time I press a button.
private static buttonclickersUiBinder uiBinder = GWT
.create(buttonclickersUiBinder.class);
@UiField PushButton button_1;
@UiField PushButton button_2;
@UiField Image checkimage;
@UiField Label label_one;
interface buttonclickersUiBinder extends UiBinder<Widget, buttonclickers> {
}
public buttonclickers() {
initWidget(uiBinder.createAndBindUi(this));
}
@UiHandler("button_1")
void onButton_1Click(ClickEvent event) {
AppUtils.EVENT_BUS.fireEvent(new ButtonEvent());
}
@UiHandler("button_2")
void onButton_2Click(ClickEvent event) {
}
@UiHandler("checkimage")
void onCheckimageClick(ClickEvent event) {
Window.alert("hit");
AppUtils.EVENT_BUS.fireEvent(new ButtonEvent());
}
@UiHandler("label_one")
void onLabel_oneClick(ClickEvent event) {
AppUtils.EVENT_BUS.fireEvent(new ButtonEvent());
}
}
I understand we have checkimage as the id. is it possible that I just add other images into the xml and call it whenever something is pressed?