|
Article on other languages:
|
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);
}
}
関連項目外部リンク
|
|||||||||||||||||||||||||||||
This article is from Wikipedia. All text is available under the terms of the GNU Free Documentation License.
Mercedes Car
This site monitored by SitePinger.net