NetRexx and JavaFX

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

NetRexx and JavaFX

gustavo_mindreau
Dear members,
Java AWT was superseded by Java Swing.
And now it seems that Swing in Java8 is being superseded by JavaFX.
In any case I like the FXML concept of being able to separate the design from the code.

I have a test panel in FXML,
        test.fxml
        <?xml version="1.0" encoding="UTF-8"?>
        <?import javafx.scene.shape.*?>
        <?import javafx.scene.text.*?>
        <?import javafx.scene.control.*?>
        <?import java.lang.*?>
        <?import javafx.scene.layout.*?>
        <Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="170.0"
                        prefWidth="322.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
           <children>
              <TextFlow layoutX="66.0" layoutY="133.0" prefHeight="57.0" prefWidth="112.0" />
              <Button layoutX="66.0" layoutY="62.0" mnemonicParsing="false" text="Button" />
           </children>
        </Pane>

Basic display of this panel works fine in Java,
        c_testJavaFX.java
        import javafx.application.Application;
        import javafx.fxml.FXMLLoader;
        import javafx.scene.Parent;
        import javafx.scene.Scene;
        import javafx.stage.Stage;

        public class c_testJavaFX extends Application {
            public static void main(String[] args) {
                launch(args);
            }
            public void start(Stage primaryStage) throws Exception{
                Parent panel = FXMLLoader.load(getClass().getResource("test.fxml"));
                primaryStage.setTitle("FXML Application");
                primaryStage.setScene(new Scene(panel,300,200));
                primaryStage.show();
            }
        }

and it correctly produces,
       

But translating this into NetRexx,
        Import javafx.
        Class c_testJavaFX02 public extends Application        
                Method main(args=string[]) public static
                 Application.launch(args)
                Method start(primaryStage=Stage) public
                 panel(javafx.scene.Parent) = FXMLLoader.load(getClass().getResource("test.fxml"))
                 primaryStage.setTitle("FXML Welcome")
                 primaryStage.setScene(Scene(panel,300,200))
                 primaryStage.show()
        does not even compile,
                12 +++  panel(javafx.scene.Parent) = FXMLLoader.load(getClass().getResource("test.fxml"))
           +++        ^^^^^^
           +++ Error: Result of this expression cannot be just a type; it must have a value

It is most probable related to the "Parent" statement.  I have joggled with this in all possible combinations, but I am not able to make it work  :-(
Does anybody have any comments or suggestions on how to correct this?
Probably it will result in a D'oh! moment here, but any help would be appreciated.

Regards,
Gus

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: NetRexx and JavaFX - D'oh!

gustavo_mindreau
D'oh !!   :-(
Thanks a lot.  It works now !  




"Dave Woodman" <[hidden email]>
Sent by: [hidden email]

2018-01-11 11:15

Please respond to
IBM Netrexx <[hidden email]>

To
"'IBM Netrexx'" <[hidden email]>,
cc
Subject
Re: [Ibm-netrexx] NetRexx and JavaFX





Perhaps
Import javafx.
        Class c_testJavaFX02 public extends Application        
                Method main(args=string[]) public static
                 Application.launch(args)
                Method start(primaryStage=Stage) public
                 panel = javafx.scene.Parent FXMLLoader.load(getClass().getResource("test.fxml"))
                 primaryStage.setTitle("FXML Welcome")
                 primaryStage.setScene(Scene(panel,300,200))
                 primaryStage.show()
 
?
 
Dave.

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: NetRexx and JavaFX

Jason Martin
In reply to this post by gustavo_mindreau
You should also have a look at Apache Pivot

https://pivot.apache.org/

------------------------HelloBXML.nrx----------------------------

import org.apache.pivot.beans.BXMLSerializer
import org.apache.pivot.collections.Map
import org.apache.pivot.wtk.Application
import org.apache.pivot.wtk.DesktopApplicationContext
import org.apache.pivot.wtk.Display
import org.apache.pivot.wtk.Window
import org.apache.pivot.wtk.ImageView

class HelloBXML public implements Application


  properties private
    win=Window null

  method startup(display=Display,properties=Map) signals Exception
    bxml=BXMLSerializer()
    win=Window bxml.readObject(HelloBXML.class,"hello.bxml")
    win.open(display)

  method shutdown(optional=boolean) returns boolean
    if win\==null then do
      win.close()
    end
    return 0

  method suspend

  method resume

  method main(args=String[]) static
    DesktopApplicationContext.main(HelloBXML.class,args)


------------------------hello.bxml----------------------------

<Window title="Hello BXML!" maximized="true"
    xmlns:bxml="http://pivot.apache.org/bxml"
    xmlns="org.apache.pivot.wtk">
    <Label text="Hello BXML!"
        styles="{font:'Arial bold 24', color:'#ff0000',
            horizontalAlignment:'center', verticalAlignment:'center'}"/>
</Window>



_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: NetRexx and JavaFX

gustavo_mindreau
Thanks for the tip  :-)




Jason Martin <[hidden email]>
Sent by: [hidden email]

2018-01-11 20:19

Please respond to
IBM Netrexx <[hidden email]>

To
IBM Netrexx <[hidden email]>,
cc
Subject
Re: [Ibm-netrexx] NetRexx and JavaFX





You should also have a look at Apache Pivot

https://pivot.apache.org/

------------------------HelloBXML.nrx----------------------------

import org.apache.pivot.beans.BXMLSerializer
import org.apache.pivot.collections.Map
import org.apache.pivot.wtk.Application
import org.apache.pivot.wtk.DesktopApplicationContext
import org.apache.pivot.wtk.Display
import org.apache.pivot.wtk.Window
import org.apache.pivot.wtk.ImageView

class HelloBXML public implements Application


  properties private
    win=Window null

  method startup(display=Display,properties=Map) signals Exception
    bxml=BXMLSerializer()
    win=Window bxml.readObject(HelloBXML.class,"hello.bxml")
    win.open(display)

  method shutdown(optional=boolean) returns boolean
    if win\==null then do
      win.close()
    end
    return 0

  method suspend

  method resume

  method main(args=String[]) static
    DesktopApplicationContext.main(HelloBXML.class,args)


------------------------hello.bxml----------------------------

<Window title="Hello BXML!" maximized="true"
    xmlns:bxml="
http://pivot.apache.org/bxml"
    xmlns="org.apache.pivot.wtk">
    <Label text="Hello BXML!"
        styles="{font:'Arial bold 24', color:'#ff0000',
            horizontalAlignment:'center', verticalAlignment:'center'}"/>
</Window>

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive :
http://ibm-netrexx.215625.n3.nabble.com/



_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/