纠错
全专业资料、题库、学位、网课
最高直省2344元
上千+科次精品网课
买网课即送全真模考题库
五千+科次教材资料
电子资料满三件9折
五千+科次在线题库
全真呈现历年考试试题
1、[填空题]第7题 采用______布局的容器中多个组件拥有同一个显示空间,某一时刻只能显示一个组件。
2、[填空题]在Java语言中有定义:char c[]-{0',1,2', '3', '4'};则c. length-.
【原题如下】
题中横线处答案为:______。
3、[主观题]【程序分析题】阅读下面程序,写出程序功能。
import java.applet.*;import java.awt.*;
public class Class3602 extends Applet implements Runnable
{
Thread redBall,blueBall;Graphics redPen,bluePen;
int blueSeta=0,redSeta=0;
public void init()
{
setSize(250,200);
redBall=new Thread(this);blueBall=new Thread(this);
redPen=getGraphics();bluePen=getGraphics();
redPen.setColor(Color.red);bluePen.setColor(Color.blue);
setBackground(Color.gray);
}
public void start()
{
redBall.start();blueBall.start();
}
public void run()
{
int x,y;
while(true)
{
if(Thread.currentThread()==redBall)
{
x=(int)(80.0*Math.cos(3.1415926/180.0*redSeta));
y=(int)(80.0*Math.sin(3.1415926/180.0*redSeta));
redPen.setColor(Color.gray);
redPen.fillOval(100+x,100+y,10,10);
redSeta +=3;
if(redSeta>=360) redSeta=0;
x=(int)(80.0*Math.cos(3.1415926/180.0*redSeta));
y=(int)(80.0*Math.sin(3.1415926/180.0*redSeta));
redPen.setColor(Color.red);
redPen.fillOval(100+x,100+y,10,10);
try {redBall.sleep(20);}
catch(InterruptedException e){}
}
else if (Thread.currentThread()==blueBall)
{
x=(int)(80.0*Math.cos(3.1415926/180.0*blueSeta));
y=(int)(80.0*Math.sin(3.1415926/180.0*blueSeta));
bluePen.setColor(Color.gray);
bluePen.fillOval(150+x,100+y,10,10);
blueSeta-=3;
if(blueSeta<=-360) blueSeta=0;
x=(int)(80.0*Math.cos(3.1415926/180.0*blueSeta));
y=(int)(80.0*Math.sin(3.1415926/180.0*blueSeta));
bluePen.setColor(Color.blue);
bluePen.fillOval(150+x,100+y,10,10);
try {blueBall.sleep(40);}
catch(InterruptedException e){}
}
}
}
}
4、[主观题]【程序分析题】阅读下列程序,写出程序运行结果。
import java.awt.event.*;
import javax.swing.*;
public class C3502 implements MouseMotionListener
{
JTextField text=new JTextField(30);
C3502()
{
JFrame myWin=new JFrame("Ex0611");
myWin.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
myWin.setBounds(100,100,300,100);
myWin.getContentPane().add(text,"North");
myWin.addMouseMotionListener(this);
myWin.setVisible(true);
}
public void mouseDragged(MouseEvent e)
{
int x=e.getX(),y=e.getY();
text.setText("拖动鼠标,鼠标坐标为:"+x+","+y);
}
public void mouseMoved(MouseEvent e)
{
int x=e.getX(),y=e.getY();
text.setText("移动鼠标,鼠标坐标为:"+x+","+y);
}
public static void main(String[] args)
{
new C3502();
}
}
5、[主观题]【简答题】文本框(JTextField)是界面中用于输入和输出一行文本的区域。文本框处理程序的基本内容有哪五个方面?
Copyright © 2010 - 2023 湖南求实创新教育科技有限公司 All Right Reserved.
温馨提示:如您需要的资料本网暂时没有,请于工作日08:00-18:00,点击这里,联系客服及时补充资料。