Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java.swing.image

import javax.swing.ImageIcon; //導入方法依賴的package包/類
private void setIconButtons()

    {
        homeIcon = new ImageIcon("icon/home.png");
        Image icon = homeIcon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH);
        homeIcon.setImage(icon);
        home.setIcon(homeIcon);
        
        nextIcon = new ImageIcon("icon/next.png");
        icon = nextIcon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH);
        nextIcon.setImage(icon);
        next.setIcon(nextIcon);
        
        backIcon = new ImageIcon("icon/back.png");
        icon = backIcon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH);
        backIcon.setImage(icon);
        back.setIcon(backIcon);
        
        /*endIcon = new ImageIcon("icon/end.png");
        icon = endIcon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH);
        endIcon.setImage(icon);
        end.setIcon(endIcon);*/
    }
Source by vimsky.com #
 
PREVIOUS NEXT
Tagged:
ADD COMMENT
Topic
Name
2+6 =