• 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

reading only one char from user input

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

i'm new to j2me, i have a simple question. I read about High-User interface and low user interface and found no solution to get only one char from the user input. for example: is it possible to get 'b', if the button '2' was pressed twice? do i have to use a Form? Can i use a form without showing the form?

Thanks and sorry for my poor english
 
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hiya Kay,

You have a few options:

1. You could use a textbox and set the maxSize of it to 1, so the user can only enter one charachter or digit.
2. You could use a Form containing a TextField, and change it's properties similarly to get one charachter or digit from the user.

But those will both be displayed on the screen. If you want to do it without the user seeing what's going on, you could...

3. Use a Canvas, utilising it's KeyPressed(int keyCode) method that detects when a key has been pressed. Canvas is a bit more difficult to use, but gives you loads of control.

Cheers,
James
 
Kay Tracid
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, i did it like 3.
reply
    Bookmark Topic Watch Topic
  • New Topic