tailieunhanh - Core J2ME™ Technology & MIDP phần 5

Các yếu tố được chèn vào sẽ có chỉ số 2, và yếu tố trước đây ở vị trí thứ 2 bây giờ sẽ có một chỉ số của 3. Trước khi rời khỏi ví dụ này mất vài phút để xem qua các mã trong commandAction (). Chú ý kiểm tra xem nếu lệnh khởi xướng sự kiện này là một danh sách tiềm ẩn. Ngoài ra, nhìn vào báo cáo chuyển đổi sử dụng | Simpo PDF Merge and Split Unregistered Version - http Mutable These images are created by requesting a block of memory specifying the height and width of the desired image. The image is empty until drawn into. Here s how to allocate a mutable image Create mutable image and get graphics object for image Image tmpImg 80 20 Graphics g Look what we just uncovered. There s our second reference to a Graphics object through a mutable image. Which also answers the question how do you draw into a mutable image Before moving on let s go over the fundamental difference between the lifetime of a Graphics objects acquired inside paint versus a Graphics object acquired through an Image. 1. Through paint method The Graphics reference is valid only inside paint . Once leaving even if you save a reference to the variable the object cannot be used to draw onto the Canvas. 2. Through an image The Graphics reference is valid as long as the Image and the variable that references the Graphics object are in scope. For example depending on where the following declaration is made image and g may be available for the lifetime of the MIDlet. Image image 40 40 Graphics g 24 bits are allocated for color support 8 bits to each of the colors red green and blue. If a device does not support all possible colors in the range it will map color requests to the closest possible match available. This includes mapping a color request to an appropriate shade of gray for non-color devices. Table . Color Suppor t Method Description void setColor int RGB Set color by combining each color component Red Green Blue into one integer value void setColor int red int green int blue Set color specifying each color component Red Green Blue separately int getColor Get current color as one integer value int getBlueComponent Get the blue component of the current color 211 Simpo PDF Merge and .

TỪ KHÓA LIÊN QUAN