Monday, July 14, 2014

Native launcher for Java applications

When developing desktop applications based on Java platform, one of the most overlooked and engelcted phases is the deployment. Most often, developers just bundle together all required .jar files in a zip file, along with some batch/shell script which launches main jar, and that's it. I mean, it works fine on my machine. What could go wrong?

Sunday, March 11, 2012

Display file copy progress in Swing applications

One of the most commonly used operations in applications is copying files. When there is large amount of data, this operation can take a long time, and user has to be informed about what is going on. In this post, I'll showcase simple file transfer monitor dialog. To make things a bit more interesting, this dialog will have two progress indicators. In case of transferring multiple files, it shows both current file proogress and overall progress.

Wednesday, February 29, 2012

Deploying Swing applications on Linux with Maven and RPM

In the final part of application deployment series, I'll cover how to deploy Swing application as an RPM package. For this purpose, I'll use Maven RPM plugin to integrate deployment with application build process. Note that rpm tool must be installed on a system in order for this to work.

We start with simple Maven project as usual, and then configure Maven RPM plugin to run during package phase. Plugin configuration is shown in code snippet bellow:

Thursday, February 23, 2012

Swing applications deployment on Mac OS X

The most convenient way to deploy Java application on Mac OS X is to package it as application bundle. Bundle is nothing more then a directory with specific file structure beneath it. On Mac OS X, bundles are treated specially, while on other OS-es they appear simply as a directory with .app suffix.

The first step is to create correct directory structure. It is shown in the following image:
Application bundle directory structure

Saturday, February 18, 2012

Swing applications deployment on Linux: DEB packages

Deploying Java Swing applications on Linux could be a pain, mostly due to differences in distributions, desktop environments and package management. Two of the most widely used package management systems are DEB and RPM. In today's post, I'm gonna try to create .DEB package for my sample Swing application.

DEB packages are created using dpkg-deb tool, found in most Linux distributions. We need to create correct file structure and control file which is used by dpkg-deb to create the package. The following image shows the file structure:
Directory structure for DEB packages

Top-level directory (myapp-1.0.0) is used as a root for package creation. By default, created package will be named myapp-1.0.0.deb. This can be overriden at runtime.

Tuesday, February 14, 2012

Swing applications deployment on Windows

I thought I'd start another series of posts about deploying Java applications on different platforms. This is one of the commonly overlooked aspects of application development, so it would be useful to shed some light on it. This series will cover creating native distribution packages for Windows, Mac OS X and Linux (RPM and DEB packages).
These are the features that we want from  native packages:
  • using platform native installer system
  • automatic detection and installation of correct JRE
  • creating application shortcuts and registerign any required application information
  • creating uninstalation script

Sunday, February 12, 2012

Roll your own Synth look & feel - part 5: Menus

There's one GUI element left on our sample GUI that has no styles defined: the menu. There's nothing different about styling menus then any other component, only that it consists of several parts that need to be addressed separately:
  • menu bar and  border
  • menus borders
  • menu items and borders
  • check box menu items and borders
  • radio button menu items and borders
  • separator s
This covers all components that can be present in a menu. We also need to define Synth styles for different states of these components: default, mouse over and disabled.