网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
不属于响应鼠标事件的监听器中方法的是( )。
A.mouseDragged(MouseEvent)
B.mouseExited(MouseEvent)
C.mouseReleased(MouseEvent)
D.mouseQuited(MouseEvent)
参考答案
更多 “ 不属于响应鼠标事件的监听器中方法的是( )。A.mouseDragged(MouseEvent)B.mouseExited(MouseEvent)C.mouseReleased(MouseEvent)D.mouseQuited(MouseEvent) ” 相关考题
考题
本题的功能是跟踪鼠标在窗口的操作,以及在窗口的坐标,包括移进、移出、移动、单击、释放和拖曳,并将这些信息显示在窗口的文字标签上。 import java.awt.*; import java.awt.event.*; import javax.swing.*; public class java3 extends JFrame. implements MouseL- istener MouseMotionListener { private JLabel statusBar; public java3 { super("java3"); statllsBar=new TLabel; getContentPane.add(statusBar,BorderLayout. SOUTH); addMouseListener(this); addMouseMotionListener(this); setSize(275,100); show; } public void mouseClicked(MouseEvent e) { statusBar.setText("Clicked at["+e.getX+ ","+e.getY+"]"); } public void mousePressed(MouseEvent e) { statusBar.setText("Pressed at["+e.getX+ ","+e.getY+"]"); } public void mouseReleased(MouseEvent e) { statusBar.setText("Released at["+e.getX +","+e.getY+"]"); } public void mouseln(MouseEvent e) { statusBar.setText("Mouse in window"); public void mouseExited(MouseEvent e) { statusBar.setText("Mouse outside window"); } public void mouseDragged(MouseEvent e) { statusBar.setText("Dragged at["+e.getX +","+e.getY+"]"); } public void mouseMoved(MouseEvent e) { statusBar.setText("Moved at["+e.getX+ ","+e.getY+"]"); } public static void main(String args[]) { java3 app=new java3; app.addWindowListener(new WindowAdapter { public void windowClosing(WindowEvent e) { System.exit(0); } };
考题
阅读以下说明和JAVA2代码,将应填入(n)处的字句写在对应栏内。【说明】以下程序实现了利用鼠标任意移动该圆形的位置,仔细阅读代码和相关注释,将程序补充完整。【代码6】import java.awt.*;import java.awt.event.*;public class CIUSAMPLE extends Frame. implements MouseMotionListener, MouseListener{static CIUSAMPLE frm=new CIUSAMPLE ();int x=70,y=60,posX=70,posY=60,dx,dy;public static void main ( String args[]){frm.setTitle ("Dragging a circle");frm.setSize ( 200,150 );(1)frm.addMouseMotionListener ( frm );frm. setVisible ( true );}public void mousePressed ( MouseEvent e ){(2)dy=e.getY () -posY;}public void mouseDragged ( MouseEvent e ){(3)y=e.getY () -dy;if ( dx>0 dx<50 dy>0 dy<50 ) //如果指我落在正方形区域内{Graphics g=getGraphics ();(4)}}public void paint ( Graphics g ){g.setColor ( Color. pink ); // 设置绘图颜色为粉红g.fillOval ( x,y,50,50 ); //以基准点为图形的左上角绘出圆形(5)posY=y;}public void mouseMoved ( MouseEvent e ) { }public void mouseReleased ( MouseEvent e ) { }public void mouseEntered ( MouseEvent e ) { }public void mouseExited ( MouseEvent e ) { }public void mouseClicked ( MouseEvent e ) { }}
考题
当用户点击按钮时,Java程序采用什么方法来响应?()
A.通过框架的事件监听器对象响应B.通过框架的onbutton函数响应C.通过按钮的事件监听器对象响应D.通过按钮的onbutton函数响应
考题
WhichisamethodoftheMouseMotionListenerinterface?()
A.PublicvoidmouseMoved(MouseEvent)B.PublicbooleanmouseMoved(MouseEvent)C.PublicvoidmouseMoved(MouseMotionEvent)D.PublicbooleanMouseMoved(MouseMotionEvent)E.PublicbooleanmouseMoved(MouseMotionEvent)
考题
当按下鼠标时,一个圆不断地增大半径。注意:请勿改动已有语句内容,仅在下划线处填入适当的语句。import java.applet.*;import java.awt.*;import java.awt.event.*;public class ex1 extends applet implements MouseListener{TextField text;int x;public void init(){x=6;text=new TextField(30);add(text);addMouseListener(this);}public void paint(Graphics g){x= x+2;g.drawOval(10,10,x,x);}public void mousePressed(MouseEvent e){Text.setText("鼠标按下的位置是:"+e.getX()+","e.getY());repaint();}public void mouseReleased(MouseEvent e){Text.setText("鼠标松开的位置是:"+e.getX()+","e.getY());repaint();}public void mouseEntered(MouseEvent e){Text.setText("鼠标进来的位置是:"+e.getX()+","e.getY());repaint();}public void mouseExited(MouseEvent e){Text.setText("鼠标退出的位置是:"+e.getX()+","e.getY());______;}}
考题
下列______方法属于MouseMotionListener接口中的方法。A.mouseExited(MouseEvent)B.mouseEntered(MouseEvent)C.mouseMoved(MouseEvent)D.mousePressed(MouseEvent)
考题
阅读以下说明和JAVA 2代码,填入(n)处。[说明]以下程序实现了利用鼠标任意移动圆形的位置,仔细阅读代码和相关注释,将程序补充完整。[代码6-1]import java.awt.*;import java.awt.event.*;public class CIUSAMPLE extends Frame. implements MouseMotionListener, MouseListener{static CIUSAMPLE frm=new CIUSAMPLE ( );int x=70,y=60,posX=70,posY=60,dx,dy;public static void main (String args[]){frm.setTitle ("Dragging a circle");frm.setSize (200,150);(1)ffm.addMouseMotionListener (frm);frm.setVisible (true);}public void mousePressed (MouseEvent e){(2)dy=e.getY ( ) -posY;}public void mouseDragged (MouseEvent e){(3)y=e.getY ( ) -dy;if(dx>0dx<50dy>0dy<50) //如果指针落在正方形区域内{Graphicsg=getGraphics ( );(4)}}public void paint (Graphics g){g.setColor (Color.pink); //设置绘图颜色为粉红g.fillOval(x,y,50,50); //以基准点为图形在左上角绘出圆形(5)posY=y;}public void mouseMoved (MouseEvent e) {}public void mouseReleased (MouseEvent e) {}public void mouseEntered (MouseEvent e) {}public void mouseExited (MouseEvent e) {}public void mouseClicked (MouseEvent e) {}}
考题
当用户点击按钮时,Java程序采用什么方法来响应?()A、通过框架的事件监听器对象响应B、通过框架的onbutton函数响应C、通过按钮的事件监听器对象响应D、通过按钮的onbutton函数响应
考题
鼠标监听器有哪些特点?()A、Java提供了鼠标适配器类(MouseAdapter),鼠标监听器只需要从鼠标适配器类中继承,并实现它所需要的函数即可B、监听器类可以只实现接口中的一两个函数C、所有与鼠标相关的事件都通过该鼠标监听器类来处理D、不包括鼠标移动事件,鼠标移动事件单独有一个事件监听器E、用来监听鼠标移入,移出组件,以及鼠标按下,放开的事件接口具有5个函数
考题
对于鼠标事件MouseEvent,下列哪一项是不正确的()A、有两类监听器,MouseListener和MouseMotionListenerB、MouseListener处理鼠标点击事件C、一次鼠标操作,只能触发两类监听器中的一种D、MouseMotionListener处理鼠标移动事件
考题
Which is a method of the MouseMotionListener interface?()A、 Public void mouseMoved(MouseEvent)B、 Public boolean mouseMoved(MouseEvent)C、 Public void mouseMoved(MouseMotionEvent)D、 Public boolean MouseMoved(MouseMotionEvent)E、 Public boolean mouseMoved(MouseMotionEvent)
考题
当鼠标放在按钮上时产生效果的鼠标事件类型是哪个?()A、MouseEvent.MOVEB、MouseEvent.OUTC、MouseEvent.DOWND、MouseEvent.OVER
考题
判断题传递给实现了java.awt.event.MouseMotionListener接口的类中mouseDragged()方法的事件对象是MouseEvent类型的。()A
对B
错
考题
单选题Which is a method of the MouseMotionListener interface?()A
Public void mouseMoved(MouseEvent)B
Public boolean mouseMoved(MouseEvent)C
Public void mouseMoved(MouseMotionEvent)D
Public boolean MouseMoved(MouseMotionEvent)E
Public boolean mouseMoved(MouseMotionEvent)
考题
单选题当用户点击按钮时,Java程序采用什么方法来响应?()A
通过框架的事件监听器对象响应B
通过框架的onbutton函数响应C
通过按钮的事件监听器对象响应D
通过按钮的onbutton函数响应
考题
单选题对于鼠标事件MouseEvent,下列哪一项是不正确的()A
有两类监听器,MouseListener和MouseMotionListenerB
MouseListener处理鼠标点击事件C
一次鼠标操作,只能触发两类监听器中的一种D
MouseMotionListener处理鼠标移动事件
热门标签
最新试卷