| 1 6 7 package com.memoire.vainstall.xui; 8 9 import java.awt.*; 10 import java.io.*; 11 import javax.swing.*; 12 import javax.swing.border.*; 13 import com.memoire.vainstall.VAGlobals; 14 15 19 20 public class XuiImagePanel 21 extends XuiPanel 22 { 23 public static final XuiImagePanel IMAGE_PANEL=new XuiImagePanel(); 24 25 public XuiImagePanel() 26 { 27 super(); 28 29 setBackground(Color.white); 30 setForeground(new Color(255,224,192)); 31 34 InputStream imgStream=VAGlobals.BASE_CLASS.getResourceAsStream("/"+VAGlobals.IMAGE); 35 if( imgStream==null ) { 36 } else { 38 ByteArrayOutputStream dataStream=new ByteArrayOutputStream(); 39 try { 40 byte[] buf=new byte[1024]; 41 int read=imgStream.read(buf, 0, buf.length); 42 while( read>0 ) { 43 dataStream.write(buf, 0, read); 44 read=imgStream.read(buf, 0, buf.length); 45 } 46 imgStream.close(); 47 JLabel img=new JLabel(new ImageIcon(dataStream.toByteArray())); 48 dataStream.close(); 49 add(img); 50 } catch( IOException ex ) { 51 } 53 } 54 } 55 } 56 | Popular Tags |