本文整理了Java中javax.swing.Icon.paintIcon()
方法的一些代码示例,展示了Icon.paintIcon()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Icon.paintIcon()
方法的具体详情如下:
包路径:javax.swing.Icon
类名称:Icon
方法名:paintIcon
暂无
代码示例来源:origin: skylot/jadx
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
int w = getIconWidth();
int h = getIconHeight();
icon.paintIcon(c, g, x, y);
int k = 0;
for (Icon subIcon : icons) {
int dx = (int) (OVERLAY_POS[k++] * (w - subIcon.getIconWidth()));
int dy = (int) (OVERLAY_POS[k++] * (h - subIcon.getIconHeight()));
subIcon.paintIcon(c, g, x + dx, y + dy);
}
}
代码示例来源:origin: nodebox/nodebox
public Icon getHostIcon() {
if (hostIcon != null) return hostIcon;
BufferedImage img = new BufferedImage(64, 64, BufferedImage.TYPE_INT_ARGB);
Graphics2D g = (Graphics2D) img.getGraphics();
Icon icon = new ImageIcon(host.getIconFile());
float factor = 64f / icon.getIconHeight();
g.scale(factor, factor);
icon.paintIcon(null, g, 0, 0);
hostIcon = new ImageIcon(img);
return hostIcon;
}
代码示例来源:origin: otros-systems/otroslogviewer
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
int xPos = x;
for (Icon icon : icons) {
icon.paintIcon(c, g, xPos, y);
xPos += icon.getIconWidth();
}
}
代码示例来源:origin: plantuml/plantuml
public BufferedImage getImage(double scale, Color foregroundColor, Color backgroundColor)
throws ClassNotFoundException, NoSuchMethodException, SecurityException, InstantiationException,
IllegalAccessException, IllegalArgumentException, InvocationTargetException {
final Icon icon = buildIcon(foregroundColor);
final BufferedImage image = new BufferedImage((int) (icon.getIconWidth() * scale),
(int) (icon.getIconHeight() * scale), BufferedImage.TYPE_INT_ARGB);
final Graphics2D g2 = image.createGraphics();
g2.scale(scale, scale);
if (backgroundColor != null) {
g2.setColor(backgroundColor);
g2.fillRect(0, 0, icon.getIconWidth(), icon.getIconHeight());
}
icon.paintIcon(null, g2, 0, 0);
return image;
}
代码示例来源:origin: freeplane/freeplane
public void paintIcon(final Component c, final Graphics g, final int x, final int y) {
int myX = x;
for (final Icon icon : mIcons) {
icon.paintIcon(c, g, myX, y);
myX += icon.getIconWidth();
}
}
代码示例来源:origin: nodebox/nodebox
Graphics2D g = (Graphics2D) img.getGraphics();
Icon icon = new ImageIcon(updater.getHost().getIconFile());
float factor = 64f / icon.getIconHeight();
g.scale(factor, factor);
icon.paintIcon(this, g, 0, 0);
ImageIcon scaledIcon = new ImageIcon(img);
JLabel iconLabel = new JLabel(scaledIcon);
代码示例来源:origin: 4thline/cling
public void paintComponent(Graphics g) {
Dimension dim = getSize();
int x, y;
if (isOpaque()) {
super.paintComponent(g);
}
for (y = 0; y < dim.height; y += ditherBackground.getIconHeight()) {
for (x = 0; x < dim.width; x += ditherBackground.getIconWidth()) {
ditherBackground.paintIcon(this, g, x, y);
}
}
}
代码示例来源:origin: Audiveris/audiveris
@Override
public void paintIcon (Component c,
Graphics g,
int x,
int y)
{
int w = icon.getIconWidth();
icon.paintIcon(c, g, x + ((width - w) / 2), y);
}
}
代码示例来源:origin: bobbylight/RSyntaxTextArea
if (icon!=null) {
int y2 = y + (line-topLine)*cellHeight;
y2 += (cellHeight-icon.getIconHeight())/2;
ti.getIcon().paintIcon(this, g, 0, y2);
lastLine = line-1; // Paint only 1 icon per line
代码示例来源:origin: org.netbeans.api/org-openide-util
/**
* Converts given icon to a {@link java.awt.Image}.
*
* @param icon {@link javax.swing.Icon} to be converted.
*/
public static final Image icon2Image(Icon icon) {
if (icon instanceof ImageIcon) {
return ((ImageIcon) icon).getImage();
} else {
ToolTipImage image = new ToolTipImage("", icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB);
Graphics g = image.getGraphics();
icon.paintIcon(new JLabel(), g, 0, 0);
g.dispose();
return image;
}
}
代码示例来源:origin: org.gdl-lang.gdl-tools/openehr-utils-gui-swing
public void paintIcon(Component comp, Graphics graph, int newPosX, int newPosY) {
posX = newPosX;
for (Icon fileIcon : fileIcons) {
posY = newPosY;
fileIcon.paintIcon(comp, graph, posX, posY);
posX = posX + fileIcon.getIconWidth();
}
}
代码示例来源:origin: bobbylight/RSyntaxTextArea
Icon icon = ti.getIcon();
if (icon!=null) {
int iconH = icon.getIconHeight();
int offs = ti.getMarkedOffset();
if (offs>=0 && offs<=doc.getLength()) {
if (lineY<=bottomY && (lineY+iconH>=topY)) {
int y2 = lineY + (cellHeight-iconH)/2;
ti.getIcon().paintIcon(this, g, 0, y2);
lastLine = line-1; // Paint only 1 icon per line
代码示例来源:origin: plantuml/plantuml
.newInstance(ctx, fontAsShapes);
dimension = new Dimension(icon.getIconWidth(), icon.getIconHeight());
g2.fillRect(0, 0, icon.getIconWidth(), icon.getIconHeight());
icon.paintIcon(null, g2, 0, 0);
代码示例来源:origin: com.fifesoft.rtext/fife.common
private int paintOtherIcon(Component c, Graphics g, int x, int y) {
if (otherIcon!=null) {
otherIcon.paintIcon(c, g, x,y);
x += otherIcon.getIconWidth() + SPACING;
}
return x;
}
代码示例来源:origin: bobbylight/RSyntaxTextArea
int topLine = (visibleRect.y-textAreaInsets.top)/cellHeight;
int y = topLine*cellHeight +
(cellHeight-collapsedFoldIcon.getIconHeight())/2;
y += textAreaInsets.top;
collapsedFoldIcon.paintIcon(this, g, x, y);
expandedFoldIcon.paintIcon(this, g, x, y);
代码示例来源:origin: kiegroup/optaplanner
Icon errorIcon = UIManager.getIcon("OptionPane.errorIcon");
BufferedImage errorImage = new BufferedImage(
errorIcon.getIconWidth(), errorIcon.getIconHeight(), BufferedImage.TYPE_INT_RGB);
errorIcon.paintIcon(null, errorImage.getGraphics(), 0, 0);
exceptionFrame.setIconImage(errorImage);
exceptionFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
代码示例来源:origin: org.gephi/ui-components
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
orig.paintIcon(c, g, x, y);
if (decorationController == null || decorationController.isDecorated()) {
decoration.paintIcon(c, g, x + orig.getIconWidth() - decoration.getIconWidth(), y);
}
}
代码示例来源:origin: bobbylight/RSyntaxTextArea
visibleEditorRect);
int y = r.y;
y += (cellHeight-collapsedFoldIcon.getIconHeight())/2;
collapsedFoldIcon.paintIcon(this, g, x, y);
y += LineNumberList.getChildViewBounds(v, line,
visibleEditorRect).height;
expandedFoldIcon.paintIcon(this, g, x, y);
y += curLineH;
line++;
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
public static Image getImage(Icon icon) {
if (icon instanceof ImageIcon) {
return ((ImageIcon)icon).getImage();
}
int width = icon.getIconWidth();
int height = icon.getIconHeight();
BufferedImage image = UIUtil.createImage(width, height, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = (Graphics2D) image.getGraphics();
icon.paintIcon(null, g2, 0, 0);
return image;
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-notifications
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
origIcon.paintIcon(c, g, x, y);
g.setColor(UIManager.getColor("controlHighlight")); //NOI18N
g.drawLine(x + origIcon.getIconWidth() - arrowWidth - 2, y,
x + origIcon.getIconWidth() - arrowWidth - 2, y + getIconHeight());
g.setColor(UIManager.getColor("controlShadow")); //NOI18N
g.drawLine(x + origIcon.getIconWidth() - arrowWidth - 3, y,
x + origIcon.getIconWidth() - arrowWidth - 3, y + getIconHeight());
}
内容来源于网络,如有侵权,请联系作者删除!