Learning Java Objects

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

Re: Learning Java Objects (The GUI affair)

David Requena
Oh, I see now.

There is 2 different programs there.

The firs is Kermit's and goes from then line:

--  --------------------------------  NetRexx GUI sample code  ---------------------------------------

to the line before:

/*  some notes removed here  */

The rest is my own version of the program.

Since you put both together into a single source file, you get the duplicate function error.
Try each one in its own and they'll work.
---
Saludos / Kind regards.
David Requena

El 06/10/2010 12:53, Robert Hamilton escribió:

Here is the code I'm trying to run in jEdit;  I don't find a 'prefix' setting.  email gives some spurious line breaks.

bobh




--  --------------------------------  NetRexx GUI sample code  ---------------------------------------
import javax.swing.

  class guisample implements ActionListener     --    ActionListener interface lets the GUI objects talk to the program code
 
    properties static
        frame=JFrame                           --    holder for a GUI window
 
    method main(sa=String[]) static

        frame=JFrame("Sample GUI window")                 --    create a GUI window frame
        frame.setSize(400,100)                            --    give the window some space on the screen
        panel=JPanel()                                    --    create a panel to hold some GUI objects
        frame.add(panel)                                  --    put the panel in the window frame
        textfield=JTextField("Some default text here")    --    create a spot for some text
        panel.add(textfield)                              --    add the text field to the panel
        button=JButton("OK")                              --    create a button to click
     
        button.addActionListener(guisample())             --    attach some code (an instance of this class) to watch the button
     
        panel.add(button)                                 --    put the button in the panel
        frame.show                                        --    display the GUI window on the screen
     
        loop while frame\=null;end                        --    wait for the GUI window to do something
     
        say textfield.getText                             --    show the text field contents
     
    method actionPerformed(e=ActionEvent)                 --    this is the code that listens to the button
        frame.dispose                                     --    clear the GUI window frame from screen and memory
        frame=null                                        --    erase the pointer to stop the main program

/*  some notes removed here  */


import javax.swing.

 class guisample public implements ActionListener
 
    properties inheritable static
        frame = JFrame
        textfield = JTextField
 
    method main(sa=String[]) static
        -- build a gui and die..
        guisample()
     
    method guisample
        -- GUI objects must be instantiated from EDT so
        -- tell it to do so
        SwingUtilities.InvokeLater(this.guiBuilder())
              
    method actionPerformed(e=ActionEvent)
        -- safe here as event handling code is called from EDT
        say textfield.getText
        frame.dispose
        frame=null
  
      
