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

题目内容 (请给出正确答案)
在Applet画面的左上角至右下角画一条直线,则//draw处应如何选择?import java.awt.*;import java.applet.*;public class myApplet extends Applet {public void paint(Graphics g) {//draw}}

A. g.drawLine(0,0,getHeight(),getWidth());

B. g.drawLine(0,getWidth(),0,getHeight());

C. g.drawLine(0,getWidth(),getHeight(),0);

D. g.drawLine(getWidth(),getHeight(),0,0);


参考答案

更多 “ 在Applet画面的左上角至右下角画一条直线,则//draw处应如何选择?import java.awt.*;import java.applet.*;public class myApplet extends Applet {public void paint(Graphics g) {//draw}} A. g.drawLine(0,0,getHeight(),getWidth());B. g.drawLine(0,getWidth(),0,getHeight());C. g.drawLine(0,getWidth(),getHeight(),0);D. g.drawLine(getWidth(),getHeight(),0,0); ” 相关考题
考题 【说明】下面是一个Applet程序,程序的功能是在显示面板上输出字符串。当html页面被其他窗口遮挡后再次显示时,请给出输出结果。import java.awt.*;import java. (1). *;public class MyApplet (2) Applet {public void (3) (Graphics g) {g.drawString(tip,20,40);tip ="I am Java Applet";}public void init() {tip ="welcome"; }private (4) tip;}<html><head><title> A Simple Applet </title></head><body><applet code="MyApplet.class" width=800 height=400></applet></body></html>网页输出 (5)

考题 下面代码包括一个HTML文件和一个Applet类,在hello.html文件的横线处填入相应的内容,把HelloApplet嵌入在hello.html中。hello.html文件内容:<HTML><HEAD><TITLE>Hello</TITLE></HEAD><BODY><APPLET CODE="______"IDTH=150 HIGHT=25></APPLET></BODY></HTML>HelloApplet.java文件内容:import java.awt.*;import java.applet.*;public class HelloApplet extends Applet {public void paint(Graphics g) {g.drawString("Hello!",25,25);}}

考题 下面的Applet获取了相对于getDocumentBase()方法返回的目录路径为graph/java.gif的图像文件,并将它显示出来。在下面程序的划线处填入相应的语句。import java.awt.*;import java.applet.Applet;public class Test extends Applet {Image img;public void init() {【 】}public void paint (Graphics g) {g.drawlmage (img,30,25,this);}}

考题 将下面Applet程序补充完整。import java.awt.*:import java.apptet.*;public class Hi ______ {public void paint(Graghics g) {g.drawstring("Hi!",2.5,2.5);}}

考题 下列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);}}

考题 在下面Java Applet程序的下画线处填入代码,使程序完整并能够正确运行。import java.applet.*;import java.awt.*;public class HelloWorld ______ {public void paint(Graphics g) {g.drawString("Hello World!",25,25);}}

考题 下列代码的下划线处应填入的方法名是______。import java.awt.*;import java.applet.*;public class Hello extends Applet{public void______(Graphics g){g.drawString("How are you!", 10, 10);}}A) repaintB) printlnC) paintD) showA.B.C.D.

考题 有如下applet代码:import java.applet.*;import java.awt.*;public class MyApplet extends Applet{AA s;public void int(){s = new AA("Hello!", "I love JAVA.");}public void paint(Graphics g){g.drawString(s.toString(), 30, 50);}}class AA{String s1;String s2;AA(String str1, String str2){s1 = str1;s2 - str2;}public String toString(){return s1 + s2;}}运行后,窗口上将会出现什么,选择一个正确答案______。A.Hello!B.I love JAVA.C.Hello! I love JAVA.D.什么都没有

考题 下列Applet使用drawLine()方法绘制矩形,左上角坐标为(20,40),长为60,宽为 40。请选择正确的语句填入横线处。 import java.awt.*; import java.applet.*; public class ex32 extends Applet { public void paint(Graphics g) { g.setColor(Color.blue); g.drawLine(20, 40, 80, 40); ______ g.drawLine(20, 80, 80, 80); g.drawLine(20, 80, 20, 40); } }A.g.drawLme(80, 40, 80, 80);B.drawLine(40, 40, 80, 80);C.g.drawLine(80, 20, 80, 80);D.drawLine(80, 40, 80, 80);

考题 下面程序的输出结果是( )。 import java.awt.*; import java.applet.*; public class HelloApplet extends Applet { public void paint(Graphics g) { g.drawstring("Hello World!", 20, 20); } }A.20,20B.Hello World!C.编译不能通过D.以上都不对

考题 将下面的程序补充完整。注意:不改动程序结构,不得增行或删行。import java.appplet.Applet;import java.awt.Graphics;public class ex1 extends Applet{public void paint(Graphics______){int i=682;gap.drawstring(Integer.______(i),20,60);}}

考题 请将下面的Applet程序补充完整。import java. awt. *;import java. applet. *;public class Hi【 】{public void paint(Graphics g){g. drawString("Hi!", 25, 25);}}

考题 要下列Java Applet程序完整并能够正确运行,横线处应填人的内容是( )。 import java.applet.*; nmport java.awt.*0 public class HelloWorld{ public void paint(Graphics g){ drawstring("Hello World!",25,25); } }A.extends ThreadB.extends AppletC.extends CharD.extends Float

考题 下列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实现键盘事件处理,当一个键按下时,判断是否为26个英文字母,并输出该字母。选择正确的语句填入横线处。 import java.applet.Applet; import java.awt.*; import java.awt.event.*; public class ex34 extends Applet { String str = ""; public void init() { addKeyListener (new KeyAdapter (} { ______ { char ch; ch = ke.getKeyChar(); if((ch >= 'a' ch <= 'z') || (ch >= 'A' ch <= 'Z')) str = "字母:"+ ch; else str ">"不是字母"; repaint(); } }); requestFocus(); } public void paint(Graphics g) { g.drawString(str, 50, 50); } }A.public void keyPress(KeyEvent ke)B.public void keyTyped(KeyEvent ke)C.public void keyTyped(Event ke)D.public void keyPressing(KeyEvent ke)

考题 下列Applet在窗口中输出一个以坐标(100,80)为中心,长轴半径为70,短轴半径为50的椭圆。选择正确的语句填入横线处。 import java.awt.*; import java.applet.*; public class exl5 extends Applet { public void paint(Graphics g) { g. setColor (Color. RED); g. setColor (Color. GREEN);______ g. drawString(".O", 100, 80); } }A.drawOval(30, 30, 140, 100);B.g.drawOval(30, 30, 70, 50);C.g.drawLine(30, 30, 140, 100);D.g.drawOval(30, 30, 140, 100);

考题 下列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 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);

考题 下列代码的下画线处应填入的方法名是( )。 import java.awt.*; import java.applet.*; public class Hello extends Applet{ public void (Graphics g){ 9.drawstring("How are you!",l0,10); } }A.repaintB.printlnC.paintD.show

考题 下列是一个Java Applet程序,输出结果是(要求只写出在Applet容器内显示的内容) import java.awt.*; import java.applet.*; public class Testuu extends Applet { float[]x={1.2f,3.4f,5.6f,7.8f}; public void paint(Graphics g) { int s=0; for(int i=0;i〈x.length;i++) s+=(int)x[i]; g.drawstring(" "+s,30,60); } }A.15B.16C.16D.17

考题 下面是一个Applet程序,程序的功能是显示一个圆心在Applet的中心,半径从0到100像素的不断变大的蓝色球的动画。请改正程序中的错误(有下划线的语句),使程序执行后,能得到预期的结果。注意:不改动程序的结构,不得增行或删行。程序的执行结果为:import java.awt.*;import java.applet.*;/*<applet code=XiaoQiu width=800 height=600></applet>*/public class XiaoQiu extends Applet implements Runnable{int currentX=0,currentY=0;Thread m_Draw=null;public void init(){m_Draw=new Thread (super);}public void paint(Graphics g){g.setColor(Color.blue);mycircle(g,getSize().width/2,getSize().height/2,currentX,currentY);}public void start(){m_Draw.start();try{Thread.sleep(500);}catch(InterruptedException e){}}public void stop(){if(m_Draw.isAlive())m_Draw. stop();}public void run(){try{while(true){currentX++;currentY++;if(currentX>i00(currentY>100)){currentX=0;currentY=0;}paint();Thread.sleep(100);}}catch(InterruptedException e){}}public void mycircle(Graphics g,int x,int y,int rx, int ry){g.filloval(x-rx,y-ry,2*rx,2*ry);}}ex3 9_3. html:<html><head><title>A Simple Program</title></head><body><applet cede=" XiaoQiu.class" width=800 height=400></applet></body></html>

考题 要使下列程序能够正确运行,则横线处应填写的内容是( )。 import Java.awt.*; import java.applet.*; public class SayHi extends Applet{ public void (Graphics g){ 9.drawString("Hi!",20,20); } }A.intB.startC.paintD.stop

考题 请在下划线处填入代码,使程序能够正确运行。import java .awt.*;import java .applet.*;public class SayHi extends Applet{public void【 】(Graphics g){g .drawString(“Hi!”20,20);}}

考题 ( 8 )在下列 Java applet 程序的横线处填入代码,使程序完整并能够正确运行。Import java. awt. *;Import java. applet. *;Public class Greeting extends applet{Public void 【 8 】 (Graphics g) {g.drawSting( “ how are you! ” ,10,10);}}

考题 ( 15 )在下列 Java Applet 程序的下划线处填入代码,使程序完整并能够正确运行。import java.applet.*;import java.awt.*;public class HelloWorld 【 15 】 {public void paint(Graphics g){g.drawString( " Hello World! " ,25,25);}}