本文整理了Java中javax.swing.JLabel.getIcon()
方法的一些代码示例,展示了JLabel.getIcon()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JLabel.getIcon()
方法的具体详情如下:
包路径:javax.swing.JLabel
类名称:JLabel
方法名:getIcon
暂无
代码示例来源:origin: stackoverflow.com
JOptionPane.showMessageDialog(null, imageLabel);
Icon icon = imageLabel.getIcon();
代码示例来源:origin: stackoverflow.com
Icon icon = getIcon();
代码示例来源:origin: org.netbeans.api/org-openide-awt
animationTimer = new AnimationTimer(lbl, lbl.getIcon());
} else {
animationTimer = null;
代码示例来源:origin: com.haulmont.thirdparty/swingx-core
/**
* @param treeComponent
*/
private void updateIconWidth(Component treeComponent) {
iconWidth = 0;
if (!(treeComponent instanceof JLabel)) return;
Icon icon = ((JLabel) treeComponent).getIcon();
if (icon != null) {
iconWidth = icon.getIconWidth() + ((JLabel) treeComponent).getIconTextGap();
}
}
代码示例来源:origin: stackoverflow.com
System.out.println("getSourceActions");
DragPanel p = (DragPanel)c;
label.setIcon(p.draggingLabel.getIcon());
label.setText(p.draggingLabel.getText());
window.pack();
DragPanel src = (DragPanel)support.getTransferable().getTransferData(localObjectFlavor);
JLabel l = new JLabel();
l.setIcon(src.draggingLabel.getIcon());
l.setText(src.draggingLabel.getText());
target.add(l);
代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-core
/**
* @param treeComponent
*/
private void updateIconWidth(Component treeComponent) {
iconWidth = 0;
if (!(treeComponent instanceof JLabel)) return;
Icon icon = ((JLabel) treeComponent).getIcon();
if (icon != null) {
iconWidth = icon.getIconWidth() + ((JLabel) treeComponent).getIconTextGap();
}
}
代码示例来源:origin: igniterealtime/Spark
/**
* Returns the current icon used in the textfield.
*
* @return the icon used in the textfield.
*/
public Icon getIcon() {
return imageComponent.getIcon();
}
代码示例来源:origin: net.java.dev.swing-layout/swing-layout
private int getLabelBaseline(JLabel label, int height) {
Icon icon = (label.isEnabled()) ? label.getIcon() :
label.getDisabledIcon();
FontMetrics fm = label.getFontMetrics(label.getFont());
resetRects(label, height);
SwingUtilities.layoutCompoundLabel(label, fm,
"a", icon, label.getVerticalAlignment(),
label.getHorizontalAlignment(), label.getVerticalTextPosition(),
label.getHorizontalTextPosition(), viewRect, iconRect, textRect,
label.getIconTextGap());
return textRect.y + fm.getAscent();
}
代码示例来源:origin: com.fifesoft.rtext/fife.common
/**
* Returns the icon displayed by this titled panel.
*
* @return The icon.
* @see #setIcon
*/
public Icon getIcon() {
return iconLabel.getIcon();
}
代码示例来源:origin: net.java.dev.swing-layout/swing-layout
private static int getLabelBaseline(JLabel label, int height) {
Icon icon = (label.isEnabled()) ? label.getIcon() :
label.getDisabledIcon();
FontMetrics fm = label.getFontMetrics(label.getFont());
resetRects(label, height);
SwingUtilities.layoutCompoundLabel(label, fm,
"a", icon, label.getVerticalAlignment(),
label.getHorizontalAlignment(), label.getVerticalTextPosition(),
label.getHorizontalTextPosition(), viewRect, iconRect, textRect,
label.getIconTextGap());
return textRect.y + fm.getAscent();
}
代码示例来源:origin: com.haulmont.thirdparty/swingx-core
/**
* Returns the graphic image (glyph, icon) that the
* <code>JXTitledSeparator</code> displays.
*
* @return an Icon
* @see #setIcon
*/
public Icon getIcon() {
return label.getIcon();
}
代码示例来源:origin: khuxtable/seaglass
protected void paint(SeaGlassContext context, Graphics g) {
JLabel label = (JLabel) context.getComponent();
Icon icon = (label.isEnabled()) ? label.getIcon() : label.getDisabledIcon();
g.setColor(context.getStyle().getColor(context, ColorType.TEXT_FOREGROUND));
g.setFont(style.getFont(context));
context.getStyle().getGraphicsUtils(context).paintText(context, g, label.getText(), icon, label.getHorizontalAlignment(),
label.getVerticalAlignment(), label.getHorizontalTextPosition(), label.getVerticalTextPosition(),
label.getIconTextGap(), label.getDisplayedMnemonicIndex(), 0);
}
代码示例来源:origin: com.haulmont.thirdparty/swingx-core
/**
* Returns the icon used in this panel, may be null.
*
* @return the icon used in this panel, may be null.
*/
@Override
public Icon getIcon() {
return iconLabel.getIcon();
}
代码示例来源:origin: igniterealtime/Spark
/**
* Returns the Icon representation of the Avatar.
*
* @return Icon of avatar.
*/
public Icon getAvatar() {
return avatar.getIcon();
}
代码示例来源:origin: org.nuiton/nuiton-widgets
/**
* Returns the frame's icon.
*
* @return the frame's icon
*/
public Icon getFrameIcon() {
return titleLabel.getIcon();
}
代码示例来源:origin: com.google.code.validationframework/validationframework-swing
/**
* @see AbstractComponentProperty#getPropertyValueFromComponent()
*/
@Override
protected Icon getPropertyValueFromComponent() {
return component.getIcon();
}
代码示例来源:origin: io.ultreia.java4all.jaxx/jaxx-widgets-extra
/**
* Returns the frame's icon.
*
* @return the frame's icon
*/
public Icon getFrameIcon() {
return titleLabel.getIcon();
}
代码示例来源:origin: stackoverflow.com
addition.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
JLabel label = (JLabel) e.getComponent();
Icon icon = label.getIcon();
// Create new frame and pass it the icon value
}
});
代码示例来源:origin: org.jboss.errai/errai-tools
@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
if (value instanceof DefaultMutableTreeNode && ((DefaultMutableTreeNode) value).getUserObject() instanceof JLabel) {
JLabel l = (JLabel) ((DefaultMutableTreeNode) value).getUserObject();
setIcon(l.getIcon());
setText(l.getText());
}
return this;
}
}
代码示例来源:origin: apache/felix
public void mouseClicked(MouseEvent e){
if (SwingUtilities.isLeftMouseButton(e)){
if (e.getClickCount()==1){
Icon icon = label.getIcon();
if (icon == LIGHT_ON)
model.switchOff();
else
model.switchOn();
}
}
}
});
内容来源于网络,如有侵权,请联系作者删除!