actionPeformed Method

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

actionPeformed Method

measel
On the method specify "returns obj-type" and replace the "return statement with "return variable" where variable is the same object-type as on the method statement.

________________________________

From: [hidden email] <[hidden email]>
To: [hidden email] <[hidden email]>
Sent: Fri Feb 05 05:54:52 2010
Subject: [Ibm-netrexx] actionPeformed Method


Hi all,

nice to see this list active again and new projects in motion.

how can I return the filename to the caller program, the u/m code is called when the menubar item or toolbar button is pressed, this obtains the zip file which is what I want to have access to in the caller program.

can this method return the variable zps (in this example) or is there another way where I can access this fm the caller program.

as always , any help is appreciated.


PS: I am an eComStation (OS/2) user so all new stuff being discussed here will also be tried on this OS and feedback given.



class eZE.OpenAction dependent extends AbstractAction
  method OpenAction( text = String, icon = ImageIcon )      
  super( text, icon )

  method actionPerformed( e = ActionEvent ) public
  -- load file chooser using filters
  fc = JFileChooser( "d:\\download" )
  fc.setFileSelectionMode( JFileChooser.FILES_ONLY )
  fc.setAcceptAllFileFilterUsed( 0 )
  fc.addChoosableFileFilter( MyFilter() )

  -- open file chooser
  returnedval = fc.showOpenDialog( parent.mainwindow )

  -- query the filechooser to get user input
  if returnedval = JFileChooser.APPROVE_OPTION then
    do
      zp = fc.getSelectedFile()
      zf = ZipFile( zp )
      entries = zf.entries()

      -- store total entires into variable
      zipentries = zf.size()

      -- set out conter
      i = 0

      -- convert selected archive to string format
      zps = zp.toString()

      loop while entries.hasMoreElements()                
        ze  = ZipEntry entries.nextElement()
        ...
        ...
        ...
      end

      catch e=IOException
        say "Open Zip Error  ==>"||e

    end

    -- update status bar with archive information
    parent.sb.setMessage( zps )
    parent.sbrb.setMessage( zipentries||" files" )

  return


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ns.hursley.ibm.com/pipermail/ibm-netrexx/attachments/20100205/e62d4a0f/attachment.html
Reply | Threaded
Open this post in threaded view
|

actionPeformed Method

Quique Britto
tried this before (not mentioned in my original post...sorry :-) ) and
compiler returns the flwg:

>>>
method has return type "java.lang.string" so cannot override or implement
method with no return type in class
"java.awt.event.ActionListener"
<<<

if I am no mistaken this method does not allows returns?



On 5 February 2010 12:59, Measel, Mike <[hidden email]> wrote:

> On the method specify "returns obj-type" and replace the "return statement
> with "return variable" where variable is the same object-type as on the
> method statement.
>
> ------------------------------
>  *From*: [hidden email] <
> [hidden email]>
> *To*: [hidden email] <[hidden email]>
> *Sent*: Fri Feb 05 05:54:52 2010
> *Subject*: [Ibm-netrexx] actionPeformed Method
>
> Hi all,
>
> nice to see this list active again and new projects in motion.
>
> how can I return the filename to the caller program, the u/m code is called
> when the menubar item or toolbar button is pressed, this obtains the zip
> file which is what I want to have access to in the caller program.
>
> can this method return the variable zps (in this example) or is there
> another way where I can access this fm the caller program.
>
> as always , any help is appreciated.
>
>
> PS: I am an eComStation (OS/2) user so all new stuff being discussed here
> will also be tried on this OS and feedback given.
>
>
>
> class eZE.OpenAction dependent extends AbstractAction
>   method OpenAction( text = String, icon = ImageIcon )
>   super( text, icon )
>
>   method actionPerformed( e = ActionEvent ) public
>   -- load file chooser using filters
>   fc = JFileChooser( "d:\\download" )
>   fc.setFileSelectionMode( JFileChooser.FILES_ONLY )
>   fc.setAcceptAllFileFilterUsed( 0 )
>   fc.addChoosableFileFilter( MyFilter() )
>
>   -- open file chooser
>   returnedval = fc.showOpenDialog( parent.mainwindow )
>
>   -- query the filechooser to get user input
>   if returnedval = JFileChooser.APPROVE_OPTION then
>     do
>       zp = fc.getSelectedFile()
>       zf = ZipFile( zp )
>       entries = zf.entries()
>
>       -- store total entires into variable
>       zipentries = zf.size()
>
>       -- set out conter
>       i = 0
>
>       -- convert selected archive to string format
>       zps = zp.toString()
>
>       loop while entries.hasMoreElements()
>         ze  = ZipEntry entries.nextElement()
>         ...
>         ...
>         ...
>       end
>
>       catch e=IOException
>         say "Open Zip Error  ==>"||e
>
>     end
>
>     -- update status bar with archive information
>     parent.sb.setMessage( zps )
>     parent.sbrb.setMessage( zipentries||" files" )
>
>   return
>
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ns.hursley.ibm.com/pipermail/ibm-netrexx/attachments/20100205/332d833f/attachment.html
Reply | Threaded
Open this post in threaded view
|

