Results 1 to 2 of 2

Thread: Java - Add items to a listbox from a textbox

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2007
    Posts
    341

    Java - Add items to a listbox from a textbox

    Hi everybody,
    please can someone show me a simple code to transfer data entered into a textbox to a listbox.

    I have a GUI which contains a Listbox, a textbox and a command button.
    My objective is to enter some data in the textbox, press the command button(ENTER) and the data is transfered to the listbox.

    Any input will be greatly appreciated.
    GiftX.

  2. #2
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: Java - Add items to a listbox from a textbox

    Code:
    selectedDomains.addElement(jTextFieldDomain.getText());
    jListDomain.setListData(selectedDomains);
    where selectedDomains is a Vector
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

Posting Permissions

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



Click Here to Expand Forum to Full Width