我正在开发一个应用程序来查看表单中的日历,并且日历显示在屏幕上。但不突出选择,我使用的代码如下请帮助我
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();
}
});
感谢和问候普拉纳夫