actionPeformed Method

measel
Ah, didn't read to see your code I was considering your earlier example
which I think would work better for you.  No reason to extend the action
class.  You want a main class that has a loop that can sleep and wait
for events.

 

From: [hidden email]
[mailto:[hidden email]] On Behalf Of Quique Britto
Sent: Friday, February 05, 2010 6:20 AM
To: IBM Netrexx
Subject: Re: [Ibm-netrexx] actionPeformed Method

 

tried this before (not mentioned in my original post...sorry :-) ) and
compiler returns the flwg:

>>>
method has return type "java.lang.string" so cannot override or
implement method with no return type in class
"java.awt.event.ActionListener"
<<<

if I am no mistaken this method does not allows returns?




On 5 February 2010 12:59, Measel, Mike <[hidden email]> wrote:

On the method specify "returns obj-type" and replace the "return
statement with "return variable" where variable is the same object-type
as on the method statement.

 

________________________________

From: [hidden email]
<[hidden email]>
To: [hidden email] <[hidden email]>
Sent: Fri Feb 05 05:54:52 2010
Subject: [Ibm-netrexx] actionPeformed Method

Hi all,

nice to see this list active again and new projects in motion.

how can I return the filename to the caller program, the u/m code is
called when the menubar item or toolbar button is pressed, this obtains
the zip file which is what I want to have access to in the caller
program.

can this method return the variable zps (in this example) or is there
another way where I can access this fm the caller program.

as always , any help is appreciated.


PS: I am an eComStation (OS/2) user so all new stuff being discussed
here will also be tried on this OS and feedback given.



class eZE.OpenAction dependent extends AbstractAction
  method OpenAction( text = String, icon = ImageIcon )      
  super( text, icon )

  method actionPerformed( e = ActionEvent ) public
  -- load file chooser using filters
  fc = JFileChooser( "d:\\download" )
  fc.setFileSelectionMode( JFileChooser.FILES_ONLY )
  fc.setAcceptAllFileFilterUsed( 0 )
  fc.addChoosableFileFilter( MyFilter() )

  -- open file chooser
  returnedval = fc.showOpenDialog( parent.mainwindow )

  -- query the filechooser to get user input
  if returnedval = JFileChooser.APPROVE_OPTION then
    do
      zp = fc.getSelectedFile()
      zf = ZipFile( zp )
      entries = zf.entries()

      -- store total entires into variable
      zipentries = zf.size()

      -- set out conter
      i = 0

      -- convert selected archive to string format
      zps = zp.toString()

      loop while entries.hasMoreElements()                
        ze  = ZipEntry entries.nextElement()
        ...
        ...
        ...
      end

      catch e=IOException
        say "Open Zip Error  ==>"||e

    end

    -- update status bar with archive information
    parent.sb.setMessage( zps )
    parent.sbrb.setMessage( zipentries||" files" )

  return


