Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Other Java > Java GUI
Java GUI Discussions specific to programming Java GUI.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java GUI section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old August 28th, 2003, 06:37 AM
Authorized User
Join Date: Jul 2003
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default User can add Item in JComboBox list ??

Hi all friends,
I have developed one swing client interface on that interface i have added JComboBox,Now I want to give facility to user so that they can add more item in JComboBox list because it's my client requirement, for that I have provided one JTextField and one "Save" button on my swing client interface,Now I want that when user write more item in textfield and click on Save button that item should save in my String array list of JComboBox and user can see that item in the list of JComboBox.Can any one please guide me how I can do that.Any help will be highly appreciated.

Thanks & Regards

Old February 12th, 2004, 12:46 AM
Authorized User
Join Date: Oct 2003
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to mrafaqi Send a message via Yahoo to mrafaqi

   yes, a JComboBox is realy for adding items, you can do it as

   make a String array
    like as
     String[] comboBoxItems = {"1st Item", "2nd Item", "third Item"};

  then make a JComboBox as
    JComboBox comboBox = new JComboBox(list)


Old March 20th, 2004, 05:43 PM
Registered User
Join Date: Mar 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts

you can also use this
      comboBox.addItem( "new item" );


Similar Threads
Thread Thread Starter Forum Replies Last Post
Invisible List Item? The Duke ASP.NET 3.5 Professionals 0 September 1st, 2008 12:14 PM
cannot add a new item to this menu ... paulmarshall General .NET 0 April 18th, 2007 03:03 PM
Get the first item of a List hpox ASP.NET 2.0 Basics 1 February 16th, 2007 06:04 PM
Can I add a JComboBox twice to the same jpanel david.byrne Java GUI 4 May 14th, 2005 11:42 AM
add conditional DataList item jtyson ASP.NET 1.0 and 1.1 Basics 1 July 1st, 2003 01:10 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.