解答例 - 実習課題1 - 1.ウィンドウの作成
(実習課題1)
サンプルプログラムを改良しなさい。
- JFrameクラスを拡張してウィンドウを作成する事。
- main関数の中のプログラムは以下の2行のみとする事。
SampleFrame frame=new SampleFrame(); frame.setVisible(true);
解答例
package com.techscore.ui.chapter1.exercise1;
/**
* SampleFrame.java
* TECHSCORE Javaユーザインタフェース1章 実習課題1
*
* Copyright (c) 2004 Four-Dimensional Data, Inc.
*/
import javax.swing.JFrame;
public class SampleFrame extends JFrame {
public SampleFrame() {
super("SampleFrame");
super.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
super.setSize(400, 400);
}
public static void main(String args[]) {
SampleFrame frame = new SampleFrame();
frame.setVisible(true);
}
}

