JavaでAWTを表示してみる
/* | |
* To change this template, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
package frametest; | |
import java.awt.*; | |
/** | |
* | |
* @author ogaaaan | |
*/ | |
public class FrameTest extends Frame { | |
/** | |
* @param args the command line arguments | |
*/ | |
public static void main(String[] args) { | |
new FrameTest(); | |
} | |
private FrameTest() { | |
// 親クラスコンストラクタ呼び出し | |
super("Frame Test"); | |
// フレームサイズ設定 | |
setSize(300, 300); | |
// レイアウトの定義 | |
setLayout(new FlowLayout()); | |
// ボタンを追加 | |
Button b1 = new Button("OK!!"); | |
add(b1); | |
// ラベルを追加 | |
Label l1 = new Label("This is IT!!"); | |
add(l1); | |
// テキストフィールドを追加 | |
TextField t1 = new TextField("Kitty on your lap!!"); | |
add(t1); | |
// テキストエリアを追加 | |
TextArea ta1 = new TextArea("This is all day.", 5, 30); | |
add(ta1); | |
// チェックボックスを追加 | |
Checkbox c1 = new Checkbox("Agree!?"); | |
add(c1); | |
// プルダウンの追加 | |
Choice ch1 = new Choice(); | |
ch1.add("FireFox"); | |
ch1.add("Chrome"); | |
ch1.add("Safari"); | |
ch1.add("Opera"); | |
add(ch1); | |
// リストの追加 | |
List ls1 = new List(); | |
ls1.add("Fedora"); | |
ls1.add("Ubuntu"); | |
ls1.add("Vine"); | |
ls1.add("BSD"); | |
add(ls1); | |
// 表示 | |
show(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment