How to show images and text together in textfield or textbox.

I want to show text and image both in text field or text box or any other container. I actually want to make an messaging application like msn message chat. Where user can add emotion along with their text messages.Do any one have any idea how to do this?
[269 byte] By [Atiqea] at [2007-11-27 3:18:31]
# 1

You must make your own customItem.

The paint method can draw image and drawString based on keypressed for textbox, you can also draw border around etc.

see that: http://developers.sun.com/techtopics/mobility/midp/ttips/customitem/

You can intercept the item focus and movement by implementing traverse method:

http://developers.sun.com/techtopics/mobility/midp/ttips/customitemtraversal/index.html

PeppeMEa at 2007-7-12 8:21:09 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 2
Thanx for reply. I got your point but how can i send a graphical component through sms.
Atiqea at 2007-7-12 8:21:09 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 3
You can store in the jar file any emoticon in png format.When your sms have a particular code you can parse this code and show the right emoticon bypassing code text and showing only the text not equals to any code.
PeppeMEa at 2007-7-12 8:21:09 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 4

I am already working on somrthing like that. But now i want to make a pop up window which will shows all available emotions in it. And tell user to pick one. And the code of that pick will be entered in place on image.

How to do so. I tried to make a Image Selector but it am a new with J2ME. So io i failed. Can you tell me how to make an image selector for J2Me?

Atiqea at 2007-7-12 8:21:09 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 5

You must load in memory an image[][] matrix

You can make a canvas and display all the emoticon in a virtual matrix.

With this solution you must calculate the various coordinate of each image.

In alternative you can try the org.netbeans.microedition.lcdui.TableModel/items etc midp component (you can find it by installing netbeans + mobility pack)

when the user choose an emoticon you close the canvas and update the string message by adding the emoticon code and not showing this code in textfield.

PeppeMEa at 2007-7-12 8:21:09 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 6

I have parsed the input string from the user and and than get the image and text tokens and shown them in form. And it solved the problem. But now i am getting a new problem. I dont know how to go back to previous page. When i try to use form of previous page it give me error of security.

How to solve that. ?

Atiqea at 2007-7-12 8:21:09 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 7
Switching between form or canvas is simple, you can do it by using display.setCurrent.In my project I use a displayble java.util.stack in order to manage the various displayable component.Security problem is strange.. post the code.
PeppeMEa at 2007-7-12 8:21:09 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 8

I am using differnt classes i have a main calss which is a Midlet and than an other class which is a form. Now The midlet has its own form which display initial contents of the application. and than the Other Form class is called to display. But when i try to go back to midlet form The following error occur.

java.lang.SecurityException: Application not authorized to access the restricted API

at com.sun.midp.security.SecurityToken.checkIfPermissionAllowed(+40)

at com.sun.midp.security.SecurityToken.checkIfPermissionAllowed(+7)

at com.sun.midp.midletsuite.MIDletSuiteImpl.checkIfPermissionAllowed(+8)

at com.sun.midp.midlet.MIDletState.<init>(+83)

at javax.microedition.midlet.MIDletProxy.<init>(+5)

at javax.microedition.midlet.MIDlet.<init>(+13)

at com.kraysis.NokiaSMSSolution.WMAExample.<init>(+4)

at com.kraysis.NokiaSMSSolution.ImageTextField.<init>(+13)

at com.kraysis.NokiaSMSSolution.WMAExample$2.run(+23)

I think When i create an object of Midlet class than it give me this error.

Atiqea at 2007-7-12 8:21:09 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 9
The problem is the WMA api that you use in the form not the form passage from one to another.
PeppeMEa at 2007-7-12 8:21:09 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 10

Thanx for your support. But i have done it. I think WMA donot let Mildlets extended class to create instance. But any how i passed thr required fields like display and form as arguments to My handler class and get the required results. And i have done that. At last.

But now can you tell me how to check message receiving in a simulator?

Atiqea at 2007-7-12 8:21:09 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 11
In the emulator there are a set of utilities, Find the WMA CONSOLE
PeppeMEa at 2007-7-12 8:21:10 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 12
Sorry but i dont get your point. How can i test message receiving using WMA consol. Can you explain that !
Atiqea at 2007-7-12 8:21:10 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 13
Can we read SMS Messages from the Inbox. If yes than how ?And how to make a browser for selecting messages from the inbox?
Atiqea at 2007-7-12 8:21:10 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 14
I have found WMA consol. I tried it. Now how can i attach my own code with this console. .
Atiqea at 2007-7-12 8:21:10 > top of Java-index,Java Mobility Forums,Java ME Technologies...