_______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
On 1/10/2012 6:30 PM, Dropbox wrote:
> /"Did this invite get thru?"/ > > > > It did, but access to the file(s) did not. Instead of "Sharing" a file, you need to right-click it in your Dropbox folder, select "Dropbox" from the menu, and then "Copy public link". That will put the URL of the file in your clipboard. Then just paste it into a note to the list. When you "Share" only the first person who accepts your invitation gains access to the file(s). _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
Hello Kenneth,
my DROPBOX ID is [hidden email] (as usual) Tom Maynard, thanks for the clarification. Thomas. =========================================================== Am 11.01.2012 04:25, schrieb Tom Maynard: > On 1/10/2012 6:30 PM, Dropbox wrote: >> /"Did this invite get thru?"/ >> >> >> >> > > It did, but access to the file(s) did not. Instead of "Sharing" a > file, you need to right-click it in your Dropbox folder, select > "Dropbox" from the menu, and then "Copy public link". That will put > the URL of the file in your clipboard. > > Then just paste it into a note to the list. > > When you "Share" only the first person who accepts your invitation > gains access to the file(s). > > _______________________________________________ > Ibm-netrexx mailing list > [hidden email] > Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ > > -- Thomas Schneider (Founder of www.thsitc.com) Member of the Rexx Languge Asscociation (www.rexxla.org) Member of the NetRexx Developer's Team (www.netrexx.org) _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
Thomas Schneider, Vienna, Austria (Europe) :-)
www.thsitc.com www.db-123.com |
That is a great tool that should help me out a lot, thanks. Has anyone figured out where the "package component" is? In converting the ButtonDemo.java example from the java tutorial pages to netrexx a few problems arise. First a few syntax problems arose with the (, ) and { and }. Also "true" and "false" are reserved words so I manually converted those to isTrue and isFalse methods. Finally "Runnable" seems to be part of a package that I can not find in the tutorials anywhere. Kenneth Klein Systems Specialist [hidden email] _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
Runnable is a Java "interface". It is described here (find it in the left hand bottom list)
Interfaces don't have constructors. That is the short answer, but probably not what you're hoping for :) . Tell us more and the Java experts will jump in. On Thu, Jan 12, 2012 at 11:30 AM, <[hidden email]> wrote:
_______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
*** I'm trying to translate this java: *** package components; import javax.swing.AbstractButton; import javax.swing.JButton; import javax.swing.JPanel; import javax.swing.JFrame; import javax.swing.ImageIcon; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; /* * ButtonDemo.java requires the following files: * images/right.gif * images/middle.gif * images/left.gif */ public class ButtonDemo extends JPanel implements ActionListener { protected JButton b1, b2, b3; public ButtonDemo() { ImageIcon leftButtonIcon = createImageIcon("images/right.gif"); ImageIcon middleButtonIcon = createImageIcon("images/middle.gif"); ImageIcon rightButtonIcon = createImageIcon("images/left.gif"); b1 = new JButton("Disable middle button", leftButtonIcon); b1.setVerticalTextPosition(AbstractButton.CENTER); b1.setHorizontalTextPosition(AbstractButton.LEADING); //aka LEFT, for left-to-right locales b1.setMnemonic(KeyEvent.VK_D); b1.setActionCommand("disable"); b2 = new JButton("Middle button", middleButtonIcon); b2.setVerticalTextPosition(AbstractButton.BOTTOM); b2.setHorizontalTextPosition(AbstractButton.CENTER); b2.setMnemonic(KeyEvent.VK_M); b3 = new JButton("Enable middle button", rightButtonIcon); //Use the default text position of CENTER, TRAILING (RIGHT). b3.setMnemonic(KeyEvent.VK_E); b3.setActionCommand("enable"); b3.setEnabled(false); //Listen for actions on buttons 1 and 3. b1.addActionListener(this); b3.addActionListener(this); b1.setToolTipText("Click this button to disable the middle button."); b2.setToolTipText("This middle button does nothing when you click it."); b3.setToolTipText("Click this button to enable the middle button."); //Add Components to this container, using the default FlowLayout. add(b1); add(b2); add(b3); } public void actionPerformed(ActionEvent e) { if ("disable".equals(e.getActionCommand())) { b2.setEnabled(false); b1.setEnabled(false); b3.setEnabled(true); } else { b2.setEnabled(true); b1.setEnabled(true); b3.setEnabled(false); } } /** Returns an ImageIcon, or null if the path was invalid. */ protected static ImageIcon createImageIcon(String path) { java.net.URL imgURL = ButtonDemo.class.getResource(path); if (imgURL != null) { return new ImageIcon(imgURL); } else { System.err.println("Couldn't find file: " + path); return null; } } /** * Create the GUI and show it. For thread safety, * this method should be invoked from the * event-dispatching thread. */ private static void createAndShowGUI() { //Create and set up the window. JFrame frame = new JFrame("ButtonDemo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Create and set up the content pane. ButtonDemo newContentPane = new ButtonDemo(); newContentPane.setOpaque(true); //content panes must be opaque frame.setContentPane(newContentPane); //Display the window. frame.pack(); frame.setVisible(true); } public static void main(String[] args) { //Schedule a job for the event-dispatching thread: //creating and showing this application's GUI. javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } } *** into this netrexx : *** package components import javax.swing.AbstractButton import javax.swing.JButton import javax.swing.JPanel import javax.swing.JFrame import javax.swing.ImageIcon import java.awt.event.ActionEvent import java.awt.event.ActionListener import java.awt.event.KeyEvent class ButtonDemo public extends JPanel implements ActionListener properties -- protected b1 = JButton b2 = JButton b3 = JButton method ButtonDemo leftButtonIcon = ImageIcon leftButtonIcon = createImageIcon("images/right.gif") middleButtonIcon = ImageIcon middleButtonIcon = createImageIcon("images/middle.gif") rightButtonIcon = ImageIcon rightButtonIcon = createImageIcon("images/left.gif") b1 = JButton("Disable middle button", leftButtonIcon) b1.setVerticalTextPosition(AbstractButton.CENTER) b1.setHorizontalTextPosition(AbstractButton.LEADING) b1.setMnemonic(KeyEvent.VK_D) b1.setActionCommand("disable") b2 = JButton("Middle button", middleButtonIcon) b2.setVerticalTextPosition(AbstractButton.BOTTOM) b2.setHorizontalTextPosition(AbstractButton.CENTER) b2.setMnemonic(KeyEvent.VK_M) b3 = JButton("Enable middle button", rightButtonIcon) b3.setMnemonic(KeyEvent.VK_E) b3.setActionCommand("enable") b3.setEnabled(isFalse) b1.addActionListener(this) b3.addActionListener(this) b1.setToolTipText("Click this button to disable the middle button.") b2.setToolTipText("This middle button does nothing when you click it.") b3.setToolTipText("Click this button to enable the middle button.") add(b1) add(b2) add(b3) method actionPerformed( e=ActionEvent ) if "disable".equals(e.getActionCommand()) then do b2.setEnabled(isFalse) b1.setEnabled(isFalse) b3.setEnabled(isTrue) end else do b2.setEnabled(isTrue) b1.setEnabled(isTrue) b3.setEnabled(isFalse) end /** Returns an ImageIcon, or null if the path was invalid. */ method createImageIcon( path=String ) protect static returns ImageIcon imgURL = java.net.URL imgURL = ButtonDemo.class.getResource(path) if imgURL \== null then do return ImageIcon(imgURL) end else do System.err.println("Couldn't find file: " || path) return null end /** * Create the GUI and show it. For thread safety, * this method should be invoked from the * event-dispatching thread. */ method createAndShowGUI private static frame = JFrame frame = JFrame("ButtonDemo") frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) newContentPane = ButtonDemo newContentPane = ButtonDemo() newContentPane.setOpaque(isTrue) frame.setContentPane(newContentPane) frame.pack() frame.setVisible(isTrue) method main( args=String[] ) static javax.swing.SwingUtilities.invokeLater(Runnable()) method run createAndShowGUI() method isTrue public static returns boolean return (1 == 1) method isFalse public static returns boolean return \isTrue Kenneth Klein
Runnable is a Java "interface". It is described here (find it in the left hand bottom list) http://docs.oracle.com/javase/6/docs/api/ Interfaces don't have constructors. That is the short answer, but probably not what you're hoping for :) . Tell us more and the Java experts will jump in. On Thu, Jan 12, 2012 at 11:30 AM, <kenneth.klein@...> wrote: That is a great tool that should help me out a lot, thanks. Has anyone figured out where the "package component" is? In converting the ButtonDemo.java example from the java tutorial pages to netrexx a few problems arise. First a few syntax problems arose with the (, ) and { and }. Also "true" and "false" are reserved words so I manually converted those to isTrue and isFalse methods. Finally "Runnable" seems to be part of a package that I can not find in the tutorials anywhere. Kenneth Klein Systems Specialist kenneth.klein@... _______________________________________________ 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/ _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
On 12 January 2012 10:44, <[hidden email]> wrote:
Like George said Runnable is an interface so you can't call it's constructor. This is one of the weaknesses if NetRexx inner class model but it's not insurmountable. Here's one way:
package components import javax.swing.AbstractButton import javax.swing.JButton import javax.swing.JPanel import javax.swing.JFrame import javax.swing.ImageIcon import java.awt.event.ActionEvent import java.awt.event.ActionListener import java.awt.event.KeyEvent class ButtonDemo public extends JPanel implements ActionListener
... /** * Create the GUI and show it. For thread safety,
* this method should be invoked from the * event-dispatching thread. */ method createAndShowGUI inheritable static
frame = JFrame frame = JFrame("ButtonDemo") frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
newContentPane = ButtonDemo newContentPane = ButtonDemo() newContentPane.setOpaque(isTrue)
frame.setContentPane(newContentPane) frame.pack() frame.setVisible(isTrue)
method main( args=String[] ) static javax.swing.SwingUtilities.invokeLater(ButtonDemo.RunnableImpl())
method isTrue public static returns boolean return (1 == 1) method isFalse public static returns boolean return \isTrue class ButtonDemo.RunnableImpl implements Runnable
method run public ButtonDemo.createAndShowGUI() return
I attempted to highlight the changes in the source above. Here's a brief explanation:
Good luck, Alan. Can't tweet, won't tweet! _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
Alan
-- Needs more cowbell. |
Something basic here that I must be missing. Gets "Can't find the main class: ButtonDemo." C:\Documents and Settings\keklein\My Documents\REXX\NetRexx\bin+ Thu 01/12/2012 16:19 > cat ButtonDemo.nrx /* I attempted to highlight the changes in the source above. áHere's a brief explanation: Change the visibility of yourácreateAndShowGUIámethod toáinheritableáso subclasses can see it. Create a minor classáButtonDemo.RunnableImpláto implement the Runnable interface and move yourárunám ethod into it. á(Note: you must prefix the call toácreateAndShowGUIáwith it's class name too.) Modify the call in main to create an instance of theáButtonDemo.RunnableImpláclass. Good luck, Alan. */ package components import javax.swing.AbstractButton import javax.swing.JButton import javax.swing.JPanel import javax.swing.JFrame import javax.swing.ImageIcon import java.awt.event.ActionEvent import java.awt.event.ActionListener import java.awt.event.KeyEvent import java.awt.Component class ButtonDemo public extends JPanel implements ActionListener properties -- protected b1 = JButton b2 = JButton b3 = JButton method ButtonDemo leftButtonIcon = ImageIcon leftButtonIcon = createImageIcon("images/right.gif") middleButtonIcon = ImageIcon middleButtonIcon = createImageIcon("images/middle.gif") rightButtonIcon = ImageIcon rightButtonIcon = createImageIcon("images/left.gif") b1 = JButton("Disable middle button", leftButtonIcon) b1.setVerticalTextPosition(AbstractButton.CENTER) b1.setHorizontalTextPosition(AbstractButton.LEADING) b1.setMnemonic(KeyEvent.VK_D) b1.setActionCommand("disable") b2 = JButton("Middle button", middleButtonIcon) b2.setVerticalTextPosition(AbstractButton.BOTTOM) b2.setHorizontalTextPosition(AbstractButton.CENTER) b2.setMnemonic(KeyEvent.VK_M) b3 = JButton("Enable middle button", rightButtonIcon) b3.setMnemonic(KeyEvent.VK_E) b3.setActionCommand("enable") b3.setEnabled(isFalse) b1.addActionListener(this) b3.addActionListener(this) b1.setToolTipText("Click this button to disable the middle button.") b2.setToolTipText("This middle button does nothing when you click it.") b3.setToolTipText("Click this button to enable the middle button.") add(b1) add(b2) add(b3) method actionPerformed( e=ActionEvent ) if "disable".equals(e.getActionCommand()) then do b2.setEnabled(isFalse) b1.setEnabled(isFalse) b3.setEnabled(isTrue) end else do b2.setEnabled(isTrue) b1.setEnabled(isTrue) b3.setEnabled(isFalse) end /** Returns an ImageIcon, or null if the path was invalid. */ method createImageIcon( path=String ) protect static returns ImageIcon imgURL = java.net.URL imgURL = ButtonDemo.class.getResource(path) if imgURL \== null then do return ImageIcon(imgURL) end else do System.err.println("Couldn't find file: " || path) return null end /** * Create the GUI and show it. For thread safety, * this method should be invoked from the * event-dispatching thread. */ method createAndShowGUI inheritable static -- method createAndShowGUI private static frame = JFrame frame = JFrame("ButtonDemo") frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) newContentPane = ButtonDemo newContentPane = ButtonDemo() newContentPane.setOpaque(isTrue) frame.setContentPane(newContentPane) frame.pack() frame.setVisible(isTrue) method main( args=String[] ) static javax.swing.SwingUtilities.invokeLater(ButtonDemo.RunnableImpl()) method run createAndShowGUI() method isTrue public static returns boolean return (1 == 1) method isFalse public static returns boolean return \isTrue class ButtonDemo.RunnableImpl implements Runnable method run public ButtonDemo.createAndShowGUI() return C:\Documents and Settings\keklein\My Documents\REXX\NetRexx\bin+ Thu 01/12/2012 16:19 > nrc ButtonDemo.nrx NetRexx portable processor, version NetRexx 3.01RC2, build 1-20110925-2337 Copyright (c) RexxLA, 2011. All rights reserved. Parts Copyright (c) IBM Corporation, 1995,2008. Program ButtonDemo.nrx === class components.ButtonDemo === constructor ButtonDemo() overrides JPanel() method actionPerformed(ActionEvent) implements ActionListener.actionPerformed(ActionEvent) function createImageIcon(String) function createAndShowGUI function main(String[]) method run function isTrue function isFalse === class components.ButtonDemo.RunnableImpl === method run implements Runnable.run Compilation of 'ButtonDemo.nrx' successful [2 classes] C:\Documents and Settings\keklein\My Documents\REXX\NetRexx\bin+ Thu 01/12/2012 16:19 > java ButtonDemo Exception in thread "main" java.lang.NoClassDefFoundError: ButtonDemo (wrong name: components/Button Demo) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632) at java.lang.ClassLoader.defineClass(ClassLoader.java:616) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) at java.net.URLClassLoader.access$000(URLClassLoader.java:58) at java.net.URLClassLoader$1.run(URLClassLoader.java:197) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) Could not find the main class: ButtonDemo. Program will exit. C:\Documents and Settings\keklein\My Documents\REXX\NetRexx\bin+ Thu 01/12/2012 16:19 > Kenneth Klein _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
The program has a package components statement in it; it should be compiled into a components directory then run from that directory's parent via java component.ButtonDemo.
Here's an admittedly UNIX incantation: $ find . .
./components ./components/ButtonDemo.nrx ./components/images
./components/images/left.gif ./components/images/middle.gif
./components/images/right.gif $ cd components/
$ nrc -keepasjava ButtonDemo NetRexx portable processor, version NetRexx 3.01RC2, build 1-20110925-2337
Copyright (c) RexxLA, 2011. All rights reserved. Parts Copyright (c) IBM Corporation, 1995,2008.
Program ButtonDemo.nrx === class components.ButtonDemo ===
constructor ButtonDemo() overrides JPanel()
method actionPerformed(ActionEvent) implements ActionListener.actionPerformed(ActionEvent)
function createImageIcon(String) function createAndShowGUI
function main(String[]) function isTrue
function isFalse === class components.ButtonDemo.RunnableImpl ===
method run implements Runnable.run
Compilation of 'ButtonDemo.nrx' successful [2 classes] $ cd ..
$ find . . ./components
./components/ButtonDemo$RunnableImpl.class ./components/ButtonDemo.class
./components/ButtonDemo.crossref ./components/ButtonDemo.java
./components/ButtonDemo.nrx ./components/images
./components/images/left.gif ./components/images/middle.gif
./components/images/right.gif $ java components.ButtonDemo
Alan.
On 12 January 2012 13:24, <[hidden email]> wrote:
Can't tweet, won't tweet! _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
Alan
-- Needs more cowbell. |
In reply to this post by kenner
On 01/12/2012 10:24 PM, [hidden email] wrote:
.. > package components .. > Compilation of 'ButtonDemo.nrx' successful [2 classes] > > C:\Documents and Settings\keklein\My Documents\REXX\NetRexx\bin+ Thu 01/12/2012 16:19 > > java ButtonDemo > Exception in thread "main" java.lang.NoClassDefFoundError: ButtonDemo (wrong name: components/Button > Demo) .. You need to put the ButtonDemo* class files in directory 'components' (for convenience also the source files and compile in that directory) because of the packhage statement. Then invoke the class by FQN: java components.ButtonDemo Marc _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
In reply to this post by kenner
Kenneth,
On 12 January 2012 13:24, <[hidden email]> wrote: You should also remove the run method from the ButtonDemo class, it's never called and is sure to lead to confusion later. The run method in the RunnableImpl implementation of the Runnable interface is the one that will be called by Swing.8X ------------------------------------------------------
8X ------------------------------------------------------
8X ------------------------------------------------------ Alan.
Can't tweet, won't tweet! _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
Alan
-- Needs more cowbell. |
Working source code from http://docs.oracle.com/javase/tutorial/uiswing/examples/components/ButtonDemoProject/src/components/ButtonDemo.java translated to netrexx with java2nrx.bat and tweaked with outstanding help from this list. > type ButtonDemo.nrx /* I attempted to highlight the changes in the source above. áHere's a brief explanation: Change the visibility of yourácreateAndShowGUIámethod toáinheritableáso subclasses can see it. Create a minor classáButtonDemo.RunnableImpláto implement the Runnable interface and move yourárunám ethod into it. á(Note: you must prefix the call toácreateAndShowGUIáwith it's class name too.) Modify the call in main to create an instance of theáButtonDemo.RunnableImpláclass. Good luck, Alan. */ package components import javax.swing.AbstractButton import javax.swing.JButton import javax.swing.JPanel import javax.swing.JFrame import javax.swing.ImageIcon import java.awt.event.ActionEvent import java.awt.event.ActionListener import java.awt.event.KeyEvent import java.awt.Component class ButtonDemo public extends JPanel implements ActionListener properties -- protected b1 = JButton b2 = JButton b3 = JButton method ButtonDemo leftButtonIcon = ImageIcon leftButtonIcon = createImageIcon("images/right.gif") middleButtonIcon = ImageIcon middleButtonIcon = createImageIcon("images/middle.gif") rightButtonIcon = ImageIcon rightButtonIcon = createImageIcon("images/left.gif") b1 = JButton("Disable middle button", leftButtonIcon) b1.setVerticalTextPosition(AbstractButton.CENTER) b1.setHorizontalTextPosition(AbstractButton.LEADING) b1.setMnemonic(KeyEvent.VK_D) b1.setActionCommand("disable") b2 = JButton("Middle button", middleButtonIcon) b2.setVerticalTextPosition(AbstractButton.BOTTOM) b2.setHorizontalTextPosition(AbstractButton.CENTER) b2.setMnemonic(KeyEvent.VK_M) b3 = JButton("Enable middle button", rightButtonIcon) b3.setMnemonic(KeyEvent.VK_E) b3.setActionCommand("enable") b3.setEnabled(isFalse) b1.addActionListener(this) b3.addActionListener(this) b1.setToolTipText("Click this button to disable the middle button.") b2.setToolTipText("This middle button does nothing when you click it.") b3.setToolTipText("Click this button to enable the middle button.") add(b1) add(b2) add(b3) method actionPerformed( e=ActionEvent ) if "disable".equals(e.getActionCommand()) then do b2.setEnabled(isFalse) b1.setEnabled(isFalse) b3.setEnabled(isTrue) end else do b2.setEnabled(isTrue) b1.setEnabled(isTrue) b3.setEnabled(isFalse) end /** Returns an ImageIcon, or null if the path was invalid. */ method createImageIcon( path=String ) protect static returns ImageIcon imgURL = java.net.URL imgURL = ButtonDemo.class.getResource(path) if imgURL \== null then do return ImageIcon(imgURL) end else do System.err.println("Couldn't find file: " || path) return null end /** * Create the GUI and show it. For thread safety, * this method should be invoked from the * event-dispatching thread. */ method createAndShowGUI inheritable static -- method createAndShowGUI private static frame = JFrame frame = JFrame("ButtonDemo") frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) newContentPane = ButtonDemo newContentPane = ButtonDemo() newContentPane.setOpaque(isTrue) frame.setContentPane(newContentPane) frame.pack() frame.setVisible(isTrue) method main( args=String[] ) static javax.swing.SwingUtilities.invokeLater(ButtonDemo.RunnableImpl()) -- method run -- createAndShowGUI() method isTrue public static returns boolean return (1 == 1) method isFalse public static returns boolean return \isTrue class ButtonDemo.RunnableImpl implements Runnable method run public ButtonDemo.createAndShowGUI() return Kenneth Klein _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
Glad that worked.
The inner class was not translated because it's an anonymous one. Difficult to trap these. Also, true and false could be translated to 1 and 0 in NetRexx, but they are reserved words only for literal values. Might need some investigation to perform an automatic translation.. I do think the JComponents are the way to go for Java GUI development. They are relatively easy to produce, provide a wealth of out-of-the-box features and good documentation to extend the behaviour. Marc _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
On 13 January 2012 07:11, Marc Remes <[hidden email]> wrote:
IMO it's better that true/false aren't translated to 1/0 as that would mean the initial type would be changed from boolean to int, which in turn may lead to undesirable side effects. Results from tools like this always require a little clean-up work and any decent programmer's editor will make that a snap. Having 98% to 99% of the conversion work done for you is a more than satisfactory outcome and saves a lot of the grunt work.Glad that worked. Alan.
Can't tweet, won't tweet! _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
Alan
-- Needs more cowbell. |
Hi Kenneth,
This is wonderful news, and also has implications for our strategies in providing aid to newcomers like you. You are the first I can remember who attacked the Java Tutorial head on (evidently with considerable success), and it could be very useful if you commented on your experiences while they are fresh in your mind. Would you tell us anything you find noteworthy about the experience? About your programming experience? A few (random) questions that spring to my mind:
George On Fri, Jan 13, 2012 at 11:57 AM, Alan Sampson <[hidden email]> wrote:
_______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
If you compile the NetRexx does it look anything like the Java from which it was produced?
Bob H On Fri, Jan 13, 2012 at 12:37 PM, George Hovey <[hidden email]> wrote: Hi Kenneth, _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
In reply to this post by Marc Remes-2
Hi Marc,
many thanks for those insigths :-) The do help me a lot in my current work and the decisions to be taken for my own soft. Thanks again, Thomas. ========================================================================= Am 13.01.2012 16:11, schrieb Marc Remes: > Glad that worked. > The inner class was not translated because it's an anonymous one. > Difficult to trap these. > Also, true and false could be translated to 1 and 0 in NetRexx, but > they are reserved words only for literal values. Might need some > investigation to perform an automatic translation.. > > I do think the JComponents are the way to go for Java GUI development. > They are relatively easy to produce, provide a wealth of > out-of-the-box features and good documentation to extend the behaviour. > > Marc > > _______________________________________________ > Ibm-netrexx mailing list > [hidden email] > Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ > > -- Thomas Schneider (Founder of www.thsitc.com) Member of the Rexx Languge Asscociation (www.rexxla.org) Member of the NetRexx Developer's Team (www.netrexx.org) _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
Thomas Schneider, Vienna, Austria (Europe) :-)
www.thsitc.com www.db-123.com |
In reply to this post by alansam
this was my method of coping with the type of True/False. method isTrue public static returns boolean return (1 == 1) method isFalse public static returns boolean return \isTrue I have also simply added my own public properties: mytrue = boolean 1 myfalse = boolean 0 Kenneth Klein
On 13 January 2012 07:11, Marc Remes <remesm@...> wrote: Glad that worked. The inner class was not translated because it's an anonymous one. Difficult to trap these. Also, true and false could be translated to 1 and 0 in NetRexx, but they are reserved words only for literal values. Might need some investigation to perform an automatic translation.. IMO it's better that true/false aren't translated to 1/0 as that would mean the initial type would be changed from boolean to int, which in turn may lead to undesirable side effects. Results from tools like this always require a little clean-up work and any decent programmer's editor will make that a snap. Having 98% to 99% of the conversion work done for you is a more than satisfactory outcome and saves a lot of the grunt work. Alan. -- Can't tweet, won't tweet!_______________________________________________ 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/ |
In reply to this post by George Hovey-2
Would you tell us anything you find noteworthy about the experience? About your programming experience? A few (random) questions that spring to my mind: 1 Can you make some sense of Java code, perhaps because you have a C/C++ background? 2 Did you start the Tutorials with basics (Java types, syntax, etc) or jump directly to the Swing Tutorial? 3 How would you rate the quality of the Java Tutorial? 4 Can you interpret (perhaps partially) a Javadoc? I've been programming since 1982. Even in those days we pushed "structured programming" in COBOL along the lines of OO in a way. Gotos and spaghetti code was tabu. I find JAVA very much like spaghetti code. Assembler coding was also very procedural, top down, you always new which instruction was next and traces made sense. I love(d) REXX from day one and have written 1000's of lines of add-hoc code for system utilities on the mainframe. I dabbled with C++ for a while and praise the use of functions like it does. 1) Java code is still mysterious even when I am looking at and tracing a working example. There is so much under the covers. Coding in Java is not programming, it is trying to second guess the infinitely wise designers of all these classes and subclasses and methods. At first I could not tell the java code from properties specific to the program I was looking at. Even the Netrexx code was a blur between what was a reserved word and field-name in this program. When you define methods and classes the source becomes the programming language. 2) I tried to start from the very beginning with the basics and you all know how it goes, I got impatient and just wanted to see something work. That's how I turned a java example using AboutFrame, Guiapp and actionlistener into a multiple choice quiz and a true or false quiz. When I got really bogged down I went back to the basics. 3) "The Java Tutorial" kept showing up when I was googl'ing for solutions. Lot's of good stuff there, but you still need to translate it into Netrexx. It has grown into my go-to site when I get confused on how to use a new class or component. 4) Javadoc is still beyond me. I tripped over it a few times but have not found a use for it with Netrexx. A primer there would be great. Kenneth Klein
Hi Kenneth, This is wonderful news, and also has implications for our strategies in providing aid to newcomers like you. You are the first I can remember who attacked the Java Tutorial head on (evidently with considerable success), and it could be very useful if you commented on your experiences while they are fresh in your mind. Would you tell us anything you find noteworthy about the experience? About your programming experience? A few (random) questions that spring to my mind:
George On Fri, Jan 13, 2012 at 11:57 AM, Alan Sampson <alansamps@...> wrote: On 13 January 2012 07:11, Marc Remes <remesm@...> wrote: Glad that worked. The inner class was not translated because it's an anonymous one. Difficult to trap these. Also, true and false could be translated to 1 and 0 in NetRexx, but they are reserved words only for literal values. Might need some investigation to perform an automatic translation.. IMO it's better that true/false aren't translated to 1/0 as that would mean the initial type would be changed from boolean to int, which in turn may lead to undesirable side effects. Results from tools like this always require a little clean-up work and any decent programmer's editor will make that a snap. Having 98% to 99% of the conversion work done for you is a more than satisfactory outcome and saves a lot of the grunt work. Alan. -- Can't tweet, won't tweet! _______________________________________________ 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/ _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
Here is another sample from the java tutorial, converted to netrexx and working. The conversion with java2nrx was fairly complete. A couple stray curly brackets survived. A couple properties keywords were superfluously created. The exception processing didn't compile so it's just commented out. And I still don't understand how the class "Runnable" works, but I just blindly followed Alan's tips like with ButtonDemo. Is the source to java2nrx written in netrexx? Is it available? 01/16/2012 13:41 > type FocusConceptsDemo.nrx package misc import java.awt. import java.awt.event. import javax.swing. class FocusConceptsDemo public extends JPanel properties static frame = JFrame properties t1 = JTextField t2 = JTextField t3 = JTextField t4 = JTextField -- properties b1 = JButton b2 = JButton b3 = JButton b4 = JButton -- properties text1 = JTextArea method FocusConceptsDemo super(BorderLayout()) b1 = JButton("JButton") b2 = JButton("JButton") b3 = JButton("JButton") b4 = JButton("JButton") buttonPanel = JPanel buttonPanel = JPanel(GridLayout(1, 1)) buttonPanel.add(b1) buttonPanel.add(b2) buttonPanel.add(b3) buttonPanel.add(b4) text1 = JTextArea("JTextArea", 15, 40) textAreaPanel = JPanel textAreaPanel = JPanel(BorderLayout()) textAreaPanel.add(text1, BorderLayout.CENTER) t1 = JTextField("JTextField") t2 = JTextField("JTextField") t3 = JTextField("JTextField") t4 = JTextField("JTextField") textFieldPanel = JPanel textFieldPanel = JPanel(GridLayout(1, 1)) textFieldPanel.add(t1) textFieldPanel.add(t2) textFieldPanel.add(t3) textFieldPanel.add(t4) add(buttonPanel, BorderLayout.PAGE_START) add(textAreaPanel, BorderLayout.CENTER) add(textFieldPanel, BorderLayout.PAGE_END) setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)) /** * Create the GUI and show it. For thread safety, * this method should be invoked from the * event-dispatching thread. */ method createAndShowGUI inheritable static frame = JFrame("FocusConceptsDemo") frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) newContentPane = JComponent newContentPane = FocusConceptsDemo() newContentPane.setOpaque(isTrue) frame.setContentPane(newContentPane) frame.pack() frame.setVisible(isTrue) method isTrue public static returns boolean return (1 == 1) method isFalse public static returns boolean return \isTrue method main( args=String[] ) static -- do UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel") -- catch ex=UnsupportedLookAndFeelException -- ex.printStackTrace() -- catch ex=IllegalAccessException -- ex.printStackTrace() -- catch ex=InstantiationException -- ex.printStackTrace() -- catch ex=ClassNotFoundException -- ex.printStackTrace() -- end UIManager.put("swing.boldMetal", Boolean.FALSE) javax.swing.SwingUtilities.invokeLater(FocusConceptsDemo.RunnableImp()) class FocusConceptsDemo.RunnableImp implements Runnable method run public FocusConceptsDemo.createAndShowGUI() return Kenneth Klein _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
Free forum by Nabble | Edit this page |