下列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实现画一条连接窗口右上角的直线。选择正确的语句填入横线处。 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在坐标 ( 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实现在窗口中按右对齐方式摆放三个单选按钮。选择正确的语句填入下面横线处。 import java.applet.Applet; import java.awt.*; public class ex21 extends Applet { CheckboxGroup chkG; Checkbox chk1, chk2, chk3; public void init() { ______ chkG = new CheckboxGroup(); chk1 = new Checkbox("选项1", chkG, false); add(chk1); chk2 = new Checkbox("选项2", chkG, false); add(chk2); chk3 = new Checkbox("选项3", chkG, false); add(chk3); } }A.setLayout(new BorderLayout());B.setLayout(new FlowLayout());C.setLayout(FlowLayout(FlowLayout. RIGHT));D.setLayout(new FlowLayout(FlowLayout.RIGHT));
下面是一个Applet小程序,其功能为:以坐标(10,20)为起点,画一条长为80个像素点的绿色直线,请在横线处填写一条语句,使程序的完整。注意:请勿改动main()主方法和其他已有的语句内容,仅在横线处填入适当的语句。______________________import java.awt.*;public class test_drawline extends Applet{public void paint(_______________){g.setColor(Color.green);_____________________}}
下列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实现了使用灰度值递减的顺序显示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程序时,程序中必须有的import语句是A.import.java.io.*;B.import java.applet.Applet;C.import.java.awt.event.*;D.import.java.lang.*;