Swing

Article on other languages:

del.icio.us del.icio.us
Digg Digg
Furl Furl
Reddit Reddit
Rojo Rojo
Add to OnlyWire
Swingの部品を使用したウィンドウの例

Swingは、プログラミング言語Javaグラフィカルユーザーインターフェース (GUI) を構築するためのツールキット。同じくJavaのGUIツールキットであるAWTを拡張したもの。

AWTはオペレーティングシステムのウィンドウシステムに準じたデザインになるのに対し、Swingで作成したGUIはJavaプログラム上で描画されるので、より柔軟な設計が可能となる。AWTに対しSwingのようなコンポーネントを軽量コンポーネント (Light Weight Component) と呼ぶ。

プラグイン可能なLook&Feelを持っているので、簡単にLook&Feelを切り替えることができる。 またAWTには無かった、スライダーやスピナ、ツリー表示をするコンポーネントなど高度なコンポーネントが用意されている。

プログラム例

import javax.swing.JFrame;
import javax.swing.JLabel;

public class HelloWorld {
    public static void main(String[] args) {
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().add(new JLabel("Hello, world!"));
        frame.setLocationRelativeTo(null);
        frame.pack(); 
        frame.setVisible(true);
    }
}

関連項目

外部リンク

ウィキブックス
ウィキブックスJava関連の教科書や解説書があります。

This article is from Wikipedia. All text is available under the terms of the GNU Free Documentation License.


Giant Panda

Mercedes Car
James Bond Guide
This site monitored by SitePinger.net