close

class Init 是用來自動設定好Size、Location、visable等等的類別,可以減少主要類別裡的程式複雜度


import java.awt.*;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
public class Init {
	/*polymorphism*/
	public static void InitWin(Frame v){
		v.setSize(1000,800);
		v.setLocation(500,100);
		v.setLayout(null);
		v.setVisible(true);
	}
	
	public static void addWinListen(Frame v){
		/*Interface*/
		v.addWindowListener(
				new WindowListener(){
					/*WindowListener Method*/
					public void windowOpened(WindowEvent e) {}
					public void windowClosing(WindowEvent e) {v.dispose();}
					public void windowClosed(WindowEvent e) {}
					public void windowIconified(WindowEvent e) {}
					public void windowDeiconified(WindowEvent e) {}
					public void windowActivated(WindowEvent e) {}
					public void windowDeactivated(WindowEvent e) {}
				}
		);
	}
	
	public static void setButton(Button b, int weigh, int height, int x, int y){
		b.setSize(weigh,height);
		b.setLocation(x,y);
	}
}
arrow
arrow
    文章標籤
    Init Class Init
    全站熱搜
    創作者介紹
    創作者 Kuihao 的頭像
    Kuihao

    溫暖午後的金針田__孕育有趣的創新

    Kuihao 發表在 痞客邦 留言(0) 人氣()