javax.swing.ImageIcon#getImage ( )源码实例Demo

下面列出了javax.swing.ImageIcon#getImage ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: coming   文件: JGenProg2015_000_s.java
/**
 * Returns the JFreeChart logo (a picture of a gorilla).
 *
 * @return The JFreeChart logo.
 */
public Image getLogo() {

    Image logo = super.getLogo();
    if (logo == null) {
        URL imageURL = this.getClass().getClassLoader().getResource(
                "org/jfree/chart/gorilla.jpg");
        if (imageURL != null) {
            ImageIcon temp = new ImageIcon(imageURL);  
                // use ImageIcon because it waits for the image to load...
            logo = temp.getImage();
            setLogo(logo);
        }
    }
    return logo;

}
 
源代码2 项目: Spark   文件: GraphicUtils.java
/**
    * Returns a scaled down image if the height or width is smaller than the
    * image size.
    * 
    * @param icon
    *            the image icon.
    * @param newHeight
    *            the preferred height.
    * @param newWidth
    *            the preferred width.
    * @return the icon.
    */
   public static ImageIcon scaleImageIcon(ImageIcon icon, int newHeight,
    int newWidth) {
Image img = icon.getImage();
int height = icon.getIconHeight();
int width = icon.getIconWidth();

if (height > newHeight) {
    height = newHeight;
}

if (width > newWidth) {
    width = newWidth;
}
img = img.getScaledInstance(width, height, Image.SCALE_SMOOTH);
return new ImageIcon(img);
   }
 
源代码3 项目: javagame   文件: MessageWindow.java
public MessageWindow(Rectangle rect) {
    this.rect = rect;

    innerRect = new Rectangle(
            rect.x + EDGE_WIDTH,
            rect.y + EDGE_WIDTH,
            rect.width - EDGE_WIDTH * 2,
            rect.height - EDGE_WIDTH * 2);

    textRect = new Rectangle(
            innerRect.x + 16,
            innerRect.y + 16,
            320,
            120);
    
    // ���b�Z�[�W�G���W�����쐬
    messageEngine = new MessageEngine();

    // �J�[�\���C���[�W�����[�h
    ImageIcon icon = new ImageIcon(getClass().getResource("image/cursor.gif"));
    cursorImage = icon.getImage();
    
    timer = new Timer();
}
 
源代码4 项目: javagame   文件: MessageWindow.java
public MessageWindow(Rectangle rect) {
    this.rect = rect;

    innerRect = new Rectangle(
            rect.x + EDGE_WIDTH,
            rect.y + EDGE_WIDTH,
            rect.width - EDGE_WIDTH * 2,
            rect.height - EDGE_WIDTH * 2);

    textRect = new Rectangle(
            innerRect.x + 16,
            innerRect.y + 16,
            320,
            120);
    
    // ���b�Z�[�W�G���W�����쐬
    messageEngine = new MessageEngine();

    // �J�[�\���C���[�W�����[�h
    ImageIcon icon = new ImageIcon(getClass().getResource("image/cursor.gif"));
    cursorImage = icon.getImage();
    
    timer = new Timer();
}
 
源代码5 项目: development   文件: ImageValidator.java
/**
 * Validates if the image is one of the following types: jpg, png, gif.
 * 
 * @param imageData
 * @param contentType
 * @throws ValidationException
 *             Is thrown if the image data is not of the expected type.
 */
public static void validateImageType(byte[] imageData, String contentType)
        throws ValidationException {

    if (contentType == null || contentType.length() == 0) {
        throw new ValidationException(ReasonEnum.IMAGE_TYPE, "image type",
                null);
    }

    final ImageIcon image = new ImageIcon(imageData);
    if (image.getImage() == null) {
        throw new ValidationException(ReasonEnum.IMAGE_TYPE,
                "image format", null);
    }

    if (!contentType.equalsIgnoreCase("image/jpeg")
            && !contentType.equalsIgnoreCase("image/jpg")
            && !contentType.equalsIgnoreCase("image/pjpeg")
            && !contentType.equalsIgnoreCase("image/png")
            && !contentType.equalsIgnoreCase("image/x-png")
            && !contentType.equalsIgnoreCase("image/gif")) {
        throw new ValidationException(ReasonEnum.IMAGE_TYPE, "image type",
                new Object[] { contentType });
    }

}
 
源代码6 项目: coming   文件: Cardumen_0077_s.java
/**
 * Returns the JFreeChart logo (a picture of a gorilla).
 *
 * @return The JFreeChart logo.
 */
public Image getLogo() {

    Image logo = super.getLogo();
    if (logo == null) {
        URL imageURL = this.getClass().getClassLoader().getResource(
                "org/jfree/chart/gorilla.jpg");
        if (imageURL != null) {
            ImageIcon temp = new ImageIcon(imageURL);  
                // use ImageIcon because it waits for the image to load...
            logo = temp.getImage();
            setLogo(logo);
        }
    }
    return logo;

}
 
