tailieunhanh - Java software solutions foundations of program design 4th edition phần 7

trong đó đề cập đến một tập hợp các các lớp học định nghĩa các thành phần đồ họa đặc biệt được sử dụng trong một giao diện người dùng đồ họa (GUI). Đôi khi toàn bộ thư viện tiêu chuẩn được gọi đến tổng quát | 548 CHAPTER 9 graphical user interfaces List Selection Mode Description Single Selection Only one item can be selected at a time. Single Interval Selection Multiple contiguous items can be selected at a time. Multiple Interval Selection Any combination of items can be selected. figure List selection modes In the Pickimage program we set the list selection mode to single selection because only one image can be displayed at a time. However even if multiple selections were allowed in this program the getSelectedValue method returns the first item selected so that would be the image displayed. A similar method called getSelectedValues returns an array of objects representing the items selected when multiple selections are permitted. Instead of an array of String objects the JList constructor could be passed an array of Imageicon objects instead. In that case the images would be displayed in the list. combo boxes key A combo box provides a list of options from which to choose and displays the current selection. A combo box allows the user to select one of several options. When the user presses a combo box using the mouse a list of options is displayed from which the user can choose. The current choice is displayed in the combo box. A combo box is defined by the JComboBox class. Note the similarities and differences between a combo box and a JList object described in the previous section . Both allow the user to select an item from a set of choices. However the choices on a list are always displayed with the current choice highlighted whereas a combo box presents its options only when the user presses it with the mouse. The only item displayed all the time in a combo box is the current selection. A combo box can be either editable or uneditable. By default a combo box is uneditable. Changing the value of an uneditable combo box can be accomplished only by selecting an item from the list. If the combo box is editable however the user can change the value by either .

TỪ KHÓA LIÊN QUAN
crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.