鍍金池/ 教程/ Java/ SWING MouseEvent事件類
Swing JRadioButton
Swing Layout布局
Swing JTextField
Swing JLabel
Swing開發(fā)環(huán)境安裝
Swing JComponent類
SWING ActionEvent事件類
Swing JScrollBar
Swing教程首頁
Swing JFileChooser
SWING ContainerEvent事件處理類
Swing AdjustmentListener接口
Swing WindowAdapter類
SWING ComponentListener接口
Swing JMenuBar類
Swing JPanel類及實(shí)例
Swing
SWING AdjustmentEvent事件處理
Swing JWindow類及實(shí)例
Swing介紹
Swing MouseMotionAdapter類
SWING WindowEvent事件類
Swing ItemListener接口
SWING MouseEvent事件類
Swing JMenu類
SWING KeyEvent事件類
Swing MouseMotionListener接口
Swing JProgressBar
SWING AWTEvent事件類
Swing JRadioButtonMenuItem類及例子
Swing KeyAdapter類
SWING ActionListener接口
Swing LayoutManager接口
SWING MouseMotionEvent事件處理
Swing Component類
Swing Container類
Swing CardLayout布局
Swing MouseAdapter類
Swing JSlider
Swing KeyListener接口
Swing FocusAdapter類
Swing JColorChooser
Swing ImageIcon
Swing JComboBox
Swing GroupLayout布局類
Swing JOptionPane
Swing GridBagLayout布局類
Swing JMenuItem類
Swing MouseListener Interface
Swing事件適配器
SWING ComponentEvent處理類
SWING PaintEvent事件類
Swing FlowLayout布局類
SWING Event事件類
Swing FocusListener接口
Swing控件
Swing JButton
Swing JCheckBox
Swing SpringLayout布局類
Swing容器
Swing事件處理
Swing事件監(jiān)聽器
Swing Menu菜單類
Swing JList
Swing ContainerListener接口
Swing LayoutManager2接口
Swing JFrame類和實(shí)例
Swing JTextArea
SWING InputEvent事件類
Swing BorderLayout布局
Swing WindowListener接口
Swing JCheckboxMenuItem類及例子
Swing JSpinner
Swing GridLayout布局類
Swing JPopupMenu類及實(shí)例

SWING MouseEvent事件類

此事件表明在一個組件中發(fā)生鼠標(biāo)動作。這種低層次的事件所產(chǎn)生的一個組件對象的鼠標(biāo)事件和鼠標(biāo)移動事件。

  • 按下鼠標(biāo)按鈕

  • 釋放鼠標(biāo)按鈕

  • 點(diǎn)擊鼠標(biāo)按鈕(按下并釋放)

  • 鼠標(biāo)光標(biāo)進(jìn)入視野開闊的一部分組件的幾何

  • 遮掩部分組件的幾何形狀的鼠標(biāo)光標(biāo)退出

  • 鼠標(biāo)指針移動

  • 拖動鼠標(biāo)

類聲明

以下是java.awt.event.MouseEvent類的聲明:

public class MouseEvent
   extends InputEvent

字段域

以下是java.awt.event.MouseEvent類字段:

  • static int BUTTON1 --Indicates mouse button #1; used by getButton()

  • static int BUTTON2 --Indicates mouse button #2; used by getButton()

  • static int BUTTON3 --Indicates mouse button #3; used by getButton()

  • static int MOUSE_CLICKED --The "mouse clicked" event

  • static int MOUSE_DRAGGED --The "mouse dragged" event

  • static int MOUSE_ENTERED --The "mouse entered" event

  • static int MOUSE_EXITED --The "mouse exited" event

  • static int MOUSE_FIRST --The first number in the range of ids used for mouse events

  • static int MOUSE_LAST -- The last number in the range of ids used for mouse events

  • static int MOUSE_MOVED --The "mouse moved" event

  • static int MOUSE_PRESSED -- The "mouse pressed" event

  • static int MOUSE_RELEASED --The "mouse released" event

  • static int MOUSE_WHEEL --The "mouse wheel" event

  • static int NOBUTTON --Indicates no mouse buttons; used by getButton()

  • static int VK_WINDOWS --Constant for the Microsoft Windows "Windows" key.

類構(gòu)造函數(shù)

S.N. 構(gòu)造函數(shù) & 描述
1 MouseEvent(Component source, int id, long when, int modifiers, int x, int y, int clickCount, boolean popupTrigger) 
Constructs a MouseEvent object with the specified source component, type, modifiers, coordinates, and click count.
2 MouseEvent(Component source, int id, long when, int modifiers, int x, int y, int clickCount, boolean popupTrigger, int button) 
Constructs a MouseEvent object with the specified source component, type, modifiers, coordinates, and click count.
3 MouseEvent(Component source, int id, long when, int modifiers, int x, int y, int xAbs, int yAbs, int clickCount, boolean popupTrigger, int button) 
Constructs a MouseEvent object with the specified source component, type, modifiers, coordinates, absolute coordinates, and click count.

類方法

S.N. 方法 & 描述
1 int getButton() 
Returns which, if any, of the mouse buttons has changed state.
2 int getClickCount() 
Returns the number of mouse clicks associated with this event.
3 Point getLocationOnScreen() 
Returns the absolute x, y position of the event.
4 static String getMouseModifiersText(int modifiers) 
Returns a String describing the modifier keys and mouse buttons that were down during the event, such as "Shift", or "Ctrl+Shift".
5 Point getPoint() 
Returns the x,y position of the event relative to the source component.
6 int getX() 
Returns the horizontal x position of the event relative to the source component.
7 int getXOnScreen() 
Returns the absolute horizontal x position of the event.
8 int getY() 
Returns the vertical y position of the event relative to the source component.
9 int getYOnScreen() 
Returns the absolute vertical y position of the event.
10 boolean isPopupTrigger() Returns whether or not this mouse event is the popup menu trigger event for the platform.
11 String paramString() 
Returns a parameter string identifying this event.
12 void translatePoint(int x, int y) 
Translates the event's coordinates to a new position by adding specified x (horizontal) and y (vertical) offsets.

方法繼承

這個類從以下類繼承的方法:

  • java.awt.event.InputEvent

  • java.awt.event.ComponentEvent

  • java.awt.AWTEvent

  • java.util.EventObject

  • java.lang.Object