【问题标题】:How to apply a different backgroundcolor for GWT decoratedPopupPanel?如何为 GWT decoratedPopupPanel 应用不同的背景颜色?
【发布时间】:2014-07-13 00:59:22
【问题描述】:
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();

        }
    });

【问题讨论】:

    标签: java gwt popup ui-design


    【解决方案1】:

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

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

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

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

    CSS:

    .myPopupPanelStyle {
      background: #0000FF;
    }
    

    JAVA:

    infoPopup.setStyleName("myPopupPanelStyle");
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-11-09
      • 1970-01-01
      • 2016-07-13
      • 2020-04-01
      • 2018-11-18
      • 2011-04-29
      • 1970-01-01
      相关资源
      最近更新 更多