## Saturday May 23, 2015

### News from the Modular JavaFX Application Framework

The last time I reported on the status of the mFX project was in July last year.

The biggest problem at that time was that the mouse didn't work on the menus. I ran the project again today and I guess my JDK is different (newer) than what I was using at that time because now that problem is fixed, without any changes in my code, i.e., something has been enhanced on the JavaFX level.

Click to enlarge the image below to see a JavaFX application on top of mFX:

The remaining problem is that the window system is still in Swing. If the tabs could somehow be rewritten to JavaFX (and I have tried several things without success) then the entire application would be stylable via CSS.

Aside from that, it's looking pretty good. Above, you see a CSS-styled label that updates itself, via NetBeans Lookup, based on whatever the user has chosen in the selector window in the top right. There's an editor module, a viewer module, and a domain module, in other words, mFX truly enables you to do modular JavaFX development, using all the techniques provided out of the box by the NetBeans Platform, i.e., modularity, loose coupling, and pluggability.

## Friday May 22, 2015

### javafx.scene.media.MediaPlayer in the NetBeans Platform

Let's integrate javafx.scene.media.MediaPlayer in a NetBeans Platform application so that you can, for example, have an interesting TopComponent like the below.

Steps:

1. Copy this class into a NetBeans module.

2. In your TopComponent, which here is named 'NBMediaPlayerTopComponent':
public NBMediaPlayerTopComponent() {

initComponents();

setName(Bundle.CTL_NBMediaPlayerTopComponent());
setToolTipText(Bundle.HINT_NBMediaPlayerTopComponent());

setLayout(new BorderLayout());
JPanel playerpanel = new JPanel();
final JFXPanel jFXPanel = new JFXPanel();

Platform.setImplicitExit(false);
Platform.runLater(new Runnable() {
@Override
public void run() {
initFxLater(jFXPanel);
}
});

}

private static void initFxLater(JFXPanel panel) {
MediaPlayer mediaPlayer = new MediaPlayer(new Media(MEDIA_URL));
mediaPlayer.setAutoPlay(true);
mediaPlayer.setVolume(20.0);
panel.setScene(new Scene(new MediaControl(mediaPlayer)));
}


References:

http://docs.oracle.com/javafx/2/swing/MediaControl.java.htm

http://stackoverflow.com/questions/15479821/javafx-mediaplayer-volume-trouble-why-the-volume-of-mediaplayer-do-not-chang

## Saturday May 16, 2015

### Porting Knockout Components to DukeScript

With Knockout, you can extend the DOM by means of widgets, also known as 'components', such as the "user" component that you see below, which has the parameters "firstName" and "lastName":

As discussed yesterday and the day before in this blog, a component is created in JavaScript, like this:

ko.components.register('user', {
viewModel: function (params) {
this.firstName = ko.observable(params.firstName);
this.lastName = ko.observable(params.lastName);
this.fullName = ko.pureComputed(function () {
return this.firstName() + " " + this.lastName();
}, this);
},
template:
'First Name: <input data-bind="textInput: firstName"/>\
<br/>\
Last Name: <input data-bind="textInput: lastName"/>\
<h2 data-bind="text: fullName"></h2>'
});

As you can see here, by means of 'ko.components.register', you're able to register a new component, which is named 'user' here, consisting of a viewmodel and a template.

Now let's imagine we're using DukeScript, i.e., the WORA framework for Java programmers. Imagine you have several Knockout components like the above, how would you integrate them into your DukeScript application?

One of the Maven projects provided by the DukeScript Maven archetype has "JavaScript Libraries" in its name:

Notice that in the above there's a JavaScript file named 'userEntryComponent.js'. The content of that file is the 'user' component described in code at the start of this blog entry. Also notice that there is a Java source file in the above screenshot, named 'UserEntryWidget.java', which has this content:

package org.demo.ko4j.DemoKO4J.js;

import net.java.html.js.JavaScriptBody;
import net.java.html.js.JavaScriptResource;

@JavaScriptResource(value = "userEntryComponent.js")
public final class UserEntryWidget {

private UserEntryWidget() {
}

@JavaScriptBody(args = {}, body = "")
public static native void registerComponent();

}

Notice that there is a reference to the JavaScript file, as well as a static method named 'registerComponent'.

OK, congratulations, you have ported your Knockout component to DukeScript, which consists of (1) copying the JavaScript file into the correct place in the DukeScript application structure and (2) registering it via the @JavaScriptResource annotation shown above.

The final step is to use the component. In the 'Main.java' class, i.e., in the Maven project where the client code is defined, you need the following:

