javax.swing.JButton.setSelectedIcon()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(97)

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

JButton.setSelectedIcon介绍

暂无

代码示例

代码示例来源:origin: redwarp/9-Patch-Resizer

this.xhdpiButton.setHorizontalAlignment(SwingConstants.CENTER);
this.xhdpiButton.setIcon(this.blueArrow);
this.xhdpiButton.setSelectedIcon(this.redArrow);
this.xhdpiButton.setBorder(null);
this.xhdpiButton.setContentAreaFilled(false);

代码示例来源:origin: org.netbeans.api/org-openide-awt

@Override
public void setSelectedIcon(Icon icon) {
  Icon arrow = updateIcons( icon, ICON_SELECTED );
  super.setSelectedIcon( hasPopupMenu() ? arrow : icon );
}

代码示例来源:origin: org.netbeans.api/org-openide-awt

bBack.setRolloverIcon(ImageUtilities.loadImageIcon("org/openide/resources/html/back_hover.png", true)); //NOI18N
bBack.setDisabledIcon(ImageUtilities.loadImageIcon("org/openide/resources/html/back_disabled.png", true)); //NOI18N
bBack.setSelectedIcon(bBack.getIcon());
bBack.setToolTipText(NbBundle.getMessage(HtmlBrowser.class, "CTL_Back")); //NOI18N
bForward.setRolloverIcon(ImageUtilities.loadImageIcon("org/openide/resources/html/forward_hover.png", true)); //NOI18N
bForward.setDisabledIcon(ImageUtilities.loadImageIcon("org/openide/resources/html/forward_disabled.png", true)); //NOI18N
bForward.setSelectedIcon(bForward.getIcon());
bForward.setToolTipText(NbBundle.getMessage(HtmlBrowser.class, "CTL_Forward")); //NOI18N
bReload.setRolloverIcon(ImageUtilities.loadImageIcon("org/openide/resources/html/refresh_hover.png", true)); //NOI18N
bReload.setDisabledIcon(ImageUtilities.loadImageIcon("org/openide/resources/html/refresh.png", true)); //NOI18N
bReload.setSelectedIcon(bReload.getIcon());
bReload.setToolTipText(NbBundle.getMessage(HtmlBrowser.class, "CTL_Reload")); //NOI18N
bReload.setFocusPainted(false);
bStop.setRolloverIcon(ImageUtilities.loadImageIcon("org/openide/resources/html/stop_hover.png", true)); //NOI18N
bStop.setDisabledIcon(ImageUtilities.loadImageIcon("org/openide/resources/html/stop.png", true)); //NOI18N
bStop.setSelectedIcon(bStop.getIcon());
bStop.setToolTipText(NbBundle.getMessage(HtmlBrowser.class, "CTL_Stop")); //NOI18N
bStop.setFocusPainted(false);

代码示例来源:origin: org.rwshop/org.rwshop.swing.common

/**
 *
 * @param icon
 * @param hover
 * @param select
 */
public void setCloseIcons(Icon icon, Icon hover, Icon select){
  myCloseButton.setIcon(icon);
  myCloseButton.setRolloverIcon(hover);
  myCloseButton.setSelectedIcon(select);
  myCloseButton.setRolloverEnabled(hover == null && select == null);
}

代码示例来源:origin: org.gephi/ui-components

@Override
public void setSelectedIcon(Icon icon) {
  Icon arrow = updateIcons(icon, ICON_SELECTED);
  super.setSelectedIcon(hasPopupMenu() ? arrow : icon);
}

代码示例来源:origin: org.rwshop/org.rwshop.swing.common

/** Creates new form ComponentHeaderPanel */
public ComponentHeaderPanel() {
  initComponents();
  if(!SettingsRepository.isInitialized()){
    return;
  }
  Icon[] icons = SettingsRepository.getDefaultHeaderIcons();
  myIcon.setIcon(icons[0]);
  myCloseButton.setIcon(icons[1]);
  myCloseButton.setRolloverIcon(icons[2]);
  myCloseButton.setSelectedIcon(icons[3]);
  myCloseButton.setRolloverEnabled(true);
}

代码示例来源:origin: Spoutcraft/LegacyLauncher

public static JButton drawCropped(JPanel contentPane, ActionListener listener, BufferedImage img, int type, int sx1, int sy1, int sx2, int sy2, int x, int y, int scale, boolean reflect) {
  BufferedImage resizedImage = new BufferedImage((sx2 - sx1) * scale, (sy2 - sy1) * scale, type);
  Graphics2D g = resizedImage.createGraphics();
  int asx2 = sx2, asx1 = sx1;
  if (reflect) {
    asx2 = sx1;
    asx1 = sx2;
  }
  g.drawImage(img, 0, 0, (sx2 - sx1) * scale, (sy2 - sy1) * scale, asx1, sy1, asx2, sy2, null);
  g.dispose();
  JButton tmp = new JButton(new ImageIcon(resizedImage));
  tmp.setRolloverEnabled(true);
  tmp.setRolloverIcon(tmp.getIcon());
  tmp.setSelectedIcon(tmp.getIcon());
  tmp.setDisabledIcon(tmp.getIcon());
  tmp.setPressedIcon(tmp.getIcon());
  tmp.setFocusable(false);
  tmp.setContentAreaFilled(false);
  tmp.setBorderPainted(false);
  tmp.setBounds(x, y, (sx2 - sx1) * scale, (sy2 - sy1) * scale);
  if (listener != null) {
    tmp.addActionListener(listener);
  }
  contentPane.add(tmp);
  return tmp;
}

代码示例来源:origin: igvteam/igv

infoLinkButton.setOpaque(false);
infoLinkButton.setPreferredSize(new java.awt.Dimension(15, 15));
infoLinkButton.setSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/images/info.gif"))); // NOI18N
infoLinkButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
infoLinkButton.setVerticalTextPosition(javax.swing.SwingConstants.TOP);

代码示例来源:origin: Spoutcraft/LegacyLauncher

tmp.setModel(new RolloverModel(buttons));
tmp.setRolloverIcon(hover);
tmp.setSelectedIcon(tmp.getIcon());
tmp.setDisabledIcon(tmp.getIcon());
tmp.setPressedIcon(tmp.getIcon());

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

JComponent     title = ((BasicInternalFrameUI)myInternalFrame.getUI()).getNorthPane();
 for (int i = 0; i < title.getComponentCount(); i++) {
   JComponent component = (JComponent)title.getComponent(i);
   if(component instanceof JButton) {
     JButton button = ((JButton)component);
     if(button.getName() == null) continue;
     if(button.getName().endsWith("closeButton")) {
       button.setIcon(myIcon);
       button.setSelectedIcon(myIcon);
       button.setPressedIcon(myIcon);
     }
     if(button.getName().endsWith("maximizeButton")) {
       ...
     }
     if(button.getName().endsWith("iconifyButton")) {
       ...
     }
   }
 }

代码示例来源:origin: Spoutcraft/LegacyLauncher

background.setRolloverEnabled(true);
background.setRolloverIcon(background.getIcon());
background.setSelectedIcon(background.getIcon());
background.setDisabledIcon(background.getIcon());
background.setPressedIcon(background.getIcon());

相关文章

JButton类方法