Core J2ME™ Technology & MIDP phần 3

Phương pháp ngày getdate () void setDate (ngày nay) int getInputMode () (int mode) Tạo DateField Tạo DateField với thông tin múi giờ quy định hiện hành Thiết lập giá trị ngày mới / giá trị thời gian chế độ đầu vào hiện tại Thiết lập chế độ đầu vào mới | Simpo PDF Merge and Split Unregistered Version - http When creating a DateField object you specify whether the user can edit the date the time or both see the mode constants declared in the Table . DateField API Table . DateField Class Method Description Constructors DateField String label int mode Create DateField DateField String label int mode TimeZone timeZone Create DateField with specified TimeZone information Methods Date getDate Get current value void setDate Date date Set new date time value int getInputMode Get the current input mode void setInputMode int mode Set new input mode Example Creating an Alarm Clock Let s create a simple alarm clock MIDlet see Example . This application will allow the user to specify a date and time and will sound an alarm and display a message when the appointed time has arrived. To make this example a little more realistic I ve included two components that we have yet to introduce the Timer and Alert. With a Timer you can schedule tasks to occur at some future time in our case a task to display a message . The message will be contained as part of an Alert component. An Alert is similar to a pop-up window or dialog box. Once again don t worry about the details of these components as we ll cover them as we progress through the book. Example import . import . import . import import public class Snooze extends MIDlet implements ItemStateListener CommandListener private Display display Reference to display object private Form fmMain The main form private Command cmSnooze Start the timer private Command cmReset Reset to current date time private Command cmExit Exit the MIDlet private DateField dfSnoozeTime How long to snooze private int dateIndex Index of DateField on Form private Date currentTime Current time private Timer tmSnooze The timer private SnoozeTimer

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
284    80    3    16-05-2024
322    79    1    16-05-2024
Đã 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.