getting a mouse event without using applet

I

itayber

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
 
R

Roedy Green

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.
 
M

Matt Humphrey

itayber said:
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).

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/
 
B

bhindrawaletigerstyle

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 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.
 
M

Matt Humphrey

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.

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/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top