Download NetBeans!

20081023 Thursday October 23, 2008

2 Minute Video: Groovy Makes Java Better

The first of several screencasts I am planning in relation to Groovy:

PS: When I said "on our dialog", I should have said "on our Groovy class".

Oct 23 2008, 11:32:01 AM PDT Permalink

Trackback URL: http://blogs.sun.com/geertjan/entry/video_groovy_makes_java_better
Comments:

Why do you have to call toString() on what is returned from the getText() call (in Java)?

Posted by Mario Aquino on October 23, 2008 at 06:52 PM PDT #

I wish we could have Jython support in NetBeans IDE: If you've jython installed on your machine, try following:

<pre>
ijazfx@mypc:~$ jython
Jython 2.2.1 on java1.6.0_07
Type "copyright", "credits" or "license" for more information.
>>> from java.awt import *
>>> from javax.swing import *
>>> frame1 = JFrame('Hello World', size = (400, 200))
>>> frame1.visible = True
>>> frame1.move(300, 100)
>>> frame1.dispose()
</pre>

I think jython is shorter than Groovy to write java programs, plus is completely dynamic.

Posted by Farrukh Ijaz on October 23, 2008 at 06:56 PM PDT #

Mario,

DisplayProvider#getText() will have the return type of java.lang.Object, because the field 'text' is not typed (defined with "def" and not a solid class).

Posted by Chris Broadfoot on October 23, 2008 at 07:10 PM PDT #

Great Demo... and great sound quality! What did you use for recording it?

cu tomorrow in Poznan!

Toni

Posted by Toni Epple on October 24, 2008 at 12:14 AM PDT #

That's so cool!
Go groovy & NetBeans!

Posted by O(∩_∩)O哈哈~ on October 24, 2008 at 01:59 AM PDT #

Chris,

I still don't think you need the call to toString(). Right?

Jeff

Posted by Jeff Brown on October 24, 2008 at 12:12 PM PDT #

I would expect Groovy and Jython to be similar length:

import javax.swing.*
new JFrame(title:'Hello World', size:[400, 200], visible:true).with {
move(300, 100)
dispose()
}

Posted by Paul King on October 24, 2008 at 05:10 PM PDT #

I love the Groovy Support in Netbeans :) Makes Java fun again...

Posted by Michael on October 25, 2008 at 07:22 AM PDT #

This was pretty cool.
Definitely looking forward to checking out groovy now.

Posted by Shams Mahmood on October 25, 2008 at 09:10 PM PDT #

Jython is cool and make things very simple but I liked Groovy with the SwingBuilder, Griffon and now this support on Netbeans is pretty neat.

Posted by OtengiM on October 26, 2008 at 06:00 AM PDT #

While the groovy-java demo works fine in 6.5, when using 6.7 I get a "can not find symbol" error for the groovy class in the java code. Is there some additional configuration needed for 6.7 that is not needed in 6.5?

Posted by Jim Tucker on June 29, 2009 at 10:54 AM PDT #

That's a known bug, I am afraid. It should still run successfully though. The first patch to 6.7 (once it comes out) should resolve this issue.

Posted by Geertjan Wielenga on June 29, 2009 at 10:59 AM PDT #

Post a Comment:

Name:
E-Mail:
URL:

Your Comment:

HTML Syntax: NOT allowed