题目内容 (请给出正确答案)
[主观题]

在事件jian听的处理模型中,主要涉及如下3类对象,事件源(EventSource)、事件(Event)、以及()

查看答案
如搜索结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能会需要:
您的账号:
发送账号密码至手机
发送
更多“在事件jian听的处理模型中,主要涉及如下3类对象,事件源(…”相关的问题

第1题

下面是一个Applet程序,其功能是实现对JButton类的扩展,封装成上网助力一样的按钮类,每个按钮对象对应一个 URL地址,点击则访问相应的URL。要求在窗口中从上到下排列3个这样的按钮。请改正程序中的错误(有下划线的语句),使程序能输出正确的结果。

注意:不改动程序的结构,不得增行或删行。

程序运行结果如下:

import java.net.*;

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

public class ex28_3 extends JApplet implements ActionListener {

ButtonURL[] btnURL = new ButtonURL[3];

public void init() {

btnURL[0] = new ButtonURL("新浪网","http://www.sina.com.cn/");

btnURL[1] = new ButtonURL("163","http://www.163.com/");

btnURL[2] = new ButtonURL("搜狐","http://www.sohu.com/");

GridLayout gl = new GridLayout(1,3);

getContentPane().setLayout(gl);

for (int i = 0; i < btnURL.length; i++) {

btnURL[i].addActionListener(this);

getContentPane().add(btnURL[i]);

}

}

public void actionPerformed(ActionEvent ae) {

ButtonURL btnClick =ae.getSource();//获取发生事件的对象

try {

URL load = new URL(btnClick.strAddr);

getAppletContext().showDocument(strAddr);

} catch (MalformedURLException e) {

showStatus("Bad URL:" + btnClick.strAddr);

}

}

}

class ButtonURL extends JButton {

String strAddr;

ButtonURL(String strLabel, String strAddress) {

super(strLabel);

strAddr = strAddress;

}

}

ex28_3, html

<HTML>

<HEAD>

<TITLE>ex28_3</TITLE>

</HEAD>

<BODY>

<applet code="ex28_3.class" width=800 height=400 >

</applet>

</BODY>

</HTML>

点击查看答案

第2题

以下的代码是如何实现事件处理过程的?()classHelllWordFrame_jButton4_actionAdapterimplementsActionListener{HelloWorldFrameadaptee;HelloworldFrame_jButton4_actionAdapter(HelloWorldFrameadaptee){this.adaptee=adaptee;}publicvoidactionPerformed(ActionEvente){adaptee,jButton4_actionPerfomed(e);}}

A.在事件处理类的actionPerformed函数中,调用主框架的对应函数进行处理

B.事件处理类实现了ActionListener接口

C.主框架作为事件处理类的一部分,包括在事件处理类中

D.在事件处理类的构造函数中将主框架的引用变量传递给事件处理类

E.在事件处理类的构构造函数中,创建一个主框架对象,并显示该对象

点击查看答案

第3题

Even though the main source of______exposure for a majority of the human population is the sun, the artificial tanning from sun beds contributes significantly to the total UV risk.

A.extra violent

B.extra violet

C.ultraviolet

D.ultravirus

点击查看答案

第4题

setOnTouchEvent设置返回值为true和false有何区别?()

A.没有区别,都能对事件进行监听

B.设置为true时只能在移动时获得一次监听事件,false则可以多次

C.返回true表示这个消息已经被处理结束,后续的handler不再接收到这个消息

D.设置为false是,在处理一次监听事件后,系统将抛弃该次事件

点击查看答案

第5题

请完成下列Java程序:记录鼠标在窗口中的信息,包括鼠标的移动事件以及鼠标在窗口中的位置坐标,要求在窗口下方显示鼠标的事件和位置信息,在窗口上方有按钮控制程序的正常退出。

注意:请勿改动main()主方法和其他已有语句内容,仅在下划线处填入适当的语句。

源程序文件代码清单如下:

import java.awt.*;

import java.awt.event.*;

public class ex12_2

extends Frame. implements MouseMotionListener, ActionListener

private Label 1;

private String str=" ";

public static void main(String args[])

{

new ex12_2();

}

ex12_2( )

{

______;

setSize(200,200);

Button btn=new Button("exit");

btn.addActionListener (this);

add (btn, "North" );

l=new Label(str);

add (l, "South" );

show ();

}

public void mouseMoved(MouseEvent event)

{

str="Move: "+

l. setText (str);

}

public void mouseDragged(MouseEvent event)

{

}

public void actionPerformed(ActionEvent event)

{

if(event.getActionCommand().equals("exit"))

{

System.exit(0);

}

}

}

点击查看答案

第6题

【单选题】Search and Rescue In the unlikely event th...

【单选题】Search and Rescue In the unlikely event that an aircraft crashes, a pilot should be very aware of search and rescue procedures, and what pilots do can improve survival odds(生存概率). What does the term “search and rescue” mean? After a crash, how can pilots best utilize the resources available to accomplish the survival goal? We need to distinguish between these two key words: search and rescue. If rescue personnel don’t know where crashed aircraft is, it’s a search. If they do know where it is, then it’s a rescue. We will discuss what pilots can do to help in the search phase. The key to survival is to shorten the time from the crash to rescue. Obviously, if the rescue team doesn’t know the location, then it will take a lot longer for them to find it. How much longer? The average time from the last known position (LKP) to rescue is 31 hours. Since this is an average, one could be a survivor for a few hours or a few days. To assure that the LKP is known, as a pilot, the key survival effort begins by filing a flight plan. It is a road map of the inflight movements and is the cheapest insurance available. How cheap? It’s free. The types of flight plans filed will greatly affect the time pilots may have to survive during a search phase. It’s important to understand how the rescue personnel are put into action. When an aircraft is overdue, missing, or sends a radio distress call, the National Search and Rescue Plan is activated. There are many organizations and volunteers associated with Search and Rescue (SAR), but the Federal Government assumes overall responsibility. The National SAR plan designates the U.S. Coast Guard as responsible for maritime SAR and the U.S. Air Force for inland SAR. All SAR activities in the contiguous 48 states are coordinated through the full-time Air Force Rescue Coordination Center (AFRCC) at Scott Air Force Base, Illinois. When a call on a missing or overdue aircraft is received by the Center, the National SAR Plan is activated. (348 words) QUESTION 1: What are the differences between search and rescue

A、A

B、B

C、C

D、D

点击查看答案

第7题

下列代码中的内部类名是( )。 import java.awt.event.*; lapoct javax.swin9.*; class TalkingClock( public void start(int interval,final boolean beep){ ActionListener listener=new ActionListener{ public void actionPerformed(ActionEvent e- vent){ … } } Timer t=new Timer(interval,listener); start; } }

A.Timer

B.ActionListener

C.1istener

D.匿名

点击查看答案
热门考试 全部 >
相关试卷 全部 >
账号:
你好,尊敬的上学吧用户
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改
谢谢您的反馈

您认为本题答案有误,我们将认真、仔细核查,
如果您知道正确答案,欢迎您来纠错

警告:系统检测到您的账号存在安全风险

为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!

微信搜一搜
上学吧
点击打开微信
警告:系统检测到您的账号存在安全风险
抱歉,您的账号因涉嫌违反上学吧购买须知被冻结。您可在“上学吧”微信公众号中的“官网服务”-“账号解封申请”申请解封,或联系客服
微信搜一搜
上学吧
点击打开微信