0

when **

Window.alert

** is used in gwt, a window pops up with the message , I want to **

change the title

** of that window , Please help as I need it urgently

Javier Brooklyn
  • 624
  • 3
  • 9
  • 25
Ekata
  • 259
  • 2
  • 7
  • 21

2 Answers2

0

Window.alert() opens a native dialog box which contais OK button. You can not change the title of it.

Use PopupPanel or DecoratedPopupPanel or DialogBox

bNd
  • 7,512
  • 7
  • 39
  • 72
  • how to add the contents to dialogBox , i created a label and added it to dialogBox , then i added a button- its throwing an exception – Ekata Feb 06 '13 at 05:15
  • Use layout panel. i.e. VerticlePanel, HorizonatalPanel..etc. put widgets in it. and finally add this layout with widgets group in dialog. because only one widgets you allow to put in dialogbox. – bNd Feb 06 '13 at 05:24
  • @Ekata, If you find this answer useful then you should accept it. – RAS Feb 06 '13 at 06:37
0

You cant change the title of that ..for that you need to look into another alternative ..

Below is one of them.

Here is a simple dialog box which is genreated from GWT sample code

// Create the popup dialog box
    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText("Remote Procedure Call");
    dialogBox.setAnimationEnabled(true);
    final Button closeButton = new Button("Close");
    // We can set the id of a widget by accessing its Element
    closeButton.getElement().setId("closeButton");
    final Label textToServerLabel = new Label();
    final HTML serverResponseLabel = new HTML();
    VerticalPanel dialogVPanel = new VerticalPanel();
    dialogVPanel.addStyleName("dialogVPanel");
    dialogVPanel.add(new HTML("<b>Sending name to the server:</b>"));
    dialogVPanel.add(textToServerLabel);
    dialogVPanel.add(new HTML("<br><b>Server replies:</b>"));
    dialogVPanel.add(serverResponseLabel);
    dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT);
    dialogVPanel.add(closeButton);
    dialogBox.setWidget(dialogVPanel);

Add your lables and widgets in middle to get the desired dialog ..

Suresh Atta
  • 120,458
  • 37
  • 198
  • 307