首页 > 建设工程> 造价工程师
题目内容 (请给出正确答案)
[主观题]

阅读下列程序,请写出该程序的功能。import java.awt.*;import javax.swing.*;public class Cla

阅读下列程序,请写出该程序的功能。

import java.awt.*;

import javax.swing.*;

public class Class33

{public static void main(String[] args)throws Exception

{

JFrameframe=new JFrame("调制颜色");

JPanelpColor=new JPanel();

JLabellColor=new JLabel("0,0,0");

pColor.setBackground(new Color(0,0,0);

JScrollBar sRed=new JScrollBar(JScrollBar.HORIZONTAL,0,1,0,

256);

JScrollBar sGreen=new JScrollBar(JScrollBar.HORIZONTAL,0,1,

0,256);

JScrolIBarsBule=new JScrollBar(JScrollBar.HORIZONTAL,0,1,0,

256);

frame.setLayout(new GridLayout(5,1));

frame.add(pColor);

frame.add(lColor);

frame.add(sRed);frame.add(sGreen);

frame.add(sBule);

frame.pack();

frame.setVisible(true);

Color col;

int nRed,nGreen,nBule;

while(true)

}

nRed=sRed.getValue();

nGreen=sGreen.getValue();

nBule=sBule.getValue();

col=new Color(nRed,n(nGreen,nBule);

pColor.setBackground(col);

lColor.setText(nRed+","+nGreen+","+nBule);

Thread.sleep(100);

}

}

}

查看答案
答案
收藏
如果结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能还需要:
您的账号:
发送账号密码至手机
发送
安装优题宝APP,拍照搜题省时又省心!
更多“阅读下列程序,请写出该程序的功能。import java.a…”相关的问题
第1题
阅读下列程序并写出程序运行结果。Private Sub Form_Click()Dim A(1 To 3) As StringDim c As I
阅读下列程序并写出程序运行结果。Private Sub Form_Click()Dim A(1 To 3) As StringDim c As I

阅读下列程序并写出程序运行结果。

Private Sub Form_Click()

Dim A(1 To 3) As String

Dim c As Integer

Dim j As Integer

A(1) = "4"

A(2) = "8"

A(3) = "12"

c = 1

For j = 1 To 3

c = c + Val(A(j))

Next j

Print c

End Sub

写出程序运行时单击窗体后,窗体Form1上的结果。

点击查看答案
第2题
阅读下列程序,请写出程序的运行结果。import java.applet.*;import javax.swing.*;import java

阅读下列程序,请写出程序的运行结果。

import java.applet.*;

import javax.swing.*;

import java.awt.event.*;

public class C extends Applet implements ActionListener

{

int n=0;

JButton button;

public void init()

{

setSize(400,100);

button=new JButton("");

add(button);

button.addActionListener(this);

}

public void actionPerformed(ActionEvent e)

{

n++;

button.setText(n+"");

}

}

点击查看答案
第3题
阅读下列程序,写出程序运行结果。import j ava. util. StringTokenizer;public class C3301{pu

阅读下列程序,写出程序运行结果。

import j ava. util. StringTokenizer;

public class C3301

{

public static void main(String[] args)

{

String ss="public static void main";

StringTokenizer pas=new StringTokenizer(ss, " ") ;

int n=pas. countTokens() ;

System. out. println(n) ;

String s=pas. nextToken() ;

for(pas. nextToken() ; pas. hasMorcTokens() ; s=pas. nextToken()

System. out. println(s) ;

}

}

点击查看答案
第4题
阅读下列程序并写出程序运行结果。Public Sub change1(ByVal x As Integer, ByVal y As Integer
阅读下列程序并写出程序运行结果。Public Sub change1(ByVal x As Integer, ByVal y As Integer

阅读下列程序并写出程序运行结果。

Public Sub change1(ByVal x As Integer, ByVal y As Integer)

Dim t As Integer

t = x

x = y

y = t

End Sub

Public Sub change2(x As Integer, y As Integer)

Dim t As Integer

t = x

x = y

y = t

End Sub

Private Sub Form_Click()

Dim a As Integer, b As Integer

a = 22: b = 33

change1 a, b

Form1.Print "A1="; a, "B1="; b

a = 22: b = 33

change2 a, b

Form1.Print "A2="; a, "B2="; b

End Sub

写出程序运行时,单击窗体Form1上的输出结果。

点击查看答案
第5题
阅读下列程序,请写出程序的运行结果。import java.applet.*;import java.awt.*;public class C

阅读下列程序,请写出程序的运行结果。

import java.applet.*;

import java.awt.*;

public class C 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()

{

intx,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){}

}

elseif(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.sleepp(40);}

catch(InterruptedException e){}

}

}

}

}

点击查看答案
第6题
下列缩略语错误的是()。

A.ELM例外的锂金属电池

B.IMP信息交换程序

C.PEP便携式电子设备

D.PMED便携式电子医疗设备

点击查看答案
第7题
阅读下面的程序段,试说明其实现的功能。

点击查看答案
第8题
阅读下面的程序段,分析其功能。

点击查看答案
第9题
阅读下面的程序段,回答以下问题。if (x < 5 ) System.out.print(" one ");else {i
阅读下面的程序段,回答以下问题。if (x < 5 ) System.out.print(" one ");else {i

阅读下面的程序段,回答以下问题。

if (x < 5 ) System.out.print(" one ");

else {

if (y < 5 ) System.out.print(" two ");

else System.out.println(" three ");

}

问题:1)若执行前x=6,y=8,该程序段输出是什么?2)若执行前x=1,y=8,该程序段输出是什么?

点击查看答案
第10题
写出下列程序段的输出结果(栈的元素类型S Elem Type为char)。

写出下列程序段的输出结果(栈的元素类型S Elem Type为char)。

点击查看答案
退出 登录/注册
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改