• 2022-06-16 问题

    为事件源对象注册动作事件的监听器对象,需要用的方法是 。 A: addActionListener B: addMouseListener C: addFocusListener D: addItemListener

    为事件源对象注册动作事件的监听器对象,需要用的方法是 。 A: addActionListener B: addMouseListener C: addFocusListener D: addItemListener

  • 2022-05-28 问题

    处理鼠标事件时,通过方法将监-听-器绑定到事件源对象() A: mousePressed B: addMouseListener C: mouseEntered D: mouseClicked

    处理鼠标事件时,通过方法将监-听-器绑定到事件源对象() A: mousePressed B: addMouseListener C: mouseEntered D: mouseClicked

  • 2021-04-14 问题

    调用了按钮btn的addMouseListener()方法,并在该方法中以匿名内部类的方式给按钮注册了一个鼠标事件监听器

    调用了按钮btn的addMouseListener()方法,并在该方法中以匿名内部类的方式给按钮注册了一个鼠标事件监听器

  • 2021-04-14 问题

    分析下列程序,写出其功能。 import java.applet.*; import java.awt.*; import java.awt.event.*; public class Test extends Applet implements MouseListener { final int number = 5; int count = 0; Image[] card = new Image[number]; public void init() { setSize(1200,1000); addMouseListener(this); for (int i = 0; i < number; i++) { card[i] = getImage(getCodeBase(), i+".jpg"); } } public void paint(Graphics g) { if ((card[count]) != null) g.drawImage(card[count], 10,10,card[count].getWidth(this),card[count].getHeight(this), this); } public void mousePressed(MouseEvent e) { count = (count + 1) % number; repaint(); } public void mouseReleased(MouseEvent e) {} public void mouseEntered(MouseEvent e) {} public void mouseExited(MouseEvent e) {} public void mouseClicked(MouseEvent e) {} }

    分析下列程序,写出其功能。 import java.applet.*; import java.awt.*; import java.awt.event.*; public class Test extends Applet implements MouseListener { final int number = 5; int count = 0; Image[] card = new Image[number]; public void init() { setSize(1200,1000); addMouseListener(this); for (int i = 0; i < number; i++) { card[i] = getImage(getCodeBase(), i+".jpg"); } } public void paint(Graphics g) { if ((card[count]) != null) g.drawImage(card[count], 10,10,card[count].getWidth(this),card[count].getHeight(this), this); } public void mousePressed(MouseEvent e) { count = (count + 1) % number; repaint(); } public void mouseReleased(MouseEvent e) {} public void mouseEntered(MouseEvent e) {} public void mouseExited(MouseEvent e) {} public void mouseClicked(MouseEvent e) {} }

  • 1