FAQ Frequently Asked Questions



How Much of My Existing Code Can I Salvage?

See the section Migrating Applications to SMC.

Goto Top
How Do I Load Images, ResourceBundles, and Online Help?

See the section Accessing Resources.

Goto Top
How Do I Access the Console Frame Parent for Dialogs?

If you descend from one of the AWT or Swing top-level windows (for example, Window, Frame, Dialog, JFrame, JDialog), you limit the contexts in which your code will run, which is often not required. Using the VConsoleProperties.DIALOGTYPE property will do the following:

If the DIALOGTYPE setting is FRAME, (SMC style), you need the parent frame to create dialogs. If the DIALOGTYPE setting is INTERNALFRAME (as in the "desktop" console), you need the Swing desktop pane to add your JInternalFrame.

Sample Code Sample Code Console Frame Parent for Dialogs

Goto Top
How Do I Access the Selection Set in the Results Pane?

Obtain a handle to the VDisplayModel and call getSelectedNodes().

Sample Code Sample Code Getting Selections in Results Pane

Goto Top
How Do I Set Selections in the Results Pane?

There several methods for effecting the selection set, depending on the what you want to do. Each require obtaining a handle to the VDisplayModel.

Sample Code Sample Code Setting Selections in Results Pane

Goto Top
How Do I Get the Currently Selected Node in the Navigation Pane?

Obtain a handle to the VDisplayModel and call getSelectedNavigationNode().

Sample Code Sample Code Get Selected Navigation Pane Node

Goto Top
How Do I Specify System Properties on the Console Command Line?

smc J-Dname1=value1 -J-Dname2=value2 ...

This is convenient if you want to dynamically effect application behavior without having to change code. However, your application will by default only have access to the standard properties (or whatever access is permitted by the security policy in effect).

To grant read permission for application-specific properties, you can create a policy file in your home directory (.java.policy).

Sample Code Sample Code Specify Properties on Command Line

Goto Top
How Do I Update the Console Display to Show Changes in the Data Model?

Send an UPDATESCOPE event to the console.

Sample Code Sample Code UPDATESCOPE

Goto Top
How Do I Integrate Menubars and Toolbars?

You can specify your own menubar and toolbar on a per-navigation-node basis, via the VScopeNode constructor. You should also do this for the root node of each internal-root model. Your menu/toolbar will appear to the right of the console's menu/toolbar.

See the Menu bar section for details on how to integrate your menu items with the console menus.

Goto Top
How Do I Create Dialogs?

Extend VOptionPane to create your own dialogs. When you need to display it, create a VDialog or VFrame, place the VOptionPane inside it and then display your VDialog or VFrame.

Sample Code Sample Code Creating a Dialog

Goto Top
How Do I add an About Box for my tool?

First integrate an About menu item into the Help menu, as discussed in the Menu bar section. When you receive the event (in the ActionListener for the menu item) associated with this menu item, instantiate a VAboutBox dialog, set the title and description information relative to your tool, and display the dialog.

Sample Code Sample Code About Box

Goto Top
How Do I Save and Restore User Preferences?

See the section VConsoleProperties.

Goto Top
How Do I Manage Sorting Preferences?

Your tool is responsible for tracking what the sort attribute (column identifier) and sort order (ascend or descend) are, and saving them as a property. Sort preferences are in [+/-]# format, where:

For example, +2 means to sort column 2 in ascending order, -1 means to sort column 1 (the first column) in descending order.

Sample Code Sample Code Manage Sorting Preferences

Goto Top
How Do I Customize the First Column Header in Details View?

By default, SMC assigns the title for the first column in details view to be Name. You can use the VConsoleProperties.DEFAULTCOLUMNHEADER property to customize the title.

If your tool is not limitted to the Details view only, then at the same time you customize the first column, you might also want to customize the width of the column grid for the other views using VConsoleProperties.DEFAULTCOLUMNWIDTH. Specifiy the value as a pixel width in String format.

Sample Code Sample Code Customize first Column Header

Goto Top
How Do I Align Column Values in Details View?

See VScopeNode.columnHeaders in the SMC SDK Javadocs for detailed information about how to specify column headers and their widths.

Specifying alignment involves adding fixed values to the desired column widths:

Sample Code Sample Code Align Column Values

Goto Top
Can I Use Global Static Variables?

The short answer is no. Depending on user-specific console configuration, your application may be instantiated more than once, and no variable should have scope beyond the instance for which it was originally set, otherwise you may get very strange results. Furthermore, you cannot use GlossaryVConsoleProperties for per-application global data because the Properties object is a console-wide shared object.

Goto Top
Why Can't SMC find my new jar file I just registered?

Newly registered jar files require that the SMC server be restarted. See the Starting Services section for how to do this.

Goto Top
I Re-Registered My jar File, But I Get a ClassNotFoundException at Runtime.

This is a common error during development, typically after you've added a new class or new properties file. It is especially common during GUI development, where named and anonymous inner classes are used quite frequently, and often without the developer even realizing that this results in additional .class files. New classes and properties files require that the SMC server be restarted. See the Starting Services section for how to do this.