当前位置: 首页>>代码示例>>Java>>正文


Java Button.addClickHandler方法代码示例

本文整理汇总了Java中com.google.gwt.user.client.ui.Button.addClickHandler方法的典型用法代码示例。如果您正苦于以下问题:Java Button.addClickHandler方法的具体用法?Java Button.addClickHandler怎么用?Java Button.addClickHandler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.gwt.user.client.ui.Button的用法示例。


在下文中一共展示了Button.addClickHandler方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addButton

import com.google.gwt.user.client.ui.Button; //导入方法依赖的package包/类
private Button addButton(String operation, String name, Character accessKey, String width, ClickHandler clickHandler) {
	Button button = new AriaButton(name);
	button.addClickHandler(clickHandler);
	ToolBox.setWhiteSpace(button.getElement().getStyle(), "nowrap");
	if (accessKey != null)
		button.setAccessKey(accessKey);
	if (width != null)
		ToolBox.setMinWidth(button.getElement().getStyle(), width);
	iOperations.put(operation, iButtons.getWidgetCount());
	iClickHandlers.put(operation, clickHandler);
	iButtons.add(button);
	button.getElement().getStyle().setMarginLeft(4, Unit.PX);
	for (UniTimeHeaderPanel clone: iClones) {
		Button clonedButton = clone.addButton(operation, name, null, width, clickHandler);
		clonedButton.addKeyDownHandler(iKeyDownHandler);
	}
	button.addKeyDownHandler(iKeyDownHandler);
	return button;
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:20,代码来源:UniTimeHeaderPanel.java

示例2: UniTimeMobileMenu

import com.google.gwt.user.client.ui.Button; //导入方法依赖的package包/类
public UniTimeMobileMenu() {
	iMenuButton = new Button(MESSAGES.mobileMenuSymbol());
	iMenuButton.addStyleName("unitime-MobileMenuButton");
	iMenuButton.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			if (iStackPanel.isVisible())
				hideMenu();
			else
				showMenu();
		}
	});
	iStackPanel = new MyStackPanel();
	iStackPanel.setVisible(false);
	initWidget(iMenuButton);
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:17,代码来源:UniTimeMobileMenu.java

示例3: initEdititButton

import com.google.gwt.user.client.ui.Button; //导入方法依赖的package包/类
/**
 * Helper method called by constructor to initialize the edit it button
 * Only seen by app owner.
 */
private void initEdititButton() {
  final User currentUser = Ode.getInstance().getUser();
  if(app.getDeveloperId().equals(currentUser.getUserId())){
    editButton = new Button(MESSAGES.galleryEditText());
    editButton.addClickHandler(new ClickHandler() {
      // Open up source file if clicked the action button
      public void onClick(ClickEvent event) {
        editButton.setEnabled(false);
        Ode.getInstance().switchToGalleryAppView(app, GalleryPage.UPDATEAPP);
      }
    });
    editButton.addStyleName("app-action-button");
    appAction.add(editButton);
  }
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:20,代码来源:GalleryPage.java

示例4: initTryitButton

import com.google.gwt.user.client.ui.Button; //导入方法依赖的package包/类
/**
 * Helper method called by constructor to initialize the try it button
 */
private void initTryitButton() {
  actionButton = new Button(MESSAGES.galleryOpenText());
  actionButton.addClickHandler(new ClickHandler() {
    // Open up source file if clicked the action button
    public void onClick(ClickEvent event) {
      actionButton.setEnabled(false);
      /*
       *  open a popup window that will prompt to ask user to enter
       *  a new project name(if "new name" is not valid, user may need to
       *  enter again). After that, "loadSourceFil" and "appWasDownloaded"
       *  will be called.
       */
      new RemixedYoungAndroidProjectWizard(app, actionButton).center();
    }
  });
  actionButton.addStyleName("app-action-button");
  appAction.add(actionButton);
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:22,代码来源:GalleryPage.java

示例5: initCancelButton

import com.google.gwt.user.client.ui.Button; //导入方法依赖的package包/类
/**
 * Helper method called by constructor to initialize the cancel button
 */
private void initCancelButton() {
  cancelButton = new Button(MESSAGES.galleryCancelText());
  cancelButton.addClickHandler(new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
      if (editStatus==NEWAPP) {
        Ode.getInstance().switchToProjectsView();
      }else if(editStatus==UPDATEAPP){
        Ode.getInstance().switchToGalleryAppView(app, GalleryPage.VIEWAPP);
      }
    }
  });
  cancelButton.addStyleName("app-action-button");
  appAction.add(cancelButton);
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:19,代码来源:GalleryPage.java

示例6: addGallerySearchTab

import com.google.gwt.user.client.ui.Button; //导入方法依赖的package包/类
/**
 * Creates the GUI components for search tab.
 *
 * @param searchApp: the FlowPanel that search tab will reside.
 */
private void addGallerySearchTab(FlowPanel searchApp) {
  // Add search GUI
  FlowPanel searchPanel = new FlowPanel();
  final TextBox searchText = new TextBox();
  searchText.addStyleName("gallery-search-textarea");
  Button sb = new Button(MESSAGES.gallerySearchForAppsButton());
  searchPanel.add(searchText);
  searchPanel.add(sb);
  searchPanel.addStyleName("gallery-search-panel");
  searchApp.add(searchPanel);
  appSearchContent.addStyleName("gallery-search-results");
  searchApp.add(appSearchContent);
  searchApp.addStyleName("gallery-search");

  sb.addClickHandler(new ClickHandler() {
    //  @Override
    public void onClick(ClickEvent event) {
      gallery.FindApps(searchText.getText(), 0, NUMAPPSTOSHOW, 0, true);
    }
  });
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:27,代码来源:GalleryList.java

示例7: OdeLog

import com.google.gwt.user.client.ui.Button; //导入方法依赖的package包/类
/**
 * Creates a new output panel for displaying internal messages.
 */
private OdeLog() {
  // Initialize UI
  Button clearButton = new Button(MESSAGES.clearButton());
  clearButton.addClickHandler(new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
      clear();
    }
  });

  text = new HTML();
  text.setWidth("100%");

  VerticalPanel panel = new VerticalPanel();
  panel.add(clearButton);
  panel.add(text);
  panel.setSize("100%", "100%");
  panel.setCellHeight(text, "100%");
  panel.setCellWidth(text, "100%");

  initWidget(panel);
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:26,代码来源:OdeLog.java

示例8: HelloWorld

import com.google.gwt.user.client.ui.Button; //导入方法依赖的package包/类
public HelloWorld() {
	HTML html = new HTML("Hello Word");
	refresh = new Button("refresh UI");
	refresh.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			GeneralComunicator.refreshUI();
		}
	});

	vPanel = new VerticalPanel();
	vPanel.add(html);
	vPanel.add(refresh);

	refresh.setStyleName("okm-Input");

	initWidget(vPanel);
}
 
