KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > javax > swing > ImageIcon

javax.swing
Class ImageIcon

java.lang.Object
  extended by javax.swing.ImageIcon
All Implemented Interfaces:
Serializable, Accessible, Icon
See Also:
Top Examples, Source Code, XMLEncoder

protected static final Component component
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public AccessibleContext getAccessibleContext()
See Also:
Accessible
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String getDescription()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public int getIconHeight()
See Also:
Icon
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public int getIconWidth()
See Also:
Icon
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Image getImage()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[1679]
By arunstelecom { at } rediffmail { dot } com on 2005/11/10 03:42:45  Rate
read some parameters and display by GUI with green buttons

public int getImageLoadStatus()
See Also:
MediaTracker.COMPLETE, MediaTracker.ERRORED, MediaTracker.ABORTED
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public ImageObserver getImageObserver()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public ImageIcon()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public ImageIcon(byte[] imageData)
See Also:
Image.getProperty(java.lang.String, java.awt.image.ImageObserver), getDescription(), Toolkit.createImage(java.lang.String)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[796]Load, scale and display image applet
By beatrizocampo { at } epm { dot } net { dot } co on 2004/06/02 01:26:28  Rate
// Java core packages 
 import java.applet.Applet; 
 import java.awt.*; 
  
  
 // Java extension packages 
 import javax.swing.*; 
  
  
 public class LoadImageAndScaleDorc extends JApplet  {  
    private Image logo1;        
    private ImageIcon logo2; 
    public int  [  ]  imageData;  
  
  
    // load image when applet is loaded 
    public void init (  )  
     {  
       logo1 = getImage (  getDocumentBase (  ) , "logo.gif"  ) ; 
       int  [  ]  imageData =  { 0x47,0x49,0x46,0x38,0x39,0x61,0x38,0x00,0x12,0x00,0xF3,0x00,0x00,0xFB,0x0B,0x0E,0xFF,0x24,0x00,0xFF,0x3C,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0x7B,0xFF,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2C,0x00,0x00,0x00,0x00,0x38,0x00,0x12,0x00,0x00,0x04,0x68,0x10,0xC8,0x49,0xAB,0xBD,0x38,0xEB,0xCD,0xBB,0x0E,0x5E,0x26,0x84,0x64,0x69,0x9E,0xE6,0xA0,0x0E,0xD5,0xEA,0x4E,0xEE,0x4A,0xBD,0xA8,0x2A,0xD9,0x30,0xCB,0xE1,0x00,0xCE,0x93,0xBC,0x9F,0x6E,0x13,0x1C,0xF6,0x8C,0xA7,0x62,0x47,0x99,0x43,0xDD,0x8C,0x31,0x64,0x73,0xFA,0xAC,0xC9,0xA8,0x3F,0xEA,0x71,0x26,0x2D,0x65,0xB9,0x96,0xAC,0xEF,0x9B,0xEA,0x6E,0x5B,0xD2,0xA8,0x53,0x0B,0x6E,0x67,0xC8,0x44,0xA8,0x4E,0x88,0x14,0xCB,0x93,0xF3,0xFB,0xD9,0x3D,0x85,0x2F,0xAF,0x5C,0x64,0x82,0x80,0x6B,0x16,0x04,0x85,0x88,0x6B,0x05,0x89,0x12,0x11,0x00,0x3B } ; 
        
       logo2 = ImageIcon  ( int [  ]  imageData ) ; 
       for  ( int i=0;i < imageData.length;i++ )  {  
         System.out.print ( " i= "+i+" byte= "+imageData [ i ] +"\n" ) ; 
          
          }  
          
     }  
  
  
    // display image 
    public void paint (  Graphics g  )  
     {  
       // draw original image 
       g.drawImage (  logo1, 0, 0, this  ) ; 
  
  
       // draw image scaled to fit width of applet 
       // and height of applet minus 120 pixels 
       g.drawImage (  logo1, 0, 120, 
          getWidth (  ) , getHeight (  )  - 120, this  ) ; 
  
  
       // draw icon using its paintIcon method 
       logo2.paintIcon (  this, g, 180, 0  ) ; 
     }  
  
  
  }  // end class LoadImageAndScale 
 


public ImageIcon(byte[] imageData,
                 String description)
See Also:
Toolkit.createImage(java.lang.String)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public ImageIcon(Image image)
See Also:
Image.getProperty(java.lang.String, java.awt.image.ImageObserver), getDescription()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public ImageIcon(Image image,
                 String description)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public ImageIcon(String filename)
See Also:
getDescription()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public ImageIcon(String filename,
                 String description)
See Also:
ImageIcon(String)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public ImageIcon(URL location)
See Also:
getDescription()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public ImageIcon(URL location,
                 String description)
See Also:
ImageIcon(String)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


protected void loadImage(Image image)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void paintIcon(Component c,
                      Graphics g,
                      int x,
                      int y)
See Also:
Icon
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setDescription(String description)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setImage(Image image)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setImageObserver(ImageObserver observer)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String toString()
See Also:
Object
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


protected static final MediaTracker tracker
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  

Popular Tags