I have the following code that creates a menu with 3 buttons:
[java]private ScreenBuilder createScreen()
{
return new ScreenBuilder(“player”) {{
controller(HudController.this);
layer(new LayerBuilder(“background”) {{
childLayoutCenter();
panel(new PanelBuilder("panel_hud") {{
childLayoutHorizontal();
}});
layer(new LayerBuilder("left_side_layer") {{
childLayoutHorizontal();
alignLeft();
valignTop();
panel(new PanelBuilder("panel_modifier_buttons") {{
// sets the menu to horizontal
childLayoutHorizontal();
// align it to left top
alignLeft();
valignTop();
// width of the buttons
width("20%");
control(constructButton("ShowEnergy", "Energy Level"));
control(constructButton("ShowPower", "Power Level"));
control(constructButton("ShowHelp", "Help"));
}});
}});
layer(new LayerBuilder("dialog_panel_layer") {{
childLayoutCenter();
layer(new LayerBuilder("dialog_selection_layer") {{
childLayoutAbsolute();
}});
}});
}});
}};
}
private ButtonBuilder constructButton(String id, String label)
{
return new ButtonBuilder(id, label) {{
width(“100%”);
alignCenter();
valignCenter();
visibleToMouse(true);
this.focusable(false);
}};
}
[/java]
Is there any way I could change the label of the button after the menu has already been constructed? There is a method set() to change that. But the question is how can I access that. I tried playing around with screen.findElement… but it got a little confusing. Can anyone guide me on this one?