Results 1 to 2 of 2
  1. #1
    Vorrin is offline Member
    Join Date
    Mar 2011
    Rep Power

    Default Place a working checkbox in a JTable header.


    I have a need (well, mostly aesthetic, so other solutions might work out fine too) to place working comboboxes within the header of a JTable.

    This far I managed to create a custom renderer, so I can place even a whole JPanel (containing a checkbox) inside a certain cell of the TableHeader.

    The problem right now, though, is that such checkbox, will not really get any input (ie. I can't set it to selected/checked). I suppose that might be as the header's own mouselisteners take over the checkbox ones.

    I thought of just stripping off the header's mouselistener, and re-adding some for the checkbox itself, but I can't really find out how to access the checkbox living inside the header :(

    Would anyone be so nice as to point me in the right direction from here?

    If this is not the right direction at all, what could also help, is some hint on how I could place components, such as checkboxes, on TOP of a tableheader, meaning, render the checboxes in the foreground and have the tableheader stay in the background, which this far I didn't manage to do.

    This said, I'm using absolute layout for the panel that contains all of the above.

    This is my first post, so, sorry if my description is insufficient or lame, if that's the case I'll try and do better next time :).


  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power

Similar Threads

  1. Disable a checkbox in jtable
    By pink123 in forum AWT / Swing
    Replies: 8
    Last Post: 03-24-2011, 06:29 PM
  2. Problem in giving row header name in a JTable
    By pratim in forum AWT / Swing
    Replies: 6
    Last Post: 03-23-2011, 10:43 AM
  3. JTable with multiple Header
    By bircastri in forum AWT / Swing
    Replies: 1
    Last Post: 11-15-2010, 11:26 AM
  4. CheckBox in JTable
    By nikosa in forum AWT / Swing
    Replies: 1
    Last Post: 08-05-2009, 05:01 AM
  5. header of jtable
    By bbq in forum AWT / Swing
    Replies: 1
    Last Post: 07-05-2007, 04:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts