简答题
Java
题号 #2591710
本题的功能是用文本框来设定表盘中指针的位置。窗口中有-个画板和两个文本框,画板中绘制了-个表盘和时针、分针,通过文本框分别设定“时”和“分”,表盘中的时针和分针就会指到对应的位置上。






参考答案
暂无
答案解析
第1处:DocumentListener listener=new ClockField-Listener( )
第2处:hourField.getDocument( ).addDocumentLis-tener(listener)
第3处:private class ClockFMdListener implements Docu—mentListener
【解析】第1处从后面程序可以看出ClockFieldListener类扩展了DocumentListener,此处应使用继承后的子类;第2处注册窗体的监听器,参数应为事件源;第3处实现的是接口,应使用implements。
第2处:hourField.getDocument( ).addDocumentLis-tener(listener)
第3处:private class ClockFMdListener implements Docu—mentListener
【解析】第1处从后面程序可以看出ClockFieldListener类扩展了DocumentListener,此处应使用继承后的子类;第2处注册窗体的监听器,参数应为事件源;第3处实现的是接口,应使用implements。












