为日期类型的控件添加focusLost事件
2009-01-14 11:13
260 查看
一、普通日期控件
二、在分录中的日期控件
public void onLoad() throws Exception { super.onLoad(); //当鼠标在签约日期处失去焦点时,设置到期日期默认为签约日期后1年减一天,如签约日期为2009-1-10,则到期日期就是2010-1-9 this.pksignDate.getEditor().getEditorComponent().addFocusListener(new java.awt.event.FocusAdapter() { public void focusLost(java.awt.event.FocusEvent e) { try { pksignDate_focusLost(e); if (pksignDate.getValue() != null){ Calendar cal = Calendar.getInstance(); cal.setTime((Date)pksignDate.getValue()); cal.add(Calendar.YEAR,1); cal.add(Calendar.DAY_OF_MONTH,-1); pkcontractEndDate.setValue(cal.getTime()); } } catch(Exception exc) { handUIException(exc); } } }); }
二、在分录中的日期控件
/** * @author 胡千好 */ protected void kdtEntrys_editStopped(KDTEditEvent e) throws Exception { super.kdtEntrys_editStopped(e); int row = e.getRowIndex(); int col = e.getColIndex(); //如果是费用开始日期那一列 if(col==2){ if(this.kdtEntrys.getCell(row,col).getValue()!=null){ Calendar cal = Calendar.getInstance(); cal.setTime((Date)this.kdtEntrys.getCell(row,col).getValue()); cal.add(Calendar.YEAR,1); cal.add(Calendar.DAY_OF_MONTH,-1); //设置费用结束日期为开始日期后一年 this.kdtEntrys.getCell(row,"feeEndDate").setValue(cal.getTime()); } } }
相关文章推荐
- 为日期类型的控件添加focusLost事件
- asp.net中为Calendar日历控件添加双击日期事件
- 发布首款支持Shift/Ctrl多选的国产日历控件,界面仿Twitter风格,支持中文日期类型,支持SImpleDateFormat格式,支持change等自定义事件,全中文注释和API,欢迎支持
- 发布首款支持Shift/Ctrl多选的国产日历控件,界面仿Twitter风格,支持中文日期类型,支持SImpleDateFormat格式,支持change等自定义事件,全中文注释和API,欢迎支持
- JS脚本动态给元素/控件添加事件
- 动态添加ASP.NET控件并绑定处理事件
- jsp页面将String类型的值(日期控件,如2017-01-01)转为时间戳
- 玩无限消乐的设计示例(基础篇)DataGridView控件添加拖放事件方法和委托
- c#给用户控件添加事件处理程序
- 安卓·为控件添加事件
- 用代码给控件添加事件
- 为listview中的控件添加点击事件
- tabbar隐藏后,在tabbar的位置添加控件不会响应事件解决方案。
- ScrollView动态添加控件,并设定绑定事件
- asp.net 服务器控件LinkButton等在后台代码中设置js事件或添加css样式
- asp.net为控件动态添加事件
- 给服务器端DropDownList控件添加客户端onchange事件
- 前端js日期控件传时间类型到java后台转Date类型
- asp.net运行时,动态添加Button(或其它控件),并处理相应的事件
- ASP.NET文本框中添加日期选择控件