Jump to content

PROBLEM WITH JList CONTROL

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
fas

fas

    Newbie

  • Members
  • Pip
  • 2 posts
Hello ! I am new to swing...and I need to add String array items in list box control in java frame form.
whatever code I write but none of the items are displayed in JList control at run time. The code I am writing is :-

String[] data = {"one", "two", "free", "four"};
JList dataList = new JList(data);

no error appears but also no items added in the list. list appears empty. plzz help as soon as poss.
Is threre anything like jpanel or internal frame or such things hv to be added first and then list control ?

#2
ZekeDragon

ZekeDragon

    Writes binary right handed and hex left handed

  • Moderators
  • 2,103 posts
Works fine for me. Did you add the JList to the JFrame's content pane? Could you show us the code you used, because this looks like the sample code used in the JList documentation.
Wow I changed my sig!

#3
fas

fas

    Newbie

  • Members
  • Pip
  • 2 posts
hello zekedragon !
thanks 4 replying...
yaa here I am attaching my code..I hv put comments somewhere those code r not necessary for solving this part. error and some code is extra which I will require later..so

u plz try to solve this error..I dont know much how to put swing controls ? I mean in panel, jpanel or jframe or whatever else...Right now I have used one JFrame form, upon it I hv put one jPanel2 control and upon it I have put other swing controls like buttons and JList..
:confused: