示例#1
0
 private void addSuggestPanel() {
   HorizontalPanel langPanel = new HorizontalPanel();
   langPanel.setSpacing(5);
   langPanel.add(new HTML("Enter language:"));
   MultiWordSuggestOracle langChoices = new ProgrammingLanguageOracle();
   SuggestBox langBox = new SuggestBox(langChoices);
   langPanel.add(langBox);
   Button searchButton = new Button("Send to Google");
   searchButton.addClickHandler(new SearchHandler(langBox));
   langPanel.add(searchButton);
   RootPanel.get("suggest-panel").add(langPanel);
 }
示例#2
0
 private void addPanelForPopups() {
   HorizontalPanel buttonPanel = new HorizontalPanel();
   buttonPanel.setSpacing(10);
   Button button1 = new Button("DialogBox");
   button1.addClickHandler(new DialogHandler());
   buttonPanel.add(button1);
   Button button2 = new Button("PopupPanel");
   button2.addClickHandler(new PopupHandler());
   buttonPanel.add(button2);
   Button button3 = new Button("Native Dialog (Alert) Box");
   button3.addClickHandler(new AlertHandler());
   buttonPanel.add(button3);
   RootPanel.get("popup-buttons").add(buttonPanel);
 }
示例#3
0
 private void addMenuPanel() {
   HorizontalPanel searchPanel = new HorizontalPanel();
   searchPanel.setSpacing(5);
   searchPanel.add(new HTML("Enter language:"));
   MultiWordSuggestOracle langChoices = new ProgrammingLanguageOracle();
   final SuggestBox langBox = new SuggestBox(langChoices);
   searchPanel.add(langBox);
   MenuBar mainMenu = new MenuBar();
   MenuBar searchMenu = new SearchMenuBar(langBox);
   mainMenu.addItem("Search", searchMenu);
   Command alertCommand =
       new Command() {
         public void execute() {
           Window.alert("Selection is " + langBox.getText());
         }
       };
   mainMenu.addItem("Alert", alertCommand);
   MenuBar modifierMenu = new ModifierMenuBar(langBox);
   mainMenu.addItem("Modify", modifierMenu);
   searchPanel.add(mainMenu);
   RootPanel.get("menu-panel").add(searchPanel);
 }