Hello, JavaFX(Jasmin) World!

Posted on 1月 3rd, 2013 by cx20

JavaFX(Jasmin)

JavaFX は Java による RIA 向けの GUI ライブラリならびにプラットフォームである。
類似の RIA プラットフォームとしては Adobe Flex や Microsoft Silverlight などがある。
以下は Jasmin による JavaFX の使用例となっている。

ソースコード

; Produced by NeoJasminVisitor (tinapoc)
; http://tinapoc.sourceforge.net
; The original JasminVisitor is part of the BCEL
; http://jakarta.apache.org/bcel/
; Sun Dec 02 01:36:56 JST 2012
 
.bytecode 51.0
.source Hello.java
.class public Hello
.super javafx/application/Application
 
 
.method public <init>()V
    .limit stack 1
    .limit locals 1
    .var 0 is this LHello; from Label0 to Label1
 
    Label0:
.line 7
       0: aload_0
       1: invokespecial javafx/application/Application/<init>()V
 
    Label1:
       4: return
 
.end method
 
.method public static main([Ljava/lang/String;)V
    .limit stack 2
    .limit locals 1
    .var 0 is arg0 [Ljava/lang/String; from Label0 to Label1
 
    Label0:
.line 9
       0: ldc_w Hello
       3: aload_0
       4: invokestatic javafx/application/Application/launch(Ljava/lang/Class;[Ljava/lang/String;)V
 
    Label1:
.line 10
       7: return
 
.end method
 
.method public start(Ljavafx/stage/Stage;)V
    .limit stack 7
    .limit locals 4
    .var 0 is this LHello; from Label0 to Label1
    .var 1 is arg0 Ljavafx/stage/Stage; from Label0 to Label1
 
    Label0:
.line 14
       0: new javafx/scene/layout/HBox
       3: dup
       4: invokespecial javafx/scene/layout/HBox/<init>()V
       7: astore_2
 
    .line 15
       8: new javafx/scene/Scene
      11: dup
      12: aload_2
      13: ldc2_w 640.0
      16: ldc2_w 480.0
      19: invokespecial javafx/scene/Scene/<init>(Ljavafx/scene/Parent;DD)V
      22: astore_3
 
    .line 16
      23: aload_2
      24: invokevirtual javafx/scene/layout/HBox/getChildren()Ljavafx/collections/ObservableList;
      27: new javafx/scene/control/Label
      30: dup
      31: ldc "Hello, JavaFX World!"
      33: invokespecial javafx/scene/control/Label/<init>(Ljava/lang/String;)V
      36: invokeinterface javafx/collections/ObservableList/add(Ljava/lang/Object;)Z 2
      41: pop
 
    .line 18
      42: aload_1
      43: aload_3
      44: invokevirtual javafx/stage/Stage/setScene(Ljavafx/scene/Scene;)V
 
    .line 19
      47: aload_1
      48: ldc "Hello, World"
      50: invokevirtual javafx/stage/Stage/setTitle(Ljava/lang/String;)V
 
    .line 20
      53: aload_1
      54: invokevirtual javafx/stage/Stage/show()V
 
    Label1:
.line 21
      57: return
 
.end method

コンパイル&実行方法

C:¥> SET JAVAFX_HOME=C:\Program Files (x86)\Oracle\JavaFX 2.0 SDK
C:¥> java -jar jasmin.jar Hello.j
C:¥> javaw -cp "%JAVAFX_HOME%\rt\lib\jfxrt.jar;." Hello

実行結果

+------------------------------------------+
|Hello, World!                    [_][~][X]|
+------------------------------------------+
|Hello, JavaFX World!                      |
|                                          |
|                                          |
|                                          |
|                                          |
|                                          |
|                                          |
|                                          |
|                                          |
|                                          |
+------------------------------------------+

Tags:

Categories: Jasmin, Java, JavaFX

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

WP-SpamFree by Pole Position Marketing