IBM WebSphere Multichannel Bank Transformation Toolkit, Version 7.1

Accessing Desktop components from an application

About this task

When the different Desktop components are defined in the XML file, their name attributes can be set. The Desktop keeps a list of named components so that it can keep track of these components. Any component can be retrieved from this list by the application, using the following method:
Desktop.getDesktop().getComponentByName("componentName"); 

Thus, the properties of any component inside the Desktop can be changed from an external process. For instance, if you want to set the foreground color of the text field named USERNAME to red, use the following code:

((TextField)Desktop.getDesktop().getComponentByName("USERNAME")).setForeground(
    new java.awt.Color(255,0,0)); 

You can also get access to the main components WorkingArea and TaskArea by using the corresponding getter methods available in the Desktop class (getWorkingArea() and getTaskArea()).



Feedback