14.03.2018 Views

AWT Tutorialspoint Simply Esay Learning

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>AWT</strong><br />

3<br />

4<br />

5<br />

6<br />

7<br />

8<br />

Invoked when a mouse button is pressed on a component and then<br />

dragged.<br />

void mouseEntered(MouseEvent e)<br />

Invoked when the mouse enters a component.<br />

void mouseExited(MouseEvent e)<br />

Invoked when the mouse exits a component.<br />

void mouseMoved(MouseEvent e)<br />

Invoked when the mouse cursor has been moved onto a component, but<br />

no buttons have been pushed.<br />

void mousePressed(MouseEvent e)<br />

Invoked when a mouse button has been pressed on a component.<br />

void mouseReleased(MouseEvent e)<br />

Invoked when a mouse button has been released on a component.<br />

void mouseWheelMoved(MouseWheelEvent e)<br />

Invoked when the mouse wheel is rotated.<br />

Methods Inherited<br />

This class inherits methods from the following classes:<br />

<br />

java.lang.Object<br />

MouseAdapter Example<br />

Create the following java program using any editor of your choice in say D:/ ><br />

<strong>AWT</strong> > com > tutorialspoint > gui ><br />

AwtAdapterDemo.java<br />

package com.tutorialspoint.gui;<br />

import java.awt.*;<br />

import java.awt.event.*;<br />

public class AwtAdapterDemo {<br />

private Frame mainFrame;<br />

private Label headerLabel;<br />

private Label statusLabel;<br />

private Panel controlPanel;<br />

public AwtAdapterDemo(){<br />

prepareGUI();<br />

}<br />

172

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!