[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


Changing from Choice to JComboBox

Posted on 2004-10-22
Medium Priority
Last Modified: 2010-03-31
I have a object for choice and i add the items to the choice object.

then i have a select method of choice to select the item in the choice box.

now i am changing to JComboBox instead of Choice

how can i select the item in the JComboBox.

here is a piece of my code:

public class choicedemo{
private Choice portChoice;

 portChoice = new Choice();


now i have to change my choice object to JComboBox object

do i have any methods in JComboBox as

how can i access the items in the JComboBox.

With regards


Question by:ashok3sep
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
LVL 37

Expert Comment

ID: 12378805
LVL 37

Accepted Solution

zzynx earned 100 total points
ID: 12378817
>> how can i select the item in the JComboBox.
You can use  
      setSelectedIndex(int anIndex)     // passing an index
      setSelectedItem(Object anObject) // passing an objec
LVL 37

Expert Comment

ID: 12378822
>> how can i access the items in the JComboBox.
        Object getItemAt(int index)
LVL 37

Expert Comment

ID: 12380055
Thanks for accepting

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question