Archive for 1月, 2013

  1. Hello, Java 3D(Jasmin) World!

    Posted on 1月 5th, 2013 by cx20

    Java 3D

    Java 3D は Java による 3D グラフィックライブラリである。
    以下は Jasmin による Java 3D の使用例となっている。

    ソースコード

    ; 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:53:35 JST 2012
     
    .bytecode 51.0
    .source Hello.java
    .class public Hello
    .super javax/swing/JFrame
     
    .method public static main([Ljava/lang/String;)V
        .limit stack 3
        .limit locals 2
        .var 0 is arg0 [Ljava/lang/String; from Label0 to Label1
     
        Label0:
    .line 12
           0: new Hello
           3: dup
           4: ldc "Hello, World"
           6: invokespecial Hello/<init>(Ljava/lang/String;)V
           9: astore_1
     
        .line 13
          10: aload_1
          11: iconst_1
          12: invokevirtual Hello/setVisible(Z)V
     
        Label1:
    .line 14
          15: return
     
    .end method
     
    .method public <init>(Ljava/lang/String;)V
        .limit stack 3
        .limit locals 4
        .var 0 is this LHello; from Label0 to Label1
        .var 1 is arg0 Ljava/lang/String; from Label0 to Label1
     
        Label0:
    .line 17
           0: aload_0
           1: aload_1
           2: invokespecial javax/swing/JFrame/<init>(Ljava/lang/String;)V
     
        .line 18
           5: aload_0
           6: sipush 640
           9: sipush 480
          12: invokevirtual Hello/setSize(II)V
     
        .line 19
          15: aload_0
          16: iconst_3
          17: invokevirtual Hello/setDefaultCloseOperation(I)V
     
        .line 20
          20: aload_0
          21: invokespecial Hello/createCanvas3D()Ljavax/media/j3d/Canvas3D;
          24: astore_2
     
        .line 21
          25: aload_0
          26: invokevirtual Hello/createSceneGraph()Ljavax/media/j3d/BranchGroup;
          29: astore_3
     
        .line 22
          30: aload_0
          31: aload_2
          32: aload_3
          33: invokespecial Hello/connect(Ljavax/media/j3d/Canvas3D;Ljavax/media/j3d/BranchGroup;)V
     
        Label1:
    .line 23
          36: return
     
    .end method
     
    .method private createCanvas3D()Ljavax/media/j3d/Canvas3D;
        .limit stack 3
        .limit locals 3
        .var 0 is this LHello; from Label0 to Label1
     
        Label0:
    .line 26
           0: aload_0
           1: invokevirtual Hello/getContentPane()Ljava/awt/Container;
           4: new java/awt/BorderLayout
           7: dup
           8: invokespecial java/awt/BorderLayout/<init>()V
          11: invokevirtual java/awt/Container/setLayout(Ljava/awt/LayoutManager;)V
     
        .line 27
          14: invokestatic com/sun/j3d/utils/universe/SimpleUniverse/getPreferredConfiguration()Ljava/awt/GraphicsConfiguration;
          17: astore_1
     
        .line 28
          18: new javax/media/j3d/Canvas3D
          21: dup
          22: aload_1
          23: invokespecial javax/media/j3d/Canvas3D/<init>(Ljava/awt/GraphicsConfiguration;)V
          26: astore_2
     
        .line 29
          27: aload_0
          28: invokevirtual Hello/getContentPane()Ljava/awt/Container;
          31: aload_2
          32: invokevirtual java/awt/Container/add(Ljava/awt/Component;)Ljava/awt/Component;
          35: pop
     
        .line 30
          36: aload_2
     
        Label1:
          37: areturn
     
    .end method
     
    .method public createSceneGraph()Ljavax/media/j3d/BranchGroup;
        .limit stack 7
        .limit locals 5
        .var 0 is this LHello; from Label0 to Label1
     
        Label0:
    .line 34
           0: new javax/media/j3d/BranchGroup
           3: dup
           4: invokespecial javax/media/j3d/BranchGroup/<init>()V
           7: astore_1
     
        .line 35
           8: aload_0
           9: invokespecial Hello/moveTextBack()Ljavax/media/j3d/TransformGroup;
          12: astore_2
     
        .line 36
          13: aload_0
          14: invokespecial Hello/createSpinner()Ljavax/media/j3d/TransformGroup;
          17: astore_3
     
        .line 37
          18: new javax/media/j3d/RotationInterpolator
          21: dup
          22: new javax/media/j3d/Alpha
          25: dup
          26: iconst_m1
          27: ldc2_w 4000
          30: invokespecial javax/media/j3d/Alpha/<init>(IJ)V
          33: aload_3
          34: new javax/media/j3d/Transform3D
          37: dup
          38: invokespecial javax/media/j3d/Transform3D/<init>()V
          41: fconst_0
          42: ldc 6.2831855
          44: invokespecial javax/media/j3d/RotationInterpolator/<init>(Ljavax/media/j3d/Alpha;Ljavax/media/j3d/TransformGroup;Ljavax/media/j3d/Transform3D;FF)V
          47: astore 4
     
        .line 38
          49: aload 4
          51: new javax/media/j3d/BoundingSphere
          54: dup
          55: invokespecial javax/media/j3d/BoundingSphere/<init>()V
          58: invokevirtual javax/media/j3d/RotationInterpolator/setSchedulingBounds(Ljavax/media/j3d/Bounds;)V
     
        .line 39
          61: aload_3
          62: aload 4
          64: invokevirtual javax/media/j3d/TransformGroup/addChild(Ljavax/media/j3d/Node;)V
     
        .line 40
          67: aload_1
          68: aload_2
          69: invokevirtual javax/media/j3d/BranchGroup/addChild(Ljavax/media/j3d/Node;)V
     
        .line 41
          72: aload_2
          73: aload_3
          74: invokevirtual javax/media/j3d/TransformGroup/addChild(Ljavax/media/j3d/Node;)V
     
        .line 42
          77: aload_3
          78: aload_0
          79: invokespecial Hello/createTextShape()Ljavax/media/j3d/Shape3D;
          82: invokevirtual javax/media/j3d/TransformGroup/addChild(Ljavax/media/j3d/Node;)V
     
        .line 43
          85: aload_0
          86: aload_2
          87: invokespecial Hello/setLighting(Ljavax/media/j3d/TransformGroup;)V
     
        .line 44
          90: aload_1
     
        Label1:
          91: areturn
     
    .end method
     
    .method private createSpinner()Ljavax/media/j3d/TransformGroup;
        .limit stack 2
        .limit locals 2
        .var 0 is this LHello; from Label0 to Label1
     
        Label0:
    .line 48
           0: new javax/media/j3d/TransformGroup
           3: dup
           4: invokespecial javax/media/j3d/TransformGroup/<init>()V
           7: astore_1
     
        .line 49
           8: aload_1
           9: bipush 18
          11: invokevirtual javax/media/j3d/TransformGroup/setCapability(I)V
     
        .line 50
          14: aload_1
     
        Label1:
          15: areturn
     
    .end method
     
    .method private moveTextBack()Ljavax/media/j3d/TransformGroup;
        .limit stack 6
        .limit locals 2
        .var 0 is this LHello; from Label0 to Label1
     
        Label0:
    .line 54
           0: new javax/media/j3d/Transform3D
           3: dup
           4: invokespecial javax/media/j3d/Transform3D/<init>()V
           7: astore_1
     
        .line 55
           8: aload_1
           9: new javax/vecmath/Vector3f
          12: dup
          13: fconst_0
          14: fconst_0
          15: ldc -10.0
          17: invokespecial javax/vecmath/Vector3f/<init>(FFF)V
          20: invokevirtual javax/media/j3d/Transform3D/setTranslation(Ljavax/vecmath/Vector3f;)V
     
        .line 56
          23: new javax/media/j3d/TransformGroup
          26: dup
          27: aload_1
          28: invokespecial javax/media/j3d/TransformGroup/<init>(Ljavax/media/j3d/Transform3D;)V
     
        Label1:
          31: areturn
     
    .end method
     
    .method private createTextShape()Ljavax/media/j3d/Shape3D;
        .limit stack 7
        .limit locals 5
        .var 0 is this LHello; from Label0 to Label1
     
        Label0:
    .line 60
           0: new javax/media/j3d/Appearance
           3: dup
           4: invokespecial javax/media/j3d/Appearance/<init>()V
           7: astore_1
     
        .line 61
           8: aload_1
           9: new javax/media/j3d/Material
          12: dup
          13: invokespecial javax/media/j3d/Material/<init>()V
          16: invokevirtual javax/media/j3d/Appearance/setMaterial(Ljavax/media/j3d/Material;)V
     
        .line 62
          19: new javax/media/j3d/Font3D
          22: dup
          23: new java/awt/Font
          26: dup
          27: ldc "MS Pゴシック"
          29: iconst_0
          30: iconst_1
          31: invokespecial java/awt/Font/<init>(Ljava/lang/String;II)V
          34: new javax/media/j3d/FontExtrusion
          37: dup
          38: invokespecial javax/media/j3d/FontExtrusion/<init>()V
          41: invokespecial javax/media/j3d/Font3D/<init>(Ljava/awt/Font;Ljavax/media/j3d/FontExtrusion;)V
          44: astore_2
     
        .line 63
          45: new javax/media/j3d/Text3D
          48: dup
          49: aload_2
          50: new java/lang/String
          53: dup
          54: ldc "Hello, Java 3D World!"
          56: invokespecial java/lang/String/<init>(Ljava/lang/String;)V
          59: invokespecial javax/media/j3d/Text3D/<init>(Ljavax/media/j3d/Font3D;Ljava/lang/String;)V
          62: astore_3
     
        .line 64
          63: aload_3
          64: iconst_0
          65: invokevirtual javax/media/j3d/Text3D/setAlignment(I)V
     
        .line 65
          68: new javax/media/j3d/Shape3D
          71: dup
          72: invokespecial javax/media/j3d/Shape3D/<init>()V
          75: astore 4
     
        .line 66
          77: aload 4
          79: aload_3
          80: invokevirtual javax/media/j3d/Shape3D/setGeometry(Ljavax/media/j3d/Geometry;)V
     
        .line 67
          83: aload 4
          85: aload_1
          86: invokevirtual javax/media/j3d/Shape3D/setAppearance(Ljavax/media/j3d/Appearance;)V
     
        .line 68
          89: aload 4
     
        Label1:
          91: areturn
     
    .end method
     
    .method private setLighting(Ljavax/media/j3d/TransformGroup;)V
        .limit stack 6
        .limit locals 3
        .var 0 is this LHello; from Label0 to Label1
        .var 1 is arg0 Ljavax/media/j3d/TransformGroup; from Label0 to Label1
     
        Label0:
    .line 72
           0: new javax/media/j3d/DirectionalLight
           3: dup
           4: invokespecial javax/media/j3d/DirectionalLight/<init>()V
           7: astore_2
     
        .line 73
           8: aload_2
           9: new javax/media/j3d/BoundingSphere
          12: dup
          13: invokespecial javax/media/j3d/BoundingSphere/<init>()V
          16: invokevirtual javax/media/j3d/DirectionalLight/setInfluencingBounds(Ljavax/media/j3d/Bounds;)V
     
        .line 74
          19: aload_2
          20: new javax/vecmath/Vector3f
          23: dup
          24: fconst_0
          25: fconst_0
          26: ldc -1.0
          28: invokespecial javax/vecmath/Vector3f/<init>(FFF)V
          31: invokevirtual javax/media/j3d/DirectionalLight/setDirection(Ljavax/vecmath/Vector3f;)V
     
        .line 75
          34: aload_2
          35: new javax/vecmath/Color3f
          38: dup
          39: fconst_1
          40: fconst_1
          41: fconst_1
          42: invokespecial javax/vecmath/Color3f/<init>(FFF)V
          45: invokevirtual javax/media/j3d/DirectionalLight/setColor(Ljavax/vecmath/Color3f;)V
     
        .line 76
          48: aload_1
          49: aload_2
          50: invokevirtual javax/media/j3d/TransformGroup/addChild(Ljavax/media/j3d/Node;)V
     
        Label1:
    .line 77
          53: return
     
    .end method
     
    .method private connect(Ljavax/media/j3d/Canvas3D;Ljavax/media/j3d/BranchGroup;)V
        .limit stack 3
        .limit locals 4
        .var 0 is this LHello; from Label0 to Label1
        .var 1 is arg0 Ljavax/media/j3d/Canvas3D; from Label0 to Label1
        .var 2 is arg1 Ljavax/media/j3d/BranchGroup; from Label0 to Label1
     
        Label0:
    .line 80
           0: new com/sun/j3d/utils/universe/SimpleUniverse
           3: dup
           4: aload_1
           5: invokespecial com/sun/j3d/utils/universe/SimpleUniverse/<init>(Ljavax/media/j3d/Canvas3D;)V
           8: astore_3
     
        .line 81
           9: aload_3
          10: invokevirtual com/sun/j3d/utils/universe/SimpleUniverse/getViewingPlatform()Lcom/sun/j3d/utils/universe/ViewingPlatform;
          13: invokevirtual com/sun/j3d/utils/universe/ViewingPlatform/setNominalViewingTransform()V
     
        .line 82
          16: aload_3
          17: aload_2
          18: invokevirtual com/sun/j3d/utils/universe/SimpleUniverse/addBranchGraph(Ljavax/media/j3d/BranchGroup;)V
     
        Label1:
    .line 83
          21: return
     
    .end method

    コンパイル&実行方法

    C:¥> java -jar jasmin.jar Hello.j
    C:¥> javaw Hello

    実行結果

    +------------------------------------------+
    |Hello, World!                    [_][~][X]|
    +------------------------------------------+
    |Hello, Java 3D World!                     |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    +------------------------------------------+
  2. Hello, Java 2D(Jasmin) World!

    Posted on 1月 4th, 2013 by cx20

    Java 2D

    Java 2D は Java による 2D グラフィックライブラリである。
    以下は Jasmin による Java 2D の使用例となっている。

    ソースコード

    ; 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:34:06 JST 2012
     
    .bytecode 50.0
    .source Hello.java
    .class public Hello
    .super javax/swing/JFrame
     
    .method public static main([Ljava/lang/String;)V
        .limit stack 3
        .limit locals 2
        .var 0 is arg0 [Ljava/lang/String; from Label0 to Label1
     
        Label0:
    .line 8
           0: new Hello
           3: dup
           4: ldc "Hello, World"
           6: invokespecial Hello/<init>(Ljava/lang/String;)V
           9: astore_1
     
        .line 9
          10: aload_1
          11: iconst_1
          12: invokevirtual Hello/setVisible(Z)V
     
        Label1:
    .line 10
          15: return
     
    .end method
     
    .method  <init>(Ljava/lang/String;)V
        .limit stack 3
        .limit locals 3
        .var 0 is this LHello; from Label0 to Label1
        .var 1 is arg0 Ljava/lang/String; from Label0 to Label1
     
        Label0:
    .line 13
           0: aload_0
           1: aload_1
           2: invokespecial javax/swing/JFrame/<init>(Ljava/lang/String;)V
     
        .line 14
           5: aload_0
           6: iconst_3
           7: invokevirtual Hello/setDefaultCloseOperation(I)V
     
        .line 15
          10: aload_0
          11: sipush 640
          14: sipush 480
          17: invokevirtual Hello/setSize(II)V
     
        .line 17
          20: new HelloPanel
          23: dup
          24: invokespecial HelloPanel/<init>()V
          27: astore_2
     
        .line 18
          28: aload_0
          29: aload_2
          30: invokevirtual Hello/add(Ljava/awt/Component;)Ljava/awt/Component;
          33: pop
     
        Label1:
    .line 19
          34: return
     
    .end method
    ; 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:34:19 JST 2012
     
    .bytecode 50.0
    .source Hello.java
    .class  HelloPanel
    .super javax/swing/JPanel
     
    .method  <init>()V
        .limit stack 1
        .limit locals 1
        .var 0 is this LHelloPanel; from Label0 to Label1
     
        Label0:
    .line 22
           0: aload_0
           1: invokespecial javax/swing/JPanel/<init>()V
     
        Label1:
           4: return
     
    .end method
     
    .method public paintComponent(Ljava/awt/Graphics;)V
        .limit stack 4
        .limit locals 3
        .var 0 is this LHelloPanel; from Label0 to Label1
        .var 1 is arg0 Ljava/awt/Graphics; from Label0 to Label1
     
        Label0:
    .line 24
           0: aload_1
           1: checkcast java/awt/Graphics2D
           4: astore_2
     
        .line 25
           5: aload_2
           6: ldc "Hello, Java2D World!"
           8: iconst_0
           9: bipush 16
          11: invokevirtual java/awt/Graphics2D/drawString(Ljava/lang/String;II)V
     
        Label1:
    .line 26
          14: return
     
    .end method

    コンパイル&実行方法

    C:¥> java -jar jasmin.jar Hello.j HelloPanel.j
    C:¥> javaw Hello

    実行結果

    +------------------------------------------+
    |Hello, World!                    [_][~][X]|
    +------------------------------------------+
    |Hello, Java 2D World!                     |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    +------------------------------------------+
  3. 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!                      |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    +------------------------------------------+
  4. Hello, SWT(Jasmin) World!

    Posted on 1月 2nd, 2013 by cx20

    SWT(Java)

    SWT(Standard Widget Toolkit) は Java で GUI を扱うためのライブラリである。
    IBM により AWT や Swing を置き換える目的で作成された。
    以下は Jasmin による SWT の使用例となっている。

    ソースコード

    ; 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:23:19 JST 2012
     
    .bytecode 50.0
    .source Hello.java
    .class public Hello
    .super java/lang/Object
     
    .method public <init>()V
        .limit stack 1
        .limit locals 1
        .var 0 is this LHello; from Label0 to Label1
     
        Label0:
    .line 5
           0: aload_0
           1: invokespecial java/lang/Object/<init>()V
     
        Label1:
           4: return
     
    .end method
     
    .method public static main([Ljava/lang/String;)V
        .limit stack 4
        .limit locals 5
        .var 0 is arg0 [Ljava/lang/String; from Label3 to Label4
     
        Label3:
    .line 7
           0: new org/eclipse/swt/widgets/Display
           3: dup
           4: invokespecial org/eclipse/swt/widgets/Display/<init>()V
           7: astore_1
     
        .line 8
           8: new org/eclipse/swt/widgets/Shell
          11: dup
          12: aload_1
          13: invokespecial org/eclipse/swt/widgets/Shell/<init>(Lorg/eclipse/swt/widgets/Display;)V
          16: astore_2
     
        .line 9
          17: aload_2
          18: ldc "Hello, World"
          20: invokevirtual org/eclipse/swt/widgets/Shell/setText(Ljava/lang/String;)V
     
        .line 12
          23: new org/eclipse/swt/layout/FillLayout
          26: dup
          27: sipush 512
          30: invokespecial org/eclipse/swt/layout/FillLayout/<init>(I)V
          33: astore_3
     
        .line 13
          34: aload_2
          35: aload_3
          36: invokevirtual org/eclipse/swt/widgets/Shell/setLayout(Lorg/eclipse/swt/widgets/Layout;)V
     
        .line 15
          39: new org/eclipse/swt/widgets/Label
          42: dup
          43: aload_2
          44: sipush 2048
          47: invokespecial org/eclipse/swt/widgets/Label/<init>(Lorg/eclipse/swt/widgets/Composite;I)V
          50: astore 4
     
        .line 16
          52: aload 4
          54: ldc "Hello, SWT World!"
          56: invokevirtual org/eclipse/swt/widgets/Label/setText(Ljava/lang/String;)V
     
        .line 18
          59: aload_2
          60: sipush 640
          63: sipush 480
          66: invokevirtual org/eclipse/swt/widgets/Shell/setSize(II)V
     
        .line 19
          69: aload_2
          70: invokevirtual org/eclipse/swt/widgets/Shell/open()V
     
        Label1:
    .line 21
          73: aload_2
          74: invokevirtual org/eclipse/swt/widgets/Shell/isDisposed()Z
          77: ifne Label0
     
        .line 22
          80: aload_1
          81: invokevirtual org/eclipse/swt/widgets/Display/readAndDispatch()Z
          84: ifne Label1
     
        .line 23
          87: aload_1
          88: invokevirtual org/eclipse/swt/widgets/Display/sleep()Z
          91: pop
          92: goto Label1
     
        Label0:
    .line 27
          95: aload_1
          96: invokevirtual org/eclipse/swt/widgets/Display/dispose()V
     
        Label4:
    .line 28
          99: return
     
    .end method

    コンパイル&実行方法

    C:¥> java -jar jasmin.jar Hello.j
    C:¥> javaw -cp org.eclipse.swt.win32.win32.x86_3.6.1.v3655c.jar;. Hello

    実行結果

    +------------------------------------------+
    |Hello, World!                    [_][~][X]|
    +------------------------------------------+
    |Hello, SWT World!                         |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    |                                          |
    +------------------------------------------+
  5. Hello, Swing(Jasmin) World!

    Posted on 1月 1st, 2013 by cx20

    Swing(Java)

    Swing は AWT(Abstract Window Toolkit) を拡張したものであり Java で GUI を扱うためのライブラリである。
    J2SE 1.2 以降は AWT よりも Swing が使われることが多くなっている。
    以下は Jasmin による Swing の使用例となっている。

    ソースコード

    ; 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:16:09 JST 2012
     
    .bytecode 51.0
    .source Hello.java
    .class public Hello
    .super javax/swing/JFrame
     
    .method public static main([Ljava/lang/String;)V
        .limit stack 3
        .limit locals 2
        .var 0 is arg0 [Ljava/lang/String; from Label0 to Label1
     
        Label0:
    .line 7
           0: new Hello
           3: dup
           4: ldc "Hello, World"
           6: invokespecial Hello/<init>(Ljava/lang/String;)V
           9: astore_1
     
        .line 8
          10: aload_1
          11: iconst_1
          12: invokevirtual Hello/setVisible(Z)V
     
        Label1:
    .line 9
          15: return
     
    .end method
     
     
    .method  <init>(Ljava/lang/String;)V
        .limit stack 3
        .limit locals 3
        .var 0 is this LHello; from Label0 to Label1
        .var 1 is arg0 Ljava/lang/String; from Label0 to Label1
     
        Label0:
    .line 12
           0: aload_0
           1: aload_1
           2: invokespecial javax/swing/JFrame/<init>(Ljava/lang/String;)V
     
        .line 13
           5: aload_0
           6: iconst_3
           7: invokevirtual Hello/setDefaultCloseOperation(I)V
     
        .line 14
          10: aload_0
          11: aconst_null
          12: invokevirtual Hello/setLocationRelativeTo(Ljava/awt/Component;)V
     
        .line 15
          15: aload_0
          16: sipush 640
          19: sipush 480
          22: invokevirtual Hello/setSize(II)V
     
        .line 17
          25: new javax/swing/JLabel
          28: dup
          29: ldc "Hello, Swing World!"
          31: invokespecial javax/swing/JLabel/<init>(Ljava/lang/String;)V
          34: astore_2
     
        .line 18
          35: aload_2
          36: iconst_1
          37: invokevirtual javax/swing/JLabel/setVerticalAlignment(I)V
     
        .line 19
          40: aload_0
          41: aload_2
          42: invokevirtual Hello/add(Ljava/awt/Component;)Ljava/awt/Component;
          45: pop
     
        Label1:
    .line 20
          46: return
     
    .end method

    コンパイル&実行方法

    C:¥> java -jar jasmin.jar Hello.j
    C:¥> javaw Hello

    実行結果

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