当前位置: 首页>>代码示例>>Java>>正文


Java ImageIcon.setImage方法代码示例

本文整理汇总了Java中javax.swing.ImageIcon.setImage方法的典型用法代码示例。如果您正苦于以下问题:Java ImageIcon.setImage方法的具体用法?Java ImageIcon.setImage怎么用?Java ImageIcon.setImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.ImageIcon的用法示例。


在下文中一共展示了ImageIcon.setImage方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setIconButtons

import javax.swing.ImageIcon; //导入方法依赖的package包/类
private void setIconButtons()

    {
        homeIcon = new ImageIcon("icon/home.png");
        Image icon = homeIcon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH);
        homeIcon.setImage(icon);
        home.setIcon(homeIcon);
        
        nextIcon = new ImageIcon("icon/next.png");
        icon = nextIcon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH);
        nextIcon.setImage(icon);
        next.setIcon(nextIcon);
        
        backIcon = new ImageIcon("icon/back.png");
        icon = backIcon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH);
        backIcon.setImage(icon);
        back.setIcon(backIcon);
        
        /*endIcon = new ImageIcon("icon/end.png");
        icon = endIcon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH);
        endIcon.setImage(icon);
        end.setIcon(endIcon);*/
    }
 
开发者ID:IngSW-unipv,项目名称:Progetto-I,代码行数:24,代码来源:ExecutePage.java

示例2: getImage

import javax.swing.ImageIcon; //导入方法依赖的package包/类
ImageIcon getImage(URL base) {
    if (!loadedImage) {
        synchronized(this) {
            if (!loadedImage) {
                URL url = CSS.getURL(base, svalue);
                loadedImage = true;
                if (url != null) {
                    image = new ImageIcon();
                    Image tmpImg = Toolkit.getDefaultToolkit().createImage(url);
                    if (tmpImg != null) {
                        image.setImage(tmpImg);
                    }
                }
            }
        }
    }
    return image;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:CSS.java

示例3: setIconButtons

import javax.swing.ImageIcon; //导入方法依赖的package包/类
private void setIconButtons()
{
    homeIcon = new ImageIcon("icon/home.png");
    Image icon = homeIcon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH);
    homeIcon.setImage(icon);
    home.setIcon(homeIcon);
    
    nextIcon = new ImageIcon("icon/next.png");
    icon = nextIcon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH);
    nextIcon.setImage(icon);
    next.setIcon(nextIcon);
    
    backIcon = new ImageIcon("icon/back.png");
    icon = backIcon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH);
    backIcon.setImage(icon);
    back.setIcon(backIcon);
    
    endIcon = new ImageIcon("icon/end.png");
    icon = endIcon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH);
    endIcon.setImage(icon);
    end.setIcon(endIcon);
}
 
开发者ID:IngSW-unipv,项目名称:Progetto-I,代码行数:23,代码来源:ExecutePage.java

示例4: setIconPath

import javax.swing.ImageIcon; //导入方法依赖的package包/类
/**
 * 按图片路径设置菜单图片
 * 
 * @param i_IconPath
 * @throws Exception
 */
public void setIconPath(String i_IconPath) throws Exception
{
	ImageIcon v_Image = new ImageIcon(new URL(i_IconPath));
	
	v_Image.setImage(v_Image.getImage().getScaledInstance(17 ,17 ,1));
	
	super.setIcon(v_Image);
}
 
开发者ID:HY-ZhengWei,项目名称:hy.common.ui,代码行数:15,代码来源:JMenuItem.java

示例5: Inicial

import javax.swing.ImageIcon; //导入方法依赖的package包/类
/**
 * Creates new form Main
 */
public Inicial() {
    initComponents();
    this.setLocationRelativeTo(null);

    setIcon();

    ImageIcon img = new javax.swing.ImageIcon("C:\\Users\\Public\\Pictures\\telaFundo.png");
    img.setImage(img.getImage().getScaledInstance(617, 447, 100));

    lbl_imagem.setIcon(img);
}
 
开发者ID:wesleyreis1808,项目名称:projetomcdonalds,代码行数:15,代码来源:Inicial.java

示例6: loadImages

