• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

how to get # key when button is press?

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear all,

i'm developing a Midlet application using the netbeans IDE.
i facing some problem where if i want to key in # or * from the emulator, i just can't get it right.

1.when i press the button which have # key(because this button have #-+ and space together) what i always get is - or + or space.
how can i code it so that i can get to display the # key when i press on that button?

2.the other question is when developing a database application, is using RMS or JDBC better?
my application will deal with 1000++ data. can we apply JDBC into mobile phone?

3.How to know which button of the mobile phone is pressed? is using the "itemStateChanged" able to do this?
can you show me the example? what should i put in the "if" statement, if i want to capture the button of number 6 is pressed?
Some example i get it from internet.
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
//label.setVisible(true);
} else {
// label.setVisible(false);
}

Thanks.

 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
There is no key event in the TextBox.
you can use canvas for getting Key Event.

You can use only RMS for database connectivity.you cant use JDBC directly in device.


regards
 
Vincent Tan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Gopinath Karyadath,

Thanks for the answer.
i have try canvas in my midlet and it able to capture the keypress.
But this method is a bit troublesome as what i want to get is something like this:

at the emulator screen (when key is press)
________________________

888888#99#100*10
111111#99#100*10

________________________

if i want to display the above value, i have to store it into a string and repaint it when ever a key is press in order to show the string.
Is there a more simple way to do it?

the textbox with numeric type able to display number only but no the # and the *.
is there any other way?


 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
vb EndUser welcome to JavaRanch , please check your private messages.
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use the TextField.ANY field and have a state listener whenever user enters a value the state changed will fire up, tell the user that the text field takes only numeric input.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic