×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    35

    Post Adding TextBox in Canvas

    Hello,
    In my game canvas I want a TextBox to input text.

    This is my method

    private TextBox playerTextBox(){

    TextBox myTextBox =null;
    myTextBox = new TextBox("", "", 50, 100);
    return myTextBox;


    }

    How can I set the textBox in canvas? how can I set the position of the text box in canvas?

    I have searched a lot but didn't found any clear answer.Somebody says that it is not possible
    because the textbox is High level APIbut the canvas is the low level.

    I want a textField to get the name of the player to save the record after finishing the game.

    Please help me with ideas.

    Thx in advance.

    Amin

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Adding TextBox in Canvas

    A TextBox is a Displayable object, the same as Canvas. You can only display one Displayable, so you can display a Canvas, or a TextBox, never both.

    You will need either to switch Displayable (by calling Display.setCurrent()), or implement your own text input by hand (a lot of effort!).

    Graham.

  3. #3
    Regular Contributor
    Join Date
    Dec 2007
    Posts
    159

    Re: Adding TextBox in Canvas

    if u want to implement your own text input then below url is helpful to you
    http://www.java2s.com/Open-Source/Ja...creen.java.htm
    here loginscreen create in canvas.

  4. #4
    Registered User
    Join Date
    Oct 2008
    Posts
    35

    Re: Adding TextBox in Canvas

    Quote Originally Posted by sis1987 View Post
    if u want to implement your own text input then below url is helpful to you
    http://www.java2s.com/Open-Source/Ja...creen.java.htm
    here loginscreen create in canvas.
    Thx a lot sis1987. Thats a great help.

Similar Threads

  1. how can call TextBox in Canvas ???
    By mahdi68 in forum Mobile Java General
    Replies: 3
    Last Post: 2009-11-10, 20:49
  2. textbox in canvas using PyS60
    By rabeehkm in forum Symbian
    Replies: 1
    Last Post: 2009-06-02, 13:21
  3. Displaying Textbox In Canvas
    By satyarajasekhar in forum Mobile Java General
    Replies: 1
    Last Post: 2007-12-28, 18:25
  4. Major problem with delegation to Canvas
    By bartekn in forum Mobile Java Media (Graphics & Sounds)
    Replies: 8
    Last Post: 2003-10-08, 17:46
  5. Help!--Display TextBox upon Canvas
    By FriedDragon in forum Mobile Java General
    Replies: 0
    Last Post: 2003-07-31, 09:04

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×