如何为GET装饰的PopupPanel应用不同的背景颜色?

时间:2014-05-23 15:27:07

标签: java gwt popup ui-design

final DecoratedPopupPanel infoPopup = new DecoratedPopupPanel(true);
    infoPopup.setWidget(new Label("Table below displays the total number of users for each application for the selected time range."));
    infoPopup.setWidth("150px");

    inImage.addMouseOverHandler(new MouseOverHandler(){
        public void onMouseOver(MouseOverEvent arg0){
            int left = inImage.getAbsoluteLeft() + 10;
            int top = inImage.getAbsoluteTop() + 10;
           infoPopup.setPopupPosition(left, top);

            // Show the popup
            infoPopup.show();
        }

    });

    inImage.addMouseOutHandler(new MouseOutHandler(){
        public void onMouseOut(MouseOutEvent arg0){
           //hide
            infoPopup.hide();

        }
    });

1 个答案:

答案 0 :(得分:0)

您可以使用CSS创建自己的自定义样式来实现它。

默认情况下DecoratedPopupPanel使用 clean.css 中定义的gwt-DecoratedPopupPanel样式。

.gwt-DecoratedPopupPanel .popupMiddleCenter {
    padding: 3px;
    background: #f1f1f1;
}

创建自己的样式,只需更新背景颜色属性并在其上应用样式,如下所示:

CSS:

.myPopupPanelStyle {
  background: #0000FF;
}

JAVA:

infoPopup.setStyleName("myPopupPanelStyle");