javax.swing.ImageIcon.setDescription()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(161)

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

ImageIcon.setDescription介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

ImageIcon giraffe = new ImageIcon(...);
giraffe.setDescription("Giraffe Description");

代码示例来源:origin: icza/scelight

@Override
public ImageIcon getIcon() {
  if ( icon == null ) {
    icon = iconImgData == null ? new ImageIcon() : new ImageIcon( iconImgData );
    // Set a description so that if this icon is used in a table, copying cells will not result in a meaningless
    // or strange text.
    icon.setDescription( "I" );
  }
  
  return icon;
}

代码示例来源:origin: icza/scelight

/**
 * Returns the lazily initialized icon of the module.
 * <p>
 * The icon is created from the icon image data returned by {@link #getIconImgData()}.
 * </p>
 * 
 * @return the lazily initialized icon of the module
 */
public ImageIcon getIcon() {
  if ( icon == null ) {
    icon = iconImgData == null ? new ImageIcon() : new ImageIcon( iconImgData );
    // Set a description so that if this icon is used in a table, copying cells will not result in a meaningless
    // or strange text.
    icon.setDescription( "I" );
  }
  
  return icon;
}

代码示例来源:origin: net.anwiba.commons/anwiba-commons-swing-icon

@Override
public void setDescription(final String description) {
 this.model.get().setDescription(description);
}

代码示例来源:origin: org.apache.jmeter/ApacheJMeter_core

/**
 * This looks for the requested image in the classpath under
 * org.apache.jmeter.images.<em>&lt;name&gt;</em>, and also sets the description
 * of the image, which is useful if the icon is going to be placed
 * on the clipboard.
 *
 * @param name
 *            the name of the image
 * @param description
 *            the description of the image
 * @return The Image value
 */
public static ImageIcon getImage(String name, String description) {
  ImageIcon icon = getImage(name);
  if(icon != null) {
    icon.setDescription(description);
  }
  return icon;
}

代码示例来源:origin: stackoverflow.com

private void addCardsAndChangeSize() throws Exception
{
  String tempString;
  ImageIcon tempIcon;
  allCards.clear();
  URL imageURL;

  for(int i = 0; i < all.length; i++)
  {
    for(int x = 0; x < clubs.length; x++)
    {
      tempString = all[i][x];
      tempString = "/cards/"+cardFolders[i]+"/"+tempString;
      imageURL = this.getClass().getResource(tempString);
      System.out.println(tempString);
      System.out.println(imageURL == null);
      tempIcon = resizeImage(new ImageIcon(imageURL),70,70,false);
      tempString = all[i][x];
      tempIcon.setDescription(tempString);
      allCards.add(tempIcon);
    }
  }
  backCard = resizeImage(new ImageIcon(this.getClass().getResource(back)),70,70,false);
}

代码示例来源:origin: triplea-game/triplea

/**
 * Gets the small flag for a given PlayerId.
 *
 * @param player the player to get the flag for
 * @return ImageIcon small flag
 */
protected ImageIcon getIcon(final PlayerId player) {
 ImageIcon icon = mapPlayerImage.get(player);
 if (icon == null && uiContext != null) {
  final Image img = uiContext.getFlagImageFactory().getSmallFlag(player);
  icon = new ImageIcon(img);
  icon.setDescription(player.getName());
  mapPlayerImage.put(player, icon);
 }
 return icon;
}

代码示例来源:origin: HearthStats/HearthStats.net-Uploader

hoverIcon = new ImageIcon(hoverImage);
normalIcon.setDescription("Help");
hoverIcon.setDescription("Help");

代码示例来源:origin: igniterealtime/Spark

protected ImageIcon getImageIcon(EntityFullJid participantJID) {
  Resourcepart displayName = participantJID.getResourcepart();
  ImageIcon icon = SparkRes.getImageIcon(SparkRes.GREEN_BALL);
  icon.setDescription(displayName.toString());
  return icon;
}

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

private void setImageIcon(ImageIcon newIcon) {
  boolean sizeChanged = icon.getIconWidth() != newIcon.getIconWidth()
      || icon.getIconHeight() != newIcon.getIconHeight();
  Image oldImage = icon.getImage();
  icon.setImage(newIcon.getImage());
  icon.setDescription(newIcon.getDescription());
  informUsers(oldImage, newIcon.getImage(), sizeChanged);
}

