+ 1
JList - space or tabulation
Hello, I have a JList. I filled it with a defaultmodel object. Each item in my defaultModel contains 3 strings. So, i would like of my item in the JList be arrange with tabulation.. How can i arange The Items of my JList? Name FirstName Email Blablabla Bloblo bla@yahoo.com Polo Santos posan@yahoo.com
5 Antworten
+ 3
Sounds/looks more like you want to use a JTable instead of a JList. You can then remove the the cell borders to make it appear more like a list with headers using table.setShowGrid(false);
https://stackoverflow.com/questions/3167112/remove-cells-border-in-a-jtable
+ 2
Have you tried building each string for the list inserting a \t or 2 between each field?
name+"\t"+firstname+"\t"+email
+ 1
You'll need to use a monospace font along with String.format().
https://stackoverflow.com/questions/28243788/how-do-i-format-text-within-a-jlist
https://stackoverflow.com/questions/8637181/java-formating-strings-in-jlist
But, you should really consider using JTable instead. I think you'll find it easier once you understand how to use it IMO.
0
I want to use JList. There's no method named padding to use for that?
0
Yes i did it. I puted "\t", but nothing happened.