This discussion is archived
3 Replies Latest reply: May 7, 2007 6:58 PM by 807597 RSS

reading data from textbox

807597 Newbie
Currently Being Moderated
i have a textbox with button, if i execute a button it has to start the backend console program and if i submit the some data through textbox that console programhas to read that data and save it.how will do this..help me plz..

thx
  • 1. Re: reading data from textbox
    807597 Newbie
    Currently Being Moderated
    i have a textbox with button, if i execute a button
    it has to start the backend console program and if i
    submit the some data through textbox that console
    programhas to read that data and save it.how will do
    this..help me plz..

    thx
    textbox ? may be you mean JTextField or JTextArea

    to set value to JTextField/JTextArea use 'setText' method
    to get value from JTextField/JTextArea use 'getText' method

    for details you can read API doc about JTextField and JTextArea
  • 2. Re: reading data from textbox
    807597 Newbie
    Currently Being Moderated
    Add a JTextField and a JButton to a container, then have the container implement ActionListener. Then check the source or the actionCommand in method actionPerformed, and proceed accordingly. This is to let your console easily work with the text from the textfield, and there is no need for a socket at this point.
  • 3. Re: reading data from textbox
    807597 Newbie
    Currently Being Moderated
    PrintStream, FileOutputStream, FileWriter should all help you to save it to a file.