Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / February 2008

Tip: Looking for answers? Try searching our database.

getting a mouse event without using applet

Thread view: 
itayber - 18 Jan 2008 20:47 GMT
hello all.

im writing a client for a web service and i want it to start when the
user press a key in the keyboard and clicks the right click in the
mouse (like babylon).
i saw alot of solutions butt all using applet, and the mouse event
only works when the mouse inside the applet. i need the program to
start when ever the mouse is on a textfield (in explorer, forefox and
even word).

any ideas?

thanks alot
Roedy Green - 19 Jan 2008 03:01 GMT
On Fri, 18 Jan 2008 12:47:24 -0800 (PST), itayber
<itayberman1@gmail.com> wrote, quoted or indirectly quoted someone who
said :

>i saw alot of solutions butt all using applet, and the mouse event
>only works when the mouse inside the applet. i need the program to
>start when ever the mouse is on a textfield (in explorer, forefox and
>even word).

I think any solution that works in an Applet would also work in a
regular app.  At any rate see
http://mindprod.com/products.html#KEYPLAYER
for how to do it.
Signature

Roedy Green, Canadian Mind Products
The Java Glossary, http://mindprod.com

Matt Humphrey - 19 Jan 2008 17:21 GMT
> hello all.
>
[quoted text clipped - 5 lines]
> start when ever the mouse is on a textfield (in explorer, forefox and
> even word).

What kind of client are you talking about?  It sounds as if you want your
(presumably Java) program to start or perform some function when the user
enters a text field in some other program, such as a field of the browser or
text in Microsoft World or some other application.  Is that what you mean?
If you mean only without your own application, follow Roedy's advice.

Generally speaking, latching into another program is a seriously difficult
if not downright impossible task.  Maybe someone else can provide a better
answer for that than I can.

As for browsers, however, you can attach event handlers in JavaScript (not
Java) to text fields in web pages you produce yourself, but these would
still end up invoking an applet, which is otherwise the only way to execute
client functionality in the browser.  As for attaching an event handler to a
text field you did not create, I think it is a security violation (or should
be) for JavaScript on one web page to access data from a different page
(different domain).  If it weren't, you could quietly pickup passwords and
we know that's not allowed.

Can you explain a bit more what you're trying to do?

Matt Humphrey http://www.iviz.com/
bhindrawaletigerstyle@gmail.com - 04 Feb 2008 16:48 GMT
> > hello all.
>
[quoted text clipped - 28 lines]
>
> Matt Humphreyhttp://www.iviz.com/

hello sir/madam,
i Mst. Manminder Singh need some help regarding the use of mouse-
listener class in my java application
as i am new to this language i dont know how to use this predefined
class with its inbuilt functions like on mouse-clicking we get the
that text to be printed on text-area.
please reply me to the earliest, waiting for your response. please
attach any sample program without the use of applet.
Matt Humphrey - 04 Feb 2008 22:15 GMT
On Jan 19, 10:21 pm, "Matt Humphrey" <ma...@iviz.com> wrote:

> hello sir/madam,
> i Mst. Manminder Singh need some help regarding the use of mouse-
[quoted text clipped - 4 lines]
> please reply me to the earliest, waiting for your response. please
> attach any sample program without the use of applet.

I'm not sure what you're asking, or whether your question is related to the
prior discussion.  A Java application (GUI) can detect mouse clicking by
adding a MouseListener or MouseAdapter to an existing GUI component.  The
listener or adapter will receive method calls as the mouse is clicked,
pressed, released, etc.  This tutorial explains in detail how to do this

http://java.sun.com/docs/books/tutorial/uiswing/events/mouselistener.html

but generally you would say:

myComponent.addMouseListener (new MouseAdapter () {
 public void mouseClicked (MouseEvent e) {
   // Put your code to do something on the click here
 }
}

Many GUI components (trees, text areas, tables, buttons, etc) already
understand how to process mouse events specific to their own function, so
you would not use this with them.  You'll have to say more about what you're
trying to do.

Matt Humphrey http://www.iviz.com/


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.