首页 > 大学专科> 电子信息
题目内容 (请给出正确答案)
[主观题]

读下列程序 import java.awt.*; import java.awt.event.*; publid class MyApplet

extends java.applet.Applet { public void init() { Button b = new Button("Buttonl"); b.addMouseListener(new ClickHandler()); add(B) ; } class ClickHandler extends MousAdapter { public void mouseClicked(MouseEvent evt) { ______; } } } 在横线处写上语句【 】可实现将鼠标当前的水平位置输出到标准输出设备上。

查看答案
答案
收藏
如果结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能还需要:
您的账号:
发送账号密码至手机
发送
安装优题宝APP,拍照搜题省时又省心!
更多“读下列程序 import java.awt.*; impor…”相关的问题
第1题
编写Box2D程序,一般的需要在程序中加入库文件,下列选项中不相关的是:()。
编写Box2D程序,一般的需要在程序中加入库文件,下列选项中不相关的是:()。

A、import shiffman.box2d.*;

B、import org.jbox2d.collision.shapes.*;

C、import org.jbox2d.common.*;

D、import processing.opengl.*;

点击查看答案
第2题
阅读下列程序,请写出程序的运行结果。import java.applet.*;import javax.swing.*;import java

阅读下列程序,请写出程序的运行结果。

import java.applet.*;

import javax.swing.*;

import java.awt.event.*;

public class C extends Applet implements ActionListener

{

int n=0;

JButton button;

public void init()

{

setSize(400,100);

button=new JButton("");

add(button);

button.addActionListener(this);

}

public void actionPerformed(ActionEvent e)

{

n++;

button.setText(n+"");

}

}

点击查看答案
第3题
下列哪--个import命令可以使我们在程序中创建输入/输出流对象()。

A.importjava.sql.*

B.importjava.util.*

C.importjava.io.*

D.importjava.net.*

点击查看答案
第4题
将下列的程序补充完整。 import java.applet.Applet; import java.awt.Graphics;
public class Applet2 extends Applet { public void paint(Graphics gap) { in i=678; gap.drawstring(Integer.【 】(i),20,60); } }

点击查看答案
第5题
下列程序的运行结果是【 】。 import java.io.*; public class abc { p
ublic static void main(Stringargs[ ] ) { String s1 = "Hello!"; System.out.println(s1.toUpperCase() ); } }

点击查看答案
第6题
阅读下列程序,请写出该程序的功能。import java.awt.*;import javax.swing.*;public class Cla

阅读下列程序,请写出该程序的功能。

import java.awt.*;

import javax.swing.*;

public class Class32

{public static void main(String[] args)

{

JFrame. frame=new JFrame("登录对话框");

TextField id=new TextField(12);

TextField pw=new TextField(12);

JButton login=new JButton("登录");

JButton cancel=new JButton("取消");

pw.setEchoChar('*');

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

frame.add(new JLabel("ID:",JLabel.RIGHT));

frame.add(id);

frame.add(new JLabel("密码:",JLabel.CENTER));

frame.add(pw);

frame.add(login);

frame.add(cancel);

frame.pack();

frame.setVisible(true);

}

}

点击查看答案
第7题
下列Applet在坐标(20,20)处显示一幅GIF图像,请填写正确的程序在横线处。 import java.awt.*;

下列Applet在坐标(20,20)处显示一幅GIF图像,请填写正确的程序在横线处。 import java.awt.*; import java.applet.*; import java.net.URL; public class Testl3 extends Applet { Image i; public void init() { URL url=getDocumentBase(); String name="IMG nClick=over(this) title=放大0, gif"; 【 】; } public void paint(Graphics g) { g.drawImage(i,20,20,this); } }

点击查看答案
第8题
阅读下列程序,写出程序功能。import j ava. awt. *;import j avax. swing. *;import j ava. aw

阅读下列程序,写出程序功能。

import j ava. awt. *;

import j avax. swing. *;

import j ava. awt. event. *;

public class C3401 implements ActionListener

{

JFrame. frmFrame;

JButton btnUp, btnDown;

public C3401()

{

frmFrame=new JFrame("按钮应用") ;

frmFrame. setLayout(new CridLayout(2, 1) ) ;

btnUp=new JButton("上") ;

btnUp. setActionCommand("btnUp") ;

btnUp. addActionListener(this) ;

btnDown=new JButton("下") ;

btnDown. setActionCommand("btnDown") ;

btnDown. addActionListener(this) ;

frmFrame. add(btnUp) ;

frmFrame. add(btnDown) ;

frmFrame. pack() ;

frmFrame. setVisible(true) ;

}

public void actionPerformed(ActionEvent e)

{

String cmd=e. getActionCommand() ;

if(cmd. equals("btnDown")

if(btnUp. getBackground() ==Color. BLUE.

btnUp. setBackground(Color. red) ;

else

btnUp. setBackground(Color. blue) ;

else

if(btnDown. getBackground() ==Color. BLUE.

btnDown. setBackground (Color. red) ;

else

btnDown. setBackground(Color. blue) ;

}

public static void main(String[] args)

{

new C3401() ;

}

}

点击查看答案
第9题
阅读下列程序,写出程序运行结果。import j ava. util. StringTokenizer;public class C3301{pu

阅读下列程序,写出程序运行结果。

import j ava. util. StringTokenizer;

public class C3301

{

public static void main(String[] args)

{

String ss="public static void main";

StringTokenizer pas=new StringTokenizer(ss, " ") ;

int n=pas. countTokens() ;

System. out. println(n) ;

String s=pas. nextToken() ;

for(pas. nextToken() ; pas. hasMorcTokens() ; s=pas. nextToken()

System. out. println(s) ;

}

}

点击查看答案
第10题
有以下程序片段,下列哪个选项不能插入到行1。()1.2 .public class Interesting{undefined3. //do sth4.}

A.import jav

B.awt.

C.package mypackage

D.class OtherClass{ }

E.public class MyClass{ }

点击查看答案
退出 登录/注册
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改