【计算机类职业资格】计算机二级JAVA-162 (1)及答案解析.doc

上传人:周芸 文档编号:1338273 上传时间:2019-10-17 格式:DOC 页数:4 大小:38KB
下载 相关 举报
【计算机类职业资格】计算机二级JAVA-162 (1)及答案解析.doc_第1页
第1页 / 共4页
【计算机类职业资格】计算机二级JAVA-162 (1)及答案解析.doc_第2页
第2页 / 共4页
【计算机类职业资格】计算机二级JAVA-162 (1)及答案解析.doc_第3页
第3页 / 共4页
【计算机类职业资格】计算机二级JAVA-162 (1)及答案解析.doc_第4页
第4页 / 共4页
亲,该文档总共4页,全部预览完了,如果喜欢就下载吧!
资源描述

1、计算机二级 JAVA-162 (1)及答案解析(总分:100.00,做题时间:90 分钟)一、简单应用题(总题数:3,分数:100.00)1.本程序是一个 Applet,页面中有 10 个按钮,名称从“0”“9”,用鼠标任意单击其中一个按钮后,通过键盘上的上下左右键可以控制按钮在窗口上移动,如图所示。 (分数:30.00)_2.本程序中,主窗口中有一个按钮,按钮的长和宽每 200 毫秒增加 1,当达到 100 时又恢复原来大小重新进行增加,如图所示。 import java.awt.*; import java.awt.event.*; public class exam_94 public

2、static void main(String args) Mywin win=new Mywin(); class Mywin extends Frame _ Button b=new Button(“按钮“);int x=5; Thread bird=null; Mywin() setBounds(100,100,400,400);setLayout(new FlowLayout(); setTitle(“exam_94“); setVisible(true); add(b);b.setBackground(Color.green); addWindowListener(new Windo

3、wAdapter() public void windowClosing(WindowEvent e) System.exit(0); ); bird=new Thread(this); bird.start(); public _ () while(true) x=x+1; if(x100) x=5; b.setBounds(40,40,x,x); try bird.sleep(200); catch(InterruptedException e) (分数:30.00)_3.本程序是一个 Applet,其功能是用户对文本框的输入,如果输入的是数字(09)或者是点(.),则接受并在文本框中显示

4、否则不接受,如图所示。 (分数:40.00)_计算机二级 JAVA-162 (1)答案解析(总分:100.00,做题时间:90 分钟)一、简单应用题(总题数:3,分数:100.00)1.本程序是一个 Applet,页面中有 10 个按钮,名称从“0”“9”,用鼠标任意单击其中一个按钮后,通过键盘上的上下左右键可以控制按钮在窗口上移动,如图所示。 (分数:30.00)_正确答案:()解析:第 1 处:implements KeyListener 第 2 处:keyPressed(KeyEvent e)2.本程序中,主窗口中有一个按钮,按钮的长和宽每 200 毫秒增加 1,当达到 100 时又恢

5、复原来大小重新进行增加,如图所示。 import java.awt.*; import java.awt.event.*; public class exam_94 public static void main(String args) Mywin win=new Mywin(); class Mywin extends Frame _ Button b=new Button(“按钮“);int x=5; Thread bird=null; Mywin() setBounds(100,100,400,400);setLayout(new FlowLayout(); setTitle(“exa

6、m_94“); setVisible(true); add(b);b.setBackground(Color.green); addWindowListener(new WindowAdapter() public void windowClosing(WindowEvent e) System.exit(0); ); bird=new Thread(this); bird.start(); public _ () while(true) x=x+1; if(x100) x=5; b.setBounds(40,40,x,x); try bird.sleep(200); catch(InterruptedException e) (分数:30.00)_正确答案:()解析:第 1 处:implements Runnable 第 2 处:void run3.本程序是一个 Applet,其功能是用户对文本框的输入,如果输入的是数字(09)或者是点(.),则接受并在文本框中显示,否则不接受,如图所示。 (分数:40.00)_正确答案:()解析:第 1 处:extends PlainDocument 第 2 处:text.setDocument(document)

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 考试资料 > 职业资格

copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
备案/许可证编号:苏ICP备17064731号-1