添加日历,并应突出显示选择日期

时间:2012-07-03 12:30:36

标签: lwuit

我正在开发一个应用程序来查看表单中的日历,并且屏幕上显示了压延器。但不突出选择,我使用的代码如下,请帮助我

final Dialog dialogue = new Dialog();
                calendar = new Calendar();
                calendar.setFocus(true);
                /*calendar.setFocusable(true);
                calendar.setEnabled(true);*/
                calendar.setSelectedStyle(getSelectedStyle());

                calendar.getStyle().setBgColor(0xff0000);
                calendar.getStyle().setFont(FontUtils.PROPORTIONAL_FONT_PLAIN_SMALL);

                calendar.setMonthViewSelectedStyle(getSelectedStyle());
                calendar.setMonthViewUnSelectedStyle(getUnselectedStyle());

                calendar.getUnselectedStyle().setFont(FontUtils.PROPORTIONAL_FONT_PLAIN_SMALL);
                calendar.getSelectedStyle().setFont(FontUtils.PROPORTIONAL_FONT_BOLD_MEDIUM);
                calendar.getPressedStyle().setFont(FontUtils.PROPORTIONAL_FONT_BOLD_MEDIUM);
                calendar.getSelectedStyle().setFgColor(0xff0000);
                calendar.getPressedStyle().setFgColor(0xff0000);
                calendar.setUnselectedStyle(getSelectedStyle());
                dialogue.addComponent(calendar);
                dialogue.addCommand(new Command("Cancel") {

                    public void actionPerformed(ActionEvent evt) {
                        dialogue.dispose();
                    }
                });
                calendar.addFocusListener(new FocusListener() {

                    public void focusLost(Component paramComponent) {
                        // TODO Auto-generated method stub

                    }

                    public void focusGained(Component paramComponent) {
                        // TODO Auto-generated method stub
                        paramComponent.getSelectedStyle().setFgColor(0xff0000);
                        paramComponent.getPressedStyle().setFgColor(0xff0000);
                    }
                });
                calendar.addActionListener(new ActionListener() {

                    public void actionPerformed(ActionEvent ae) {
                        btnbirthday.setText(null);
                        btnbirthday.setText(formatingCalenderText(calendar.getDate().toString()));
                        dialogue.dispose();
                    }
                });

感谢和问候 Pranav

1 个答案:

答案 0 :(得分:1)

尝试使用这些UIID来更改此Component的样式.. CalendarDay,CalendarNavigation和CAlendarDay