源代码7 项目: qmcflactomp3   文件: AnimatedPanel.java
/**
 * Cr茅e un panneau anim茅 contenant l'image pass茅e en param猫tre. L'animation
 * ne d茅marre que par un appel 脿 start().
 *
 * @param message Le message 脿 afficher
 * @param icon L'image 脿 afficher et 脿 animer
 * @author Romain Guy
 */
public AnimatedPanel(String message, ImageIcon icon) {
    this.message = message;
    this.font = getFont().deriveFont(14.0f);

    Image image = icon.getImage();
    originalImage = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB);
    convolvedImage = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB);
    Graphics g = originalImage.createGraphics();
    g.drawImage(image, 0, 0, this);
    g.dispose();

    setBrightness(1.0f);
    setOpaque(false);
}
 
源代码8 项目: javagame   文件: Beam.java
/**
 * �C���[�W�����[�h����
 *  
 */
private void loadImage() {
    ImageIcon icon = new ImageIcon(getClass().getResource("image/beam.gif"));
    image = icon.getImage();

    // ���ƍ������Z�b�g
    width = image.getWidth(panel);
    height = image.getHeight(panel);
}
 
源代码9 项目: javagame   文件: Alien.java
/**
 * �C���[�W�����[�h����
 *  
 */
private void loadImage() {
    // �G�C���A���̃C���[�W��ǂݍ���
    // ImageIcon���g����MediaTracker���g��Ȃ��Ă���
    ImageIcon icon = new ImageIcon(getClass()
            .getResource("image/alien.gif"));
    image = icon.getImage();

    // ���ƍ������Z�b�g
    width = image.getWidth(panel);
    height = image.getHeight(panel);
}
 
源代码10 项目: javagame   文件: Chara.java
private void loadImage(String filename) {
    ImageIcon icon = new ImageIcon(getClass().getResource(filename));
    image = icon.getImage();
}
 
源代码11 项目: javagame   文件: Sprite.java
/**
 * �C���[�W�����[�h����
 * @param filename �C���[�W�t�@�C����
 */
private void loadImage(String filename) {
    ImageIcon icon = new ImageIcon(getClass().getResource(
            "image/" + filename));
    image = icon.getImage();
}
 
源代码12 项目: javagame   文件: MainPanel.java
/**
 * �u���b�N�̃C���[�W�����[�h
 * 
 * @param filename
 */
private void loadImage(String filename) {
    // �u���b�N�̃C���[�W��ǂݍ���
    ImageIcon icon = new ImageIcon(getClass().getResource(filename));
    blockImage = icon.getImage();
}
 
源代码13 项目: javagame   文件: Chara.java
private void loadImage(String filename) {
    ImageIcon icon = new ImageIcon(getClass().getResource(filename));
    image = icon.getImage();
}
 
源代码14 项目: javagame   文件: Chara.java
private void loadImage() {
    // �L�����N�^�[�̃C���[�W�����[�h
    ImageIcon icon = new ImageIcon(getClass().getResource("image/chara.gif"));
    charaImage = icon.getImage();
}
 
源代码15 项目: javagame   文件: Chara.java
private void loadImage(String filename) {
    ImageIcon icon = new ImageIcon(getClass().getResource(filename));
    image = icon.getImage();
}
 
源代码16 项目: javagame   文件: Map.java
private void loadImage() {
    // �}�b�v�`�b�v�̃C���[�W�����[�h
    ImageIcon icon = new ImageIcon(getClass().getResource("image/mapchip.gif"));
    chipImage = icon.getImage();
}
 
源代码17 项目: javagame   文件: Map.java
/**
 * �C���[�W�����[�h����
 */
private void loadImage() {
    ImageIcon icon = new ImageIcon(getClass().getResource("image/block.gif"));
    blockImage = icon.getImage();
}
 
源代码18 项目: javagame   文件: Map.java
private void loadImage() {
    // �}�b�v�`�b�v�̃C���[�W�����[�h
    ImageIcon icon = new ImageIcon(getClass().getResource("image/mapchip.gif"));
    chipImage = icon.getImage();
}
 
源代码19 项目: javagame   文件: Chara.java
private void loadImage() {
    // �L�����N�^�[�̃C���[�W�����[�h
    ImageIcon icon = new ImageIcon(getClass().getResource("image/chara.gif"));
    charaImage = icon.getImage();
}
 
源代码20 项目: javagame   文件: Chara.java
private void loadImage() {
    // �L�����N�^�[�̃C���[�W�����[�h
    ImageIcon icon = new ImageIcon(getClass().getResource("image/chara.gif"));
    charaImage = icon.getImage();
}