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

x
?
Solved

Changing from Choice to JComboBox

Posted on 2004-10-22
4
Medium Priority
?
186 Views
Last Modified: 2010-03-31
Hallo,
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();
          portChoice.addItemListener(this);
          add(portChoice);
          listPortChoices();
          portChoice.select(parameters.getPortName());

}

now i have to change my choice object to JComboBox object

do i have any methods in JComboBox as
(JComboBoxobject).select();

how can i access the items in the JComboBox.


With regards

Ashok.G

0
Comment
Question by:ashok3sep
[X]
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
4 Comments
 
LVL 37

Expert Comment

by:zzynx
ID: 12378805
0
 
LVL 37

Accepted Solution

by:
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
or
      setSelectedItem(Object anObject) // passing an objec
 
0
 
LVL 37

Expert Comment

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

Expert Comment

by:zzynx
ID: 12380055
Thanks for accepting
0

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