class guisample.guiBuilder dependent implements Runnable
  
    -- SwingUtilities.InvokeLater requires a Runnable so we need
    -- a separate class :-(
  
    method run
        parent.frame=JFrame("Sample GUI window")
        parent.frame.setSize(400,100)
        panel=JPanel()
        parent.frame.add(panel)
        parent.textfield=JTextField("Some default text here")
        panel.add(parent.textfield)
        button=JButton("OK")
        button.addActionListener(parent)
        panel.add(button)
        parent.frame.setVisible(1)

-- Saludos / Kind regards. David Requena

 
_______________________________________________ Ibm-netrexx mailing list [hidden email]

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Learning Java Objects (The GUI affair)

Robert L Hamilton
i TRIED with each commented out; I'll give it another try.

I really think NetRexx is worth the time. I have two 'County' Colleges and one Large private University interested but I have nothing really to show them. That's why I'm interested in the NetRexx/JAVA project.

Thanks for the time and Enjoy the Day, Evening -- whatever.

BobH

On Wed, Oct 6, 2010 at 6:14 AM, David Requena <[hidden email]> wrote:
Oh, I see now.

There is 2 different programs there.

The firs is Kermit's and goes from then line:

--  --------------------------------  NetRexx GUI sample code  ---------------------------------------

to the line before:

/*  some notes removed here  */

The rest is my own version of the program.

Since you put both together into a single source file, you get the duplicate function error.
Try each one in its own and they'll work.
---
Saludos / Kind regards.
David Requena


_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Learning Java Objects (The GUI affair)

Robert L Hamilton
In reply to this post by David Requena


 -- This code

import javax.swing.

 class guisample public implements ActionListener
 
    properties inheritable static
        frame = JFrame
        textfield = JTextField
 
    method main(sa=String[]) static
        -- build a gui and die..
        guisample()
     
    method guisample
        -- GUI objects must be instantiated from EDT so
        -- tell it to do so
        SwingUtilities.InvokeLater(this.guiBuilder())
              
    method actionPerformed(e=ActionEvent)
        -- safe here as event handling code is called from EDT
        say textfield.getText
        frame.dispose
        frame=null
  
      
class guisample.guiBuilder dependent implements Runnable
  
    -- SwingUtilities.InvokeLater requires a Runnable so we need
    -- a separate class :-(
  
    method run
        parent.frame=JFrame("Sample GUI window")
        parent.frame.setSize(400,100)
        panel=JPanel()
        parent.frame.add(panel)
        parent.textfield=JTextField("Some default text here")
        panel.add(parent.textfield)
        button=JButton("OK")
        button.addActionListener(parent)
        panel.add(button)
        parent.frame.setVisible(1)

-- Saludos / Kind regards. David Requena


-- gives this result
/*
[C:\Program Files\jEdit\guisample.nrx 94 8 9]  Error: 'Class guisample' instruction has already been implied for this program
Program index.nrx
Program multi.nrx
Program asktest.nrx
Program test.nrx
Program testbin.nrx
  === class testbin ===
    function main(String[])
Program iosample.nrx  */

-- in jEdit Script;  FILE name is guisample.nrx

bobh

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Learning Java Objects (The GUI affair)

Robert L Hamilton
In reply to this post by Robert L Hamilton
Second try on this . . .

-- This code

import javax.swing.

 class guisample public implements ActionListener
 
    properties inheritable static
        frame = JFrame
        textfield = JTextField
 
    method main(sa=String[]) static
        -- build a gui and die..
        guisample()
     
    method guisample
        -- GUI objects must be instantiated from EDT so
        -- tell it to do so
        SwingUtilities.InvokeLater(this.guiBuilder())
              
    method actionPerformed(e=ActionEvent)
        -- safe here as event handling code is called from EDT
        say textfield.getText
        frame.dispose
        frame=null
  
      
class guisample.guiBuilder dependent implements Runnable
  
    -- SwingUtilities.InvokeLater requires a Runnable so we need
    -- a separate class :-(
  
    method run
        parent.frame=JFrame("Sample GUI window")
        parent.frame.setSize(400,100)
        panel=JPanel()
        parent.frame.add(panel)
        parent.textfield=JTextField("Some default text here")
        panel.add(parent.textfield)
        button=JButton("OK")
        button.addActionListener(parent)
        panel.add(button)
        parent.frame.setVisible(1)

-- Saludos / Kind regards. David Requena
-- gives this result
/*
[C:\Program Files\jEdit\guisample.nrx 94 8 9]  Error: 'Class guisample' instruction has already been implied for this program
Program index.nrx
Program multi.nrx
Program asktest.nrx
Program test.nrx
Program testbin.nrx
  === class testbin ===
    function main(String[])
Program iosample.nrx  */

-- in jEdit Script;  FILE name is guisample.nrx

 

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Learning Java Objects (The GUI affair)

David Requena
Bob,

OK, I'm now able to reproduce the problem.

Kermit will give you the details but there is an option in NetrexxScript to define if certain internal jEdit variables should be auto-included.
When it is selected the line "import javax.swing." must be the very first in your program or you get that error.

So I see 2 possible solutions:

- Delete any comment lines and have the import line as the first one.
- Go to menu Plugins --> Plugin Options... then select NetrexxScript on left pane and then uncheck the checkbox labeled "add jEdit variables to all scripts"
---
Saludos / Kind regards.
David Requena

El 06/10/2010 14:16, Robert Hamilton escribió:
Second try on this . . .

-- This code

import javax.swing.

 class guisample public implements ActionListener
 
    properties inheritable static
        frame = JFrame
        textfield = JTextField
 
    method main(sa=String[]) static
        -- build a gui and die..
        guisample()
     
    method guisample
        -- GUI objects must be instantiated from EDT so
        -- tell it to do so
        SwingUtilities.InvokeLater(this.guiBuilder())
              
    method actionPerformed(e=ActionEvent)
        -- safe here as event handling code is called from EDT
        say textfield.getText
        frame.dispose
        frame=null
  
      
class guisample.guiBuilder dependent implements Runnable
  
    -- SwingUtilities.InvokeLater requires a Runnable so we need
    -- a separate class :-(
  
    method run
        parent.frame=JFrame("Sample GUI window")
        parent.frame.setSize(400,100)
        panel=JPanel()
        parent.frame.add(panel)
        parent.textfield=JTextField("Some default text here")
        panel.add(parent.textfield)
        button=JButton("OK")
        button.addActionListener(parent)
        panel.add(button)
        parent.frame.setVisible(1)

-- Saludos / Kind regards. David Requena
-- gives this result
/*
[C:\Program Files\jEdit\guisample.nrx 94 8 9]  Error: 'Class guisample' instruction has already been implied for this program
Program index.nrx
Program multi.nrx
Program asktest.nrx
Program test.nrx
Program testbin.nrx
  === class testbin ===
    function main(String[])
Program iosample.nrx  */

-- in jEdit Script;  FILE name is guisample.nrx

 
_______________________________________________ Ibm-netrexx mailing list [hidden email]

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Learning Java Objects (The GUI affair)

Robert L Hamilton
OK; got it working . . .

thnx

bobh

 

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Learning Java Objects (The GUI affair)

Kermit Kiser
In reply to this post by Robert L Hamilton
Bob ;

"prefix" is described in the help document for NetRexxScript which is in the jEdit Help option. It adds a code prefix to your NetRexx programs which is useful for writing jEdit macro scripts but sometimes it interferes with standalone programs such as are being discussed here. To get rid of it do this:

Select "Plugins" from the jEdit menu bar.
Select "Plugin Options" from the Plugins menu.
Select NetRexxScript from the list of installed plugins.
Remove the check mark from the boxes labeled "preparse all scripts" and "add jEdit variables to all scripts".
Click the "OK" button.

That should make these programs run better. If you don't want to turn off the prefixing, you can just make sure that the first line in the program file is an "import" instruction or a "class" instruction to automatically override it.

-- Kermit



On 10/6/2010 3:53 AM, Robert Hamilton wrote:

Here is the code I'm trying to run in jEdit;  I don't find a 'prefix' setting.  email gives some spurious line breaks.

bobh




--  --------------------------------  NetRexx GUI sample code  ---------------------------------------
import javax.swing.

  class guisample implements ActionListener     --    ActionListener interface lets the GUI objects talk to the program code
 
    properties static
        frame=JFrame                           --    holder for a GUI window
 
    method main(sa=String[]) static

        frame=JFrame("Sample GUI window")                 --    create a GUI window frame
        frame.setSize(400,100)                            --    give the window some space on the screen
        panel=JPanel()                                    --    create a panel to hold some GUI objects
        frame.add(panel)                                  --    put the panel in the window frame
        textfield=JTextField("Some default text here")    --    create a spot for some text
        panel.add(textfield)                              --    add the text field to the panel
        button=JButton("OK")                              --    create a button to click
     
        button.addActionListener(guisample())             --    attach some code (an instance of this class) to watch the button
     
        panel.add(button)                                 --    put the button in the panel
        frame.show                                        --    display the GUI window on the screen
     
        loop while frame\=null;end                        --    wait for the GUI window to do something
     
        say textfield.getText                             --    show the text field contents
     
    method actionPerformed(e=ActionEvent)                 --    this is the code that listens to the button
        frame.dispose                                     --    clear the GUI window frame from screen and memory
        frame=null                                        --    erase the pointer to stop the main program

/*  some notes removed here  */


import javax.swing.

 class guisample public implements ActionListener
 
    properties inheritable static
        frame = JFrame
        textfield = JTextField
 
    method main(sa=String[]) static
        -- build a gui and die..
        guisample()
     
    method guisample
        -- GUI objects must be instantiated from EDT so
        -- tell it to do so
        SwingUtilities.InvokeLater(this.guiBuilder())
              
    method actionPerformed(e=ActionEvent)
        -- safe here as event handling code is called from EDT
        say textfield.getText
        frame.dispose
        frame=null
  
      
class guisample.guiBuilder dependent implements Runnable
  
    -- SwingUtilities.InvokeLater requires a Runnable so we need
    -- a separate class :-(
  
    method run
        parent.frame=JFrame("Sample GUI window")
        parent.frame.setSize(400,100)
        panel=JPanel()
        parent.frame.add(panel)
        parent.textfield=JTextField("Some default text here")
        panel.add(parent.textfield)
        button=JButton("OK")
        button.addActionListener(parent)
        panel.add(button)
        parent.frame.setVisible(1)

-- Saludos / Kind regards. David Requena

 

_______________________________________________ Ibm-netrexx mailing list [hidden email]

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Learning Java Objects (The GUI affair)

Robert L Hamilton
Kermit: thanx -- I'm trying to figure out how to display the date instead of the literal.

bobh

 

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Learning Java Objects

Quique Britto
In reply to this post by Fernando Cassia-2
Mensys is proving the bulk of the funding.

The netlabs.org project to port Java to OS/2 has released (10/1/2010) a build of OpenJDK 1.6.0-b19. This alpha release of the SDK can only compile and run console Java applications, as the GUI classes (AWT and Swing) are not yet available. Funding is being provided by Mensys and other interested parties. It uses the Odin32 runtime libraries; a GA release is scheduled for the end of the year.

http://svn.netlabs.org/java


Quique



On 6 October 2010 00:21, Fernando Cassia <[hidden email]> wrote:
On Tue, Oct 5, 2010 at 6:46 PM, Quique Britto <[hidden email]> wrote:
> I use eCS (OS/2) which Java is currently at 1.41 level only therefore can
> only use the tools what currently work.
> luckily enough Java Developers Kit is being updated to current level and
> should be available to us eCS users before the end of the year.

You mean that someone is porting the current Java 6uNN to OS/2?? Using
OpenJDK I guess?. And who is doing this? MenSys? or Paul Smedley using
emx tools?.

Thanks.
FC
_______________________________________________
Ibm-netrexx mailing list
[hidden email]



_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Learning Java Objects (The GUI affair)

Kermit Kiser
In reply to this post by Robert L Hamilton
Bob ;

Try changing this line:

      textfield=JTextField("Some default text here")    --    create a
spot for some text

to this line:

        textfield=JTextField(Date().toString)    --    create a spot for
some text


-- Kermit

On 10/6/2010 7:26 AM, Robert Hamilton wrote:
> Kermit: thanx -- I'm trying to figure out how to display the date
> instead of the literal.
>
> bobh
_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Learning Java Objects (The GUI affair)

Robert L Hamilton
Great; thnx.

Now if JAVA had a Parse???  Can I switch over to NetRexx and parse the Date().toString;  lemyc

bobh



On Wed, Oct 6, 2010 at 12:20 PM, Kermit Kiser <[hidden email]> wrote:
Bob ;

Try changing this line:


    textfield=JTextField("Some default text here")    --    create a spot for some text

to this line:

      textfield=JTextField(Date().toString)    --    create a spot for some text


-- Kermit


On 10/6/2010 7:26 AM, Robert Hamilton wrote:
Kermit: thanx -- I'm trying to figure out how to display the date instead of the literal.

bobh
_______________________________________________
Ibm-netrexx mailing list
[hidden email]



_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Learning Java Objects (The GUI affair)

Marc Remes
SimpleDataFormat comes handy :

fmt = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
timestamp = fmt.format(Date(time))

Marc

mailto:mremes@...




Robert Hamilton <[hidden email]>
Sent by: [hidden email]

10/06/2010 08:01 PM

Please respond to
IBM Netrexx <[hidden email]>

To
IBM Netrexx <[hidden email]>
cc
Subject
Re: [Ibm-netrexx] Learning Java Objects (The GUI affair)





Great; thnx.

Now if JAVA had a Parse???  Can I switch over to NetRexx and parse the Date().toString;  lemyc

bobh



On Wed, Oct 6, 2010 at 12:20 PM, Kermit Kiser <infire@...> wrote:
Bob ;

Try changing this line:



    textfield=JTextField("Some default text here")    --    create a spot for some text

to this line:

      textfield=JTextField(Date().toString)    --    create a spot for some text



-- Kermit



On 10/6/2010 7:26 AM, Robert Hamilton wrote:

Kermit: thanx -- I'm trying to figure out how to display the date instead of the literal.

bobh

_______________________________________________
Ibm-netrexx mailing list

[hidden email]

_______________________________________________
Ibm-netrexx mailing list
[hidden email]




Tenzij hierboven anders aangegeven: / Sauf indication contraire ci-dessus: / Unless otherwise stated above:

International Business Machines of Belgium sprl / bvba
Siège social / Maatschappelijke zetel: Avenue du Bourget 42 Bourgetlaan, B-1130 Bruxelles/Brussel
N° d'entreprise / Ondernemingsnr: TVA / BTW BE 0405 912 336
RPM Bruxelles / RPR Brussel

_______________________________________________
Ibm-netrexx mailing list
[hidden email]


smime.p7s (12K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Learning Java Objects (The GUI affair)

Kermit Kiser
In reply to this post by Robert L Hamilton
Java does have a "parse" - it's called NetRexx! ;-)

But seriously, you have lots of options - you could use NetRexx parse to get a format you like:

        parse Date().toString a b c d e f
        textfield=JTextField(b c f)    --    create a spot for some text

Or you could just use a Java date formatter if you don't mind looking at some Java docs:

textfield=JTextField(SimpleDateFormat("MMM. d, yyyy").format(Date()))    --    create a spot for some text

-- Kermit


On 10/6/2010 11:01 AM, Robert Hamilton wrote:
Great; thnx.

Now if JAVA had a Parse???  Can I switch over to NetRexx and parse the Date().toString;  lemyc

bobh



On Wed, Oct 6, 2010 at 12:20 PM, Kermit Kiser <[hidden email]> wrote:
Bob ;

Try changing this line:


    textfield=JTextField("Some default text here")    --    create a spot for some text

to this line:

      textfield=JTextField(Date().toString)    --    create a spot for some text


-- Kermit


On 10/6/2010 7:26 AM, Robert Hamilton wrote:
Kermit: thanx -- I'm trying to figure out how to display the date instead of the literal.

bobh
_______________________________________________
Ibm-netrexx mailing list
[hidden email]



_______________________________________________ Ibm-netrexx mailing list [hidden email]

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Learning Java Objects (The GUI affair)

rickmcguire
On Wed, Oct 6, 2010 at 2:21 PM, Kermit Kiser <[hidden email]> wrote:

> Java does have a "parse" - it's called NetRexx! ;-)
>
> But seriously, you have lots of options - you could use NetRexx parse to get
> a format you like:
>
>         parse Date().toString a b c d e f
>         textfield=JTextField(b c f)    --    create a spot for some text
>
> Or you could just use a Java date formatter if you don't mind looking at
> some Java docs:
>
> textfield=JTextField(SimpleDateFormat("MMM. d, yyyy").format(Date()))
> --    create a spot for some text

Or, an even better solution is to not parse the data at all.  The Date
and Gregorian calendar classes have methods for retrieving each of the
values of a date without requiring the whole thing be formatted as a
string first.

Rick

>
> -- Kermit
>
>
> On 10/6/2010 11:01 AM, Robert Hamilton wrote:
>
> Great; thnx.
>
> Now if JAVA had a Parse???  Can I switch over to NetRexx and parse the
> Date().toString;  lemyc
>
> bobh
>
>
>
> On Wed, Oct 6, 2010 at 12:20 PM, Kermit Kiser <[hidden email]>
> wrote:
>>
>> Bob ;
>>
>> Try changing this line:
>>
>>     textfield=JTextField("Some default text here")    --    create a spot
>> for some text
>>
>> to this line:
>>
>>       textfield=JTextField(Date().toString)    --    create a spot for
>> some text
>>
>>
>> -- Kermit
>>
>> On 10/6/2010 7:26 AM, Robert Hamilton wrote:
>>>
>>> Kermit: thanx -- I'm trying to figure out how to display the date instead
>>> of the literal.
>>>
>>> bobh
>>
>> _______________________________________________
>> Ibm-netrexx mailing list
>> [hidden email]
>>
>
> ________________________________
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
>
>
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
>
>
>

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: The GUI affair

KP Kirchdörfer
In reply to this post by David Requena
Am Dienstag, 5. Oktober 2010, 16:31:27 schrieb David Requena:

> El 05/10/2010 2:22, George Hovey escribió:
> > Hope David Requena weighs in on this - I think he is pretty GUI aware.
>
> While that might be true, I've to say it'd be more out of sheer
> stubbornness in tackling hard challenges than out of any practical
> matter :-)
> Non-trivial GUIs are not easy to make from NetRexx nor from java itself.
>
> FWIW the only reasonable way to do this is by taking advantage of the
> fact that java classes and NetRexx's own are the very same thing.
> So my advice is: do use NetBeans' wonderful point & click tools to make
> your GUI, compile it, and then drive it from your NetRexx program.
> Use your time to do more interesting things with NetRexx :-)
> I think René is also using this approach in his projects. See
> http://www.rexxla.org/events/2004/renej.pdf

With the help of Quique's "HowTo" I've been able start with a GUI.
It came out as a nice example to learn a lot about java, using java classes
from NetRexx and to read javadocs the other way round.
I do have some working code, but it's a eak GUI - e.g. it doesn't play well
once I'm rasing the app to FS mode. It's also a lot of work to add something
new later. The geometry has to adjusted by hand for each and every screen
object.  So in the long term it's not the way to go with.

I saw Rene mentioning using NetBeans for GUI building as well.
I installed NetBeans after I read the mail, and it looks pretty easy to build
a GUI and to compile it to a jar file.

But I have no idea how to make the final step, to "drive it from NetRexx".

Will it be as easy as clicking the GUI together, mark the elements as public
and create the javadoc to see how do I have to access the elements of the GUI?
(I assume, the elements might be kept private, once I find the switch to
generate javadoc including private methods and how I add my NetRexx code to
the project/package(?))

A small example will be helpful to get it.

TIA kp

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: The GUI affair

David Requena

Wouldn't want this one to slip.

As I worked in a little app to use as an example in my reply, it came upon me that this could be best suited for a little tutorial.
I'm doing just that at the moment.
---
Saludos / Kind regards.
David Requena

El 06/10/2010 21:29, KP Kirchdoerfer escribió:
Am Dienstag, 5. Oktober 2010, 16:31:27 schrieb David Requena:
El 05/10/2010 2:22, George Hovey escribió:
Hope David Requena weighs in on this - I think he is pretty GUI aware.
While that might be true, I've to say it'd be more out of sheer
stubbornness in tackling hard challenges than out of any practical
matter :-)
Non-trivial GUIs are not easy to make from NetRexx nor from java itself.

FWIW the only reasonable way to do this is by taking advantage of the
fact that java classes and NetRexx's own are the very same thing.
So my advice is: do use NetBeans' wonderful point & click tools to make
your GUI, compile it, and then drive it from your NetRexx program.
Use your time to do more interesting things with NetRexx :-)
I think René is also using this approach in his projects. See
http://www.rexxla.org/events/2004/renej.pdf
With the help of Quique's "HowTo" I've been able start with a GUI.
It came out as a nice example to learn a lot about java, using java classes 
from NetRexx and to read javadocs the other way round.
I do have some working code, but it's a eak GUI - e.g. it doesn't play well 
once I'm rasing the app to FS mode. It's also a lot of work to add something 
new later. The geometry has to adjusted by hand for each and every screen 
object.  So in the long term it's not the way to go with.

I saw Rene mentioning using NetBeans for GUI building as well. 
I installed NetBeans after I read the mail, and it looks pretty easy to build 
a GUI and to compile it to a jar file.

But I have no idea how to make the final step, to "drive it from NetRexx".

Will it be as easy as clicking the GUI together, mark the elements as public 
and create the javadoc to see how do I have to access the elements of the GUI?
(I assume, the elements might be kept private, once I find the switch to 
generate javadoc including private methods and how I add my NetRexx code to 
the project/package(?))

A small example will be helpful to get it.

TIA kp

_______________________________________________
Ibm-netrexx mailing list
[hidden email]


_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Learning Java Objects

Thomas.Schneider.Wien
In reply to this post by Quique Britto
Hello Quique, & all,
 
   as you might know from this group, I'm doing some NetRexx development,
and, amongst others, try to implement some new 'statements' like SHOW and ACCEPT for screen I/O (GUI I/O), generating NetRexx Code which uses SWING in turn.

   I would be interested to get advise from individuals fluent in Java SWING for this (as I am just starting learning SWING by my own, currently).

   Maybe we can create a topic called NetRexx GUI for discussing this?
I would be willing to implement the generator part, when we did agree on the
syntax and semantics needed.

Any volunteers ?

Thomas Schneider.
=============================================================

  
Am 05.10.2010 18:19, schrieb Quique Britto:
I ended up purchasing a Java Book as I find the Javadoc too much for my eyes.
I have started writing a tutorial for writing Netrexx programs using Java Swing, it's basically a shortcut for people who wish to use Swing and Netrexx.

http://www.esimplesoft.es/


Quique




On 5 October 2010 17:53, George Hovey <[hidden email]> wrote:
Connor, David

David wrote:
When it comes to the java library, I think it's just a matter of overseeing what is available in there and how is it broken into different "functional domains" (packages). Then, when you need something in particular,  you just look it up and use it. I don't think anyone is going to hold the whole 2700+ classes thing in his head!

Connor wrote:
Yep, you are right, getting to grips with existing java objects is a great starting point, especially where I'm not intending to leverage the OO aspect, and just want to write portable programs.    So just how do I do that?   Where/which is the guide that tells me how to use the more useful objects in a NetRexx centred way, that doesn't expect me to read Java programs?
-------------------------------------------------------------
This seems to me to focus on a core issue in making NetRexx new user-friendly.  Connor, trying to get his arms around Java, wants to know "how to use the more useful objects".  David replies, correctly, that " it's just a matter of overseeing what is available in there and how is it broken into different "functional domains" (packages)".  I suspect that Connor doesn't find this answer totally satisfactory.

The answer, briefly, is that we can't tell you what are the more useful objects, because only you know what interests you.  You don't need to read Java code.  You do need to explore the Java API by reading it's Javadoc documentation.  You don't use the Javadoc program itself, you just look at its HTML output files describing the API,  which can be downloaded from Sun/Oracle, with your browser.  This requires that you know how the find you way around the browser display to locate packages, classes, properties and methods.  You also have to understand the nature of Java's data types, both native and Object.  Then you are ready to invoke any Java class that strikes your fancy from NetRexx and without the use of Java code (you are using only NetRexx objects which are, with a few weasel words, identical to Java's).

Connor wrote: In short, is there a NetRexx Cookbook?

No, but there must be if we are to succeed (although the old IBM Red Book could be so described).  The information in the previous paragraph should be there but in much expanded form, with screen shots etc.  If you would be willing to contribute time to advancing this cause, I am available, and I think others, certainly David, will contribute.  I propose that we find out what is require to "bootstrap" you into Java API awareness by doing it step by step.  This will give us the information to produce a fair stab at the article "Using the Java Class Library in NetRexx" in "The NetRexx Cookbook".  I would be glad to act as recording secretary in collecting materials.  I also have Adobe Acrobat (writer) to produce a PDF.
We might start a new thread and ask people to use it solely for contributions to this experiment.

What do you think?

On Tue, Oct 5, 2010 at 8:23 AM, Connor Birch <[hidden email]> wrote:

On 5 Oct 2010, at 12:47, David Requena wrote:

IMO the stumbling block when coming to object oriented programming from an structured or procedural background is precisely the mind shift required by OO. You need to start thinking in objects as opposed procedures, subroutines, functions, data structures an so. 

I'm told this can be difficult to achieve. In all honesty it wasn't for me. OO is all about a few very simple principles with fancy names specially designed to scare outsiders (polymorphism, encapsulation, information hiding, inheritance, abstraction, message passing, decoupling, ...).
Believe me, this is very simple stuff. If your ever implemented and ADT in your procedural language of choice, you already have done 80% of the way!

Okay, I don't have a problem wit the concepts, most of what you mentioned ought to be familiar stuff to anyone who has written well structured code.   The only concept listed above that goes beyond 'normal' programming is inheritance.   I once took a course in Objective C; learning the concepts was no problem.   Making sense of the programming language was another issue entirely.  

In short, don't bother to "learn java's objects" (or C++', Smalltalk's, Python's, or even NetRexx'). Just pick some tutorial on object orientation which plainly explains these OO concepts and you'll be prepared to tackle any OO language. At the end of the day it's just a matter of assessing how these languages' syntaxes support the basic OO concepts. Most languages do a pretty poor job out of this task but that is not the case of NetRexx :-)

So its not an OO tutorial I need.

Also NetRexx in particular allows for a gentle two phased approach to OO programming in which you don't do any OO coding but you just *USE* existing objects. That is NetRexx' scripting mode.

/* An script using objects */

Say "This particular instant in time is:" Date().toString

/* done! */


Yep! We didn't bother with classes, methods, properties or anything OO here. Just took advantage of a given Date object which offers a toString "function" returning a nicely formatted string.
As a matter of fact you can leverage the whole java library (and literally thousands of freely available OSS ones) in this fashion; just by putting your run of the mill first argument to the front, putting in a dot and then the function (method!) at the end. Not bad!

Yep, you are right, getting to grips with existing java objects is a great starting point, especially where I'm not intending to leverage the OO aspect, and just want to write portable programs.    So just how do I do that?   Where/which is the guide that tells me how to use the more useful objects in a NetRexx centred way, that doesn't expect me to read Java programs? 

In short, is there a NetRexx Cookbook?

Connor.

_______________________________________________
Ibm-netrexx mailing list
[hidden email]




_______________________________________________
Ibm-netrexx mailing list
[hidden email]



_______________________________________________ Ibm-netrexx mailing list [hidden email]


--
Thomas Schneider Projects ReyC & LOGOS on www.KENAI.com

_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Tom. (ths@db-123.com)
Reply | Threaded
Open this post in threaded view
|

Re: Learning Java Objects

Thomas.Schneider.Wien
In reply to this post by Fernando Cassia-2
  Hi Fernando,
    could you send me a short mail privately what 'wget' does and where
I can find it?
    Or  do I have simply to google 'wget' ???

Thomas.
===========================================================
Am 05.10.2010 18:40, schrieb Fernando Cassia:

> On Tue, Oct 5, 2010 at 1:19 PM, Quique Britto<[hidden email]>  wrote:
>> I ended up purchasing a Java Book as I find the Javadoc too much for my
>> eyes.
>> I have started writing a tutorial for writing Netrexx programs using Java
>> Swing, it's basically a shortcut for people who wish to use Swing and
>> Netrexx.
>>
>> http://www.esimplesoft.es/
> Quique,
>
> Very nice, but I´d add a link at the end of each section, linking to the next.
> That´d make wget -m -np -k -c http://url much easier :)
>
> FC
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
>
>


--
Thomas Schneider Projects ReyC & LOGOS on www.KENAI.com
_______________________________________________
Ibm-netrexx mailing list
[hidden email]

Tom. (ths@db-123.com)
123