Categories

JAVA DATEBASE
Technology Network Community
Oracle Database
Fusion Middleware
Development Tools
Java
Desktop
Server & Storage Systems
Enterprise Management
Berkeley DB Family
Cloud Computing
Big Data
Business Intelligence
Architecture
Migration and Modernization
E-Business Suite
Siebel
PeopleSoft Enterprise
JD Edwards World
Industries
JD Edwards EnterpriseOne
User Productivity Kit Pro (UPK) and Tutor
Governance, Risk & Compliance (GRC)
Master Data Management (MDM)
Oracle CRM On Demand
On Demand: SaaS and Managed Applications
AutoVue Enterprise Visualization
Primavera
ATG
Agile PLM
Endeca Experience Management
Fusion Applications
Archived Forums

 



Tags

New To Java


JList ?


hi, guys  I help help about the JList  with String variables how can u add 2 or 3 String Variable to  the Same JList without using an array? ex String a=".."; String b= "..."; String c= "....";      JList list = new JList(); ....

A loop?  I don't really understand what you're asking.

How about setListData(something) where something is an array of objects (can't get around that) or a vector?

A JList offers a view of the data, and lets you select items etc.  To add data, you add them to the JLists's model.  From the API: "A ListModel can be supplied directly to a JList by way of a constructor or the setModel method. The contents need not be static - the number of items, and the values of items can change over time. ... "Simple, dynamic-content, JList applications can use the DefaultListModel class to maintain list elements."  For example:import javax.swing.DefaultListModel; import javax.swing.JFrame; import javax.swing.JList;   public class JListEg {       public static void main(String[] args) {         DefaultListModel model = new DefaultListModel();         JList list = new JList(model); 		         model.addElement(".");         model.addElement("..");         model.addElement("...");           JFrame frame = new JFrame();         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);         frame.add(list);         frame.pack();         frame.setVisible(true);     } } 

Thank , guys


Related Links

Iterarator for hash table.
java arrays - can you name the keys?
Removing from a map
Netbeans - Intellij IDE
launching applications from java code
FORCE CASTING
Getting the result from a field in a different class...
Array question
Matching HTML links with regex
What are heavy weight and light weight components?
Help with some array logic
jComboBox :setSelectedItem
Which folders do I need?
Displaying the path of the file selected by a FileChooser in a TextField
JAVA to php integration
Website security through Design