_______________________________________________
Ibm-netrexx mailing list
[hidden email]



 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ns.hursley.ibm.com/pipermail/ibm-netrexx/attachments/20100205/3ff6153d/attachment-0001.html
Reply | Threaded
Open this post in threaded view
|

actionPeformed Method

David Requena
that's right Mike.

Or applying the common java pattern of directly implementing the
ActionListener interface in the originating class, then adding itself as an
ActionListner.
Then you would have direct access to any needed private methods and or
properties.

I see a variation of this done often with anonymous classes in java.

2010/2/5 Measel, Mike <[hidden email]>

>  Ah, didn?t read to see your code I was considering your earlier example
> which I think would work better for you.  No reason to extend the action
> class.  You want a main class that has a loop that can sleep and wait for
> events.
>
>
>
> *From:* [hidden email] [mailto:
> [hidden email]] *On Behalf Of *Quique Britto
> *Sent:* Friday, February 05, 2010 6:20 AM
> *To:* IBM Netrexx
> *Subject:* Re: [Ibm-netrexx] actionPeformed Method
>
>
>
> tried this before (not mentioned in my original post...sorry :-) ) and
> compiler returns the flwg:
>
> >>>
> method has return type "java.lang.string" so cannot override or implement
> method with no return type in class
> "java.awt.event.ActionListener"
> <<<
>
> if I am no mistaken this method does not allows returns?
>
>
>  On 5 February 2010 12:59, Measel, Mike <[hidden email]> wrote:
>
> On the method specify "returns obj-type" and replace the "return statement
> with "return variable" where variable is the same object-type as on the
> method statement.
>
>
>  ------------------------------
>
> *From*: [hidden email] <
> [hidden email]>
> *To*: [hidden email] <[hidden email]>
> *Sent*: Fri Feb 05 05:54:52 2010
> *Subject*: [Ibm-netrexx] actionPeformed Method
>
> Hi all,
>
> nice to see this list active again and new projects in motion.
>
> how can I return the filename to the caller program, the u/m code is called
> when the menubar item or toolbar button is pressed, this obtains the zip
> file which is what I want to have access to in the caller program.
>
> can this method return the variable zps (in this example) or is there
> another way where I can access this fm the caller program.
>
> as always , any help is appreciated.
>
>
> PS: I am an eComStation (OS/2) user so all new stuff being discussed here
> will also be tried on this OS and feedback given.
>
>
>
> class eZE.OpenAction dependent extends AbstractAction
>   method OpenAction( text = String, icon = ImageIcon )
>   super( text, icon )
>
>   method actionPerformed( e = ActionEvent ) public
>   -- load file chooser using filters
>   fc = JFileChooser( "d:\\download" )
>   fc.setFileSelectionMode( JFileChooser.FILES_ONLY )
>   fc.setAcceptAllFileFilterUsed( 0 )
>   fc.addChoosableFileFilter( MyFilter() )
>
>   -- open file chooser
>   returnedval = fc.showOpenDialog( parent.mainwindow )
>
>   -- query the filechooser to get user input
>   if returnedval = JFileChooser.APPROVE_OPTION then
>     do
>       zp = fc.getSelectedFile()
>       zf = ZipFile( zp )
>       entries = zf.entries()
>
>       -- store total entires into variable
>       zipentries = zf.size()
>
>       -- set out conter
>       i = 0
>
>       -- convert selected archive to string format
>       zps = zp.toString()
>
>       loop while entries.hasMoreElements()
>         ze  = ZipEntry entries.nextElement()
>         ...
>         ...
>         ...
>       end
>
>       catch e=IOException
>         say "Open Zip Error  ==>"||e
>
>     end
>
>     -- update status bar with archive information
>     parent.sb.setMessage( zps )
>     parent.sbrb.setMessage( zipentries||" files" )
>
>   return
>
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
>
>
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
>
>
>


--
Saludos / Regards,
David Requena
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ns.hursley.ibm.com/pipermail/ibm-netrexx/attachments/20100205/3289d806/attachment.html