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

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

下列Applet实现了使用灰度值递减的顺序显示0~9,选择正确的语句填入横线处。 import java.applet.*; import java.awt.*; import java.awt.Color; public class ex24 extends Applet { public void paint(Graphics g) { int r = 0, g1 = 0, b = 0, j = 10; for(int i - 0; i < 10; i ++) { g.setColor(new Color(r, g1, b)); r += 25; g1 +=25; b +=25; j += 10; } } }

A.g.drawString(i, j, 30);

B.g.drawString("" + i, j, 30);

C.drawString(i,j, 30);

D.drawstring("" + i,j, 30);


参考答案

更多 “ 下列Applet实现了使用灰度值递减的顺序显示0~9,选择正确的语句填入横线处。 import java.applet.*; import java.awt.*; import java.awt.Color; public class ex24 extends Applet { public void paint(Graphics g) { int r = 0, g1 = 0, b = 0, j = 10; for(int i - 0; i < 10; i ++) { g.setColor(new Color(r, g1, b)); r += 25; g1 +=25; b +=25; j += 10; } } }A.g.drawString(i, j, 30);B.g.drawString("" + i, j, 30);C.drawString(i,j, 30);D.drawstring("" + i,j, 30); ” 相关考题
考题 下列Applet在坐标 ( 20,20) 处显示一幅GIF图像,在横线处填入正确的语句。import java. net.*;import java. awt.*;import java. applet.*;public class Test extends Applet {Image IMG;public void init() {URL url = getDocumentBase ();String name="IMG.gif";【 】}public void paint(Graphics g) {g. drawImage ( IMG,20,20,this);}}

考题 下面Applet在窗口中实现一个不可编辑的TextField,并且显示“ok”。在横线处填入正确的语句。import java.applet.Applet;import java.awt.t;public class Test extends Applet {TextField tf;public void init () {setLayout (new GridLayout(1,0);tf=new TextField("ok");【 】add(tf);}}

考题 下列Applet在窗口中放置2个Button,标签分别为“东”和“西”,在窗口中的位置与它们的名字相同。选择正确的语句填入横线处。 import java.awt.*; import java.applet.*; public class ex16 extends Applet { Button e, w; public void init() { e = new Button("东"); w = new Button("西"); add("East", e); add("West", w); } }A.setLayout(new BoxLayout());B.setLayout(new FlowLayout());C.setLayout(new BorderLayout());D.setLayout(new GridLayout());

考题 下列Applet将已知char型数组各元素的值(设分别为65,66,70,80,67,78)显示在屏幕上。选择正确的语句填入横线处。 import java.awt.*; import java.applet.*; public class ex33 extends Applet { char a[] = {65, 66, 70, 80, 67, 78}; int j = 30; public void paint(Graphics g) { for(int i = 0; i <= a.length; i ++) { ______ += 25; } } }A.g.drawString(a[i], j, 50);B.drawString(Character, toString(a[i]), j, 50);C.g.drawLine(Character, toString(a[i]),j, 50);D.g.drawString(Character, toString(a[i]), j, 50);

考题 下列Applet实现了在Applet窗口中绘制一个以(70,70)为圆心,50为半径,边框为绿色的圆,圆心是红色的。选择正确的语句填入下面横线处。 import java.awt.*; import java.applet.*; public class ex20 extends Applet { public void paint(Graphics g) { g.setColor(Color. GREEN); g.drawOval(20, 20, 100, 100); g.setColor(Color. RED); ______ } }A.g.drawOval(70, 70, 70, 70);B.g.drawRect(70, 70, 1, 1);C.drawRect(70, 70, 1, 1);D.g.drawLine(70, 70, 1, 1);

考题 下列Applet实现画一条连接窗口右上角的直线。选择正确的语句填入横线处。 import java.applet.*; import java.awt.*; public class ex25 extends Applet { public void paint (Graphics g) { Dimension d; d = getSize(); ______ } } ______ } }A.g.drawLine(d.width, al.height, 0, 0);B.g.drawLine(0, d.height, d.width, 0);C.g.drawLine(0, 0, d. width, 0);D.g.drawLine(0, d.height, 0, d.width);

考题 下列Applet在坐标(30,50)处以黄色字体显示“你好!”。请选择正确的语句填入横线处。 import java.awt.*; import java.applet.*; public class ex27 extends Applet { public void paint<Graphics g) { g.drawString("你好", 30, 50); } }A.setColor(Color.yellow);B.g.setColor(Color. Yellow),C.g.setFontColor(Color. yellow);D.g.setColor(Color. yellow);

考题 下列Applet用于显示提供它的主机的IP地址。请选择正确的语句填入横线处。 import java.awt.*; import java. awt. event.*; import java.applet.Applet; import java.net. *; public class ex23 extends Applet { public void init() { setLayout(new GridLayout(2, 1); Button btm = new Button("显示IP"); final Label 1 = new Label(" "); btn. addActionListener (new ActionListener ( ) { public void actionPerformed(ActionEvent ae) { try { URL ur1 = getCodeBase(); String strName = ur1.getHost(); ______ 1.setText (ia.toString()); } catch (Exception e) { e.printStackTrace (); } } }); add (btn); } }A.InetAddress ia = URL.getByName(strName);B.InetAddress ia = InetAddress.getByName(strName);C.InetAddress ia = new InetAddress.getByName(strName);D.InetAddress ia = InetAddress.getByName(ur1);

考题 在编写Applet程序时,程序中必须有的import语句是A.import.java.io.*;B.import java.applet.Applet;C.import.java.awt.event.*;D.import.java.lang.*;