Visual Java Components

This page describes Visual Java components and special attributes that apply to them. These components are analogs of the Java AWT (Abstract Windowing Toolkit) components. You can find additional information about the components in the documentation that describes AWT.


Attributes common to most components are described in Laying Out GUI Interfaces.

Panel

Panels are containers that do not create separate windows of their own. A panel should be used as the main container for applets that display their GUIs in a browser page or applet viewer.

Special Attributes

labelAlignment
Sets the position (left, right, center) of the borderLabel on the top edge of the panel.

Frame

Frames are top-level application windows with a title and a border. A frame should be used as the main container for: Frames are the only types of containers to which you can add menu bars.

Special Attributes

icon
The path name of the file that contains the image to be contained in the icon. A semicolon followed by the size of the image (in pixels) must be appended after the path name.

The path to the image can be a URL or (preferably) a path name relative to the codebase of the applet. So, if the applet's .class file and image files are in the same directory, only the simple file name is required.

location
Sets the initial coordinates of the frame on the screen.

menubar
Invokes the Menu Editor. For details about creating menus, see Menus.

resizable
Determines if the size of the frame can be changed by the user.

size
Sets the initial size of the frame.

visible
Determines if the frame is initially visible.

Dialog Box

Dialog boxes are pop-up windows that are activated from frames and panels.

Special Attributes

location
Sets the initial coordinates of the dialog box on the screen.

modal
Determines whether or not the dialog box is modal.

resizable
Determines if the size of the dialog box can be changed by the user.

size
Sets the initial size of the dialog box.

visible
Determines if the dialog box is initially visible.

Selection Mode

Use the selection mode to select cells and components in the grid.

When you select cells in the layout grid you can:

When you select components in the layout grid you can:

Gridbag Layout Panel

Use the Gridbag Layout Panel component to nest a layout panel inside an existing cell.


A shortcut for placing a component into a Gridbag Layout Panel:

  1. Select a component you have already inserted into the layout grid.
  2. Choose Visual=>Nested Panel.
The component is automatically placed within a Gridbag Layout Panel.

Text Label

Use the text label component to add text to your GUI.

Special Attributes

alignment
You can align text to the left side, right side, or center of the label.

Text Button

Use the text button component to add a button with a text label.

Special Attributes

standard
When set to true, the component strives to be a standard size. This attribute is intended to make rows of buttons with varying amounts of text more uniform.

Image Label

Use the image label component to add a graphic label to the GUI. The path to the image is specified in the attributes dialog box.

Special Attributes

image
The path name of the file that contains the image to be contained in the label.

The path to the image can be a URL or (preferably) a path name relative to the codebase of the applet. So, if the applet's .class file and image files are in the same directory, only the simple file name is required.

padWidth
Sets the number of pixels between the edge of the label component and the image displayed within it.

Image Button

Use the image button component to add a button that contains an image to the GUI. The path to the image is specified in the attributes dialog box.

Special Attributes

image
The path name of the file that contains the image to be contained in the button.

The path to the image can be a URL or (preferably) a path name relative to the codebase of the applet. So, if the applet's .class file and image files are in the same directory, only the simple file name is required.

pressMovement
The number of pixels down and to the left that the image moves when the button is clicked.

lineWidth
The width of the button bevel (in pixels).

padWidth
Sets the number of pixels between the edge of the button and the image displayed within it.

Single-Line Text Field

Use the single-line text field component to add a one line text field. A single-line text field can be used to obtain user input and/or to display text generated by the application.

Special Attributes

editable
Sets the field to be writable by the user.

numColumns
Sets the minimun width of the field to accommodate the specified number of characters.

Multi-line TextField

Use the multi-line text field component to add a text field that can be used to obtain user input and/or to display text generated by the application.

Special Attributes

editable
Sets the field to be writable by the user.

numColumns
Sets the minimum width of the field to accommodate the specified number of characters.

numRows
Sets the minimum height of the field to accommodate the specified number of rows.

Checkbox/Radio Button

Use the checkbox/radio button to maintain a toggle (Boolean) state--whether it is checked or not.

Special Attributes

state
Sets the initial state of the checkbox.

Radio Button Panel

Use the radio button panel to enforce mutual exclusion ("radio button" behavior) among any number of checkbox/radio button components.

To create radio buttons:

  1. Insert a radio button panel in a grid cell.
  2. Use the arrow keys to create as many panels as there will be buttons.
  3. Insert a checkbox component into each panel.

Special Attributes

labelAlignment
Sets the position (left, right, center) of the borderLabel on the top edge of the panel.

