com.google.gwt.user.client.ui.Button类的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(16.5k)|赞(0)|评价(0)|浏览(162)

本文整理了Java中com.google.gwt.user.client.ui.Button类的一些代码示例,展示了Button类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Button类的具体详情如下:
包路径:com.google.gwt.user.client.ui.Button
类名称:Button

Button介绍

[英]A standard push-button widget.

CSS Style Rules

.gwt-Button the outer element

Example

com.google.gwt.examples.ButtonExample
[中]一个标准的按钮小部件。
####CSS样式规则
.gwt按钮位于外部元件上
####范例
通用域名格式。谷歌。gwt。例子。钮扣

代码示例

代码示例来源:origin: kaaproject/kaa

Button backButton = new Button();
backButton.addStyleName(Utils.kaaAdminStyle.bAppBackButton());
 backButton.getElement().getStyle().setPaddingTop(25, Unit.PX);
 backButton.getElement().getStyle().setPaddingBottom(25, Unit.PX);
 firstRowPanel.setHeight("45px");
 firstRowPanel.getElement().getStyle().setPaddingBottom(5, Unit.PX);
updateSchemaScopeButton = new Button(Utils.constants.promote());
updateSchemaScopeButton.setVisible(!create && editable);
updateSchemaScopeButton.getElement().getStyle().setMarginLeft(horizontalMargin, Unit.PX);
createNewSchemaVersionButton = new Button(Utils.constants.createNewVersion());
createNewSchemaVersionButton.setVisible(!create && editable);
createNewSchemaVersionButton.getElement().getStyle().setMarginLeft(horizontalMargin, Unit.PX);
Button saveButton = new Button();
saveButton.getElement().getStyle().setMarginLeft(horizontalMargin, Unit.PX);
Button cancelButton = new Button();
cancelButton.setVisible(false);
cancelButton.getElement().getStyle().setMarginLeft(horizontalMargin, Unit.PX);
deleteSchemaVersionButton = new Button(Utils.constants.delete());
deleteSchemaVersionButton.addStyleName(Utils.kaaAdminStyle.deleteButton());
deleteSchemaVersionButton.setVisible(!create && editable);
deleteSchemaVersionButton.getElement().getStyle().setMarginLeft(horizontalMargin, Unit.PX);

代码示例来源:origin: libgdx/libgdx

