com.extjs.gxt.ui.client.widget.button.Button.setIcon()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(185)

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

Button.setIcon介绍

[英]Sets the button's icon style. The style name should match a CSS style that specifies a background image using the following format:

<code> .my-icon { background: url(images/icons/my-icon.png) no-repeat 
center left !important; } </code>

[中]设置按钮的图标样式。样式名称应与使用以下格式指定背景图像的CSS样式匹配:

<code> .my-icon { background: url(images/icons/my-icon.png) no-repeat 
center left !important; } </code>

代码示例

代码示例来源:origin: com.extjs/gxt

/**
 * Creates a new button with the given HTML and icon.
 * 
 * @param html the button text as HTML
 * @param icon the icon
 */
public Button(String html, AbstractImagePrototype icon) {
 this(html);
 setIcon(icon);
}

代码示例来源:origin: com.extjs/gxt

public void setIconStyle(String icon) {
 setIcon(IconHelper.create(icon));
}

代码示例来源:origin: com.extjs/gxt

/**
 * Sets the button's text as HTML.
 * 
 * @param html the new html content
 */
public void setHtml(String html) {
 this.html = html;
 if (rendered) {
  buttonEl.update(Util.isEmptyString(html) ? "&#160;" : html);
  setIcon(icon);
 }
}

代码示例来源:origin: com.extjs/gxt

@Override
protected void afterRender() {
 super.afterRender();
 setTabIndex(tabIndex);
 setIcon(icon);
}

代码示例来源:origin: com.extjs/gxt

public void loaderLoadException(LoadEvent le) {
  refresh.setIcon(getImages().getRefresh());
  setEnabled(savedEnableState);
 }
};

代码示例来源:origin: com.extjs/gxt

public void handleEvent(ComponentEvent be) {
  Component c = be.getComponent();
  if (be.getType() == Events.Disable) {
   if (c == first) {
    first.setIcon(getImages().getFirstDisabled());
   } else if (c == prev) {
    prev.setIcon(getImages().getPrevDisabled());
   } else if (c == next) {
    next.setIcon(getImages().getNextDisabled());
   } else if (c == last) {
    last.setIcon(getImages().getLastDisabled());
   }
  } else {
   if (c == first) {
    first.setIcon(getImages().getFirst());
   } else if (c == prev) {
    prev.setIcon(getImages().getPrev());
   } else if (c == next) {
    next.setIcon(getImages().getNext());
   } else if (c == last) {
    last.setIcon(getImages().getLast());
   }
  }
 }
};

代码示例来源:origin: com.extjs/gxt

public void loaderLoad(LoadEvent le) {
 refresh.setIcon(getImages().getRefresh());
 setEnabled(savedEnableState);
 onLoad(le);
}

代码示例来源:origin: com.extjs/gxt

public void loaderBeforeLoad(final LoadEvent le) {
 savedEnableState = isEnabled();
 setEnabled(false);
 refresh.setIcon(IconHelper.createStyle("x-tbar-loading"));
 DeferredCommand.addCommand(new Command() {
  public void execute() {
   if (le.isCancelled()) {
    refresh.setIcon(getImages().getRefresh());
    setEnabled(savedEnableState);
   }
  }
 });
}

代码示例来源:origin: com.extjs/gxt

public void setImages(PagingToolBarImages images) {
 this.images = images;
 refresh.setIcon(getImages().getRefresh());
 last.setIcon(last.isEnabled() ? getImages().getLast() : getImages().getLastDisabled());
 first.setIcon(first.isEnabled() ? getImages().getFirst() : getImages().getFirstDisabled());
 prev.setIcon(prev.isEnabled() ? getImages().getPrev() : getImages().getPrevDisabled());
 next.setIcon(next.isEnabled() ? getImages().getNext() : getImages().getNextDisabled());
}

代码示例来源:origin: bedatadriven/activityinfo

private void createCancelButton() {
  cancelButton = new Button(I18N.CONSTANTS.cancel());
  cancelButton.setIcon(IconImageBundle.ICONS.cancel());
  addButton(cancelButton);
  cancelButton.addListener(Events.Select, new Listener<ButtonEvent>() {
    @Override
    public void handleEvent(ButtonEvent be) {
      hide();
      onCancel();
    }
  });
}

代码示例来源:origin: geoserver/geofence

testConnectionButton.setIcon(Resources.ICONS.test());

代码示例来源:origin: geoserver/geofence

groupsUserButton.setIcon(Resources.ICONS.table());

代码示例来源:origin: bedatadriven/activityinfo

