The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
December 2000

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

mouse clicks (part 2)..

Posted by stuart on December 19, 2000 at 12:34 PM

hi .. i found this fragment on the net..it is small but helps me to understand some features.. can we think on this fragment ? i am looking forward for comments..

ps: thanks kishori

//**********

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

public class EventTest extends JFrame {

public EventTest() {
JButton jb1=new JButton("hello");
getContentPane().add(jb1);

//AWTEventListener
getToolkit().addAWTEventListener(
new AWTEventListener() {
public void eventDispatched(AWTEvent e) {
System.out.println(e+"\n");
}
}, AWTEvent.MOUSE_EVENT_MASK |
AWTEvent.FOCUS_EVENT_MASK
);
}

public static void main (String args[]) {

EventTest et=new EventTest();
et.setSize(300,300);
et.pack();
et.show();
}
}

//**********



Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us