Java me 如何在lwuit文本字段或组合框中添加日历

Java me 如何在lwuit文本字段或组合框中添加日历,java-me,lwuit,lwuit-textfield,lwuit-combobox,Java Me,Lwuit,Lwuit Textfield,Lwuit Combobox,我正在使用lwuit创建一个应用程序。我想在组合框中添加日历。请尽快给我一个想法。您的意思是要在组合框值的末尾添加日历组件的选定日期,还是要在文本框中显示选定日期? 如果是,则下面的代码在文本框中显示日历组件的选定日期: Button cal = new Button("Calendar"); // button for calendar cal.addActionListener(new ActionListener() { // define action for button

我正在使用lwuit创建一个应用程序。我想在组合框中添加日历。请尽快给我一个想法。

您的意思是要在组合框值的末尾添加日历组件的选定日期,还是要在文本框中显示选定日期? 如果是,则下面的代码在文本框中显示日历组件的选定日期:

Button cal = new Button("Calendar");  // button for calendar
cal.addActionListener(new ActionListener() {  // define action for button

                //  action listener to show the calendar container
                public void actionPerformed(ActionEvent ae) {
                    final Form calFrame = new Form();
                    final Calendar cal = new Calendar();
                    calFrame.setScrollable(true);
                    calFrame.setSmoothScrolling(true);
                    calFrame.setIsScrollVisible(true);
                    cal.addActionListener(new ActionListener() {

                        public void actionPerformed(ActionEvent ae) {
                            txtDate.setText(cal.getDate());  // textfield in which date should be set
                            mainForm.showBack();  // main form to show back after calender disappears
                        }
                    });

                    calFrame.addComponent(cal);
                    calFrame.show();
                }
});
            mainForm.addComponent(calButton); // add calendar button to main form
此代码将向主窗体添加一个日历按钮,并在文本字段中显示所选日期(此处命名为txtDate)。 如果要在组合值中添加日期,可以在组合组件的向量或向量列表中添加所选日期。 如果这不是你想要的,请简要说明你真正想要做什么