Re: Populating JTable and JList with data

From: Aristedes Maniatis (ar..sh.com.au)
Date: Mon Nov 12 2007 - 22:09:26 EST

  • Next message: Peter Karich: "Re: Populating JTable and JList with data"

    On 13/11/2007, at 2:03 PM, Phoenix Hawk wrote:

    > Does anyone have a code snippet or a link (I have looked at the
    > Cayenne
    > petstore, examples on the wiki, but none of them have what I want,
    > or maybe
    > I do not understand enough Java) that shows how the results of a
    > query can
    > be used to populate a JTable and a JList? Or maybe there is a better
    > way
    > instead of using JTable or JList?

    You'll need to poke around some Swing programming lists rather than
    the Cayenne one. What you are after is to take the List returned by
    Cayenne and attach it to the table model of your JTable. Then each
    column (or cell) will need to have a renderer which is able to draw
    the appropriate attribute from that record. There are probably a
    million ways to do this, but that's one.

    Hope that helps

    Ari

    -------------------------->
    ish
    http://www.ish.com.au
    Level 1, 30 Wilson Street Newtown 2042 Australia
    phone +61 2 9550 5001 fax +61 2 9550 4001
    GPG fingerprint CBFB 84B4 738D 4E87 5E5C 5EFA EF6A 7D2E 3E49 102A



    This archive was generated by hypermail 2.0.0 : Mon Nov 12 2007 - 22:10:03 EST