在GWT中使用NotificationMole

dst*_*nox 7 gwt toast

我正在寻找类似于针对GWT的Android Toast通知的组件(我用Google搜索得足够长,我知道有一个Ext-GWT有类似的东西,但我想避免使用外部库).似乎NotificationMole是我正在寻找的组件,并且该组件在GWT 2.1中可用.但是,当我尝试在我的应用程序中显示它时,它永远不会出现.有没有人用过这个组件?以下是我如何使用它的示例:

NotificationMole nm = new NotificationMole();
nm.setAnimationDuration(2000);
nm.setTitle("Title");
nm.setHeight("100px");
nm.setWidth("200px");
nm.setMessage("Test message to be shown in mole");
nm.show();
Run Code Online (Sandbox Code Playgroud)

Jas*_*erk 10

必须先将NotificationMole附加到DOM,然后才能显示:

HasWidgets panel; // This can be any panel that accepts children.
NotificationMole nm = new NotificatioMole();
panel.add(nm);
// Setup the NotificationMole...
nm.show();
Run Code Online (Sandbox Code Playgroud)