UniVista Programmer's Guide



Intent | Structure | Participants | Sample Code | Known Uses


Used as a means to display UniVista Screens. This class extends a generic Java container, so it too can be embedded within another container. It also handles the selecting and highlighting of ScreenObjects to provide a more user-friendly feel.



Sample Code

Removing a highlight from an object without disabling the highlight feature, simply pass null as the following excerpt shows.
// deselecting an item

The code necessary for painting the highlight properly looks like the following. Notice that removing the old rectangle could have been done using XORPainting. Also, an error factor of 2 was used in painting, since it occurs that the Swing components didn't work correspondingly with Graphics.drawRect as defined by the Graphics API.
public void paintComponent(Graphics g) {

// erase the previous highlight
if (selectionRect != null) {
g.drawRect(selectionRect.x, selectionRect.y, selectionRect.width, selectionRect.height);
selectionRect = null;
if (highlightEnabled) {
// create the new highlight
if (selectedItem != null) {
int x,y,w,h;
selectionRect = selectedItem.getUI().getBounds();
selectionRect.x -= 2; selectionRect.y -= 2;
selectionRect.height += 2; selectionRect.width += 2;


Known Uses

This class is essential for displaying Screens. Therefore, instances can be found in both the StudyEditor and the RunEngine where Screens play a central role.

Contact the UniVista Team | Main Page | Table of Contents