本文整理汇总了Java中com.google.gwt.user.client.ui.Button.addClickListener方法的典型用法代码示例。如果您正苦于以下问题:Java Button.addClickListener方法的具体用法?Java Button.addClickListener怎么用?Java Button.addClickListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.ui.Button
的用法示例。
在下文中一共展示了Button.addClickListener方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
示例2: createLyricsDialog
import com.google.gwt.user.client.ui.Button; //导入方法依赖的package包/类
private void createLyricsDialog()
{
lyricsDialog = new DialogBox();
VerticalPanel vPanel = new VerticalPanel();
vPanel.setHeight( "100%" );
vPanel.setHorizontalAlignment( VerticalPanel.ALIGN_CENTER );
vPanel.setVerticalAlignment( VerticalPanel.ALIGN_MIDDLE );
lyricsDialog.add( vPanel );
lyrics = new HTML();
ScrollPanel scrollPanel = new ScrollPanel();
scrollPanel.setWidth( "300px" );
scrollPanel.setHeight( "250px" );
scrollPanel.add( lyrics );
vPanel.add( scrollPanel );
Button close = new NativeButton( "Close" );
close.addClickListener( new ClickListener() {
public void onClick( Widget arg0 ) {
lyricsDialog.hide();
}
} );
vPanel.add( close );
}
示例3: ButtonValueWidget
import com.google.gwt.user.client.ui.Button; //导入方法依赖的package包/类
public ButtonValueWidget(final String actionName, String label, final Widget left) {
HorizontalPanel panel = new HorizontalPanel();
Button b = new Button(label);
b.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
if (actionCallback != null) {
actionCallback.onAction(actionName, left);
}
}
});
panel.add(b);
panel.add(left);
initWidget(panel);
}
示例4: showEndGame
import com.google.gwt.user.client.ui.Button; //导入方法依赖的package包/类
public void showEndGame(final Runnable runnable) {
final DialogBox box = new DialogBox();
box.setAnimationEnabled(true);
box.setText("Thanks for playing Higher or Lower! *ding*ding*ding*ding*");
Button b = new Button("Thanks for having me!");
b.addStyleName("centered");
b.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
runnable.run();
box.hide();
}
});
box.setWidget(b);
box.center();
box.show();
}
示例5: DefaultHomepage
import com.google.gwt.user.client.ui.Button; //导入方法依赖的package包/类
@Inject
public DefaultHomepage(CardGrid cardGrid,
@StartGame Button button,
GameHost startGame,
ScoreBoard scoreBoard) {
button.addClickListener(startGame);
VerticalPanel gamePanel = new VerticalPanel();
gamePanel.addStyleName("widePanel");
Label title = new Label("Welcome to... Higher or Lower!");
title.addStyleName("title");
gamePanel.add(title);
gamePanel.add(button);
gamePanel.add(cardGrid);
gamePanel.add(scoreBoard);
initWidget(gamePanel);
}
示例6: execute
import com.google.gwt.user.client.ui.Button; //导入方法依赖的package包/类
@Override
public void execute() {
final DialogBox db = new DialogBox(false, true);
db.setText("About MIT App Inventor");
db.setStyleName("ode-DialogBox");
db.setHeight("200px");
db.setWidth("400px");
db.setGlassEnabled(true);
db.setAnimationEnabled(true);
db.center();
VerticalPanel DialogBoxContents = new VerticalPanel();
String html = MESSAGES.gitBuildId(GitBuildId.getDate(), GitBuildId.getVersion()) +
"<BR/>Use Companion: " + BlocklyPanel.getCompVersion();
Config config = Ode.getInstance().getSystemConfig();
String releaseNotesUrl = config.getReleaseNotesUrl();
if (!Strings.isNullOrEmpty(releaseNotesUrl)) {
html += "<BR/><BR/>Please see <a href=\"" + releaseNotesUrl +
"\" target=\"_blank\">release notes</a>";
}
String tosUrl = config.getTosUrl();
if (!Strings.isNullOrEmpty(tosUrl)) {
html += "<BR/><BR/><a href=\"" + tosUrl +
"\" target=\"_blank\">" + MESSAGES.privacyTermsLink() + "</a>";
}
HTML message = new HTML(html);
SimplePanel holder = new SimplePanel();
Button ok = new Button("Close");
ok.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
db.hide();
}
});
holder.add(ok);
DialogBoxContents.add(message);
DialogBoxContents.add(holder);
db.setWidget(DialogBoxContents);
db.show();
}
示例7: createVideoDialog
import com.google.gwt.user.client.ui.Button; //导入方法依赖的package包/类
/**
* Creates video on page!
*/
private static void createVideoDialog(String tutorialId) {
// Create the UI elements of the DialogBox
final DialogBox dialogBox = new DialogBox(true, true); // DialogBox(autohide, modal)
dialogBox.setStylePrimaryName("ode-DialogBox");
dialogBox.setText("Tutorial Video");
dialogBox.setGlassEnabled(true);
dialogBox.setAnimationEnabled(true);
VerticalPanel DialogBoxContents = new VerticalPanel();
// Adds Youtube Video
HTML message = new HTML("<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/" + tutorialId + "?rel=0&autoplay=1\" frameborder=\"0\" allowfullscreen></iframe>");
message.setStyleName("DialogBox-message");
FlowPanel holder = new FlowPanel();
Button ok = new Button("Close");
ok.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
dialogBox.hide();
}
});
ok.setStyleName("DialogBox-button");
holder.add(ok);
DialogBoxContents.add(message);
DialogBoxContents.add(holder);
dialogBox.setWidget(DialogBoxContents);
dialogBox.center();
dialogBox.show();
}
示例8: createImageDialog
import com.google.gwt.user.client.ui.Button; //导入方法依赖的package包/类
/**
* Enlarges image on page
*/
private static void createImageDialog(String img) {
// Create the UI elements of the DialogBox
final DialogBox dialogBox = new DialogBox(true, true); // DialogBox(autohide, modal)
dialogBox.setStylePrimaryName("ode-DialogBox");
dialogBox.setGlassEnabled(true);
dialogBox.setAnimationEnabled(true);
VerticalPanel DialogBoxContents = new VerticalPanel();
FlowPanel holder = new FlowPanel();
Button ok = new Button("Close");
ok.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
dialogBox.hide();
}
});
ok.setStyleName("DialogBox-button");
// Adds Image
Image image = new Image(img);
image.addLoadHandler(new LoadHandler() {
public void onLoad(LoadEvent evt) {
dialogBox.center();
}
});
image.setStyleName("DialogBox-image");
holder.add(ok);
DialogBoxContents.add(image);
DialogBoxContents.add(holder);
dialogBox.setWidget(DialogBoxContents);
dialogBox.center();
dialogBox.show();
}
示例9: createWelcomeDialog
import com.google.gwt.user.client.ui.Button; //导入方法依赖的package包/类
/**
* Possibly display the MIT App Inventor "Splash Screen"
*
* @param force Bypass the check to see if they have dimissed this version
*/
private void createWelcomeDialog(boolean force) {
if (!shouldShowWelcomeDialog() && !force) {
maybeShowNoProjectsDialog();
return;
}
// Create the UI elements of the DialogBox
final DialogBox dialogBox = new DialogBox(false, true); // DialogBox(autohide, modal)
dialogBox.setStylePrimaryName("ode-DialogBox");
dialogBox.setText(MESSAGES.createWelcomeDialogText());
dialogBox.setHeight(splashConfig.height + "px");
dialogBox.setWidth(splashConfig.width + "px");
dialogBox.setGlassEnabled(true);
dialogBox.setAnimationEnabled(true);
dialogBox.center();
VerticalPanel DialogBoxContents = new VerticalPanel();
HTML message = new HTML(splashConfig.content);
message.setStyleName("DialogBox-message");
FlowPanel holder = new FlowPanel();
Button ok = new Button(MESSAGES.createWelcomeDialogButton());
final CheckBox noshow = new CheckBox(MESSAGES.doNotShow());
ok.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
dialogBox.hide();
if (noshow.getValue()) { // User checked the box
userSettings.getSettings(SettingsConstants.SPLASH_SETTINGS).
changePropertyValue(SettingsConstants.SPLASH_SETTINGS_VERSION,
"" + splashConfig.version);
userSettings.saveSettings(null);
}
maybeShowNoProjectsDialog();
}
});
holder.add(ok);
holder.add(noshow);
DialogBoxContents.add(message);
DialogBoxContents.add(holder);
dialogBox.setWidget(DialogBoxContents);
dialogBox.show();
}
示例10: sessionDead
import com.google.gwt.user.client.ui.Button; //导入方法依赖的package包/类
/**
* Show a Dialog Box when we receive an SC_PRECONDITION_FAILED
* response code to any Async RPC call. This is a signal that
* either our session has expired, or our login cookie has otherwise
* become invalid. This is a fatal error and the user should not
* be permitted to continue (many ignore the red error bar and keep
* working, in vain). So now when this happens, we put up this
* modal dialog box which cannot be dismissed. Instead it presents
* just one option, a "Reload" button which reloads the browser.
* This should trigger a re-authentication (or in the case of an
* App Inventor upgrade trigging the problem, the loading of newer
* code).
*/
public void sessionDead() {
// Create the UI elements of the DialogBox
final DialogBox dialogBox = new DialogBox(false, true); // DialogBox(autohide, modal)
dialogBox.setStylePrimaryName("ode-DialogBox");
dialogBox.setText(MESSAGES.invalidSessionDialogText());
dialogBox.setWidth("400px");
dialogBox.setGlassEnabled(true);
dialogBox.setAnimationEnabled(true);
dialogBox.center();
VerticalPanel DialogBoxContents = new VerticalPanel();
HTML message = new HTML(MESSAGES.sessionDead());
message.setStyleName("DialogBox-message");
FlowPanel holder = new FlowPanel();
Button reloadSession = new Button(MESSAGES.reloadWindow());
reloadSession.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
dialogBox.hide();
reloadWindow(true);
}
});
holder.add(reloadSession);
DialogBoxContents.add(message);
DialogBoxContents.add(holder);
dialogBox.setWidget(DialogBoxContents);
dialogBox.show();
}
示例11: wontConnectDialog
import com.google.gwt.user.client.ui.Button; //导入方法依赖的package包/类
/**
* Display a Dialog box that explains that you cannot connect a
* device or the emulator to App Inventor until you have a project
* selected.
*/
private void wontConnectDialog() {
// Create the UI elements of the DialogBox
final DialogBox dialogBox = new DialogBox(false, true); // DialogBox(autohide, modal)
dialogBox.setStylePrimaryName("ode-DialogBox");
dialogBox.setText(MESSAGES.noprojectDialogTitle());
dialogBox.setHeight("100px");
dialogBox.setWidth("400px");
dialogBox.setGlassEnabled(true);
dialogBox.setAnimationEnabled(true);
dialogBox.center();
VerticalPanel DialogBoxContents = new VerticalPanel();
HTML message = new HTML("<p>" + MESSAGES.noprojectDuringConnect() + "</p>");
message.setStyleName("DialogBox-message");
FlowPanel holder = new FlowPanel();
Button okButton = new Button("OK");
okButton.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
dialogBox.hide();
}
});
holder.add(okButton);
DialogBoxContents.add(message);
DialogBoxContents.add(holder);
dialogBox.setWidget(DialogBoxContents);
dialogBox.show();
}
示例12: displayFault
import com.google.gwt.user.client.ui.Button; //导入方法依赖的package包/类
private void displayFault( String faultString )
{
final DialogBox dialog = new DialogBox();
dialog.add( new Label( faultString ) );
Button closeButton = new Button( "Close" );
closeButton.addClickListener( new ClickListener() {
public void onClick( Widget arg0 ) {
dialog.hide();
}
} );
dialog.center();
dialog.show();
}
示例13: updateConnectedIncidents
import com.google.gwt.user.client.ui.Button; //导入方法依赖的package包/类
protected void updateConnectedIncidents(String objectType) {
// Add Number of incidents connected to this problem.
refIncidentControl = new CIReferenceTableControl(objectType, "<$template{ITIL_Incident}", "ITIL_Incident");
LabelCounter counter = new LabelCounter("Incidents connected", refIncidentControl);
Button viewIncidents = new Button("View");
viewIncidents.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
DefaultAttributeFilter aFilter = new DefaultAttributeFilter();
aFilter.setSimpleAttributeControl(ListProblemScreen.getOrder());
refIncidentControl.setAttributeFilter(aFilter);
CITablePanel table = new CITablePanel();
table.setAttributeRender(new AttributeRender());
table.setTabelControl(refIncidentControl);
CITablePageControlPanel tablePageControl = new CITablePageControlPanel(table);
table.load();
VerticalPanel vPanel = new VerticalPanel();
vPanel.add(tablePageControl);
vPanel.add(table);
vPanel.setCellVerticalAlignment(tablePageControl, VerticalPanel.ALIGN_TOP);
vPanel.setCellVerticalAlignment(table, VerticalPanel.ALIGN_TOP);
final DragablePopup popup = new DragablePopup("Incidents", true);
popup.setContent(vPanel);
int top = dockPanel.getAbsoluteTop() + 50;
int left = dockPanel.getAbsoluteLeft() + 50;
popup.setPopupPosition(left, top);
popup.show();
}
});
counter.update();
incidentConnectedPanel.clear();
incidentConnectedPanel.add(counter);
incidentConnectedPanel.add(viewIncidents);
incidentConnectedPanel.setCellHorizontalAlignment(counter, HorizontalPanel.ALIGN_LEFT);
incidentConnectedPanel.setCellHorizontalAlignment(viewIncidents, HorizontalPanel.ALIGN_RIGHT);
}