Download NetBeans!

20081231 Wednesday December 31, 2008

Join Free NetBeans Platform Training in Cairo (3 - 5 January)

Start your year with your first steps onto the NetBeans Platform. Ahmed Hashim, the leader of the Egyptian Java User Group, has arranged a time and place for a NetBeans Platform Training in Cairo, as described below:

I got a message from him that 45 registrations have already been received (and there I was hoping for 10 but expecting 5), so hurry because space is limited.

Dec 31 2008, 08:51:26 AM PST Permalink

Download NetBeans!

20081225 Thursday December 25, 2008

Egyptian Christmas Tree at El Menoufiya University

More pics here by Hamada and others.

Dec 25 2008, 06:02:47 AM PST Permalink

Download NetBeans!

20081224 Wednesday December 24, 2008

Nice Announcement in Egypt!

I was googling today and came across this announcement:

And everything stated above is 100% true (here are the pics from yesterday), except for the minor detail that there should be a capital "B" in "NetBeans"!

Dec 24 2008, 05:45:45 AM PST Permalink

Download NetBeans!

20081223 Tuesday December 23, 2008

El-Menoufiya and NetBeans IDE

I was at El-Menoufiya University today, which is midway between Cairo and Alexandria, which is where I have been staying for a while (and where I'll be for quite a while longer, scuba diving, learning Arabic, wandering around, etc). The always energetic Hamada Zahera, who is a member of the staff, had set up my presence there via FaceBook contact with Honza Chalupa from NetBeans. That's how it all came about.

Here are the two presentations I did:

  • Productive Web Development with NetBeans IDE (PDF)

  • Productive Desktop Development with NetBeans IDE (PDF)

About 150 students attended, which is a pretty big group. Some general observations: JSF, Struts, Hibernate, and Spring rule there. Wicket and Grails have never been heard of, so I spent a bit of time introducing those. Especially Wicket spoke to the imagination, since no Java developer likes XML, nor JavaScript, and the HTML/Java split is very easy to understand. Also Groovy was unknown, so I showed it in action a bit. My Napkin Look & Feel joky thing worked again ("ah, but now you've created your database Swing app in 3 minutes, so you better make it look bad so your manager doesn't think you're already finished and you can then work on open source projects in the extra time that results"). But the main point of the exercise was to introduce them to JavaFX, which I did (on Linux, thanks to Weiqi Gao), using a simplified version of Gregg Bolinger's space game (well, at least the images), which speaks to the imagination very well. (So, thanks Weiqi and Gregg.)

The day itself was pretty amazing, everything put together. Especially Nader (and Mohannid, who, with Nader, took me on a trip to the Alexandria Library a few days ago) I'd really like to thank for picking me up from my hotel in Alexandria at 7.00 in the morning and accompanying me to El Menoufiya. There I met the local security people as well as some of the professors, before I did my two hours of presentations. Then the trip back by bus during which I met a nice man who is going to help me with my Arabic studies (amazing how many people have offered that help already so far).

I'll put up the many photos that were made soon. They're quite fun, so it's something to look forward to! They look a lot similar to those taken by Hamada and others at a previous event they organized around Fedora that resulted in the cool pics here. Several of the faces in those Fedora pics are now quite familiar to me!

Thanks a lot to all the enthusiastic students who were there, hope you learned something new. Drop me an e-mail anytime (geertjan DOT wielenga AT sun DOT com). And I'm sure I'll be back sometime soon.

Dec 23 2008, 12:09:24 PM PST Permalink

Download NetBeans!

20081221 Sunday December 21, 2008

More Introductory Training Materials for the NetBeans Platform

In January, Jaroslav Tulach, Toni Epple, and Thomas Würthinger will be giving a NetBeans Platform training course at the Institut für Systemsoftware, which is part of the Johannes Kepler Universität in Linz, Austria. That's also where the first official NetBeans Platform training was held (read all about it here).

The course consists of 3 days, the first was an introduction to the NetBeans Platform, which has already been given, by Thomas Würthinger, who is an assistant at the institute and who previously created the Java HotSpot Client Compiler Visualizer , which is a NetBeans Platform application.

His introduction is really interesting, with slides and code provided. So, anyone interested in getting started with the NetBeans Platform should give his materials a look. Click the image below to jump straight to the page:

By the way, a complete list of training materials for the NetBeans Platform (to which a reference to the above will be added too) can be found here.

Dec 21 2008, 02:44:19 AM PST Permalink

Download NetBeans!

20081215 Monday December 15, 2008

Its Super Crazy Nesting Nightmare Might Mean JavaFX's Death...

...unless there are tools like this:

Or is it just me? I don't see myself ever seriously using a shiny PhotoShop-like designer for working with JavaFX (although I am really looking forward to there being that kind of support). I do, however, see myself wanting to get further into JavaFX. But, with all those brackets within brackets, it's a lot like XML hell in other technologies. I reckon that only with tools like the little code generator I built, shown above, can that problem be overcome. By the way, how is everyone else doing it so far? How are you making sure all those brackets are lined up correctly? If there's interest in it (though it's not very smart, e.g., doesn't add any import statements, but simply adds the selected tag around the selected characters, without even reformatting anything), I will put it in the NetBeans Plugin Portal.

Dec 15 2008, 12:19:29 PM PST Permalink

Download NetBeans!

20081214 Sunday December 14, 2008

Little Elly

Little Elly gulped a magnet
thinking that it was a sweet,
ever after she felt drawn to
metal objects in the street.

When her mother lost a bracelet,
when her father dropped a nail,
when they lost a ring or necklace,
Elly found them without fail.

She would fall for boys with braces,
they would smile, and she would swoon,
later they would find her clingy,
and they'd dump her far too soon.

Passing cars became a problem,
sometimes pulling her in tow,
but the locals knew her story:
seeing her, they'd drive real slow.

One day Elly took a plane trip,
quite unplanned, her parents say:
KL-542 flew too low,
taking Elly far away.

Dec 14 2008, 08:38:09 AM PST Permalink

Download NetBeans!

20081213 Saturday December 13, 2008

Animal Meets Person: A JavaFX Drama Unfolds

I wanted to figure out how to make two objects in JavaFX interact with each other. Something like this:

For each of these, I created a new custom node because potentially each object would have many of its own distinct properties. For now, the two are very simplistic:

package demo;

import javafx.scene.Group;
import javafx.scene.Node;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.scene.CustomNode;

public class Animal extends CustomNode {

    public var posx = 180;

    public override function create(): Node {
        return Group {
            content: [
                Circle {
                    centerX: bind posx,
                    centerY: 100
                    radius: 40
                    fill: Color.YELLOW
                }
            ]
        };
    }

}
package demo;

import javafx.scene.CustomNode;
import javafx.scene.Group;
import javafx.scene.Node;
import javafx.scene.shape.Circle;
import javafx.scene.paint.Color;

public class Person extends CustomNode {

    public var posx = 40;

    public override function create(): Node {
        return Group {
            content: [
                Circle {
                    centerX: bind posx,
                    centerY: 50
                    radius: 40
                    fill: Color.BLACK
                }
            ]
        };
    }
}

So I created two custom nodes, which can now be treated the same way as all the other JavaFX nodes, i.e., just like circles, arcs, rectangles, texts, and so on.

The only interesting thing is that I exposed the X position of each node to the outside world, such that any changes made to it from the outside would change the property in the node.

Finally, in the main JavaFX file, I imported the two nodes, added them to the scene, and changed their exposed properties in the timeline:

package demo;

import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.text.Text;
import javafx.scene.text.Font;
import javafx.animation.Timeline;
import javafx.animation.KeyFrame;
import javafx.animation.Interpolator;
import java.util.Date;

var animal = Animal{}
var person = Person{}

var date = new Date;

Stage {
    title: "Demo Animation"
    width: 250
    height: 250
    scene: Scene {
        content: [
            person,
            animal
        ]
    }
}

Timeline {
    repeatCount: Timeline.INDEFINITE
    autoReverse:true,
    keyFrames: [
        KeyFrame {
            time: 1s
            canSkip: true
            values: [
                animal.posx => 50
                person.posx => 50
            ]
            action: function() {
                if (animal.posx == person.posx){
                   println("Connected at: {date}")
                }
            }
        }
    ]
}.play();

To make the two nodes move at different speeds... simply create two different keyframes in the same timeline. Or you can add a second timeline and change the "time" property of the timelines so that they are different, then change the "values" property so that in the first case, only one node changes, while in the second case the other node changes. (Different keyframes within the same timeline is more interesting than different timelines, because if they're in different keyframes in the same timeline, one object stops while the other is still moving and then suddenly starts again when the other has finally stopped.)

It was pretty cool to be able to learn from the messages I received during all this:

Finally, the whole application looks as follows:

By the way, Gregg Bolinger's space game is very helpful in understanding some of the key concepts.

Dec 13 2008, 08:23:21 AM PST Permalink

Download NetBeans!

20081212 Friday December 12, 2008

Linux & JavaFX Tooling in NetBeans IDE

Follow Weiqi Gao's latest instructions (which I found out about thanks to Jim Weaver today) and you too will be able to develop JavaFX applications in NetBeans IDE, even though you're using Linux (in my case, Ubuntu):

Only Media support doesn't work yet, but that's part of the SDK, unrelated to the NetBeans IDE tooling support, which I now have working perfectly on Ubuntu.

And here's my simple code sample for today, note especially the line in bold:

import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.scene.paint.Color;
import javafx.scene.Scene;
import javafx.scene.shape.Circle;
import javafx.stage.Stage;

var color = Color.YELLOW;

Stage {
    title: "Application title"
    width: 250
    height: 250
    scene: Scene {
        content: [
            Circle {
                centerX: 100,
                centerY: 100
                radius: 40
                fill: bind color
            }
        ]
    }
}
Timeline {
    repeatCount: Timeline.INDEFINITE
    keyFrames: [
        KeyFrame {
            time: 5s
            canSkip: true
            values: [
                color => Color.GREEN
            ]
        }
    ]
}.play()

The "fill" property of the circle is bound to the "color" variable, which is used in the Timeline, changing gradually to green.

So here's how you'd make the circle move as it changes color (only the changes are in bold):

var color = Color.YELLOW;
var posX = 100;

Stage {
    title: "Application title"
    width: 250
    height: 250
    scene: Scene {
        content: [
            Circle {
                centerX: bind posX,
                centerY: 100
                radius: 40
                fill: bind color
            }
        ]
    }
}
Timeline {
    repeatCount: Timeline.INDEFINITE
    keyFrames: [
        KeyFrame {
            time: 5s
            canSkip: true
            values: [
                color => Color.GREEN
                posX => 200
            ]
        }
    ]
}.play()

Similarly, you can bind the radius to a variable and then change it in the Timeline. This means the circle will become larger which, in turn, creates the impression that it is coming closer and closer to the user of the application.

Dec 12 2008, 05:28:52 AM PST Permalink

Download NetBeans!

20081211 Thursday December 11, 2008

2009: The Year of Documented Business Scenarios for the NetBeans Platform

The year is drawing to a close and plans for the coming year are being drafted. Personally, my main focus in the coming year in relation to the NetBeans Platform will be—documenting business scenarios for the NetBeans Platform. Up to this point, I've mainly been focused on writing tutorials that cover the main NetBeans APIs and, to a greater or lesser extent, a lot of that is complete, between the NetBeans Platform Tutorials and the NetBeans Developer FAQ, most things have at this stage been covered.

However, what many users are asking for is documentation describing how to optimally connect to a database, how to work with popular frameworks, such as Hibernate and JPA, from a NetBeans Platform application, and similar business scenarios. The issue that describes all these scenarios is this one:

http://www.netbeans.org/issues/show_bug.cgi?id=146402

Creating tutorials that cover those scenarios will be my main focus in the coming year, although this issue would be very helpful to me and to those using the tutorials that come out of it. So, 2009 will be the Year of Documented Business Scenarios for the NetBeans Platform.

If you have any insights to pass on or experiences to share, feel free to do so in that issue or in the comments to this blog entry.

Dec 11 2008, 09:37:57 AM PST Permalink

Download NetBeans!

20081210 Wednesday December 10, 2008

Status Whiteboard: "request_for_contribution"

If you're wondering how/where to commit code to the NetBeans project, especially when you're first getting started doing so, go here.

That will bring you to NetBeans Issuezilla, in a query for the whiteboard status "request_for_contribution":

NetBeans engineers use that whiteboard status to indicate that the issue is one that they think would be especially useful for external contributors. So, why not you?

Dec 10 2008, 10:11:21 AM PST Permalink

Download NetBeans!

20081209 Tuesday December 09, 2008

NetBeans Platform CRUD

One thing I'm meant to be working on is writing a tutorial for creating a CRUD application on the NetBeans Platform. The related issue and interesting documentation relating to this point can be found in the issue:

http://www.netbeans.org/issues/show_bug.cgi?id=146402

And here's where things are right now:

It is a prototype that uses the Database Explorer API to display information in a NetBeans Explorer View via the Nodes API. It also prints column names to the Output window when a node is double-clicked. Now the column names need to end up in the columns in the Details view. One way in which this might be done is to add the column names to the global Lookup whenever a table name is selected. The global Lookup would then be available to the Details view, which would then display them as the columns of the table. Seems like a NetBeans-centric approach to me. Any advice from anyone out there on this point?

Dec 09 2008, 11:37:50 AM PST Permalink

Download NetBeans!

20081208 Monday December 08, 2008

AJAX: Can it get better than this...

...if so, I'd like to know:

  1. Go here and download the ZIP file that you find there (updated 5 seconds ago):

    http://plugins.netbeans.org/PluginPortal/faces/PluginDetailPage.jsp?pluginid=3586

    Use the NetBeans Plugin Manager to install the 3 NBMs that are contained within that ZIP file.

  2. Create a new web application and, in the final panel, click the Wicket checkbox:

    Click Finish and then you'll have a completely new & fresh Wicket application, with all its standard bells & whistles:

  3. The "HomePage" will be open, enticing you to put something there. So make it this:
    public class HomePage extends BasePage {
    
        public HomePage() {
    
            add(field);
    
        }
        
        final AutoCompleteTextField field = new AutoCompleteTextField("countries", new Model("")) {
    
            @Override
            protected Iterator getChoices(String input) {
                if (Strings.isEmpty(input)) {
                    return Collections.EMPTY_LIST.iterator();
                }
                List choices = new ArrayList(10);
                Locale[] locales = Locale.getAvailableLocales();
                for (int i = 0; i < locales.length; i++) {
                    final Locale locale = locales[i];
                    final String country = locale.getDisplayCountry();
                    if (country.toUpperCase().startsWith(input.toUpperCase())) {
                        choices.add(country);
                        if (choices.size() == 10) {
                            break;
                        }
                    }
                }
                return choices.iterator();
            }
        };
        
    }

  4. Add the Java component's HTML counterpart on the other side:

    <input type="text" wicket:id="countries" size="50"/>

  5. Run the application and you're done:

    You now have an autocomplete textfield powered by AJAX.

Ask yourself:

  1. How much JavaScript did you need to know? (Thanks, Wicket! Then read all about it here.)

  2. How much Wicket did you need to know? (Thanks, NetBeans IDE! Then read all about it here.)

If you like this stuff, track this issue, which seeks to include the Wicket plugin in the NetBeans Update Center:

http://www.netbeans.org/issues/show_bug.cgi?id=153152

Three issues: you must right-click a package (not the project) when using the Wicket file templates; don't try to use the Project Properties dialog to add/remove Wicket support; the "Login" sample has issues, though the "Pizza" sample doesn't. For the rest, this plugin should work fine.

Dec 08 2008, 11:52:25 AM PST Permalink

Download NetBeans!

20081206 Saturday December 06, 2008

Overriding a CSS Reference from a Different NetBeans Module

Let's say your application incorporates a module's helpset that has CSS references in each of its help topics such as this:

<link rel="stylesheet" href="nbdocs://org.netbeans.modules.usersguide/org/netbeans/modules/usersguide/ide.css" type="text/css">

I believe, but could be wrong, that the above is not very good. Why? Because the CSS reference is to a DIFFERENT module, so that the module that includes the reference above is not self-contained. Instead of that, it depends on another module. What if you want to include the module that includes the reference above, but not the module where the referenced CSS stylesheet is found?

Practical example: you want to include the NetBeans "db" module (because your application includes database functionality). Therefore, you also want to include the "db" helpset. However, the "db" helpset has CSS references exactly as above (in fact, I copied the above from a "db" help topic). However, you're not interested in the "usersguide" module, which is where the referenced CSS stylesheet is found. You have, in fact, excluded that module. So all the references point nowhere.

While you wait for the NetBeans Docs team to make the "db" module self-contained (i.e., they [we] should copy the ide.css into the "db" module and then reference that CSS, which breaks the "single source" concept but at least makes the module self-contained, which is more important than "single source"), you can do the following:

  1. Make sure that your application includes the "usersguide" module, even though your application doesn't need its help topics. Check in the application's platform.properties that "usersguide" has not been excluded!

  2. Hide the "usersguide" help topics (even though you're including the module itself), using the application branding module's Services/JavaHelp folder.

  3. Override the "usersguide" module, in the application's "branding" folder, pasting in your own CSS stylesheet in the place where the original CSS stylesheet used to be.

That's all. Now, when you run the application, your own stylesheet will be used, overriding the one referenced by the help topics in the module (in this case, the "db" module). Big donwside: you're including a module with many help topics, even though you're only interested in overriding one single file: the CSS stylesheet. You're hiding all the help topics in the module... so the module is a complete waste to you and to your users. The upside, though, is that the user won't notice that at all (a few more bits to download/startup doesn't make all that much difference) and, instead, will experience the helpset as one single document, because all of the topics will be styled in exactly the same way, which is especially valuable if the help topics are styled in a very special way, e.g. using a standard color for all headings, etc.

Dec 06 2008, 10:09:50 AM PST Permalink

Download NetBeans!

20081205 Friday December 05, 2008

Changing the Appearance of Windows in NetBeans IDE

I found some code by Tim Boudreau on-line, which changes the tabbed windows in the IDE to toolbars:

It works perfectly. Just click a different toolbar and a different window is opened, in the case of Projects/Files/Services. Compare that to the default, where you have tabs instead:

It's not very easy to do something like this. In this case, the class that did the trick extended AbstractTabDisplayerUI. It would be cool if somehow something like that could be done to add new buttons to the toolbars of TopComponents, though I'm not that far yet. Even better would be if there were different window layouts that the user could select.

Dec 05 2008, 09:50:56 AM PST Permalink