• 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
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

Robot - can't get symbols: !@#$^&*()_+

 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys,

I was wondering why in the following code the output is: "~%" and not "~!@#$%^&*()_+"

1. Open a textpad (before you run it)
2. Run the code
3. Go to the textpad and clickin (so the cursor is in the textpad)

Thanks

 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Robot class is not very smart. The combination of key codes you need to use is keyboard dependent. You can't always just use the key code of the character you want when a shift is also required. You need to use the key code of the character of the key you actually press. For example on my keyboard I would use:



Next I changed your do type methods so that the key events are generated in the proper order:

 
Adrian Burlington
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Got it! thanks, using the SHIFT (this will not work on a non QWERTY keyboard) but that's not a problem on my end. THANKS!!!
 
My honeysuckle is blooming this year! Now to fertilize 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