TAILIEUCHUNG - Java Programming for absolute beginner- P16

Java Programming for absolute beginner- P16:Hello and welcome to Java Programming for the Absolute Beginner. You probably already have a good understanding of how to use your computer. These days it’s hard to find someone who doesn’t, given the importance of computers in today’s world. Learning to control your computer intimately is what will separate you from the pack! By reading this book, you learn how to accomplish just that through the magic of programming. | 2 25 03 8 53 AM Page 258 k 0 c c 0 2 V The output for this application is shown in Figure . Within the itemState-Changed ItemEvent method two string objects are built based on which event occurred. The getStateChange method determines whether the item was selected or deselected by comparing the returned value to or . The program then obtains the value of the item depending on what type of component it is. The getItem method in the ItemEvent class returns an Object object that represents the item that triggered the event. For the Checkbox and the Choice this works out great because the object returned is a string that can be added to the Event string. For the List however I had to use the code Integer .intValue 0 a c E E s k a o k a s s figure ItemEvents are triggered by Checkboxes Choices and Lists. because returns the Integer index of the List item that was either selected or deselected. I had to explicitly cast it to an Integer object and call its i ntValue method which returns an int type value of the Integer object. Then I had to take that intvalue and pass it into int so that I could get the String value of the List item. Table lists some of the more common ItemEvent fields and methods. ItemEvent Fields and Methods Field or Method Description int DESELECTED Signifies that the ItemEvent occurred because an item was deselected. int SELECTED Signifies that the ItemEvent occurred because an item was selected. int getStateChange Returns a value either or depending on what type of state change is associated with this ItemEvent. Object getItem Returns an Object that represents the item whose state changed. team Line - live informative Non-cost and Genuine Please purchase PDF Split-Merge on to remove this watermark. 2 25 03 8 53 AM Page 259 Handling AdjustmentEvents The

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.