I have a JPanel within which I want to display 'property - value' type
data which changes according to the mouse position relative to the
components in another JPanel. I have all the mouse positioning code etc
sorted but I was just wondering what people think the best method of
displaying the data is?
The data will take the format of one 'column' which stays fixed, always
with the same values (the property names), and the other 'column' whose
values change depending upon the mouse position (the values, which can
be any size). I thought about just using JLabels and a layout manager
but thought that this could become very messy and have lots of niggles
in it. I am now considering using an uneditable JTable but just wondered
if anyone had any other solutions?
Steve
Knute Johnson - 28 Mar 2006 19:48 GMT
> I have a JPanel within which I want to display 'property - value' type
> data which changes according to the mouse position relative to the
[quoted text clipped - 11 lines]
>
> Steve
My first thought was the JLabels but you could also just write the data
to a JPanel. That would be faster and take less memory and might even
use less code.

Signature
Knute Johnson
email s/nospam/knute/
Stephen Marjoribanks - 29 Mar 2006 12:13 GMT
> My first thought was the JLabels but you could also just write the data
> to a JPanel. That would be faster and take less memory and might even
> use less code.
Could this not lead to messy layout problems if the JPanel is resized
though? I think I'll use a JTable as I first thought.
Thanks anyway
Steve
Knute Johnson - 29 Mar 2006 18:47 GMT
>> My first thought was the JLabels but you could also just write the
>> data to a JPanel. That would be faster and take less memory and might
[quoted text clipped - 5 lines]
> Thanks anyway
> Steve
Resizing is always messy. Either your lose sight of some data or your
components disappear. About the only cure is to put your display
component in a ScrollPane and then any display method works. I like
drawing directly on JPanels because it is fast, easy to lay out, makes
for quicker loading programs, and all you have to do is call repaint()
on your JPanel and it is done.

Signature
Knute Johnson
email s/nospam/knute/
Wardie - 28 Mar 2006 20:50 GMT
Sounds like a JTable to me. You could always make the static column
"dimmed" out a little using a custom TableCellRenderer. You haven't
mentioned memory size/speed considerations and I don't know if this is
a heavy duty solution, but it's what I'd use.
Hope it helps.
Chris
opalpa@gmail.com opalinski from opalpaweb - 28 Mar 2006 23:35 GMT
JTable is easy to use in large part because there is plenty of sample
code on Sun's site.
Opalinski
opalpa@gmail.com
http://www.geocities.com/opalpaweb/