public void setDirty(boolean dirty) {
  Button currentSaveButton = getSaveButton();
  if (currentSaveButton != null) {
    currentSaveButton.setEnabled(dirty);
    if (dirty) {
      currentSaveButton.setText(I18N.CONSTANTS.save());
      currentSaveButton.setIcon(IconImageBundle.ICONS.save());
    } else {
      currentSaveButton.setText(I18N.CONSTANTS.saved());
    }
  }
}

代码示例来源:origin: bedatadriven/activityinfo

private void createSaveButton() {
  saveButton = new Button(I18N.CONSTANTS.save());
  saveButton.setIcon(IconImageBundle.ICONS.save());
  saveButton.addListener(Events.Select, new Listener<ButtonEvent>() {
    @Override
    public void handleEvent(ButtonEvent be) {
      // use a deferred handler to make sure we get any change
      // events first
      Scheduler.get().scheduleDeferred(new ScheduledCommand() {
        @Override
        public void execute() {
          if (!form.isValid()) {
            MessageBox.alert(getHeadingHtml(),
                fromSafeConstant(I18N.CONSTANTS.pleaseCompleteForm()), null);
          } else {
            onValidated();
          }
        }
      });
    }
  });
  addButton(saveButton);
}

代码示例来源:origin: geoserver/geofence

removeUserButton.setIcon(Resources.ICONS.delete());

代码示例来源:origin: bedatadriven/activityinfo

private void createAddLayerButton() {
  Button addLayerButton = new Button();
  addLayerButton.setText(I18N.CONSTANTS.add());
  addLayerButton.addListener(Events.Select, new SelectionListener<ButtonEvent>() {
    @Override
    public void componentSelected(ButtonEvent ce) {
      final NewLayerWizard wizard = new NewLayerWizard(service, locator);
      addLayersDialog = new WizardDialog(wizard);
      addLayersDialog.show(new WizardCallback() {
        @Override
        public void onFinished() {
          addLayer(wizard.createLayer());
        }
      });
    }
  });
  addLayerButton.setIcon(IconImageBundle.ICONS.add());
  layersPanel.getHeader().addTool(addLayerButton);
}

代码示例来源:origin: com.extjs/gxt

protected Button createButton(AbstractImagePrototype icon, final String tt, String toolTipTitle) {
 Button item = new Button() {
  @Override
  protected void afterRender() {
   super.afterRender();
   if (GXT.isAriaEnabled()) buttonEl.dom.setTitle(tt);
  }
 };
 item.setIcon(icon);
 item.setTabIndex(-1);
 ToolTipConfig cfg = new ToolTipConfig(toolTipTitle, tt);
 item.setToolTip(cfg);
 if (GXT.isAriaEnabled()) {
  item.setData("gxt-menutext", toolTipTitle);
 }
 item.addSelectionListener(btnListener);
 return item;
}

代码示例来源:origin: com.extjs/gxt

protected Button createColorButton(AbstractImagePrototype icon, String toolTip, String toolTipTitle,
  Listener<ComponentEvent> listener) {
 Button item = new Button();
 item.setIcon(icon);
 item.setTabIndex(-1);
 ToolTipConfig cfg = new ToolTipConfig(toolTipTitle, toolTip);
 item.setToolTip(cfg);
 if (GXT.isAriaEnabled()) {
  item.setData("gxt-menutext", toolTipTitle);
 }
 ColorMenu menu = new ColorMenu();
 menu.getColorPalette().addListener(Events.Select, listener);
 item.setMenu(menu);
 return item;
}

代码示例来源:origin: com.extjs/gxt

@Override
protected void onRender(Element target, int index) {
 El wrap = new El(DOM.createDiv());
 wrap.addStyleName("x-form-field-wrap");
 wrap.addStyleName("x-form-file-wrap");
 input = new El(DOM.createInputText());
 input.addStyleName(fieldStyle);
 input.addStyleName("x-form-file-text");
 input.setId(XDOM.getUniqueId());
 if (GXT.isAriaEnabled()) {
  input.setTitle("File upload field");
 }
 if (GXT.isIE && target.getTagName().equals("TD")) {
  input.setStyleAttribute("position", "static");
 }
 wrap.appendChild(input.dom);
 setElement(wrap.dom, target, index);
 button = new Button(getMessages().getBrowseText());
 button.getFocusSupport().setIgnore(true);
 button.addStyleName("x-form-file-btn");
 button.setIcon(buttonIcon);
 button.render(wrap.dom);
 createFileInput();
 super.onRender(target, index);
 super.setReadOnly(true);
}

代码示例来源:origin: com.extjs/gxt

more.setIcon(GXT.IMAGES.toolbar_more());
more.setMenu(moreMenu);
ComponentHelper.setParent(container, more);

相关文章