1. 程式人生 > >如何使用set來設定按鈕的大小和位置,以及一些屬性

如何使用set來設定按鈕的大小和位置,以及一些屬性

b1 = new Button("go on");  //宣告一個按鍵


Frame f = new Frame("bu");
		f.setLayout(null);
		f.setSize(300,200);
		b1.setBounds(100,200,200,300);  //設定位置大小,x,y,寬,高
		b1.setBackground(Color.PINK);  //設定按鈕顏色
		f.add(b1);


f.setVisible(true);