The Artima Developer Community
Sponsored Link

Java Answers Forum
Event Handlers

2 replies on 1 page. Most recent reply: Aug 28, 2006 10:38 PM by prakash

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
prakash

Posts: 3
Nickname: mraprak
Registered: Jul, 2005

Event Handlers Posted: Aug 23, 2006 9:10 AM
Reply to this message Reply
Advertisement
Hi,

Could you please suggest a way to implement the following requirement in JSP?
Consider the following text is present in a JSP Page.

"This is a sample text"

When the user do a "double click" on any of the above words, i need to invoke a servlet. Is there any way to capture the 'double click' event.

Thanks!
Prakash A


Lewis MacKenzie

Posts: 1
Nickname: lamb86
Registered: Aug, 2006

Re: Event Handlers Posted: Aug 28, 2006 2:33 AM
Reply to this message Reply
Use an inner class that extends MouseAdapter and override the mouseClicked() method.

addMouseListener(new MouseHandler());

private class MouseHandler extends MouseAdapter
{
public void mouseClicked(MouseEvent e)
{
if (e.getClickCount() >= 2)
{
//blah blah
}
}
}

prakash

Posts: 3
Nickname: mraprak
Registered: Jul, 2005

Re: Event Handlers Posted: Aug 28, 2006 10:38 PM
Reply to this message Reply
Hi,

Thanks!

Let me explain what exactly my requirement is.

JSP file has the following sentence.
"parameter1 parameter2 parameter3"

If the user, double clicks on any of the parameter i need to invoke a servlet and pass that particular parameter to the servlet.

How to accomplish it?

Flat View: This topic has 2 replies on 1 page
Topic: Choosing a Parser Previous Topic   Next Topic Topic: Jbutton model or view controller in mvc

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use