开发者ID:openkm,项目名称:document-management-system,代码行数:19,代码来源:HelloWorld.java

示例9: onModuleLoad

import com.google.gwt.user.client.ui.Button; //导入方法依赖的package包/类
@Override
public void onModuleLoad() {
  uploaderPanels.put("TextButtonAndProgressText", new TextButtonAndProgressText());
  uploaderPanels.put("ImageButtonAndProgressText", new ImageButtonAndProgressText());
  uploaderPanels.put("ImageButtonAndProgressBar", new ImageButtonAndProgressBar());
  uploaderPanels.put("MultiUploadWithProgressBar", new MultiUploadWithProgressBar());
  uploaderPanels.put("MultiUploadWithProgressBarAndDragAndDrop",
                     new MultiUploadWithProgressBarAndDragAndDrop());

  for (Map.Entry<String, UploaderSample> entry : uploaderPanels.entrySet()) {
    final UploaderSample sample = entry.getValue();
    final Widget uploaderPanel = sample.getUploaderPanel();
    final Button btnViewSource = new Button("View Source");
    btnViewSource.getElement().getStyle().setMarginTop(10, Style.Unit.PX);
    btnViewSource.addClickHandler(new ClickHandler() {
      @Override
      public void onClick(ClickEvent event) {
        sourceCodePopup.showSourceCode(sample.getUploaderCode());
      }
    });
    VerticalPanel panel = new VerticalPanel();
    panel.add(uploaderPanel);
    panel.add(btnViewSource);
    RootPanel.get(entry.getKey()).add(panel);
  }
}
 
开发者ID:jiakuan,项目名称:gwt-uploader,代码行数:27,代码来源:GwtUploaderDemo.java

示例10: SourceCodePopupPanel

import com.google.gwt.user.client.ui.Button; //导入方法依赖的package包/类
public SourceCodePopupPanel() {
  // PopupPanel's constructor takes 'auto-hide' as its boolean parameter.
  // If this is set, the panel closes itself automatically when the user
  // clicks outside of it.
  super(true);
  // Set the dialog box's caption.
  setText("Source Code");

  // Enable animation.
  setAnimationEnabled(true);

  // Enable glass background.
  setGlassEnabled(true);
  Button btnClose = new Button("Close");
  btnClose.addClickHandler(new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
      hide();
    }
  });
  VerticalPanel panel = new VerticalPanel();
  panel.add(html);
  panel.add(btnClose);
  panel.setCellHorizontalAlignment(btnClose, HasHorizontalAlignment.ALIGN_RIGHT);
  setWidget(panel);
}
 
开发者ID:jiakuan,项目名称:gwt-uploader,代码行数:27,代码来源:SourceCodePopupPanel.java

示例11: addFoursquareAuth

