2011年1月20日 星期四

Icon 介面中的 PaintIcon() 方法

Icon 介面中有一個抽象方法 PaintIcon(), 用來畫出 icon. 這個方法的宣告如下:


void paintIcon(Component c, 
               Graphics g,
               int x,
               int y)
方法裡有四個參數:
x, y: 畫 icon 的位置
g: 繪圖物件
c: 用來取得繪圖所需要的屬性, 如前景或背景顏色.  

沒有留言: