带按钮事件的 lwuit 日历
我尝试使用表单在按钮单击时显示日历,但我无法更改日期,并且很难找到焦点。
...
Button mdate=new Button("change date");
mdate.addActionListener(this);
...
public void actionPerformed(ActionEvent ae) {
Form cal= new Form();
com.sun.lwuit.Calendar c =new com.sun.lwuit.Calendar();
c.setFocus(true);
c.addActionListener(this);
cal.addComponent(c);
cal.show();
}
如何以更好的方式在按钮单击上显示和隐藏日历
i tried to show the calendar on button click using form but i'm unable to change the date and very much struggled to find where the focus .
...
Button mdate=new Button("change date");
mdate.addActionListener(this);
...
public void actionPerformed(ActionEvent ae) {
Form cal= new Form();
com.sun.lwuit.Calendar c =new com.sun.lwuit.Calendar();
c.setFocus(true);
c.addActionListener(this);
cal.addComponent(c);
cal.show();
}
how to show and hide calendar on button click in a better way
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
更好的是,您可以使用
Dialog
(如弹出窗口)而不是表单。您可以轻松地在Form
中进行处理。无需显示另一种形式。请参阅下面的示例代码,并为
Calendar
添加选中和未选中的样式,例如CalendarSelectedDay
、CalendarDate
。还为ComboBox选中和未选中 样式代码>.
Better you can use
Dialog
(like pop up) instead of Form. You can easily dispose within aForm
. No need to show another form. See the below sample code,And add the selected and unselected style for
Calendar
likeCalendarSelectedDay
,CalendarDate
. Also add the selected and unselected style forComboBox
.