private void computeCache(int _w, int _h) { if( (cache_==null) ||(cache_.getIconWidth() !=_w) ||(cache_.getIconHeight()!=_h)) { if((_w>0)&&(_h>0)) cache_=new BuIcon(icon_.getImage().getScaledInstance (_w,_h,Image.SCALE_SMOOTH)); else cache_=null; } }
private void paintCache(Graphics _g,int _x,int _y,int _w,int _h) { computeCache(_w,_h); if(cache_!=null) cache_.paintIcon(this,_g,_x,_y); }
public Image getTexture(int _num) { String url = BuPreferences.BU.getStringProperty("desktop.image." + _num); Image img = null; if (!"".equals(url.trim())) { BuIcon icon = new BuIcon(url); if (!icon.isDefault()) img = icon.getImage(); } if (img == null) { img = BuResource.BU.getImage("background_desktop_" + _num); } return img; }
public int getIconWidth() { return init_&&!super.isDefault() ? super.getIconWidth() : w_; }
public int getIconHeight() { return init_&&!super.isDefault() ? super.getIconHeight() : h_; }
if((r.getIconWidth()!=_size)||(r.getIconHeight()!=_size)) r=new BuLazyIcon(((BuLazyIcon)_icon).getURL(),_size,_size); return r; if((r!=null)&&((r.getIconWidth()!=_size)||(r.getIconHeight()!=_size))) Image m=r.getImage(); m=m.getScaledInstance(_size,_size,Image.SCALE_SMOOTH); r=new BuIcon(m); String d=r.getDescription(); r.setDescription(d+" resized to "+_size+"x"+_size); t.put(i,r);
int hi = 0; if (icon != null) { wi = icon.getIconWidth(); hi = icon.getIconHeight(); if (icon != null) { if (attenue) { final Icon ia = new ImageIcon(createImage(new FilteredImageSource(icon.getImage().getSource(), FiltreAttenuation.INSTANCE))); ia.paintIcon(this, _g, x - wi - 5, y); } else { icon.paintIcon(this, _g, x - wi - 5, y);
public void computePreferredSize() { int w=0; int h=0; if(icon_!=null) { w=icon_.getIconWidth (); h=icon_.getIconHeight(); } Insets insets=getInsets(); w+=insets.left+insets.right ; h+=insets.top +insets.bottom; setPreferredSize(new Dimension(w,h)); }
paintCache(_g,xp,yp,wp,hp); else _g.drawImage(icon_.getImage(),xp,yp,wp,hp,this); break; int wi=icon_.getIconWidth(); int hi=icon_.getIconHeight(); double wr=(double)wp/(double)wi; double hr=(double)hp/(double)hi; paintCache(_g,xp,yp,wf,hf); else _g.drawImage(icon_.getImage(),xp,yp,wf,hf,this); break; int wi=icon_.getIconWidth(); int hi=icon_.getIconHeight(); double wr=(double)wp/(double)wi; double hr=(double)hp/(double)hi; paintCache(_g,xp,yp,wf,hf); else _g.drawImage(icon_.getImage(),xp,yp,wf,hf,this); break; _g.drawImage(icon_.getImage(),xp,yp,this); break; int wi=icon_.getIconWidth();
public Image getImage() { return (icon_!=null ? icon_.getImage() : null); }
int hi= 0; if (icon != null) { wi= icon.getIconWidth(); hi= icon.getIconHeight(); icon.paintIcon(this, gd, x - wi - 5, y);
public void setImage(Image _v) { setIcon(_v!=null ? new BuIcon(_v) : null); }
public boolean isDefault() { return init_ ? super.isDefault() : false; }
INFO_LOG.logo.paintIcon(null,_g,0,0); x+=INFO_LOG.logo.getIconWidth()+5;
public final static BuIcon attenueIcone(final BuIcon _icone) { final BuIcon r = attenue0(_icone.getImage()); r.setHotSpot(_icone.getHotSpot()); return r; } }
public String toString() { String r=getDescription(); if(r==null) r=""; if(isDefault()) r="default-"+r; String n=getClass().getName(); n=n.substring(n.lastIndexOf('.')+1); return n+"("+r+")"; } }
public void adjustPreferredSize(int _w) { if(icon_==null) return; if((mode_==ZOOM)||(mode_==REDUCE)) { Insets insets=getInsets(); int dw=insets.left+insets.right; int dh=insets.top+insets.bottom; int wi=icon_.getIconWidth (); int hi=icon_.getIconHeight(); int w=_w; if((mode_==REDUCE)&&(w>wi+dw)) w=wi+dw; double wr=(double)Math.max(0,w-dw)/(double)wi; if((mode_==REDUCE)&&(wr>1.0)) return; int hf=(int)Math.round(wr*hi); setPreferredSize(new Dimension(w,hf+dh)); } }
public Image getImage() { if(!init_) { FuLog.error("BLI: don't call getImage() for lazy icons"); return BuLib.DEFAULT_IMAGE; } return super.getImage(); }