import javafx.ui.*;
import javafx.gui.*;
import java.lang.System;
class Employee {
attribute id:Integer; // 社員番号
attribute name:String; // 社員氏名
attribute subject:String; // 部署
attribute address:String; // 住所
}
var employees:Employee* = [
{id: 1, name: "山田太郎", subject: "第一システム部", address: "埼玉県越谷市"},
{id: 2, name: "田中次郎", subject: "第一システム部", address: "東京都台東区"},
{id: 3, name: "佐藤花子", subject: "総務部", address: "千葉県市川市"},
{id: 4, name: "村上三郎", subject: "第二システム部", address: "千葉県茂原市"},
{id: 5, name: "加藤良子", subject: "第三システム部", address: "埼玉県草加市"},
];
operation showDialog(){
MessageDialog{
message: "追加"
visible: true
}
}
var frame:Frame = Frame {
title:"社員リスト"
height: 300
width: 200
visible: true
menubar:
MenuBar {
menus : [
Menu {
text: "ファイル"
items:
MenuItem {
text: "閉じる"
action: operation() {
System.exit(0);
}
}
},
Menu {
text: "編集"
items: [
MenuItem {
text: "追加"
action: operation() {
showDialog();
}
},
MenuItem {
text: "編集"
action: operation() {
System.out.println("編集");
}
},
MenuItem {
text: "削除"
action: operation() {
System.out.println("削除");
}
}]
},
Menu {
text: "ヘルプ"
items: MenuItem {
text: "バージョン情報"
action: operation() {
System.out.println("バージョン情報");
}
}
}
]
}
content:
BorderPanel {
top:
FlowPanel {
hgap:1
content : [
Button{
text : "追加"
font: Font {
size: 14
style: [BOLD]
}
action : operation(){
showDialog();
}
},
Button{
text : "削除"
font: Font {
size: 14
style: [BOLD]
}
action : operation(){
System.out.println("削除");
}
},
Button{
text : "保存"
font: Font {
size: 14
style: [BOLD]
}
action : operation(){
System.out.println("保存");
}
}
]
}
center:
BorderPanel {
center :
Table {
columns: [
TableColumn { text: "従業員番号" },
TableColumn { text: "名前" },
TableColumn { text: "部署" },
TableColumn { text: "住所" }
],
cells: bind foreach (employee in employees)
[
TableCell {
text: bind "{employee.id}"
},
TableCell {
text: bind employee.name
},
TableCell {
text: bind employee.subject
},
TableCell {
text: bind employee.address
},
]
}
}
bottom:
FlowPanel {
content:
Button {
text : "閉じる"
font: Font {
size: 14
style: [BOLD]
}
action : operation(){
System.exit(0);
}
}
}
}
};
frame.pack();
frame.move(100, 100);
最終更新:2008年10月08日 16:46