public static void onPageLoad() throws Exception {
Data d = new Data();
Models.toRaw(d); // this line is required to initialize knockout
UserEntryWidget.registerComponent();
d.applyBindings();
}

Notice the two lines in bold above. Notice that we're calling the static method in the UserEntryWidget class above. Also notice that we do not initialize the Data class above, i.e., we do not need to use 'setFirstName' and 'setLastName' on the Data class, because the initialization is done when you make use of the 'user' component, as you can see in the first screenshot above.

That's all you need to do to include a Knockout component in a DukeScript application.

## Wednesday Apr 29, 2015

### Node.js Express App in NetBeans IDE

The Visual Studio tutorial "Developing Node Applications" is... all about using the command line to set up a Node application. Here's the NetBeans IDE equivalent (using a development build, i.e., this is not in NetBeans IDE 8.0.2) of at least the first half of that tutorial, in screenshots, i.e., the whole process is automated, which is the point of tooling, i.e., to provide automation.

Click Finish after the above steps and you have a complete Express application, exactly the same as described in the Visual Studio tutorial above.

Then run it and you can use the many supporting tools in the IDE to tinker further with your application:

## Sunday Apr 26, 2015

### YouTube: How to Setup and Use Minecraft Forge

Quite impressed by Minecraft Forge, as well as how well it integrates via the Gradle plugin into NetBeans IDE:

## Saturday Mar 07, 2015

### Happy Birthday, Java!

\header {
title = \markup { \italic "Happy Birthday, Java!" }
}

\paper {
indent = #0
}

\score {
\new PianoStaff = "pianostaff" <<
\new Staff = "right" \relative c'' {
\clef "treble"
\time 3/4
\tempo "Quick and snappy" 4 = 160
r2 c8 c
a'4 g f
g2 e4
f r f
g2 c,4
a' b c
g2 e8 e
f4 e d
c2. r2. \bar "|."
}
Ha py birth -- day Ja va,
you are twen ty!
For fun and for gain,
pub -- lic sta -- tic void main!
}
\new Staff = "left" \relative c {
\clef "bass"
c4 <e g> <e g>
f4 <a c> <a c>
c,4 <e g> <e g>
g,4 <b d> <b d>
c4 <e g> <e g>
f4 <a c> <a c>
c,4 <e g> <e g>
g,4 <b d> <b d>
c4 <e g> <e g>
c2. \bar "|."
}
>>
\layout { }
\midi { }
}

## Tuesday Jan 20, 2015

### Free: Virtual Technology Summit by Oracle Technology Network

The Oracle Technology Network (OTN) is excited to invite you to the Virtual Technology Summit Series.  Four times a year come and join us to learn first hand from Oracle ACEs, Java Champions, and Oracle product experts, as they share their insight and expertise on using Oracle technologies to meet today’s IT challenges. Four main content areas covered will be Database, Java, Middleware and Systems.

Are you struggling in being productive with Maven, HTML5 frameworks such as AngularJS, IoT hardware such as the Raspberry Pi, and Java EE? Do you want free, easy to use, out of the box tools for quickly and efficiently developing all kinds of applications? You really need to give NetBeans a whirl!

