• Post Reply Bookmark Topic Watch Topic
  • New Topic

display String with "\n" in JList in Swing  RSS feed

 
vaibhav mishra
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to display a string in JList , the problem is that the String is as whole displayed in 1 single line but what i want the string to be displayed with newline char.



jList1 is a javax.swing.list whose content is displayed in a list

what it should display(as per my knowledge) is

Ram
Sita

but what it displays is

RamSita

it is not considering the newline character.

help me out.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try


Also, why are you explicitly casting the vector to Object? You can pass the vector directly.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!