2 Minute Video: Groovy Makes Java Better

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

<script type="text/javascript" src="http://www.netbeans.tv/js/swfobject.js"></script> <script type="text/javascript"> </script>

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

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 11:52 AM 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 11:56 AM 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 12: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 23, 2008 at 05:14 PM PDT #

That's so cool!
Go groovy & NetBeans!

Posted by O(∩_∩)O哈哈~ on October 23, 2008 at 06:59 PM PDT #

Chris,

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

Jeff

Posted by Jeff Brown on October 24, 2008 at 05:12 AM 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 10:10 AM PDT #

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

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

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

Posted by Shams Mahmood on October 25, 2008 at 02: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 25, 2008 at 11:00 PM 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 03: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 03:59 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today