rinku
rinku

Reputation: 415

GWT popuppanel how to freez the background and add the title

I am newly using GWT. I am using a simple code to create popup I add few labels ontop and show()

final PopupPanel popup = new PopupPanel();

popup.setTitle("Start connector");
popup.add(new Label("Hello"));

popup.center();
popup.show();

Now I need two things:

  1. freeze the background when the popup is displayed
  2. the setTitle() does not add the title to the popuppanel window.

any hints will be useful.

Regards, Rohit

Upvotes: 0

Views: 3473

Answers (2)

ashish kumar
ashish kumar

Reputation: 1

I had the same issue. Then i replaced popupPanel with DialogBox and it is working fine.

Upvotes: 0

Thomas Broyer
Thomas Broyer

Reputation: 64541

freeze the background when the popup is displayed

Have a look at setGlassEnabled.

From the PopupPanel javadoc:

The PopupPanel can be optionally displayed with a "glass" element behind it, which is commonly used to gray out the widgets behind it. It can be enabled using setGlassEnabled(boolean). It has a default style name of "gwt-PopupPanelGlass", which can be changed using setGlassStyleName(String).

Just an advice: do not use the "modal" behavior of PopupPanel, it's way too buggy to be usable. setGlassEnabled was added later as a replacement (not fully equivalent, but behaving reliably), and setModal is only kept there for backwards compatiibility.


the setTitle() does not add the title to the popuppanel window.

As the javadoc says:

The title is the 'tool-tip' displayed to users when they hover over the object.

You're responsible for the PopupPanel's content. Either you put a Label or whatever in the PopupPanel and make it look like a "title", or you can use a DialogBox.

Upvotes: 10

Related Questions