public void scale(int factor){
  if (m_icon != null) {
    removeAll();
    Image pic=m_icon.getImage();
    int width=m_icon.getIconWidth();
    int height=m_icon.getIconHeight();
    int reduction=width / factor;
    width-=reduction;
    height-=reduction;
    pic=pic.getScaledInstance(width,height,Image.SCALE_SMOOTH);
    m_icon=new ImageIcon(pic);
    m_visualLabel=new JLabel(m_icon);
    add(m_visualLabel,BorderLayout.CENTER);
    Dimension d=m_visualLabel.getPreferredSize();
    Dimension d2=new Dimension((int)d.getWidth() + 10,(int)d.getHeight() + 10);
    setMinimumSize(d2);
    setPreferredSize(d2);
    setMaximumSize(d2);
  }
}

public void scale ( int factor ) { if ( m_icon != null ) { removeAll ( ) ; Image pic = m_icon . getImage ( ) ; int width = m_icon . getIconWidth ( ) ; int height = m_icon . getIconHeight ( ) ; int reduction = width / factor ; width -= reduction ; height -= reduction ; pic = pic . getScaledInstance ( width , height , Image . SCALE_SMOOTH ) ; m_icon = new ImageIcon ( pic ) ; m_visualLabel = new JLabel ( m_icon ) ; add ( m_visualLabel , BorderLayout . CENTER ) ; Dimension d = m_visualLabel . getPreferredSize ( ) ; Dimension d2 = new Dimension ( ( int ) d . getWidth ( ) + 10 , ( int ) d . getHeight ( ) + 10 ) ; setMinimumSize ( d2 ) ; setPreferredSize ( d2 ) ; setMaximumSize ( d2 ) ; } }
reduce this beanvisual ' s icon size by the given factor
