Change style for PopupPanel : PopupPanel « GWT « Java






Change style for PopupPanel



package com.java2s.gwt.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.HTML;

public class GWTClient implements EntryPoint {

  public void onModuleLoad() {
    Button b = new Button("Click me", new ClickListener() {
      public void onClick(Widget sender) {
        MyPopup p = new MyPopup();
        int left = sender.getAbsoluteLeft() + 10;
        int top = sender.getAbsoluteTop() + 10;
        p.setPopupPosition(left, top);
        p.show();
      }
    });

    RootPanel.get().add(b);
  }
}
class MyPopup extends PopupPanel {
  public MyPopup() {
    super(true);

    HTML contents = new HTML("Click anywhere outside this popup to make it disappear.");
    contents.setWidth("128px");
    setWidget(contents);

    setStyleName("popups-Popup");
  }
}

           
       








GWT-setCustomStyle.zip( 2 k)

Related examples in the same category

1.extends PopupPanel to create Tooltip
2.Set position of PopupPanel