aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes About KeyEvent Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "About KeyEvent" Watch "About KeyEvent" New topic
Author

About KeyEvent

Shaan Shar
Ranch Hand

Joined: Dec 27, 2005
Posts: 1249

Actually recently I saw an article on

Use the Robot Class for Automatic Keyboard and Mouse Control

In that article they have taken only 1 button on the screen and when they were coding like this.



Now as the same code given above we can also handle window events..

Now I want to minimize all the windows open so that I can come directly to Desktop.

I have tried to search the KeyEvent key for this action But I am unable to find that.

Could anybody tell me how to peform this action. I am working on Windows XP M/C.

[ August 29, 2006: Message edited by: Ankur Sharma ]
[ August 29, 2006: Message edited by: Bear Bibeault ]

The Best way to predict your future is to create it - Every great individual common man
Shaan Shar
Ranch Hand

Joined: Dec 27, 2005
Posts: 1249

No Replies till now, I think I haven't cleared the question properly..


I again clear myself, as we use



In that same way is there any key by which we can minimize all open windows and come to dektop directly.

In Microsoft friendly keyboards we have a key "Window" and by pressing Window+D. We can directly come to dekstop.

It is same as by pressing Window+F key we can directly open the Find Dialog. By which we can find "file and folders" etc.

I hope this time I cleared the problem. Now I am waiting for the generous replies for this query.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
not sure I'm reading this correctly - you want to go directly to the desktop
on pressing one key (instead of 2 keys - windows + D).

if so, try this (for 1.5+)
I'm currently using 1.4, so this is untested, but should work.

press F2 from any of the textfields

Shaan Shar
Ranch Hand

Joined: Dec 27, 2005
Posts: 1249

Thanks for your quick reply Micheal, But I am also using JDK 1.4 and this key

is not working in 1.4


COuld anyone suggest me how to implement this key in JDK 1.4
Shaan Shar
Ranch Hand

Joined: Dec 27, 2005
Posts: 1249

??
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

If the windows key isn't working out for you - here is another idea -

Doing some checking on how the "Show Desktop" command works on my computer, and some searching on google - I found you could execute the "Show Desktop" command through the Java Runtime.exec() method.

First I went properties of the "Show Desktop" shortcut on my quicklaunch toolbar - this goes to a .scf file that you can edit - it contains some cryptic stuff - but looks easy enough to understand. I did a search on .scf files - they are some kind of proprietary Microsoft command scripting for Explorer. The .scf file in your quicklaunch directory shows you exactly the command needed to clear the desktop - but now you have to get explorer to run it...

First, I tried to just pass it to explorer - but this causes a big, ugly "Warning! You may be downloading something dangerous!... etc. etc." sort of dialog to display before giving a choice to run it or not. It does work if you push "Open" and choose to run it, but this isn't a good way to go about this...

Next, I found that by default all windows machines make the default program associated with .scf files explorer - so I looked up some code I remembered seeing about executing programs associated with file types in windows through Java's Runtime.exec()... Here's a discussion on the Sun Java Forums about it. Be sure to have some code to choose the command format appropriate to your OS version.

I copied the "Show Desktop.scf" into the local directory, renamed it to "myshow.scf", and was able to minimize all windows by typing

on the command-line. No annoying warning dialog this time! Success!


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Shaan Shar
Ranch Hand

Joined: Dec 27, 2005
Posts: 1249

Thankx Nathan,

For your quick response, but it's not working on my Machine.

Infact I am not able to see any this type of .scf. Which .scf I found was explorer.scf, Which usage is well known and right now it's not usefull for me. Could anyone suggest me some other alternative to track Window key on Windows System with Microsoft compatible KeyBoards...

Any input will be appreciated.
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

My "Show Desktop.scf" contained the following -



See if that toggles the desktop if you copy that into your own .scf file and run it.
 
Consider Paul's rocket mass heater.
 
subject: About KeyEvent