Results 1 to 5 of 5
  1. #1
    ChrisMayhew is offline Member
    Join Date
    Jan 2009
    Posts
    32
    Rep Power
    0

    Default [SOLVED] Text Box Help

    Java Code:
    import javax.microedition.lcdui.*;
    public class TextMessagingForm extends Form {
      private TextField mAddressField, mTextField;
      private TextBox mMsg;
    
      public TextMessagingForm() {
        super("New message");
        mAddressField = new TextField("Mobile Number:", "", 20,
            TextField.PHONENUMBER);
        mMsg = new TextBox(null, "Message:", 120, 0x0);
        append(mAddressField);
        append(mMsg);
    
      }
    
      public String getAddress() {
        return mAddressField.getString();
      }
    
      public String getMessage() {
        return mMsg.getString();
      }
    }
    Hello

    I am making a SMS application for my Uni course work and I am having some trouble with this part: "append(mMsg);" This part says: cannot find symbol???

    Any ideas? Any help would be great.

    Maybe I am doing the text box wrong or something I don't know, I found that code for a text box on a web site on google.

    Thanks,
    Chris

    Edit:
    Just to add this form is in a separate .java file than my main code and its just sort of imported into and displayed.

    Also I am not sure if this is the right forum for this or not, if not then im sorry :)
    Last edited by ChrisMayhew; 05-04-2009 at 01:33 PM.
    -----
    Chris

  2. #2
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    836
    Rep Power
    6

    Default

    Iam not sure about thius microedition.But as per the api if u want to store some text u have to use
    setString as per the api
    gothru this link

    Java > Java SE, EE, ME > javax > microedition > lcdui > TextBox _ Java API By Example, From Geeks To Geeks.
    Ramya:cool:

  3. #3
    ChrisMayhew is offline Member
    Join Date
    Jan 2009
    Posts
    32
    Rep Power
    0

    Default

    Quote Originally Posted by RamyaSivakanth View Post
    Iam not sure about thius microedition.But as per the api if u want to store some text u have to use
    setString as per the api
    gothru this link

    Java > Java SE, EE, ME > javax > microedition > lcdui > TextBox _ Java API By Example, From Geeks To Geeks.
    Thanks for the reply, I am not trying to store text. This is trying to display the text box on the form so that the users can type in text and then it gets sent as an SMS.

    Not sure if what your saying will do that. Not too good with Java :)
    -----
    Chris

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,251
    Rep Power
    19

    Default

    You can't append a TextBox to a Form. TextBox inherits from Displayable, not Item.

    You can however Display#setCurrent the TextBox to display it.

    db

  5. #5
    ChrisMayhew is offline Member
    Join Date
    Jan 2009
    Posts
    32
    Rep Power
    0

    Default

    Thanks guys, I decided that I would just use a text field to keep it simple rather than messing up the code that I had working.

    :)
    -----
    Chris

Similar Threads

  1. Replies: 2
    Last Post: 01-23-2009, 04:09 PM
  2. printing simple text as text on printer
    By Nicholas Jordan in forum Advanced Java
    Replies: 0
    Last Post: 12-01-2008, 01:42 AM
  3. find and replace text from a text file
    By gezzel in forum New To Java
    Replies: 2
    Last Post: 09-19-2008, 04:04 PM
  4. Replies: 0
    Last Post: 05-26-2008, 04:26 PM
  5. map javax.swing.text.Element to javax.swing.text.View
    By elizabeth in forum New To Java
    Replies: 1
    Last Post: 07-30-2007, 07:02 PM

Posting Permissions

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