Getselectedvalues object getvisiblerowcount int

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: +getSelectedValue(): Object Returns the first selected item in the list. +getSelectedValues(): Object +getVisibleRowCount(): int +setVisibleRowCount(count: int): void +getSelectionBackground(): Color Returns an array of the values for the selected cells in increasing index order. Returns the number of visible rows displayed without a scrollbar. (default: 8) Sets the preferred number of visible rows displayed without a scrollbar. Returns the background color of the selected cells. +setSelectionBackground(c: Color): void Sets the background color of the selected cells. +getSelectionForeground(): Color Returns the foreground color of the selected cells. +setSelectionForeground(c: Color): void Sets the foreground color of the selected cells. +getSelectionMode(): int Returns the selection mode for the list. EE3206/EE5805 Java Programming & Applications 31 JList Constructors & Properties JList() JList Creates an empty list. JList(Object stringItems) JList(Object Creates a new list initialized with items. selectedIndexd selectedIndexd selectedIndices selectedIndices selectedValue selectedValue selectedValues selectedValues selectionMode selectionMode visibleRowCount visibleRowCount EE3206/EE5805 Java Programming & Applications 32 Example: Using Lists This example gives a program that lets users select countries in a list and display the flags of the selected countries in the labels. ListDemo EE3206/EE5805 Java Programming & Applications Run 33 JScrollBar A scroll bar is a control that enables the user to select from a range of values. The scroll scrollbar appears in two styles: horizontal and vertical. horizontal vertical javax.swing.JComponent j avax.swing.JScrollBar -orientation: int -maximum: int Specifies horizontal or vertical style, default is horizontal. Specifies the maximum value the scroll bar represents when the bubble reaches the right end of the scroll bar for horizontal style or the bottom of the scroll bar for vertical style. Specifies the minimum value the scroll bar represents when the bubble reaches the left end of the scroll bar for horizontal style or the top of the scroll bar for vertical style. Specifies the relative width of the scroll bar's bubble. The actual width appearing on the screen is determined by the maximum value and the value of visibleAmount. Represents the current value of the scroll bar. Specifies value added (subtracted) when the user activates the blockincrement (decrement) area of the scroll bar, as shown in Figure 13.30. Specifies the value added (subtracted) when the user activates t...
View Full Document

This note was uploaded on 01/11/2011 for the course EE 3206 taught by Professor Cwting during the Spring '07 term at City University of Hong Kong.

Ask a homework question - tutors are online