Results 1 to 6 of 6
  1. #1
    pahiker's Avatar
    pahiker is offline Member
    Join Date
    Jun 2010
    Posts
    63
    Rep Power
    0

    Default JTable Auto Resize Mode - not working as I expect

    Am I doing this wrong, or am I expecting something different from what it actually does?

    I assumed that, from the API description, that if I set AUTO_RESIZE_ALL_COLUMNS, that each column would be resized to take up only the width that the data required. Instead, what I am seeing is that every column takes up exactly the same size. If my assumption is wrong, is there a way to get the columns to size themselves by the content?

    table = new JTable(model);
    table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COL UMNS);



  2. #2
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Posts
    1,236
    Rep Power
    7

    Default

    is there a way to get the columns to size themselves by the content?
    Table Column Adjuster Java Tips Weblog

  3. #3
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,774
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by camickr View Post
    Thanks for that code; I bluntly copied and pasted it (still playing with it). I did put the credits in my 'about' box though ;-) b.t.w. if you're interested you can participate/read/download/play/whatever with my project code; it's an IDE for my home brew language RPL (Reverse Polish Lisp) and I confess, I took some parts of your code, either verbatim or just the ideas for the IDE part. PM me your email address because I have to 'invite' you to be a participant of the project at Project Management Software, Online Collaboration and Document Sharing ~ Huddle. The other member of the 'team' *ahem* is r035198x, also a participant of this forum.

    kind regards,

    Jos

  4. #4
    pahiker's Avatar
    pahiker is offline Member
    Join Date
    Jun 2010
    Posts
    63
    Rep Power
    0

    Default

    Thanks both, it works perfectly!

  5. #5
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Posts
    1,236
    Rep Power
    7

    Default

    @Jos,

    As my "About" page says, I just do this for fun so I'm not interested in getting any more involved. Glad you found the code usefull. Take whatever you want, its there to be used however people see fit.

  6. #6
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,774
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by camickr View Post
    @Jos,

    As my "About" page says, I just do this for fun so I'm not interested in getting any more involved. Glad you found the code usefull. Take whatever you want, its there to be used however people see fit.
    Ok, but you're in my about box anyway ;-) If you ever change your mind give me a PM; RPL is not so much about Swing as well as computer algebra systems, a bit of compiler technology, symbolic expression fiddling and lisp like evaluation (my hobby). Thanks again for the code; very nifty stuff.

    kind regards,

    Jos

Similar Threads

  1. Replies: 2
    Last Post: 02-07-2011, 04:01 PM
  2. Replies: 0
    Last Post: 06-04-2010, 05:20 PM
  3. Working with Jtable
    By blu_fox88 in forum AWT / Swing
    Replies: 3
    Last Post: 02-20-2010, 05:49 PM
  4. JScrollpane auto resize
    By knuth in forum New To Java
    Replies: 3
    Last Post: 09-29-2009, 11:12 PM
  5. Auto-complete/Auto-fix for custom statement
    By dark_cybernetics in forum Eclipse
    Replies: 0
    Last Post: 08-19-2008, 12:19 PM

Posting Permissions

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