1 import javafx.ui.*;
2 import java.lang.System;
3
4 class ButtonClickModel {
5 attribute numClicks: Number;
6 }
7
8 var model = new ButtonClickModel();
9
10 var win = Frame {
11 width: 300
12 height:200
13 menubar: MenuBar {
14 menus: Menu {
15 text: "File"
16 mnemonic: F
17 items: MenuItem {
18 text: "Exit"
19 mnemonic: X
20 accelerator: {
21 modifier: ALT
22 keyStroke: F4
23 }
24 action: operation() {
25 System.exit(0);
26 }
27 }
28 }
29 }
30 content: GridPanel {
31 border: EmptyBorder {
32 top: 30
33 left: 30
34 bottom: 30
35 right: 30
36 }
37 rows: 2
38 columns: 1
39 vgap: 10
40 cells:
41 [Label {
42 text: bind
43 "<html>
44 <a href='{#(operation(){model.numClicks ++ ;})}'>
45 I'm a hyperlink!
46 </a>
47 </html>"
48 },
49 Label {
50 text: bind "Number of button clicks: {model.numClicks}"
51 }]
52 }
53 visible: true
54 };
让我们用HTML开发胖客户端程序吧!