Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Storing object into JList

Posted on 2003-11-27
7
Medium Priority
?
285 Views
Last Modified: 2010-03-31
Is there any way that I can store object to JList?
0
Comment
Question by:dkim18
  • 4
  • 3
7 Comments
 
LVL 92

Expert Comment

by:objects
ID: 9834390
add it to the lists model.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9834392
Yes. just add it to the JList's model
0
 
LVL 92

Assisted Solution

by:objects
objects earned 100 total points
ID: 9834401

DefaultListModel model = new DefaultListModel();
JList list = new JList(model);
model.addElement(object);
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 86

Accepted Solution

by:
CEHJ earned 400 total points
ID: 9834402
Vector model = new Vector();
model.add(yourObject);
JList l = new JList(model);
0
 
LVL 92

Expert Comment

by:objects
ID: 9893345
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9893391
8-)
0

Featured Post

Industry Leaders: 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

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses

773 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