TAILIEUCHUNG - Core J2ME™ Technology & MIDP phần 4

Hãy nhớ rằng, các yếu tố được đưa vào một danh sách trước khi các yếu tố quy định. Nếu một danh sách có 3 yếu tố như hình dưới đây và một phần tử ("Z") được đưa vào bằng cách xác định một chỉ số chèn 2, yếu tố mới sẽ được đưa vào trước khi vào phần tử 2, như hình dưới đây. | Simpo PDF Merge and Split Unregistered Version - http will change. Remember elements are inserted into a list prior to the element specified. If a list has 3 elements as shown below and an element Z is inserted by specifying an insert index of 2 the new element will be inserted prior to element 2 as shown below. The element inserted will have the index 2 and the element previously at position 2 will now have an index of 3. 2 Z null Before Insertion Elements A B C Index 0 1 2 After Insertion Elements A B Z C Index 0 1 2 3 Before leaving this example take a minute to look over the code in commandAction . Notice the check to see if the Command that initiated the event was an implicit List. Also look at the switch statement that uses to determine which element was selected and print a message to the console. public void commandAction Command c Displayable s if c switch case 0 Next break . . Example Multiple Choice List Changing our List from implicit to multiple choice is a piece of cake. All that changes is the declaration of the List. Implicit lsDocument new List Document Option options images Multiple Choice lsDocument new List Document Option options images 155 Simpo PDF Merge and Split Unregistered Version - http The last List example will create a multiple choice list and fill an array of boolean values with the selection status of each entry. The MIDlet and console output shown when the View option is selected are shown in Figure 8-6. Figure 8-6. Multiple Choice List Example --------------------------------------------------- Create multiple choice list and save selection status of each element in an array. ------------------------------------------------- import . import . public class .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.