import javax.swing.ImageIcon; //导入方法依赖的package包/类
private void loadImages() {
	String[] imageNames = { IMG_LOGOPOLI, IMG_SUITEICON };
	//load each image referenced in the above array
	for (String imageName : imageNames) {
		ImageIcon img = JMTImageLoader.loadImage(imageName);
		if (imageName.equals(IMG_LOGOPOLI)) {
			Image imgSmall = img.getImage().getScaledInstance(400, (150 * 400) / 739, Image.SCALE_SMOOTH);
			img.setImage(imgSmall);
		}
		imageIcons.put(imageName, img);
	}
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:13,代码来源:AlphaNumStartScreen.java

示例7: loadImages

import javax.swing.ImageIcon; //导入方法依赖的package包/类
private void loadImages() {
	String[] imageNames = { IMG_LOGOPOLI, IMG_JMODELICON, IMG_JMVAICON, IMG_JABAICON, IMG_JMCHICON, IMG_JWATICON, IMG_JSIMICON, IMG_SUITEICON };
	//load each image referenced in the above array
	for (String imageName : imageNames) {
		ImageIcon img = JMTImageLoader.loadImage(imageName);
		if (imageName.equals(IMG_LOGOPOLI)) {
			//                Image imgSmall = img.getImage().getScaledInstance(400,(150*(400))/739,Image.SCALE_SMOOTH);
			Image imgSmall = img.getImage().getScaledInstance(100, 100, Image.SCALE_SMOOTH);
			img.setImage(imgSmall);
		}
		imageIcons.put(imageName, img);
	}
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:14,代码来源:UniqueStartScreen.java

示例8: executeWithUnitOutForAnimation

import javax.swing.ImageIcon; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public void executeWithUnitOutForAnimation(JLabel unitLabel) {
    final GUI gui = getGUI();

    // Tile position should now be valid.
    if (gui.getTilePosition(this.tile) == null) {
        logger.warning("Failed attack animation for " + this.unit
            + " at tile: " + this.tile);
        return;
    }

    final Rectangle rect = gui.getTileBounds(this.tile);
    final ImageIcon icon = (ImageIcon)unitLabel.getIcon();
    for (AnimationEvent event : animation) {
        long time = System.nanoTime();
        if (event instanceof ImageAnimationEvent) {
            final ImageAnimationEvent ievent = (ImageAnimationEvent)event;
            Image image = ievent.getImage();
            if (mirror) {
                // FIXME: Add mirroring functionality to SimpleZippedAnimation
                image = ImageLibrary.createMirroredImage(image);
            }
            icon.setImage(image);
            gui.paintImmediatelyCanvasIn(rect);
            time = ievent.getDurationInMs()
                - (System.nanoTime() - time) / 1000000;
            if (time > 0) Utils.delay(time, "Animation delayed.");
        }
    }
    gui.refresh();
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:34,代码来源:UnitImageAnimation.java

示例9: setStartIcon

import javax.swing.ImageIcon; //导入方法依赖的package包/类
private void setStartIcon()
{
    startIcon = new ImageIcon("icon/next.png");
    Image icon = startIcon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH);
    startIcon.setImage(icon);
    start.setIcon(startIcon);
}
 
开发者ID:IngSW-unipv,项目名称:Progetto-I,代码行数:8,代码来源:Home.java

示例10: setStartIcon

import javax.swing.ImageIcon; //导入方法依赖的package包/类
private void setStartIcon()
{
    startIcon = new ImageIcon("icon/start.png");
    Image icon = startIcon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH);
    startIcon.setImage(icon);
    start.setIcon(startIcon);
}
 
开发者ID:IngSW-unipv,项目名称:Progetto-I,代码行数:8,代码来源:HomePage.java

示例11: refreshViewer

import javax.swing.ImageIcon; //导入方法依赖的package包/类
private static void refreshViewer(Image img, AtomicInteger zoomX, AtomicInteger zoomY, ImageIcon icon, Frame frame) {
    //System.err.println(zoomX);
    //System.err.println(zoomY);
    Image newImage;
    if (zoomX.get() == 1 && zoomY.get() == 1) {
        newImage = img;
    } else {
        newImage = img.getScaledInstance((int)(img.getWidth(frame) * Math.pow(2, zoomX.get())),
                                         (int)(img.getHeight(frame) * Math.pow(2, zoomY.get())),
                                         Image.SCALE_SMOOTH);
    }
    icon.setImage(newImage);
    frame.repaint();
}
 
开发者ID:tberg12,项目名称:klavier,代码行数:15,代码来源:MatrixVis.java

示例12: afficheRune

import javax.swing.ImageIcon; //导入方法依赖的package包/类
private void afficheRune(String url){
   java.net.URL imageURL = Main.class.getResource(url);
   ImageIcon icon = new ImageIcon(imageURL);
   if (url.equals("/images/stele.png")){
       java.awt.Image imagePhoto=icon.getImage();
       imagePhoto=imagePhoto.getScaledInstance(88,112,java.awt.Image.SCALE_SMOOTH);
       icon.setImage(imagePhoto);
   }
   runeLbl.setIcon(icon);
}
 
开发者ID:Denis-Bonnot-project,项目名称:Jeu-de-runes,代码行数:11,代码来源:Rune.java


注:本文中的javax.swing.ImageIcon.setImage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。