Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > JButton auto click

Reply
Thread Tools

JButton auto click

 
 
patrick
Guest
Posts: n/a
 
      04-02-2004
I want to use a JButton like this: when a user leaves the mouse pointer in a
fixed position over the button a click is generated without the user having
to do the mousepress.

Ive got an array of JButtons on a JPanel that i would like to have this
property.

Anybody know of a java code snippet that would help in doing this.

Or is there an easy way of doing this?

TIA
patrick

Wonder if this


 
Reply With Quote
 
 
 
 
Steve W. Jackson
Guest
Posts: n/a
 
      04-02-2004
In article <8%ebc.3043$(E-Mail Removed)>,
"patrick" <(E-Mail Removed)> wrote:

>:I want to use a JButton like this: when a user leaves the mouse pointer in a
>:fixed position over the button a click is generated without the user having
>:to do the mousepress.
>:
>:Ive got an array of JButtons on a JPanel that i would like to have this
>roperty.
>:
>:Anybody know of a java code snippet that would help in doing this.
>:
>:Or is there an easy way of doing this?
>:
>:TIA
>atrick
>:
>:Wonder if this


If I were to see an app/applet with this behavior, I'd probably refuse
to use it. But you should be able to do it if you're really insistent.

One way might be this. Since JButton inherits from Component, you can
add a MouseListener to it. When you get a mouseEntered event, you could
set up a timer (if you want a delay) and start it, and then stop the
timer on mouseExit. And the timer's job would essentially be to call
doClick() on the button.

= Steve =
--
Steve W. Jackson
Montgomery, Alabama
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto Shipping Auto Shipping Scheduling:car moving auto transport linkswanted ASP .Net 1 11-22-2013 07:02 AM
SIngle-click on JButton registers multiple times - why? Todd Java 5 08-23-2007 10:05 AM
Display Multiple icons on a single JButton after each click arash470@googlemail.com Java 1 02-14-2007 07:58 AM
return a String on click of a JButton Allan Bruce Java 3 06-15-2004 05:01 PM



Advertisments