List

Use the list component to create a list of string items.

Special Attributes

listContents
Adds strings to the list.

visibleRows
Sets the number of rows in the list.

Multiple Column List

Use the multiple column list component to create a columnar list of strings with headers.

Special Attributes

autowidth
Causes a column to automatically become wider to accommodate a new piece of data that doesn't fit within the current width of the column.

displayRows
Sets the minimum number of rows displayed in the list.

headers
Inserts the names of column headers.

highlightItems
When set to true, and you later programmatically change the values in one of the rows in the column list, that row will be highlighted for a moment and then gradually fade. Useful for demos or applications where you want to draw attention to the arrival of new information in the list.

selectable
Sets items in the list as selectable by users.

showHeaders
Determines whether column headers are displayed.

Choice Menu

Use the choice menu component to display a menu of options that drops down from a button.

Scrollbar

Use the scrollbar component to scroll GUI objects horizontally or vertically.

Special Attributes

minimum/ maximum
Scroll bars have an integer value associated with them that represents the location of the slider/thumb in the scrolled object. Use minimum and maximum to determine the range of those values. For example, if minimum and maximum are set to 0 and 100, when the slider/thumb is in the middle of the displayed object, its value is 50. This value is available to the programmer to manipulate the scrolled object.

lineIncrement
The number added or subtracted from the location value when the user clicks on the arrows at the ends of the scrollbar.

orientation
Determines whether the scrollbar is oriented horizontally or vertically.

pageIncrement
The number added to or subtracted from the location value when the user clicks in the area between the slider/thumb and the arrows at each end of the scrollbar.

value
The integer value that represents the initial position of the slider/thumb relative to the values of minimum and maximum.

visiblePageSize
The initial length (in value units) of the slider/thumb. This length usually indicates the percentage of the entire document that can be viewed in the window that the scrollbar controls.

flow layout panel

Use the flow layout panel component to arrange components from left to right in rows. It fits as many components in the row as possible before creating additional rows.

Special Attributes

hgap
The horizontal distance (in pixels) between components. Also controls the distance of the leftmost and rightmost components from the edges of the panel.

items
A dialog box that enables you to add and delete panels from the flow layout panel and to change the names of those panels.

labelAlignment
Sets the position (left, right, center) of the borderLabel on the top edge of the panel.

vgap
The vertical distance (in pixels) between rows of components. Also controls the distance between components and the top and bottom edges of the panel.

Border Layout Panel

Use the border layout panel to position four components against the fours edges of the panel and position another component in the center. The center component receives all remaining space in the panel.

Special Attributes

labelAlignment
Sets the position (left, right, center) of the borderLabel on the top edge of the panel

useCenter
Removes or includes the center cell in the panel

useEast
Removes or includes the east cell in the panel

useNorth
Removes or includes the north cell in the panel

useSouth
Removes or includes the south cell in the panel

useWest
Removes or includes the west cell in the panel

Card Layout Panel

Use the card layout panel to create a stack of panels that can be displayed one at a time.

Special Attributes

cards
Invokes the Cards dialog box. Use the Cards dialog box to add, delete, name, and label the stack of panels (cards).

delayedCreation
If set to true, delays creation of the component until it is requested by the program.

labelAlignment
Sets the position (left, right, center) of the borderLabel on the top edge of the panel.

Tabbed Folder Panel

Use the tabbed folder panel to create a stack of tabbed panels that can be displayed one at a time. A tabbed folder panel is a variant of the card layout panel in which each panel has a labeled tab that is used to select the panel from the stack.

Special Attributes

cards
Invokes the Cards dialog box. Use the Cards dialog box to add, delete, name, and label the stack of panels. The string in the Label field is displayed on the folder's tab.

delayedCreation
If set to true, delays creation of the component until it is requested by the program.

labelAlignment
Sets the position (left, right, center) of the borderLabel on the top edge of the panel.

Labeled Bar

Use the labeled bar component to add a horizontal rule that contains a text label.

Special Attributes

alignment
Aligns text to the left, right, or center of the bar.

textOffsetFromEdge
Number of pixels the text is offset from the edge of the cell.


See also:

Visual Java Overview
The Visual Menu
Laying Out GUI Interfaces
Generating Java Source Code
Adding Operations (Filters and Actions)
Visual Java Runtime Classes
Creating Menus
Adding Custom Components and Windows
Using Groups and Shadows (Basic)
Using Groups and Shadows (Advanced)
Visual Java API Documentation
Visual Java Runtime Packages
Class Hierarchy
Index of all Fields and Methods