File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java Micro Edition and the fly likes how to create a textfield in canvas Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "how to create a textfield in canvas" Watch "how to create a textfield in canvas" New topic
Author

how to create a textfield in canvas

Bikesh maharjan
Greenhorn

Joined: Mar 04, 2011
Posts: 1
hello

can anybody tell me how to create a textfield in canvas??

thanks
Giovanni Lima
Greenhorn

Joined: Mar 08, 2011
Posts: 13
I belive that isnt possible, because, textfield can only be attached in form component..
Look for JME documentation to figure out more details
Muzaffar Shah Khan
Greenhorn

Joined: Feb 13, 2010
Posts: 7
Yes its not possible to use form and canvas components together ! According to me but there must be some other way out for it i guess.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16061
    
  21

Technically, you can't create a textfield in a canvas, but I think you can create a textfield overlay on a canvas. By which I mean that the 2 controls (textfield and canvas) occupy the same part of the screen (layout manager permitting), but the Z order of the textfield puts it in front of the canvas.

Just be careful when implementing the paint code so that the canvas does, in fact render behind the text control!


Customer surveys are for companies who didn't pay proper attention to begin with.
Vijay Dogra
Greenhorn

Joined: Sep 16, 2004
Posts: 22
Yes, You can create textfield using Canvas, though its quite lengthy and difficult

1. Override the paint method
2. Draw rectangle and use the font to be used to type
3. Override keypressed event and check which key is pressed and repaint it.

These are just guideliness.
Vijay Dogra
Greenhorn

Joined: Sep 16, 2004
Posts: 22
Check this link

http://discussion.forum.nokia.com/forum/showthread.php?49518-textfield-on-canvas
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to create a textfield in canvas