How to enter values in JList box and JTable ?

Hi friends...

i am new to Swing

SInce i am using Netbeans IDE 5.5

and there is easy to do swing programming using this IDE

now i am confused using JTable and JList box

since i used method Insert in AWT

but how to add values in LIST BOX ( JList )

ex.

JList list = new JList( );

list.add(mystringvalue, ? );

here it ask for component so what should i write here..

when i write here this, gives error.

what to do to insert string or vector or object in JList

and to enter value in JTable

THanks

[583 byte] By [Ghanshyama] at [2007-11-26 21:52:40]
# 1

hi Ghanshyam,

i am also new to swing i was just wondering are you using the swing palette to create your interface

by the look of the code

>JList list = new JList( );

>list.add(mystringvalue, ? );

you may not be because every JList is put in a JScrollPane

but if you do want to do it through the palette there is an option in properties - model which you can uses to add in values.

and if your looking to get info. from a database look up

AbstractListModel &

AbstractTableModel

the is a lot of info on the internet (example net beans CarTableModel) is a

good start off

happy hunting.

JJ

jjdelaneya at 2007-7-10 3:46:46 > top of Java-index,Desktop,Core GUI APIs...
# 2
Read the tutorial:[url http://java.sun.com/docs/books/tutorial/uiswing/components/list.html]How to Use Lists[/url][url http://java.sun.com/docs/books/tutorial/uiswing/components/table.html]How to Use Tables[/url]
Rodney_McKaya at 2007-7-10 3:46:46 > top of Java-index,Desktop,Core GUI APIs...