为日期类型的控件添加focusLost事件
2014-12-31 14:46
211 查看
一、普通日期控件
二、在分录中的日期控件
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事件
- 在.Net下使用Access 的日期类型 及与js的日历控件交互
- 类库-----一些经常用到的对控件的处理1. 获取文本框中输入内容2.清除文本框内容3. 获取下拉列表框中选择内容,类型0为Text值,类型1为Value值4.DropDownList绑定日期
- 添加webpart时出现“此网页上的某个Web部件或Web表单控件无法显示或导入。该类型未注册为安全类型 。”
- 未能加载视图状态。正在向其中加载视图状态的控件树必须与前一请求期间用于保存视图状态的控件树相匹配。例如,当以动态方式添加控件时,在回发期间添加的控件必须与在初始请求期间添加的控件的类型和位置相匹配。
- asp.net中为Calendar日历控件添加双击日期事件
- 添加了清除日期的梅花雨日期控件
- 日期控件中添加关闭按钮
- 发布首款支持Shift/Ctrl多选的国产日历控件,界面仿Twitter风格,支持中文日期类型,支持SImpleDateFormat格式,支持change等自定义事件,全中文注释和API,欢迎支持
- [MFC]ListControl控件列表report类型添加列表图标
- 在不对控件类型进行硬编码的情况下在 Visual C# .NET 中动态添加控件
- 给datagridview添加一个自定义列类型-日期类型
- 添加用户控件提示错误:基类包括“” 但是他的类型与当前控件类型不兼容
- 在jquery repeater中添加设置日期,下拉,复选框等控件
- 日期控件于Date类型
- JSP中fckeditor控件的选项选择保留、字体类型添加、回车与段落更换
- Excel 中添加日期控件
- cocos2d-x 在cocosbuider中添加CCBFile类型的控件
- 怎样在不对控件类型进行硬编码的情况下在 C#vs 中动态添加控件
- bootstrap3添加日期控件中碰到的问题