views:

758

answers:

5

Hi, i am quiet new to J2ME GUI programming (or developing with java in general), so this question might sound very basic to some of you. I am going to ask it anyway since i can't figure out how to do this. Here it is:

I programmed a bluetooth TV-Remote control for cellphones in J2ME using javax.microedition.lcdui.* (Gauge, List, ChoiseGroup) GUI-Elements, but since i want realtime interaction with my TV, i would like to find way to send user inputs performed with the GUI-Elements immediately (e.g. changing the channel, or changing the volume) to the TV. Using javax.microedition.lcdui.Command / CommandListner and commandAction won't work since these need only recognize the commands selected with the side buttons. I would like to have something that can recognize any key pressed. I.e. if i increase the Gauge with the cursor keys, this changes need to be send to the TV in realtime (as they are pressed). I discovered that Javax.microedition.lcdui.Canvas.keyPressed can handle any key pressed on the cellphone, but i don't know how to make Canvas work with MIDP GUI elements like Gauge. They can't be added like Commands.

Is there a easy way to do this, or do i have to figure out way to build a interface for these GUI elements to make them work with Canvas.

Thanks in advance!

Best regards,

zhengtonic

A: 

From what I saw this can only be done using a Canvas.

Joachim Sauer
+1  A: 

According to this FAQ you can't do what you are asking for. This is about MIDP 1.0, but I believe it also applies for MIDP 2.0. If it is only a gauge you need, you can easily paint it yourself.

kgiannakakis
+1  A: 

I just found a half solution myself, if anyone is interested: "javax.microedition.lcdui.ItemStateListener". This function can handle the states (or state changes) of the GUI items in realtime. Its not keyPress, but this will work as well for my application.

zhengtonic
A: 

I will strongly recommend that you should either draw your Gauge-like item on a Canvas object or you follow the advice given on Dec 19 at 15:00 by "zhengtonic". I dont know any other approach to this problem, I was once there but used the first options provided by me

A: 

Q1.how to file transfer,encrypt & decrypt (rsa-asymmetric algo.) the file via bluetooth in j2me

Q2 How they exchange keys? for encryption

Q3 How the sender get the key for encryption

please give me the answer it is challenge for you. Thanks for ans giving i aspect.

chirag