下列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在坐标(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在坐标 ( 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使用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);
下面是一个Applet小程序,其功能为:以坐标(10,20)为起点,画一条长为80个像素点的绿色直线,请在横线处填写一条语句,使程序的完整。注意:请勿改动main()主方法和其他已有的语句内容,仅在横线处填入适当的语句。______________________import java.awt.*;public class test_drawline extends Applet{public void paint(_______________){g.setColor(Color.green);_____________________}}
下列Applet既可以作为Applet运行,也可以作为Application运行。请选择正确的语句填入横线处。 import java.applet.*; import java.awt.*; import j ava. awt. event. *; public class ex35 extends Applet { Label 1; public void init() { 1 = new Label(); 1.setText ("这是Applet ! "); add(1); } public static void main(String[] args) { ex35 e = new ex35(); Frame frm = new Frame("ex35"); frm. add (e); frm. addWindowListener (new WindowAdapter () { public void windowClosing (WindowEvent we) { System.exit (1); } }); e.1.setText ("这是Application! "); frm.setSize(100, 100); frm. setVisible (true); } }A.e.paint();B.不填C.e.repaint();D.e.init();
下列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用于显示提供它的主机的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.*;