Automatically resize JTable to show entire contents of every cell

Is there a way to automatically set the preferred size of a JTable, or its columns, such that the entire contents of all table cells are displayed? Setting the preferred widths of TableColumns myself isn't a great idea, because (a) the column's preferred width will change depending on what font the user is using, and (b) it can waste a lot of space if e.g., a column's values can theoretically be 1024 characters long but the only entries in that column currently are, say, less than 32 characters long.
thanks for any help

fantastic, it works beautifully. Thanks!
(for future search reference, D.B's post is at [http://forum.java.sun.com/thread.jspa?threadID=5283356&messageID=10193297|http://forum.java.sun.com/thread.jspa?threadID=5283356&messageID=10193297])

Similar Messages

  • Can a structure be automatically resized to fit it's contents?

    Using auto-grow, structures sometimes get way too big. Resizing them by hand is time consuming. Is there a way to cause a block to resize to fit it's contents?

    well.. i guest you got to manually "shrink" it down. However, it (i.e. while loop) has ability to not to shrink till it overlap your code (are't you happy about it ).
    last but not least, if LabVIEW has everything "Automated". Then, what are we (LVUs) gonna do???
    Cheers!
    ian
    Ian F
    Since LabVIEW 5.1... 7.1.1... 2009, 2010
    依恩与LabVIEW
    LVVILIB.blogspot.com

  • Show different content after every 5th web app listing

    I have a web app that list products. I would like to show different content after 5th item from the web app.
    So, it might look something like this.
    <div class="wrapper article-single-wrapper">
    Web app product 1
    Web app product 2
    Web app product 3
    Web app product 4
    Web app product 5
    </div>
    <div class="wrapper sponsored-post-list-wrapper">
    Advert
    </div>
    <div class="wrapper article-single-wrapper">
    Web app product 6
    Web app product 7
    Web app product 8
    Web app product 9
    Web app product 10
    </div>

    You can only do that with javascript, Say you had a hidden contentholder with the add on it. You could use jQuery for example, store the .html() into a variable and then every nth-item (4th) you could .insertAfter()

  • 3rd generation nano entire contents of ipod not showing up..

    3rd generation nano entire contents of ipod not showing up, itunes says to restore, however I am pretty certain this erases all contents. Is there anyway to retrieve the seemingly lost content, what do I do? I have had little to no prior issues with this product and have not recently updated my itunes. Please help!

    Hey there,
    A file or some files may have become corrupt somehow during connecting or disconnecting the unit. Try putting it into Disk Mode and see if that helps. To put it into Disk Mode, hold the Menu and Select buttons until the Apple logo appears. When it does, immediately press and hold the Center an Play/Pause buttons until you see a confirmation that your iPod has been put into Disk Mode.
    If you are able to do this, it may be a good idea to restore the iPod to its original settings. Keep in mind that by doing this you are erasing all the music and files from your iPod so make sure they are backed up on your computer somewhere. More on restoring your iPod can be found in the Apple document below.
    Hope this helps.
    http://support.apple.com/kb/HT1339
    B-rock

  • How can I get Thunderbird to SHOW REMOTE CONTENT automatically?

    I don't want to click on it for every individual message, and I can't find any such preference setting.

    Hello RyanMooncat,
    There are a few steps you must follow to allow Thunderbird to always show remote content of an email.
    1) Navigate to and click on the menu button on the top right of your screen
    2) Within the menu, select "Options" and then make your way to "Advanced" on the far right
    3) On the general tab, click on the "Config editor"
    4) In the window that appears, enter this into the search field (without quotes)
    "mailnews.message_display.disable_remote_­image"
    5) Double click the result that appears in the box below. The value should change to "False"
    Close the window and you're done!
    Hope this helped

  • Dynamically resize JTable cell to fit a JList

    Hi!
    I've been banging my head trying to add some dynamic behavior to a TableCellEditor. In short I'm trying trying to make it resize the height of the current row (the one it is in) to reflect the changes made to the JList used to let the user edit the cells value (which is a list of items).
    I've come across some threads dealing with the problem of resizing a cell to fit its content. This however is usually only done once (in the 'getTableCellEditorComponent' function) and so only provides half the answer. Also, since the editor is only active during cell editing I've been trying to make it revert to the old cell height after the editing is done.
    So far I have not come up with any decent solution to this problem and was hoping someone out there might have an idea or have read something similar and can point me to something helpful... anyone?
    Cheers!
    Teo

    The Swing tutorial on[url http://java.sun.com/docs/books/tutorial/uiswing/components/table.html]How to Use Tables shows how to dynamically change the size to Table Columns.
    If you need help calculating the acutal size then try searching the forum. Using keywords "resize jtable column" (keywords I took directly from your topic title) I found some promising postings.

  • Iphoto is automatically resizing all my pics

    after i edit my photos on iphoto, i like to post them on my blog, or send them to a friend. however, i've noticed that wherever i upload, and however i send them, they are automatically resized to a pretty small size. but when i view them on iphoto, they are at normal resolution and cover my entire screen. i don't have a problem with everything already being resized for me before i post online, that actually saves tons of time, but i was wondering where/how these settings can be adjusted so i can have larger resized pictures.

    There are a couple of places where you can set the image size when sharing your photographs. If you would like to email larger or even FULL-SIZE images, go through the normal process of emailing: 1) Select photos 2) Click Email button at bottom of window. When the dialog window comes up for email settings, there is a popup menu that allows you to pick three scaled sizes or actual size.
    Another option for exporting your photos is of course the Export function, which you get from the File menu. This will give you a dialog that allows you to select the size of the export image.
    When you export to iWeb's blog template, your image is scaled to the size of the image placeholder on the blog page. What's the secret of larger photos there? Well it is a bit tricky, but once you figure it out, it isn't so bad.
    1) Go to the blog page on which your photo appears. The photo will appear at the top of the page and have a frame around it.
    2) Select the frame around the image first. Click it "i" icon to bring up the inspector palette. Click on the little ruler icon on the inspector. There is a checkbox on the palette that says "Constrain proportions" You want to turn this off, so that you can resize one dimension if need be.
    3) Now select the actual image. If you want to size a single dimension, repeat the process you used in step 2 on the image frame. Note that the placeholder will distort the image if you stretch the image along one dimension. This is not a bad thing... you can fix this pretty easily.
    4) If you distorted the image in step 3 because of your desire of a different sized image frame, first press the Media button at the bottom of the window in iWeb.
    5) Scroll through and find the original image that you had exported from iWeb and that first showed up on the blog page.
    6) Drag that image into the placeholder and it will replace the stretched image, properly scaled and cropped.
    There ya go!
    If you find this helpful, or if it solves your issues, please indicate this by clicking in the appropriate icon in the header of this reply.

  • How can I transfer entire contents of Mail mailbox from one Mac to another?

    I've long wondered how to do this:
    I have two Macs - an iMac and a MacBook Pro.
    I have categorized several hundred emails on the MacBook into a separate "mailbox" by itself. Let's just call it "Project XYZ emails" for the sake of discussion.
    I need to transfer ALL of those emails +en masse+, hopefully still categorized together into a separate "Project XYZ emails" mailbox file, from the MacBook to the iMac. How is this done?
    In the old days, when I used to use Eudora, this was quite simple -- one could physically locate the separate desired "mailbox" file in the Finder and just copy it from one hard drive to the other, and then place the mailbox into the appropriate place of Eudora's file structure on the second computer. Relaunch Eudora and voila, the new mailbox is there for viewing, etc.
    But in Mail, I can't find any tangible "file" on my hard drive that represents a "mailbox" in the Mail program. And that includes control-clicking the application file itself and choosing "Show Package Contents." When I do that, I can see, after burrowing into the folders, a single large file called "Mail" which I think contains ALL mailboxes lumped together. But I can't see a way to separate them for individual manipulation.
    Any suggestions or ideas on how to copy entire mailboxes in Mail from one Mac to another?

    Thanks! Seems to have worked.
    Once I imported tham, I had to fiddle around renaming mailboxes and "moving" the emails to the desired locations, but that only took a minute. So overall, seems like that's the solution! I only wish that the steps to do this were made clearer by Apple in the Mail "help" menu -- where I couldn't find any mention of how to do this.
    A happy ending, in any event.
    In case anyone reads this in the future, let me add in the missing steps, to make it perfectly clear:
    In Mail, choose 'archive mailbox' from the mailbox menu.
    +Copy the newly created archived mailbox file, which will probably be a file with the suffix ".mbox," from the original machine to the second machine.+
    On the second machine: In Mail choose 'import mailbox' from the file menu.
    +The emails will now appear in a new mailbox in Mail listed under the name "imported" or "import." If desired, either rename the mailbox, or create a new mailbox with the correct name, and "move" all the emails into it.+
    Done!

  • Ipod dumps entire content and must be restored and synced each time.

    Second Generation iPod Nano. iTunes on Dell XPS410, Windows Vista.
    Battery depleted. Plugged Nano into computer. Got a "may be corrupted screen; try restoring"♦Computer recognizes Nano; I restore and screen confirms successful restoration and tells me to sync. Sync takes place and completes successfully however my Library for the Nano device shows in "graytone" and cannot be accessed. I eject the Nano; unplug it from the computer and it works fine. Once I again plug it into the computer, everything dumps out of the Nano and I have to start the Restore/Sync process all over again. Each time the Nano is unplugged and replugged to the computer iTunes it dumps its entire content!
    Would most appreciate any suggestions!

    I have tried connecting the ipod via the front and back USb 2.0 jacks on my desktop. I have only one external drive connected to the computer. Doesn't matter whether I remove it or not, the same problem occurs. I do not have a network. My drive letter for the ipod is letter z so it is not disk recognition which is a problem. 1/3 of my music comes from I-tunes, the rest I rip from my Cd's (like Linkin Park, Slipknot, Dir en grey). I only used about 650 MB worth of the ipods 30 gig drive capacity. Doesn't matter which version of the itunes software I use, it gives me the same problem. The recovery loop occured after just after 2 weeks of purchasing it from the apple storeand I took it back with only 12 songs in it. The restored it and 10 days later, the same problem occured. Recently, the ipod has been entering the recovery mode much more frequently prompting me to believe the hard drive is malfunctioning.
    I have scanned my computer and the Ipod with everything from Norton, AVG, McCafee, and trendmicro and found no viruses, bugs, worms, etc.
    Any suggestions to help me resolve this issue would be greatly appreciated.
    Thanks,
    Ice

  • Why does Preview automatically resize the text box to cut off the last character of added text? How do I fix it?

    Why does Preview automatically resize the text box to cut off the last character of added text? How do I fix it?
    I use the Tools > Annotate > Add Text feature, and when I click away after adding text, it automatically changes the text box size such that the last letter -- or last word -- gets bumped off into an invisible line below it, forcing me to manually adjust every single text box. It is highly annoying when trying to complete PDF forms (e.g. job applications).
    It appears to be a glitch, quite honestly, an error resulting from Apple's product design. Has it been fixed in the new operating system (for which they want $30)?
    I would very much appreciate any help you can provide! Thank you for your time.

    * "Clear the Cache": Tools > Options > Advanced > Network > Offline Storage (Cache): "Clear Now"
    * "Remove the Cookies" from sites that cause problems: Tools > Options > Privacy > Cookies: "Show Cookies"
    Start Firefox in [[Safe Mode]] to check if one of your add-ons is causing your problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    * Don't make any changes on the Safe mode start window.
    See [[Troubleshooting extensions and themes]] and [[Troubleshooting plugins]]

  • Clicking on "Show All Content" Closes Window

    I am working through an issue with a web-based learning tool. When the player launches, a banner appears across the bottom stating that "Only secure content is displayed" with a button labeled "Show All Content". When I click on the
    button, the entire player window closes. I know how to get rid of the warning and have applied a group policy to a set of computers and that works fine to get rid of the banner. But my question is: Why is showing all of the content - secure and not secure
    - forcing the window to close?

    Hi,
    Please share your IE and OS version?
    In addition, have you checked this KB article?
    “Only secure content is displayed” notification in Internet Explorer 9 or later
    We may disable the “Only secure content is displayed” message
    from IE:
    1. Tools-> Internet Options.
    2. Tap or click the Secruity tab, and then tap or click the Custom Level.
    3. In the Settings box, scroll down to the Miscellaneous section, and under
    Display mixed content choose from the following options:
    Disable, will not display non-secure items.
    Enable, will always display non-secure items without asking
    Prompt, will prompt you when a webpage is using non-secure content
    More information, please check into the KB article.
    Best regards
    Michael Shao
    TechNet Community Support

  • Customizing the blog post web part to not show entire entries

    I have a blog site, and as you know, the posts web part shows the entire contents of each listed post, rather than one paragraph, followed by a "click here to read more" link.  I know that there is no out-of-box functionality for this, because of course,
    why would there be? Who needs nice looking blogs?  Anyway, I found this on the internet:
    http://zabistop.blogspot.com/2009/02/customizing-sharepoint-blog-posts-web.html
    It knows what's up, but it's outdated and the code doesn't mesh with what I have. Are there any articles similar to this online? I can't be the first person who thought of this, and doing it from the ground up is not an option. I appreciate any help.

    In 2010 you can make the same changes using a similar method.
    Open the default.aspx page, in code view click in within the blog area. In the ribbon click on the List View tools >design. Click on Customize XSLT in the Actions panel. When you do that you will be able to see all the code.
    Find this line of code <xsl:template name="FieldRef_Note_body.Body" ddwrt:dvt_mode="body" match="FieldRef[@Name='Body']" mode="Note_body" ddwrt:ghost="hide">
    Approx line 402. It actually looks like   </xsl:template><xsl:template name="FieldRef.... so you will have to place your cursor after the template close and hit enter a few times to make space for the code.
    Directly above that line, where you have added spaces, include this code. (I cheated and grabbed this code from another site where we did the same thing - and was able to modify it slightly to work for the blog.)
    <!-- used to strip out HTML from passed-in field -->
        <xsl:template name="removeHtmlTagsFromField">
         <xsl:param name="html"/>
         <xsl:choose>
             <xsl:when test="contains($html, '&lt;')">
                 <xsl:value-of select="substring-before($html, '&lt;')"/>
                 <!-- Recurse through HTML removing all markup -->
                 <xsl:call-template name="removeHtmlTagsFromField">
                     <xsl:with-param name="html" select="substring-after($html, '&gt;')"/>
                 </xsl:call-template>
             </xsl:when>
             <xsl:otherwise>
                 <xsl:value-of select="$html"/>
             </xsl:otherwise>
         </xsl:choose>
     </xsl:template> 
    Next below the line ( should be the next line below the pasted code)   <xsl:template name="FieldRef_Note_body.Body" ddwrt:dvt_mode="body" match="FieldRef[@Name='Body']" mode="Note_body" ddwrt:ghost="hide">
    Locate the       <xsl:param name="thisNode" select="."/> and paste the following code:
      <!-- call "removeHtmlTagsFromField" template to strip out html markup from the field -->   
     <xsl:variable name="textOnlyDescription">
         <xsl:call-template name="removeHtmlTagsFromField">
             <xsl:with-param name="html" select="$thisNode/@*[name()=current()/@Name]" />
         </xsl:call-template>
     </xsl:variable>
    I have already swichted out the select content with the content that was in the xsl line that renders the body content.
    Locate the code  ( should be 2 lines down)     <xsl:value-of select="$thisNode/@*[name()=current()/@Name]" disable-output-escaping="yes"/>
    Comment the code out and replace with the following code:
          <xsl:value-of select="substring($textOnlyDescription, 0, 320)" disable-output-escaping="yes"/>
          <xsl:if test="string-length($textOnlyDescription)>320">...</xsl:if>
    Change the number to your desired length.
    Save your file.
    You can revert the file if you ever need to, after its checked in, by right clicking on the page and selecting reset to site definition. 
    Hope this helps. I plan on doing a post shortly covering this and will have screen shots.
    Heather Waterman SharePoint Desginer www.heatherwaterman.com

  • How do iViews on SDN automatically resize themselves?

    Hello,
    I am looking for a solution by which I can resize the current iView. I am working on EP6.0 SP2 Patch 4.
    I believe SDN embeds a JavaScript in every iView to enable auto-resizing, so that when the content becomes large enough, the iView automatically resizes itself. I want to use this feature to eliminate vertical scrollbars and would definitely like some inputs ASAP.
    Thanks in advance,
    Sagar Kirtany

    Yes I am using CS6. Every design made is in PNG format with a transparent background yes. All products rougly go in the same position also. If I can map out a specific area where the design should go with a center point that would be great. Alot of my designs are different shapes and sizes but if I can map out an area with a centre point so the design gets resized and placed there whilst keeping it's aspect ratio it should be fine.

  • Can you add the entire content of your desktop to the allowable locations in flash player?

    can you add the entire content of desktop to the allowable locations in flash player?  when i click 'add' to allowable locations and type in file:///C:/Documents and Settings under website (i know it's not the website but where else would it be added) it doesn't show up in the overall list of allowable 'sites'.

    Hi radwh,
    Are you talking about trying to add your desktop to Flash Player's trusted locations? If so, you use the "Advanced" tab on the Local Settings Manager to designate folders and files as trusted. (Full path is Advanced->Developer Tools->Trusted Location Settings.) Here's a link to the documentation for that: http://help.adobe.com/en_US/FlashPlayer/LSM/WS6aa5ec234ff3f285139dc56112e3786b68c-7ff0.htm l .
    Hope this helps, and get back to me with further details if this is not what you were asking.
    Thanks,
    KALTechWriter

  • TableView auto resize columns based on header text width or cell content

    Is there a method on the tableview or tablecolumn to automatically resize based on the content of the hearder or data?
    If not what approach can used used with JavaFX to calculate the string width based on the current font?

    The table column size is inconsistent, I set the columns in the table view and the items in the initialize method. I execute a service and task from a button action that loads data into the list, if I don't reset the columns in the table view in the succeed method then each column is the same width regardless of the content in the cells. If I do reset the table columns in the succeed method then the columns are resized based on content.
    I don't think it should be a requirement to reset the columns just to get the column widths to set based on the content in the cells. Is there a method on the table column or view that will resize the cells based on the cell content? I would prefer the largest value; column header content or the longest cell content for a column.

Maybe you are looking for