Easy Access to Java Macros

Easy Access to Java Macros


Simcenter STAR-CCM+ users automate a lot of processes by running Java macros, and need a way to easily run their important macros.


Users can access and run many different Java macros, but there wasn’t a way for them to easily run specific important macros with a single click.

Users and Audience

Experienced users of the product who may have many Java macros, but want to immediately run their most important macros with the least number of interactions.

Roles and Responsibilities

Designer and Developer

Scope and Constraints

Changes must fit in with the existing NetBeans framework that the Simcenter STAR-CCM+ client is built upon.

Code changes must be minimal.

Changes must not replace existing mechanisms for accessing and running macros.

Changes must not require modifications to the Java macros themselves.

Limit the number of these favorite Java macros to a reasonable, finite number.


Investigating the capabilities of the NetBeans framework I found the ability to customize toolbars, adding or removing individual actions.

I presented this to Product Management and they liked my idea, particularly that it used existing NetBeans functionality and required minimal code changes. After some discussion, we agreed that the optimum maximum number of toolbar macros would be ten.

I was able to add ten blank actions, creating ten different default icons for each action to the NetBeans Customize Toolbars dialog.

Actions could be dragged from the NetBeans’ Customize Toolbars dialog to any toolbar.

Edit dialog appears as soon as action dragged to toolbar.

Next up, customizing the actions added to the toolbar. Working with Product Management and internal users, I refined the required elements down to three, the file path of the Java macro, the icon and tool tip.

This required designing a new, minimal edit dialog.

The dialog, which can contains up to ten tabs, represents the favorite macros that have be added to the toolbar.

Some design considerations for this dialog…

  • The dialog opens relative to the button it is launched from.
  • The macro text field has the initial focus.
  • Tab order is macro text field, macro browse button, icon text field, icon browse button, tool tip text field, then the OK, Cancel and Help buttons and back to the macro text field.
  • Filenames can be long, so the text fields fill the available space and the dialog can be resized to be able to read the full file path.
  • The toolbar button is badged with a warning image until the macro file has been validated after user clicks OK.
  • Macros are validated when STAR-CCM+ is launched, so a toolbar button is immediately badged if the associated macro file can’t be found.
  • Macros validated when the user clicks the button. This dialog opens automatically when there’s no valid macro file, or can be opened via a context menu from the toolbar button or from Edit Favorite Macros item under the File menu.
  • Tab defaults to a particular macro if the dialog is launched from the toolbar.
  • The user can browse any png or gif file and the image will be resized to 16×16 to fit the toolbar.
  • Auto-complete was considered for the macro and icon text fields, but was out of scope given the functionality of the file browser dialogs.
  • In-line messages were considered for validation, but badging was implemented based on development constraints.

Outcomes and Lessons

The feature was well received, but the NetBeans Customize Toolbars dialog wasn’t initially easily discoverable. A subsequent story was created to address that.