JavaFX 1.2 のコントロールを試してみる
JavaFX 1.2 で追加された新しいコントロールを簡単に試してみます。
これらのコントロールは Java Swing に依存しないので、モバイル環境でも利用可能です。
package fooami; import javafx.geometry.HPos; import javafx.scene.control.*; import javafx.scene.layout.*; import javafx.scene.Scene; import javafx.stage.Stage; var toggleGroup = ToggleGroup {}; var toggleGroup2 = ToggleGroup {}; var n: Number = 0; n = 4000; Stage { title: "JavaFX Control Example" width: 300 height: 200 scene: Scene { content: [ VBox { spacing: 10 content: [ Tile { hgap: 10 vgap: 10 nodeHPos: HPos.LEFT rows: 4 columns: 2 content: [ Button { text: "Button1" action: function() { println("Button1 pressed."); } } Button { text: "Button2" action: function() { println("Button2 pressed."); } } CheckBox { text: "Check1" allowTriState: false selected: true } CheckBox { text: "Check2" allowTriState: false selected: false } RadioButton { text: "Radio1" toggleGroup: toggleGroup } RadioButton { text: "Radio2" toggleGroup: toggleGroup } ToggleButton { text: "First" toggleGroup: toggleGroup2 } ToggleButton { text: "Second" toggleGroup: toggleGroup2 } ] } Tile { vertical: true vgap: 10 nodeHPos: HPos.LEFT columns: 1 rows: 6 content: [ ProgressBar { progress: bind ProgressBar.computeProgress(10000, n) } ProgressIndicator { progress: bind ProgressIndicator.computeProgress(10000, n) } ScrollBar { min: 1 max: 10 vertical: false } Slider { min: 1 max: 10 vertical: false } TextBox { text: "SampleText" columns: 12 selectOnFocus: true } Hyperlink { text: "http://www.javafx.com" action: function() { println("http://www.javafx.com clicked."); } } ] } ] } ] } }
※TextBox は以前から存在してました。
モバイルアプリケーションとして実行(エミュレータ):
こんな感じです。
早く実際のモバイルで動かしてみたい。携帯キャリアさん、メーカーさん、お願いします。