java web编程技术(沈泽刚,清华大学出版社)第十六章课后习题部分解答

java web编程技术(沈泽刚,清华大学出版社)第十六章课后习题部分解答

ID:48262273

大小:88.50 KB

页数:17页

时间:2020-01-20

java web编程技术(沈泽刚,清华大学出版社)第十六章课后习题部分解答_第1页
java web编程技术(沈泽刚,清华大学出版社)第十六章课后习题部分解答_第2页
java web编程技术(沈泽刚,清华大学出版社)第十六章课后习题部分解答_第3页
java web编程技术(沈泽刚,清华大学出版社)第十六章课后习题部分解答_第4页
java web编程技术(沈泽刚,清华大学出版社)第十六章课后习题部分解答_第5页
资源描述:

《java web编程技术(沈泽刚,清华大学出版社)第十六章课后习题部分解答》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库

1、*********AdapterDemo.java*********importjava.awt.event.*;importjavax.swing.JFrame;publicclassAdapterDemoextendsJFrame{publicstaticvoidmain(String[]args){AdapterDemoframe=newAdapterDemo();frame.setSize(220,80);frame.setLocationRelativeTo(null);frame.setDefaultCloseOpera

2、tion(JFrame.EXIT_ON_CLOSE);frame.setTitle("适配器演示");frame.setVisible(true);}publicAdapterDemo(){addWindowListener(newWindowAdapter(){publicvoidwindowActivated(WindowEventevent){System.out.println("窗口激活");}});}}***********AnimationDemo.java*****importjava.awt.*;importjav

3、a.awt.event.*;importjavax.swing.*;publicclassAnimationDemoextendsJFrame{publicAnimationDemo(){add(newMovingMessagePanel("消息移动"));}publicstaticvoidmain(String[]args){AnimationDemoframe=newAnimationDemo();frame.setSize(280,100);frame.setLocationRelativeTo(null);frame.set

4、DefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.setTitle("消息移动演示");frame.setVisible(true);}staticclassMovingMessagePanelextendsJPanel{privateStringmessage="Java欢迎您";privateintxCoordinate=0;privateintyCoordinate=20;publicMovingMessagePanel(Stringmessage){this.message=

5、message;Timertimer=newTimer(1000,newTimerListener());timer.start();}protectedvoidpaintComponent(Graphicsg){super.paintComponent(g);if(xCoordinate>getWidth()){xCoordinate=-20;}xCoordinate+=5;g.drawString(message,xCoordinate,yCoordinate);}classTimerListenerimplementsActi

6、onListener{publicvoidactionPerformed(ActionEvente){repaint();}}//classTimerListenerimplementsActionListener}//staticclassMovingMessagePanelextendsJPanel}//publicclassAnimationDemoextendsJFrame*********AnonymousListenerDemo.java********importjavax.swing.*;importjava.awt

7、.event.*;publicclassAnonymousListenerDemoextendsJFrame{publicAnonymousListenerDemo(){JButtonjbtNew=newJButton("新建");JButtonjbtOpen=newJButton("打开");JButtonjbtSave=newJButton("保存");JButtonjbtPrint=newJButton("打印");JPanelpanel=newJPanel();panel.add(jbtNew);panel.add(jbtO

8、pen);panel.add(jbtSave);panel.add(jbtPrint);add(panel);jbtNew.addActionListener(newActionListener(){publicvoidactionP

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。