Netbeans Platform Status Bars
Thursday July 19 2018

In desktop applications, status bars are a great way to convey information to the user about the current status of certain items in the application, such as connection status, total amount of items, current mode, current row and column number in an editor, etc.

Implementing custom status bars to a Netbeans Platform application is extremely easy. In this article I will go over how we can achieve really cool things with status bars and lookups.

Creating and Registering a New Status Bar

To create a new status bar, create a new Java class that implements the StatusLineElementProvider interface. To register it as a status bar, we use the @ServiceProvider annotation:

@ServiceProvider(service = StatusLineElementProvider.class, position = 1)
public class MyStatusBar implements StatusLineElementProvider {

}

Read more...


Implementing Auto Updates for a Netbeans Platform Maven Application
Tuesday July 17 2018

Being able to update an application when a new version is released is something of critical importance for desktop applications. Otherwise, the process of updating the application is extremely tedious since you have to download more installers all the time.

Luckily, Netbeans Platform comes with integrated support for enabling your custom applications to be able to be updated when a new version is released.

In this post I will go over how to implement this on a Maven based Netbeans Platform application.

How Netbeans Update Center Works

The Update Center is how we can achieve this functionality. The way it works is that you publish your module's NBM files to a web server, along with a XML catalog file that contains information about the modules such as latest release timestamp, latest version, etc.

When you configure an update center in your application, you will configure this web server's URL so that the update center client knows where to poll and where to download the new module files to install.


Read more...


BytesIO File Uploads to Django Using Requests
Tuesday June 26 2018

It's very easy to post file data to Django using requests:

import requests


requests.post(url, files={'cover': open('imgpath.jpg', 'rb')})

However I was having a hard time getting that to work using BytesIO. The reason I wanted to use BytesIO was because I was reading the file binary data located in S3, from AWS Lambda. I didn't want to write the file to disk first and then do something like the code shown above.

Here's how to achieve that:


Read more...


Using Listeners in Custom Netbeans Platform Wizards
Tuesday May 22 2018

This tutorial explains how you can add validation to your custom wizards in the Netbeans Platform. This works by setting a boolean variable to false and then throwing a WizardValidationException which will show an error message in the wizard, disabling the ability to click the Next or Finish buttons.

The problem with this is that after the above happens, there is no way to enable these buttons again. And the way to achieve this is not covered in that tutorial.

Therefore, in this blog post I will explain just how to do that.


Read more...


Netbeans Platform Node Icon Badges
Thursday May 03 2018

The Netbeans IDE has some very cool way of letting users know when a certain file contains errors. For example, if you are editing a Java file and the file contains syntax errors, Netbeans will change the file icons with a new icon indicating errors:

Netbeans Error Icons

You can see that the error icons propagate all the way up to the top-most parent, the project itself.

Netbeans Platform Icon Badges

As a user of the Netbeans IDE and before even knowing what the Netbeans Platform was, I always assumed that the normal state of the icon and the error state of the icon were two completely different icons handled by Netbeans. A few days ago I learned that this is not the case.

Netbeans uses the concept of icon badges to display these kind of error icons. Icon badges are basically multiple images merged together at runtime into a single Image object.

In this article I want to quickly go over how you can apply this concept in your Netbeans Platform application when using the Nodes API.


Read more...