I'm not sure what library uses ButtonListenerAdapters, maybe GWT-EXT?
But vanilla GWT works:
/**
* This is the entry point method.
*/
final VerticalPanel m_content = new VerticalPanel();
Button button1 = new Button("Click Me");
Button button2 = new Button("Ta-daaa!");
public void onModuleLoad() {
//Ring Menu Test.
RootPanel.get().add(m_content);
m_content.add(button1);
button1.addClickListener(new ClickListener()
{
public void onClick(Widget sender)
{
m_content.add(button2);
}
});
}
Try mimicking that but with your UI library, see if it works.
On Mar 5, 8:18 am, sohail1u <[email protected]> wrote:
> HI, I want to add a button(button3) in verticalpanel on clicking of
> button1. I wrote the code as below but it is not working. The button3
> is not getting displayed(or added to the verticalpanel). Can anybody
> tell me what is wrong with the code?
>
> public class myExample implements EntryPoint {
>
> private Panel verticalPanel = new Panel();
> private Button button3; //= new Button("New 1");
> private Button button1 = new Button("Button1", new
> ButtonListenerAdapter() {
> public void onClick(Button button, EventObject e) {
> //button2.setText("2changed");
>
> verticalPanel.add(button3);
> }
> });
> private Button button2 = new Button("Button2", new
> ButtonListenerAdapter() {
> public void onClick(Button button, EventObject e) {
> button1.setText("1changed");
> }
> });
>
> public void onModuleLoad() {
> button3 = new Button("New 1");
> verticalPanel.setLayout(new VerticalLayout(10));
> verticalPanel.add(button1);
> verticalPanel.add(button2);
> RootPanel.get().add(verticalPanel);
> }
>
> }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---