LWUIT 1.1 for Java ME Developers- P6

Tham khảo tài liệu 'lwuit for java me developers- p6', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 10 Using Themes In the preceding chapters we have seen how to set styles for components. In an application with a large number of UI components setting attributes for each can be a tedious task and can also lead to errors. A Theme allows us to set the style attributes for an entire class of components in a single place. This not only simplifies the task of setting attributes for all components of a particular type but also ensures that any newly added component will look just like all the others of the same type in the application. A theme thereby establishes a visual coherence through all the screens of an application. In this chapter we shall study themes and their usage in detail through the following steps View an existing theme using the LWUIT Designer Edit a theme Build a new theme Preview the new theme on LWUIT demo MIDlet Use the new theme in a demo MIDlet Use your own component in a theme Working with theme files A theme file is conceptually similar to CSS while its implementation is like that of a Java properties file. Essentially a theme is a list of key-value pairs with an attribute being a key and its value being the second part of the key-value pair An entry in the list may be 555555. This entry specifies that the background color of all forms in the application will be hex 555555 in the RGB format. The list is implemented as a hashtable. Using Themes Viewing a theme file A theme is packaged into a resource file that can also hold as we have already seen other items like images animations bitmap fonts and so on. The fact that a theme is an element in a resource bundle means it can be created viewed and edited using the LWUIT Designer. The following screenshot shows a theme file viewed through the LWUIT Designer The first point to note is that there are five entries at the bottom which appear in bold letters. All such entries are the defaults. To take an example the only component-specific font setting in the theme shown above is for the .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
Đã 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.