import com.google.gwt.user.client.ui.Button; //导入方法依赖的package包/类
private void addFoursquareAuth() {
  // Since the auth flow requires opening a popup window, it must be started
  // as a direct result of a user action, such as clicking a button or link.
  // Otherwise, a browser's popup blocker may block the popup.
  Button button = new Button("Authenticate with Foursquare");
  button.addClickHandler(new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
      final AuthRequest req = new AuthRequest(FOURSQUARE_AUTH_URL, FOURSQUARE_CLIENT_ID);
      AUTH.login(req, new Callback<String, Throwable>() {
        @Override
        public void onSuccess(String token) {
          Window.alert("Got an OAuth token:\n" + token + "\n"
              + "Token expires in " + AUTH.expiresIn(req) + " ms\n");
        }

        @Override
        public void onFailure(Throwable caught) {
          Window.alert("Error:\n" + caught.getMessage());
        }
      });
    }
  });
  RootPanel.get().add(button);
}
 
开发者ID:chetsmartboy,项目名称:gwt-oauth2,代码行数:26,代码来源:OAuth2SampleEntryPoint.java

示例12: addDailymotionAuth

import com.google.gwt.user.client.ui.Button; //导入方法依赖的package包/类
private void addDailymotionAuth() {
  // Since the auth flow requires opening a popup window, it must be started
  // as a direct result of a user action, such as clicking a button or link.
  // Otherwise, a browser's popup blocker may block the popup.
  Button button = new Button("Authenticate with Dailymotion");
  button.addClickHandler(new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
      final AuthRequest req = new AuthRequest(DAILYMOTION_AUTH_URL, DAILYMOTION_CLIENT_ID);
      AUTH.login(req, new Callback<String, Throwable>() {
        @Override
        public void onSuccess(String token) {
          Window.alert("Got an OAuth token:\n" + token + "\n"
              + "Token expires in " + AUTH.expiresIn(req) + " ms\n");
        }

        @Override
        public void onFailure(Throwable caught) {
          Window.alert("Error:\n" + caught.getMessage());
        }
      });
    }
  });
  RootPanel.get().add(button);
}
 
开发者ID:chetsmartboy,项目名称:gwt-oauth2,代码行数:26,代码来源:OAuth2SampleEntryPoint.java

示例13: addWindowsLiveAuth

import com.google.gwt.user.client.ui.Button; //导入方法依赖的package包/类
private void addWindowsLiveAuth() {
  // Since the auth flow requires opening a popup window, it must be started
  // as a direct result of a user action, such as clicking a button or link.
  // Otherwise, a browser's popup blocker may block the popup.
  Button button = new Button("Authenticate with Windows Live");
  button.addClickHandler(new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
      final AuthRequest req = new AuthRequest(WINDOWS_LIVE_AUTH_URL, WINDOWS_LIVE_CLIENT_ID)
          .withScopes(WINDOWS_LIVE_BASIC_SCOPE);
      AUTH.login(req, new Callback<String, Throwable>() {
        @Override
        public void onSuccess(String token) {
          Window.alert("Got an OAuth token:\n" + token + "\n"
              + "Token expires in " + AUTH.expiresIn(req) + " ms\n");
        }

        @Override
        public void onFailure(Throwable caught) {
          Window.alert("Error:\n" + caught.getMessage());
        }
      });
    }
  });
  RootPanel.get().add(button);
}
 
开发者ID:chetsmartboy,项目名称:gwt-oauth2,代码行数:27,代码来源:OAuth2SampleEntryPoint.java

示例14: addGoogleAuthNative

import com.google.gwt.user.client.ui.Button; //导入方法依赖的package包/类
private void addGoogleAuthNative() {
  Button button = new Button("Authenticate with Google (using native JS)");
  button.addClickHandler(new ClickHandler() {
    @Override
    public native void onClick(ClickEvent event) /*-{
      $wnd.oauth2.login({
        "authUrl" : "https://accounts.google.com/o/oauth2/auth",
        "clientId" : "452237527106.apps.googleusercontent.com",
        "scopes" : [
          "https://www.googleapis.com/auth/plus.me"
        ]
      }, function(token) {
        $wnd.alert("Got an OAuth token:\n" + token + "\n"
            + "Token expires in " + $wnd.oauth2.expiresIn(req) + " ms\n");
      }, function(error) {
        $wnd.alert("Error:\n" + error);
      });
    }-*/;
  });
  RootPanel.get().add(button);
}
 
开发者ID:chetsmartboy,项目名称:gwt-oauth2,代码行数:22,代码来源:OAuth2SampleEntryPoint.java

示例15: WgtEditReserve

import com.google.gwt.user.client.ui.Button; //导入方法依赖的package包/类
public WgtEditReserve()
{
  m_panel.add( new Label( MAppGameCreation.s_messages.tipReserve() ) );
  Button btnReinit = new Button( MAppGameCreation.s_messages.defaultValue() );
  btnReinit.addClickHandler( new ClickHandler()
  {
    @Override
    public void onClick(ClickEvent p_event)
    {
      // reset to default value
      GameEngine.model().getGame().setConstructReserve( null );
      onTabSelected();
    }
  } );
  m_panel.add( btnReinit );

  m_panel.add( m_grid );

  initWidget( m_panel );
}
 
开发者ID:kroc702,项目名称:fullmetalgalaxy,代码行数:21,代码来源:WgtEditReserve.java


注:本文中的com.google.gwt.user.client.ui.Button.addClickHandler方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。