VerticalPanel vPanel = new VerticalPanel();
HorizontalPanel hPanel = new HorizontalPanel();
vPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
Button ok = new Button("OK");
ok.addClickHandler(new ClickHandler() {
  public void onClick (ClickEvent event) {
    TextInputDialogBox.this.onPositive();
Button cancel = new Button("Cancel");
cancel.addClickHandler(new ClickHandler() {
  public void onClick (ClickEvent event) {
    TextInputDialogBox.this.onNegative();
hPanel.add(ok);
hPanel.add(cancel);
textBox.setWidth("97%");
textBox.setText(text);
vPanel.add(textBox);
vPanel.add(hPanel);

代码示例来源:origin: kaaproject/kaa

VerticalPanel dialogContents = new VerticalPanel();
dialogContents.setSpacing(4);
setWidget(dialogContents);
dialogContents.add(errorPanel);
FlexTable table = new FlexTable();
table.setCellSpacing(6);
Widget label = new Label(Utils.constants.selectNotificationTopics());
label.addStyleName(Utils.avroUiStyle.requiredField());
topic = new TopicListBox();
topic.addValueChangeHandler(this);
dialogContents.add(table);
addButton = new Button(Utils.constants.add(), new ClickHandler() {
 @Override
 public void onClick(ClickEvent event) {
Button closeButton = new Button(Utils.constants.close(), new ClickHandler() {
 @Override
 public void onClick(ClickEvent event) {
addButton(closeButton);
addButton.setEnabled(false);

代码示例来源:origin: kaaproject/kaa

private void updateSaveButton(boolean enabled, boolean invalid) {
  if (invalid) {
   saveButton.setText(Utils.constants.save());
  } else {
   saveButton.setText(enabled ? Utils.constants.save() : Utils.constants.saved());
  }
  saveButton.setEnabled(enabled);
  activateButton.setEnabled(!invalid && !enabled);
 }
}

代码示例来源:origin: kaaproject/kaa

@Override
protected void init() {
 super.init();
 downloadConfigurationButton = new Button(Utils.constants.downloadConfiguration());
 buttonsPanel.add(downloadConfigurationButton);
 downloadConfigurationButton.addClickHandler(new ClickHandler() {
  @Override
  public void onClick(ClickEvent clickEvent) {
   String url = Window.Location.getHref();
   Window.open("/kaaAdmin/servlet/kaaConfigurationDownloadServlet?schemaId="
       + Utils.getSchemaIdFromUrl(url)
       + "&endGroupId=" + Utils.getEndpointGroupIdFromUrl(url),
     "_blank", "status=0,toolbar=0,menubar=0,location=0");
  }
 });
}

代码示例来源:origin: com.google.gwt/gwt-servlet

VerticalPanel mainPanel = new VerticalPanel();
mainPanel.setBorderWidth(1);
mainPanel.getElement().getStyle().setBackgroundColor("white");
final HTML titleBar = new HTML("<center><b>Logging</b></center>");
mainPanel.add(titleBar);
new WindowMoveHandler(titleBar);
scrollPanel.setPixelSize(300, 200);
HorizontalPanel bottomBar = new HorizontalPanel();
mainPanel.add(bottomBar);
bottomBar.setWidth("100%");
bottomBar.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
final Button maxmin = new Button("Minimize");
bottomBar.add(maxmin);
maxmin.addClickHandler(new ClickHandler() {
 public void onClick(ClickEvent event) {
  if (maxmin.getText().equals("Minimize")) {
 new HTML("<div style='font-size:200%; line-height:75%'>\u21F2</div>");
resizeIcon.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
bottomBar.add(resizeIcon);
new WindowResizeHandler(resizeIcon);

代码示例来源:origin: org.jboss.errai/errai-bus

setModal(false);
final VerticalPanel panel = new VerticalPanel();
final Button disconnectFromServer = new Button("Disconnect Bus");
disconnectFromServer.addClickHandler(new ClickHandler() {
 @Override
 public void onClick(final ClickEvent event) {
final Button clearErrors = new Button("Clear Log");
clearErrors.addClickHandler(new ClickHandler() {
 @Override
 public void onClick(final ClickEvent event) {
final Button closeButton = new Button("Dismiss Error");
closeButton.addClickHandler(new ClickHandler() {
 @Override
 public void onClick(final ClickEvent event) {
titleBar.setCellHorizontalAlignment(buttonPanel, HasHorizontalAlignment.ALIGN_RIGHT);
panel.add(titleBar);
final Style s = panel.getElement().getStyle();
s.setProperty("border", "1px");

代码示例来源:origin: kaaproject/kaa

VerticalPanel dialogContents = new VerticalPanel();
dialogContents.setSpacing(4);
setWidget(dialogContents);
dialogContents.add(errorPanel);
FlexTable table = new FlexTable();
table.setCellSpacing(6);
table.addStyleName(Utils.avroUiStyle.fieldWidget());
HorizontalPanel versionPanel = new HorizontalPanel();
versionPanel.add(schemaVersionLabel);
versionPanel.add(schemaBox);
table.setWidget(0, 0, versionPanel);
dialogContents.add(table);
saveButton = new Button(Utils.constants.save(), new ClickHandler() {
 @Override
 public void onClick(ClickEvent event) {
Button cancelButton = new Button(Utils.constants.cancel(), new ClickHandler() {
 @Override
 public void onClick(ClickEvent event) {
saveButton.setEnabled(false);

代码示例来源:origin: kaaproject/kaa

@Override
protected void initDetailsTable() {
 detailsTable.getColumnFormatter().setWidth(0, "200px");
 detailsTable.getColumnFormatter().setWidth(1, "550px");
 detailsTable.getColumnFormatter().setWidth(2, "0px");
 getSaveButtonWidget().removeFromParent();
 getCancelButtonWidget().removeFromParent();
 requiredFieldsNoteLabel.setVisible(false);
 Label keyHashLabel = new Label(Utils.constants.endpointKeyHash());
 endpointKeyHash = new KaaAdminSizedTextBox(-1, false);
 endpointKeyHash.setWidth("100%");
 Label userIdLabel = new Label(Utils.constants.userId());
 userId = new KaaAdminSizedTextBox(-1, false);
 userId.setWidth("100%");
 userInfoList.add(userId);
 sdkAnchor.getElement().getStyle().setCursor(Style.Cursor.POINTER);
 endpointProfSchemaName.getElement().getStyle().setCursor(Style.Cursor.POINTER);
 endpointProfSchemaName.getElement().getParentElement().getStyle().setPaddingLeft(10, Unit.PX);
 editServerProfileButton = new Button(Utils.constants.edit());

代码示例来源:origin: org.kie.guvnor/guvnor-commons-ui

getElement().getStyle().setZIndex( Integer.MAX_VALUE );
setGlassEnabled( true );
       checkInCommentTextBox );
final HorizontalPanel hp = new HorizontalPanel();
final Button create = new Button( CommonConstants.INSTANCE.DeletePopupDelete() );
create.addClickHandler( new ClickHandler() {
  public void onClick( ClickEvent arg0 ) {
hp.add( create );
final Button cancel = new Button( "Cancel" );
cancel.addClickHandler( new ClickHandler() {
  public void onClick( final ClickEvent arg0 ) {
    hide();
hp.add( new HTML( "&nbsp" ) );
hp.add( cancel );
addAttribute( "",

代码示例来源:origin: fr.lteconsulting/hexa.core

private void UpdateInterface()
  andAnchor.getElement().getStyle().setFontWeight( op.compareTo( "and" ) == 0 ? FontWeight.BOLD : FontWeight.LIGHTER );
  orAnchor.getElement().getStyle().setFontWeight( op.compareTo( "or" ) == 0 ? FontWeight.BOLD : FontWeight.LIGHTER );
  compareAnchor.getElement().getStyle().setFontWeight( op.compareTo( "eq" ) == 0 ? FontWeight.BOLD : FontWeight.LIGHTER );
    if( direction == 0 )
      VerticalPanel vp = new VerticalPanel();
      realPanel = vp;
      panel = vp;
      HorizontalPanel hp = new HorizontalPanel();
      realPanel = hp;
      panel = hp;
        HTML ophtml = new HTML( op );
        ophtml.addStyleName( "CriteriaOperator" );
        panel.add( ophtml );
    Button addButton = new Button( "..." );
    addButton.addClickHandler( new ClickHandler()
    HorizontalPanel hp = new HorizontalPanel();
    hp.add( lbField );

代码示例来源:origin: kaaproject/kaa

@Override
protected void initDetailsTable() {
 authorLabel.setVisible(!create);
 createdUsername.setVisible(!create);
 description.getTextArea().getElement().getStyle().setPropertyPx("minHeight", 100);
 Label descriptionLabel = new Label(Utils.constants.description());
 detailsTable.setWidget(5, 0, descriptionLabel);
 ecfVersionsLabel.addStyleName(Utils.kaaAdminStyle.bAppContentTitleLabel());
 addEcfVersionButton = new Button(Utils.constants.addFamilyVersion());
 addEcfVersionButton.addStyleName(Utils.kaaAdminStyle.bAppButtonSmall());
 detailsTable.setWidget(6, 0, ecfVersionsLabel);
 ecfVersionsLabel.getElement().getParentElement().getStyle().setPropertyPx("paddingBottom", 10);
 detailsTable.setWidget(7, 0, ecfVersionsGrid);
 detailsTable.setWidget(8, 2, addEcfVersionButton);
 addEcfVersionButton.getElement().getParentElement().getStyle().setPropertyPx("paddingTop", 15);
 detailsTable.getCellFormatter().setHorizontalAlignment(
   8, 2, HasHorizontalAlignment.ALIGN_RIGHT);
 ecfVersionsLabel.setVisible(!create);
 ecfVersionsGrid.setVisible(!create);
 addEcfVersionButton.setVisible(!create);

代码示例来源:origin: kaaproject/kaa

getColumnFormatter().getElement(2).setAttribute("width", "0px");
FlexTable dateTable = new FlexTable();
FlexTable userTable = new FlexTable();
dateTable.getColumnFormatter().setWidth(0, "200px");
dateTable.getColumnFormatter().setWidth(1, "200px");
userTable.getColumnFormatter().setWidth(1, "200px");
dateTable.setWidget(0, 1, createdDateTime);
detailsTable.getColumnFormatter().getElement(2).setAttribute("width", "0px");
buttonsPanel = new HorizontalPanel();
buttonsPanel.setSpacing(5);
detailsTable.setWidget(2, 0, buttonsPanel);
detailsTable.getFlexCellFormatter().setColSpan(2, 0, 2);
saveButton = new Button(Utils.constants.save());
activateButton = new Button(Utils.constants.activate());
deactivateButton = new Button(Utils.constants.deactivate());
buttonsPanel.add(saveButton);
buttonsPanel.add(activateButton);
buttonsPanel.add(deactivateButton);

代码示例来源:origin: org.jboss.errai/errai-workspaces

Button b = new Button("<span><img src='" + instanceProperties.get(LayoutParts.IconURI.name())
      + "' align='left'/>" + instanceProperties.get(LayoutParts.Name.name()) + "</span>"
      , new ClickHandler() {
  b.getElement().getStyle().setProperty("background", "transparent");
  b.getElement().getStyle().setProperty("textAlign", "left");
  b.setWidth("100%");
  vPanel.add(b);
buttonPanel = new HorizontalPanel();
okButton = new Button("OK");
okButton.addClickHandler(okListener);
buttonPanel.add(okButton);
cancelButton = new Button("Cancel");
cancelButton.addClickHandler(cancelListener);
buttonPanel.add(cancelButton);
innerContainer.add(buttonPanel);
Style s = message.getElement().getStyle();
s.setProperty("padding", "8px");
s.setProperty("verticalAlign", "top");

代码示例来源:origin: kaaproject/kaa

this.serverProfileSchemaId = serverProfileSchemaId;
VerticalPanel dialogContents = new VerticalPanel();
dialogContents.setSpacing(4);
dialogContents.getElement().getStyle().setOverflow(Overflow.AUTO);
setWidget(dialogContents);
dialogContents.add(infoPanel);
FlexTable table = new FlexTable();
table.setCellSpacing(6);
table.addStyleName(Utils.avroUiStyle.fieldWidget());
dialogContents.add(table);
testFilterButton = new Button(Utils.constants.testFilter(), new ClickHandler() {
 @Override
 public void onClick(ClickEvent event) {
testFilterButton.setEnabled(false);
Button closeButton = new Button(Utils.constants.close(), new ClickHandler() {
 @Override
 public void onClick(ClickEvent event) {

代码示例来源:origin: net.sf.javaprinciples.client/client-presentation

dialogBox.setGlassEnabled(true);
VerticalPanel dialogVPanel = new VerticalPanel();
dialogVPanel.addStyleName("dialogVPanel");
dialogVPanel.add(new HTML("<b>" + title + "</b>"));
dialogVPanel.add(new HTML("<br><b>" + message + "</b><br><br>"));
dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
HorizontalPanel buttons = new HorizontalPanel();
dialogVPanel.add(buttons);
Button ok = new Button("OK");
buttons.add(ok);
ok.addClickHandler(new ClickHandler() 
if (style == Style.OK_CANCEL)
  Label gap = new Label("");
  gap.setWidth("10px");
  buttons.add(gap);
  Button cancel = new Button("Cancel");
  buttons.add(cancel);
  cancel.addClickHandler(new ClickHandler() 
ok.setFocus(true);

代码示例来源:origin: kaaproject/kaa

super(false);
supportPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
supportPanel.setWidth("1000px");
resetButton = new Button(Utils.constants.reset());
supportPanel.add(resetButton);
listBox.getElement().getStyle().setPropertyPx("minWidth", 100);
HorizontalPanel groupPanel = new HorizontalPanel();
groupPanel.setSpacing(15);
endpointKeyHash = new TextBox();
endpointKeyHash.setWidth("100%");
findButton = new Button(Utils.constants.find());
findButton.addStyleName(Utils.avroUiStyle.buttonSmall());
keyHashPanel.add(endpointKeyHashButton);
keyHashPanel.add(endpointKeyHash);

代码示例来源:origin: kaaproject/kaa

label = new Label(Utils.constants.configurationSchemaVersion());
label.addStyleName(REQUIRED);
configurationSchemaVersion = new VersionListBox();
label = new Label(Utils.constants.profileSchemaVersion());
label.addStyleName(REQUIRED);
profileSchemaVersion = new VersionListBox();
selectedAefMaps = new MultiAefMapListBox();
addAefMapButton = new Button(Utils.constants.add());
removeAefMapButton = new Button(Utils.constants.remove());
ecfsDisclosure.setContent(ecfsTable);
addAefMapButton.addStyleName(Utils.kaaAdminStyle.bAppButtonSmall());
removeAefMapButton.addStyleName(Utils.kaaAdminStyle.bAppButtonSmall());
addAefMapButton.addClickHandler(new ClickHandler() {
 @Override
 public void onClick(ClickEvent event) {
removeAefMapButton.addClickHandler(new ClickHandler() {
 @Override
 public void onClick(ClickEvent event) {

代码示例来源:origin: kaaproject/kaa

this.listener = listener;
VerticalPanel dialogContents = new VerticalPanel();
dialogContents.setSpacing(4);
setWidget(dialogContents);
messageLabel.getElement().getStyle().setWhiteSpace(WhiteSpace.PRE_WRAP);
messageLabel.getElement().getStyle().setProperty("maxHeight", "400px");
messageLabel.getElement().getStyle()
  .setProperty("maxWidth", Window.getClientWidth() * 2 / 3 + "px");
messageLabel.getElement().getStyle().setOverflowY(Overflow.AUTO);
messageLabel.setMessage(message);
dialogContents.add(messageLabel);
okButton = new Button(Utils.constants.ok(), new ClickHandler() {
 @Override
 public void onClick(ClickEvent event) {

代码示例来源:origin: kaaproject/kaa

protected void constructTopPanel() {
 FlowPanel panel = new FlowPanel();
 panel.setSize("100%", "100%");
 topPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
 topPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
 topPanel.add(panel);
 topPanel.setCellHeight(panel, "100%");
 HorizontalPanel horizontalPanel = new HorizontalPanel();
 Button backButton = new Button();
 backButton.addStyleName(Utils.kaaAdminStyle.bAppBackButton());
 backButtonPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
 backButtonPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
 Label titleLabel = new Label();
 titleLabel.addStyleName(Utils.kaaAdminStyle.bAppContentTitle());
 horizontalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
 horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
 horizontalPanel.setCellHeight(buttonsPanel, "100%");
 Button saveButton = new Button();
 buttonsPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
 buttonsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
 Button cancelButton = new Button();
 cancelButton.setVisible(false);
 buttonsPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
 buttonsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

相关文章