网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

阅读以下说明和Java代码,将应填入(n)处的语句写在对应栏内。

【说明】

本程序通过移动滑动条修改颜色RGB值,从而控制颜色。程序中有一个面板、3个标签和3个滑动条,标签和滑动条一一对应,分别对应三原色红、绿、蓝,任意拖动其中的一个滑动条,所对应的颜色值就会发生变化,面板的颜色也会发生对应的变化,如下图所示,滑动条值的范围是0~255。

【Java代码】

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

public class simple extends JFrame. implements AdjustmentListener{

public simple(){

setTitle("simple");

setSize(300, 200);

addWindowListener(new WindowAdapter(){

public void windowClosing((1)){

System.exit(0);

}

});

Container contentPane=getContentPane();

JPanel p=(2);

p.setLayout(new GridLayout(3, 2));

p.add(redLabel=new JLabel("Red 0"));

p.add(red=new JScrollBar(Adjustable. HORIZONTAL, 0, 0, 0, 255));

red.setBlocklncrement(16);

red.addAdjustmentListener(this);

p.add(greenLabel=(3) ("Green 0"));

p.add(green=new JScrollBar(Adjustable.HORIZONTAL 0, 0, 0, 255));

green setBIocklncrement(16);

green.addAdjustmentListener(this);

p.add(blueLabel=new JLabel("Blue 0"));

p.add(btue=new JScrollBar(Adjustable. HORIZONTAL, 0, 0, 0, 255));

blue,setBIocklncrement(16);

blue.addAdjustmentListener(this);

contentPane.add(p, "South");

colorPanet=new JPanel();

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

contentPane.add((4),"Center");

} public void adjustmentValueChanged(AdjustmentEvent evt){

redLabel.setText("Red"+red.getValue());

greenLabel.setText("Green"+green.getValue());

blueLabel.setText("Blue"+blue.getValue());

coiorPanel.setBackground(new Color(red.getValue(), green.getValue(), blue.getValue()));

colorPanel.repaint();

}

public static void main(String[] args){

JFrame. f=(5);

f.show();

}

private JLabel redLabel;

private JLabel greenLabel;

private JLabel blueLabel;

private JScrollBar red;

private JScroilBar green;

private JScrollBar blue;

private JPanel colorPanel;


参考答案

更多 “ 阅读以下说明和Java代码,将应填入(n)处的语句写在对应栏内。【说明】本程序通过移动滑动条修改颜色RGB值,从而控制颜色。程序中有一个面板、3个标签和3个滑动条,标签和滑动条一一对应,分别对应三原色红、绿、蓝,任意拖动其中的一个滑动条,所对应的颜色值就会发生变化,面板的颜色也会发生对应的变化,如下图所示,滑动条值的范围是0~255。【Java代码】import java.awt.*;import java.awt.event.*;import javax.swing.*;public class simple extends JFrame. implements AdjustmentListener{public simple(){setTitle("simple");setSize(300, 200);addWindowListener(new WindowAdapter(){public void windowClosing((1)){System.exit(0);}});Container contentPane=getContentPane();JPanel p=(2);p.setLayout(new GridLayout(3, 2));p.add(redLabel=new JLabel("Red 0"));p.add(red=new JScrollBar(Adjustable. HORIZONTAL, 0, 0, 0, 255));red.setBlocklncrement(16);red.addAdjustmentListener(this);p.add(greenLabel=(3) ("Green 0"));p.add(green=new JScrollBar(Adjustable.HORIZONTAL 0, 0, 0, 255));green setBIocklncrement(16);green.addAdjustmentListener(this);p.add(blueLabel=new JLabel("Blue 0"));p.add(btue=new JScrollBar(Adjustable. HORIZONTAL, 0, 0, 0, 255));blue,setBIocklncrement(16);blue.addAdjustmentListener(this);contentPane.add(p, "South");colorPanet=new JPanel();colorPanet.setBackground(new Color(0, 0, 0));contentPane.add((4),"Center");} public void adjustmentValueChanged(AdjustmentEvent evt){redLabel.setText("Red"+red.getValue());greenLabel.setText("Green"+green.getValue());blueLabel.setText("Blue"+blue.getValue());coiorPanel.setBackground(new Color(red.getValue(), green.getValue(), blue.getValue()));colorPanel.repaint();}public static void main(String[] args){JFrame. f=(5);f.show();}private JLabel redLabel;private JLabel greenLabel;private JLabel blueLabel;private JScrollBar red;private JScroilBar green;private JScrollBar blue;private JPanel colorPanel; ” 相关考题
考题 阅读以下说明和流程图,将应填入(n)处的字句写在对应栏内。【说明】已知头指针分别为La和lb的有序单链表,其数据元素都是按值非递减排列。现要归并La和Lb得到单链表Lc,使得Lc中的元素按值非递减排列。程序流程图如下所示:

考题 阅读以下说明及Visual Basic程序代码,将应填入(n)处的字句写在对应栏内。【说明】以下程序为求行列式X(5,5)的值S。【Visual Basic代码】Private Function col ( byval x ( 5,5 ) as integer ) as longdim fesult as longdim temp as longdim I as integerdim j as integerdim k as imegerresult = 0for I = to 5(1)for j = 1 to 5if I+j>6 thenk= ( 1+j ) mod 5elsek=1endiftemp=temp*x ( k,j )(2)result=(3)(4)(5)End function

考题 在考生文件夹中有工程文件execise69.vbp及窗体文件execise69.frm。在名为Form1的窗体中有3个水平滚动条(名称分别为HS1,HS2,HS3),4个标签框(名称分别为Lab1、 Lab2、Lab3和Lab4),如下图所示,Lab1~Lab3的Text分别为,“红”、“绿”、“蓝”; Lab4用来显示颜色变化。要求程序运行后,标签框Lab4的颜色随着红、绿、蓝三种颜色滚动条的变化而变化。试在HS1、HS2、HS3中输入相应的代码以实现程序功能。本程序不完整,请补充完整,并能正确运行。要求:去掉程序中的注释符“'”,把程序中的问号“?”改为正确的内容,使其实现上述功能,但不得修改程序的其他部分。最后,按原文件名并在原文件夹中保存修改后的文件。

考题 阅读下列程序说明和C++程序,把应填入其中(n)处的字句,写在对应栏内。【说明】阅读下面几段C++程序回答相应问题。比较下面两段程序的优缺点。①for (i=0; i<N; i++ ){if (condition)//DoSomething…else//DoOtherthing…}②if (condition) {for (i =0; i<N; i++ )//DoSomething}else {for (i=0; i <N; i++ )//DoOtherthing…}

考题 阅读以下说明和Java代码,将解答写入对应栏内。【说明】下面的程序是从命令行输入3个数传递到public static void main(String args[])方法中 (如java IsTriangle 3 4 5),并判断这3个数能否构成三角形的3条边,并显示相应的结果。请在程序的每条横线处填入适当的语句,使程序的功能完整。注意:请勿改动main()主方法和其他已有的语句内容,仅在横线处填入适当的语句。public class IsTriangle{public static void main( String args[ ]){int a[] =new (1) [args.(2)];for(int i=0;i<3;(3)){a[i]=(4)}if((5))System. out. println(a[0] +","+a[1] +","+a[2]"能构成三角形的3条边");elseSystem. out. println(a[0] +","+a[1] +","+a[2]"不能构成三角形的3条边);}}

考题 阅读以下说明和JAVA 2代码,将应填入(n)处的字句写在对应栏内。[说明]以下程序为类类型的变量应用实例,通过异常处理检验了类CCircle的变量的合法性,即参数半径应为非负值。仔细阅读代码和相关注释,将程序补充完整。[JAVA代码]//定义自己的异常类class CCircleException extends Exception{}// 定义类 CCircleclass CCircle{private double radius;public void setRadius ( double r ) (1){if ( r<0 ) {(2)}else(3)}Public void show ( ) {System. out. println ( "area="+3.14*radius*radius );}}public class ciusample{public static void main ( String args[] ){CCircle cir=new CCircle( );(4) {cir. setRadius ( -2.0 )}(5){System. out. println ( e+" throwed" ) ;}cir. show( ) ;}}

考题 阅读以下说明和Java程序,填补代码中的空缺(1)~(6),将解答填入答题纸的对应栏内。【说明】很多依托扑克牌进行的游戏都要先洗牌。下面的Java代码运行时先生成一副扑克牌,洗牌后再按顺序打印每张牌的点数和花色。【Java代码】

考题 试题三(共 15 分)阅读以下说明和 C 程序,将应填入 (n) 处的字句写在答题纸的对应栏内。

考题 阅读下列说明和?C++代码,将应填入(n)处的字句写在答题纸的对应栏内。 【说明】 阅读下列说明和?Java代码,将应填入?(n)?处的字句写在答题纸的对应栏内。 【说明】 某快餐厅主要制作并出售儿童套餐,一般包括主餐(各类比萨)、饮料和玩具,其餐品种 类可能不同,但其制作过程相同。前台服务员?(Waiter)?调度厨师制作套餐。现采用生成器?(Builder)?模式实现制作过程,得到如图?6-1?所示的类图。