本文整理汇总了Java中com.google.gwt.user.client.ui.Button类的典型用法代码示例。如果您正苦于以下问题:Java Button类的具体用法?Java Button怎么用?Java Button使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Button类属于com.google.gwt.user.client.ui包,在下文中一共展示了Button类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addEnterTarget
import com.google.gwt.user.client.ui.Button; //导入依赖的package包/类
/**
* Adds a {@link KeyPressHandler} to the specified widget which calls {@link Button#click()} on <code>targetButton</code>
* when the Enter key is pressed.
* @param widget widget to add the key handler to
* @param targetButton target button to activate when the enter key is pressed
*/
public static void addEnterTarget( final HasKeyPressHandlers widget, final Button targetButton ) {
widget.addKeyPressHandler( new KeyPressHandler() {
@Override
public void onKeyPress( final KeyPressEvent event ) {
if ( event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER )
targetButton.click();
}
} );
}
示例2: onModuleLoad
import com.google.gwt.user.client.ui.Button; //导入依赖的package包/类
@Override
public void onModuleLoad() {
RootPanel rootPanel = RootPanel.get("main");
final Button button = new Button("Click me");
rootPanel.add(button);
ObservableEx.fromKeyboardEvent(button.getElement(), "keydown")
.map(event -> event.ctrlKey)
.take(5)
.subscribe(v -> log("ctrlKey " + v));
ObservableEx.fromMouseEvent(button.getElement(), "click")
.map(event -> event.clientX)
.take(5)
.subscribe(v -> log("clientX " + v));
}
示例3: 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;
}
示例4: 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);
}
示例5: 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);
}
}
示例6: 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);
}
示例7: 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);
}
示例8: 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);
}
});
}
示例9: upgradeWarnDialog
import com.google.gwt.user.client.ui.Button; //导入依赖的package包/类
private static void upgradeWarnDialog(String aMessage) {
final DialogBox dialogBox = new DialogBox(false, true);
dialogBox.setStylePrimaryName("ode-DialogBox");
dialogBox.setText(MESSAGES.warningDialogTitle());
dialogBox.setGlassEnabled(true);
dialogBox.setAnimationEnabled(true);
final HTML message = new HTML(aMessage);
message.setStyleName("DialogBox-message");
VerticalPanel vPanel = new VerticalPanel();
Button okButton = new Button("OK");
okButton.addClickListener(new ClickListener() {
@Override
public void onClick(Widget sender) {
dialogBox.hide();
}
});
vPanel.add(message);
vPanel.add(okButton);
dialogBox.setWidget(vPanel);
dialogBox.center();
dialogBox.show();
}
示例10: 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);
}
示例11: 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);
}
示例12: DebugConsolePopup
import com.google.gwt.user.client.ui.Button; //导入依赖的package包/类
/**
* Logout popup
*/
public DebugConsolePopup() {
// Establishes auto-close when click outside
super(false, false);
setText(Main.i18n("debug.console.label"));
vPanel = new VerticalPanel();
button = new Button(Main.i18n("button.close"), this);
text = new HTML(Main.i18n("debug.enable.disable"));
vPanel.add(new HTML("<br>"));
vPanel.add(text);
vPanel.add(Log.getLogger(DivLogger.class).getWidget());
vPanel.add(new HTML("<br>"));
vPanel.add(button);
vPanel.add(new HTML("<br>"));
vPanel.setCellHorizontalAlignment(button, VerticalPanel.ALIGN_CENTER);
button.setStyleName("okm-YesButton");
super.hide();
Log.getLogger(DivLogger.class).getWidget().setVisible(true);
setWidget(vPanel);
}
示例13: LogoutPopup
import com.google.gwt.user.client.ui.Button; //导入依赖的package包/类
/**
* Logout popup
*/
public LogoutPopup() {
// Establishes auto-close when click outside
super(false, true);
vPanel = new VerticalPanel();
text = new HTML(Main.i18n("logout.logout"));
button = new Button(Main.i18n("button.close"), this);
vPanel.setWidth("250px");
vPanel.setHeight("100px");
vPanel.add(new HTML("<br>"));
vPanel.add(text);
vPanel.add(new HTML("<br>"));
vPanel.add(button);
vPanel.add(new HTML("<br>"));
vPanel.setCellHorizontalAlignment(text, VerticalPanel.ALIGN_CENTER);
vPanel.setCellHorizontalAlignment(button, VerticalPanel.ALIGN_CENTER);
button.setStyleName("okm-YesButton");
super.hide();
setWidget(vPanel);
}
示例14: 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);
}
}
示例15: 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);
}