代码示例来源:origin: igniterealtime/Spark

/**
 * Loads all banned users in a ChatRoom.
 */
public void loadAllBannedUsers() {
  // Clear all elements from model
  listModel.clear();
  Iterator<Affiliate> bannedUsers = null;
  try {
    bannedUsers = chat.getOutcasts().iterator();
  }
  catch (XMPPException | SmackException | InterruptedException e) {
    Log.error("Error loading all banned users", e);
  }
  while (bannedUsers != null && bannedUsers.hasNext()) {
    Affiliate bannedUser = bannedUsers.next();
    ImageIcon icon = SparkRes.getImageIcon(SparkRes.STAR_RED_IMAGE);
    icon.setDescription(bannedUser.getJid().toString());
    listModel.addElement(icon);
  }
}

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

if (shouldPreferRegular(imageData)) {
  ImageIcon icon = new ImageIcon(imageData);
  icon.setDescription("GIF (Exception)");
  return icon;
  icon.setDescription("GIF (Dont fix)");
  return icon;
icon.setDescription("GIF");
return icon;

代码示例来源:origin: org.orbisgis/orbisgis-view

@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
  Component rendering = lookAndFeelRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
  boolean failedToUseImage = true;
  if(rendering instanceof JLabel && isKey) {
    JLabel renderLabel = (JLabel)rendering;
    Icon defaultIcon = renderLabel.getIcon();
    if(defaultIcon == null) {
      ImageIcon keyIcon = OrbisGISIcon.getIcon("key");
      keyIcon.setDescription(DESCR_IMAGE);
      renderLabel.setIcon(keyIcon);
      failedToUseImage = false;
    } else if(defaultIcon instanceof ImageIcon && !DESCR_IMAGE.equals(((ImageIcon) defaultIcon).getDescription())) {
      ImageIcon defaultImageIcon = (ImageIcon) defaultIcon;
      ImageIcon resultIcon = concatenateImages(OrbisGISIcon.getIcon("key"), defaultImageIcon);
      resultIcon.setDescription(DESCR_IMAGE);
      renderLabel.setIcon(resultIcon);
      failedToUseImage = false;
    } else if(defaultIcon instanceof ImageIcon) {
      failedToUseImage = false;
    }
  }
  // Use Bold instead of Key icon if icon is not accepted by the component
  if(failedToUseImage && isKey && rendering.getFont() != null) {
    rendering.setFont(rendering.getFont().deriveFont(Font.BOLD));
  }
  return rendering;
}

代码示例来源:origin: igniterealtime/Spark

newIcon.setDescription(statusItem.getText());

代码示例来源:origin: org.cytoscape/plugin-impl

warningIcon.setDescription("Warning");
javax.swing.ImageIcon okIcon = new ImageIcon(getClass().getResource("/images/check-mark.gif"));
okIcon.setDescription("OK");

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

if (loadedImage != null) {
  image.setImage(loadedImage);
  image.setDescription("ImageIO");

代码示例来源:origin: com.tourgeek.thin.app/com.tourgeek.thin.app.booking

/**
 * Create the button/panel for this menu item.
 * @param record The menu record.
 * @return The component to add to this panel.
 */
public JComponent makeSearchMenuButton(String strName)
{
  ProductTypeInfo productType = ProductTypeInfo.getProductType(strName);
  String strDescription = productType.getDescription();
  ImageIcon icon = productType.getStartIcon();
  icon.setDescription(strName);
  return this.makeMenuButton(strDescription, icon, SearchConstants.SEARCH_BUTTON);
}
/**

代码示例来源:origin: openpreserve/jhove

if (logoURL != null) {
  ImageIcon icn = new ImageIcon (logoURL);
  icn.setDescription ("Jhove logo");
  setNormalBackground ();
  JLabel logoLabel = new JLabel (icn);

代码示例来源:origin: stackoverflow.com

images[i] = createImageIcon("/res/" + imgStrings[i] + ".png");
if (images[i] != null) {
  images[i].setDescription(imgStrings[i]);

相关文章