In the "Free Open Source Tools for Maven, HTML5, IoT, and Java EE" session, during the upcoming free Virtual Technology Summit by OTN (nice and simple URL http://oracle.com/otnvts) we'll show you the latest enhancements and cool features of the free, open-source NetBeans IDE, which are used around the world, from engineers at Boeing and NASA to Java architects such as James Gosling and Stuart Marks!

If you haven't looked at the NetBeans IDE lately, you'll be blown away by the fast speed and performance enhancements. If you are completely new to the NetBeans IDE, see how easy it is to get started and be productive.

Tip: The full agenda is available here and notice that the session described above is in the Java Content Area: https://community.oracle.com/docs/DOC-894285

The sessions are prerecorded, while the speakers and other experts will be available live, to answer questions. To give a sneak peak at what the site will look like, take a look at these two screenshots from the session described above.

Click below to register. Pick a date and time that matches your location:

• Americas February 11th - 9am to 12:30 PT - click here.
• EMEA February 25th - 9am to 12:30 GMT - click here.
• APAC March 4th - 9:30am to 1pm IST - click here.

## Sunday Dec 21, 2014

### Integrating Cloud Providers into NetBeans IDE (Part 5)

A small piece to add to the Cloud provider integration is... Git. Since you're able to display all the resources of interest that are made available by the Cloud provider, you should be able to let the user physically access the related sources:

Clicking the menu item above can directly open the Clone Repository dialog, which is part of the Git tools in NetBeans IDE:

A few clicks later, you have the sources available locally, and you can then make changes to them and commit them, etc, using the range of Git tools made available by NetBeans IDE.

## Friday Nov 07, 2014

### JFX Fluidon in NetBeans IDE

Here's the new JFX Fluidon plugin by Gaurav Gupta in action in the Family Tree application described in step-by-step detail in "JavaFX Rich Client Programming on the NetBeans Platform". Click to enlarge the image to get the full effect.

It's pretty cool and here's a movie I made of it today:

## Sunday Oct 19, 2014

### NetBeans Translation Tip #2: Do Not Translate USE_MNEMONICS

So you're working on the NetBeans Translators project and you run the application, with its translated bundles, and then you see this error message:

WARNING [org.openide.awt.Toolbar]: Error in AWT task
java.lang.AssertionError
at org.openide.awt.Actions$MenuBridge.updateState(Actions.java:1266) at org.openide.awt.Actions$Bridge.prepare(Actions.java:902)
at org.openide.awt.Actions$MenuBridge.prepare(Actions.java:1221) at org.openide.awt.Actions.connect(Actions.java:201) at org.openide.awt.Actions$MenuItem.(Actions.java:1571)


You also, assuming you're translating into French and have already translated the text in the error dialog below, see this dialog, once the application has started:

And you're unable to access any of the menu items in the menubar.

An error message that contains "setMenuText(Actions.java:290)" is one that can be figured out by thinking about where menus are defined, in the NetBeans Platform source code. This is done in the UI Utilities API module, which is org-openide-awt.jar.

When I went there, in "LocalizedNetBeans", I found that there are two translated bundle files there, both in French:

Notice the one in blue above. Through a process of trial and error, I discovered that the key "USE_MNEMONICS" should NOT be translated. If you translate USE_MNEMONICS, the error described above occurs. Simply do not include it in the bundle file shown in blue above, in the 'branding/modules/org-openide-awt.jar' folder. Delete it from there, as I did (which is why the file is shown in blue) if you have it there.

And then the problem is solved: the error message above is not shown and menu items can be accessed again, as normal.

PS: Also see tip #1.

## Thursday Oct 09, 2014

### YouTube: Quick Tips for AngularJS in NetBeans IDE 8.0.1

Assuming you're able to run Node and Bower from the command line, follow the steps in this screencast to get started with AngularJS in NetBeans IDE 8.0.1:

## Tuesday Jun 10, 2014

Instead of creating a fullblown NetBeans Platform application for doing WYSIWYG editing for EPUB, similar to Sigil, I decided to focus purely on the very narrow scope of EPUB reading. The scope is narrower and, since the application will be a lot less ambitious and smaller, a pure JavaFX implementation makes sense.

When you somehow get, e.g., buy, an EPUB file, you typically read it on a tablet or mobile device. However, some people in the world, e.g., me, still have laptops. Therefore, I'm creating a small JavaFX application that unzips EPUB files, into a temp directory, and then loads them into a JavaFX WebView.

Arabic support:

For an application like this, simplicity is the most important thing. Very few buttons, very few options, preferably no configuration of anything. Just let the user open the EPUB file and read it, that's it, nothing fancy.

CSS stylesheets and images are correctly read. It's exactly what it looks like, a reader for EPUB files. The back and forward buttons are working and you can also switch to the table of contents.

When it is complete, which it pretty much is right now, publishers of EPUB files can make this small app available from their site, to simplify life for their readers, since it will run easily and well on all operating systems.

## Friday Feb 21, 2014

### YouTube: JPA Model Code Generator for NetBeans IDE

Awesome new plugin for NetBeans IDE!

Get the plugin here:

## Friday Feb 07, 2014

### James Webb Space Telescope on NetBeans

Great screenshot by Sean Phillips, Duke's Choice Award winner, that provides a visualization of the James Webb Space Telescope Contact Analysis. It uses JavaFX 8 and NetBeans Platform 8 as its basis.

## Saturday Dec 28, 2013

### New Book: "JavaFX Rich Client Programming on the NetBeans Platform"

Now built into Java and closely integrated with the NetBeans Platform, JavaFX 8 is today's state-of-the-art Java-based toolkit for creating advanced user interfaces, manipulating media, generating graphical effects and animations, and much more. This guide covers everything you need to know to create industrial-strength business applications with JavaFX 8 and NetBeans -- including how JavaFX impacts user experience design, graphical design, and development processes.

Focusing on JavaFX as the front end for tomorrow's most powerful rich client applications, this is the first book to cover the version of JavaFX 8 incorporated into the Java APIs with the official release of Java SE8, instead of obsolete preview versions.

Gail and Paul Andersen fully explain both JavaFX 8 and its relationships with the NetBeans Platform architecture, and systematically show Java developers how to use them effectively together. To support sophisticated real-world business development, they also thoroughly address JavaFX 8 interactions with backend databases, JavaEE, RESTful web services, and the Jersey client.

## Sunday Dec 15, 2013

### Quick Browser for NetBeans IDE 7.4

The Quick Browser I created sometime ago is now available for NetBeans IDE 7.4:

It's pretty handy, e.g., open NetBeans projects by clicking on them in the browser. Open individual files too:

Get it here:

http://plugins.netbeans.org/plugin/39264

More details on this are here:

Still same open issue as before, unresolved so far:

## Monday Oct 21, 2013

### OrbitFX: JavaFX 8 3D & NetBeans Platform in Space!

Here is a collection of screenshots from a proof of concept tool being developed by Nickolas Sabey and Sean Phillips from a.i. solutions. Before going further, read a great new article here written on java.net by Kevin Farnham, in light of the Duke's Choice Award (DCA) recently received at JavaOne 2013 by the a.i. solutions team. Here's Sean receiving the award on behalf of the a.i. solutions team, surrounded by the DCA selection committee and other officials:

They won the DCA for helping facilitate and deploy the 2014 launch of NASA's Magnetospheric Multiscale mission, using JDK 7, the NetBeans Platform, and JavaFX to create the GEONS Ground Support System, helping reduce software development time by approximately 35%.

The prototype tool that Nicklas and Sean are now working on uses JavaFX 3D with the NetBeans Platform and is nicknamed OrbitFX. Much of the early development is being done to experiment with different patterns, so that accuracy is currently not the goal. For example, you'll notice in the screenshots that the Earth is really close to the Sun, which is obviously not correct.

The screenshots are generated using Java 8 build 111, together with NetBeans Platform 7.4. Inspired by various JavaOne demos using JavaFX 3D, Nick began development integrating them into their existing NetBeans Platform infrastructure.

The 3D scene showing the Sun and Earth objects is all JavaFX 8 3D, demonstrating the use of Phong Material support, along with multiple light and camera objects. Each JavaFX component extends a JFXPanel type, so that each can easily be added to NetBeans Platform TopComponents. Right-clicking an item in the explorer view offers a context menu that animates and centers the 3D scene on the selected celestial body.

With each JavaFX scene component wrapped in a JFXPanel, they can easily be integrated into a NetBeans Platform Visual Library scene.  In this case, Nick and Sean are using an instance of their custom Slipstream PinGraphScene, which is an extension of the NetBeans Platform VMDGraphScene.

Now, via the NetBeans Platform Visual Library, the OrbitFX celestial body viewer can be used in the same space as a WorldWind viewer, which is provided by a previously developed plugin.

"This is a clear demonstration of the power of the NetBeans Platform as an application development framework," says Sean Phillips. "How else could you have so much rich application support placed literally side by side so easily?"

## Tuesday Oct 15, 2013

### YouTube: Eye-Tracking Data Visualization on the NetBeans Platform

A very interesting (silent) screencast shared in the comments to this blog yesterday by Paul Orlov from St. Petersburg State Polytechnical University, shows the visualization of data in a NetBeans Platform application for an eye-tracking study. Related to that, read this very interesting PDF document in the same domain, i.e., investigating the role of peripheral vision in visual attention in programming.

Anyway, the screencast itself is too good not to share with the world:

Of course, the charts that you see in the screencast come from JavaFX.

## Saturday Oct 12, 2013

### Improve Office Productivity with JavaFX and the NetBeans Platform

CaseLnk Case Management System, by CaseForge Technology, is a brand new piece of software for improving office productivity, user collaboration, and customer satisfaction. It supports cases, documents, tasks, events, processes, and contacts.

The technologies used are Java 7 with NetBeans Platform 7.3 and JavaFX.

NetBeans Visual Library API is used to design workflows:

The Case Editor window to input case information:

A window integrated with JavaFX for displaying weekly tasks and events:

JavaFX chart is used in reporting:

## Friday Oct 04, 2013

### EPUB Tool Fosfor Lives On (Part 1)

There have been some questions recently about Fosfor, the open source EPUB tool that I started creating some time ago. Well, it's been rearchitected from scratch and now includes the WYSIWYG editor based on JavaFX that I blogged about over the past days:

I ended up abandoning the WebView and went with the HTMLEditor, despite its problems, e.g., problems displaying images within HTML. Hoping to workaround that somehow, right now hardcoded for the screenshot above, probably need a File Protocol URLStreamHandler.

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.

##### Archives
Sun Mon Tue Wed Thu Fri Sat « June 2015 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Today