• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

About KeyEvent

 
Ranch Hand
Posts: 1252
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Shaan Shar
Ranch Hand
Posts: 1252
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1252
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1252
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
??
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Shaan Shar
Ranch Hand
Posts: 1252
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
ice is for people that are not already cool. Chill with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic