I understand that drawString() doesn't use text like JTextArea, but instead draws to the pixels. I've looked through FontMetrics, and probably has some methods I might be able to use, but was curious what might be the best way to show a table a of values using drawString()? I can do it easily using JTextArea, drawString() gives a whole heck of a lot more problems. I'm trying to create 3 rows, 10 columns, data left justified. The closest thing I have is a for loop statement:
Where s is the data as a string. Basically tries to space things out evenly, but it starts to get a little messy when the data is greater than 2 characters in length. Just a pointer in the right direction would be nice Thanks! Jason
[This message has been edited by jason adam (edited October 30, 2001).]
JTextArea is a Swing class, so I must assume that you intend to use Swing as the UI manager. Swing has a class named JTable that will handle the basic display - you can provide cell rendering class(es) if you don't like its default rendering. That would be a lot easier than building up the whole thing yourself.
"privilege" comes from the Latin words for "private" and "law" (legal) and dates to feudal times. To "claim privilege" meant that you were above the laws that applied to the common people.
Chicken Farmer ()
posted 18 years ago
Well, the data increments regularly through each row, and since it is a very small table, just set up a simple for loop to create it. It's only for display purposes anyway, which is why I was curious if using drawSting() would just introduce more formatting algorithms than is really warranted. Jason
The City calls upon her steadfast protectors. Now for a tiny ad:
Devious Experiments for a Truly Passive Greenhouse!