How can I save JTable column order and widths?

Hello,
I'm trying to find a way to save the current column order and widths in a JTable, so that the next time the same user runs the app I can use these same settings. Ideally I'd like to save this locally on the user's PC. I think it could probably be done with serialization, but hopefully there's a simple solution. Anyone else already tackled this?

The JTableHeader class can give you all the information you through the various TableColumns.
I simply save all this information to a properties file which looks somthing like this
# Column Information
total=3
column0=Names,120
column1=Dates,140
column2=Status,110This can then be read back using a java.util..Properties object. With this information you'll need to manually set the properties of each TableColumn and use the column model to move the columns to the right position ie
cmodel.moveColumn(0,2); // move column 0 to positon 2This requires a little bit more coding to properly do the comparism of the column names with those in the properties object.
Tip: it is always easier to use the above format, ie column0, column1, column2, etc, so that you can easily use a loop to access the information form the properties object ie
int total  = Integer.parseInt( prop.getProperty("total") );
for(int i = 0; i < total; i++) {
   String cname = prop.getProperty("column" + i);
    /// the rest of the TableColumn formatting could go here
}All the best.
ICE

Similar Messages

  • Hello Freinds, i am uing mozila latest version. Now i need to format my system . How can i save my web history and can i import it to mozilla after formatting ?

    Hello Friends, i am uing mozila latest version. Now i need to format my system . How can i save my web history and can i import it to mozilla after formatting ?

    See https://support.mozilla.com/en-US/kb/Backing%20up%20your%20information?s=profile+backup&r=2&as=s#os=win&browser=fx8

  • I purchased an iPhone 3 and had photos on it. Started having issues within 30 days and could replace it. Moved photos to back up on iCloud. did not restore new phone from back up how can i save the new photos and retrieve the old ones?

    I purchased an iPhone 3 and had taken some photos on it. I started having issues within 30 days and could replace it. So I created an iCloud account and  saved those photos as a back up on iCloud. I did not restore my new phone from back up because I did not realize I needed to restore and not just activitate it. How can I save the new photos, apps, and other stuff but retrieve the old photos?

    If all you want is your old photos, you could backup your new phone using iTunes, then restore it from your iCloud backup, import the old photos to your computer, then restore it from the backup your made in iTunes returning your newer data to your phone.  If you want your old photos on your phone, sync them there from your computer using iTunes.  The process would look like this:
    Connect your phone to your computer, when it appears in iTunes on the left sidebar right-click on it and select Transfer Purchases; right-click again and select Backup.
    Disconnect from your computer and go to Settings>General>Reset>Erase All Content and Settings to return it to new
    Go through the activation setup, choosing to Restore from iCloud backup.  Make sure your phone is plugged into a charger and has access to wi-fi as this can take hours to complete.
    When complete, without connecting your phone to your computer, open iTunes and go to Preferences.  On the Devices tab check "Prevent...from syncing automatically"
    Now import the old photos to your computer (see http://support.apple.com/kb/HT4083)
    When done, open iTunes, right-click on the name of your phone on the left sidebar and select Restore from Backup, choose the backup you made in step 1.
    Go to the Photos tab and select the photos you want to sync to your phone and sync.

  • How can I save ONLY the bookmarks and extensions

    I am about to do a clean reinstall of Firefox. I want to save ONLY the Bookmarks and Extensions and NOTHING ELSE from the Firefox Profile. How can I do this please?
    Thank you,

    Both answers combined to help solve the problem. It would be good if more than one answer can be selected as "Chosen Solutions", because this situation occurs often in forums.
    Thank you to both of you!
    Kind regards.

  • How can I save my Log files (and other my own files) to windows azure ?

    Hi ,Dear all
    I am migrating an Asp.Net Web App to Windows Azure. It runs in IIS
    In that Web App,it will:
      1. save log files to a virtual path (for example, save to $WEBAPP_ROOT_DIR/LOGFILES/
      2. save ViewState by session as temporary files to a virtual path (for example , save to $WEBAPP_ROOT_DIR/VIEWSTATE/
      3. upload some image files to the web server virtual path at $WEBAPP_ROOT_DIR/UPLOAD/
    so, when I migrate the web app to windows azure,how can I do the same job in my code?It seems so many great changes in my code ...
    Any ideas and suggestions for me ? many thanks!

    hi Eric,
    If you use Azure website, you can save your log and files into azure storage service ,such as blob or table.
    If you use VM to host your service, you can only attach a data disk or file service on your VM and save your data into data disk or file service.
    Regards,
    Will
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How can I save a YouTube video and watch it later while I'm offline?

    I'm trying to save a YouTube video and watch it offline.

    Another EASY way:
    Ik the address bar, insert "SS" between http://www. and youtube........
    So: http://www.youtube........ becomes
    http://www.'''SS'''youtube..... (.......is the movie you want to see)
    Click enter.
    You'll see another website, where you can download in MP4 or other extentions, low, medium or high quality.
    DONE! ☺☺☺

  • How can we set the column size and height dynamically

    Hi All,
    I have a requirement where i am designing rtf for excel output.Here i have a column where the height of that particular column must get reset dynamically according to the data that's getting populated.
    Thankq in advance.

    I had the same problem and I finally found that you can't set a form bean.
    There is no methods to do this.
    The only way is to make it a dynamic form bean, but i haven't investigated it.
    Now I use normal beans to move data between pages.
    Sorry if it's not what you want. If you have another solution let me know.

  • How can I save a named filter and sorting for later use?

    I regularly do several different complex filtering and sorting on large tables. I did not find a way to save them for later one-click reuse. So I always have to do it again, which is time-consuming and error-prone. Hoped to get a solution by AppleScript, but filter and sort is not accessible by scripting.
    Is there a way or does Apple have it on it´s agenda for future versions of Numbers? 

    Hi Jan,
    filter and sort is not accessible by scripting.
    There is some support for sort (and less for filter) in Numbers 3.
    Table has a filtered property.
    And you can sort.
    A sort example can be found at https://iworkautomation.com/numbers/table-sort.html.
    Not sure if this will be sufficient to handle your needs, but just wanted to point out there is some scripting support.
    SG

  • How can I save my original IMovie and then use that same movie, make a few changes and save as something else?

    I made an IMovie.  Now I want to keep that original Imovie but make another one using the original IMovie, make changes and save it as another IMovie.  How do I do this.

    In iMovie version 10 select your Project in the Libaray and choose Edit>Duplicate Movie to create a copy of your Project. Then make your changes to the copy.
    In iMovie verison 9 select your Project and choose File>Duplicate Project.
    Matt

  • PLEASE: How can I save my iphone texts and "notes" (not "the note") to my computer? I need them for reference and legal purposes. I have yet to find an app for this and iphone doesn't sync either one.

    Greetings!
    I am brand new to using a Support Community -- I'm more of a in-person show me learner but...huge snowstorm and I don't want to
    to make an appointment at a Genius Bar, driving 15 miles, especially since I asked about this once before  and no one there was able to
    give me an "official" Apple answer .  I do hope I am posting my question (and plea) for help properly.
    LOL when I had my first lil' Mac Classic, over 20 years ago, my participation in the techno world was soooo much easier, simpler.
    My current situation: I have soooo many texts on my iphone and I haven't deleted many because I need the information contained in them for
    future reference and for legal purposes.  I would really like to find a means and way to save them other than on the phone itself.
    I've done searches for various apps yet I'm not finding what I think I would need.  It appears Apple does not sync the texts between the iphone and
    my MacBook Pro.
    Also I often use Notes for quick journaling as well as copy and pasting from other apps, usually inspirational, that I know I am going to want
    to read again (always with credit noted ) and these too are taking up space.  If I could email myself I would but the apps I'm using don't offer that and each day there is a new commentary -- no way to go "back".
    I am currently using OS 10.6.8 on my MacBook -- my disc drive doesn't work and upgrading has to be done at the Apple Store so I don't have iCloud yet.
    My iphone 4  is running OS 6.0.1 -- no upgrade until I'm at a wifi connection -- most of the time I'm using my personal hotspot.
    I'm a very busy self-employed Nana raising grandchildren and a great-grandchild.  I don't have a lot of time and certainly not enough for copying and pasting every text as well as note and emailing it to myself.  There has got to be a better, easier way, yes?
    I'd be most appreciative of any and all assistance here.  Oh, someone mentioned to me I ought to get a "stick" for downloading but were talking
    in a language I'm still learning. 
    Thank you!
    Melinda

    SkyDaughter29 wrote:
    My current situation: I have soooo many texts on my iphone and I haven't deleted many because I need the information contained in them for future reference and for legal purposes.  I would really like to find a means and way to save them other than on the phone itself. I've done searches for various apps yet I'm not finding what I think I would need.  It appears Apple does not sync the texts between the iphone and my MacBook Pro.
    Try the computer apps PhoneView (Mac) or TouchCopy (Mac & PC):
    http://www.ecamm.com/mac/phoneview/
    http://www.wideanglesoftware.com/touchcopy/index.php
    Best of luck.

  • How can you create a SAles order and send to customer by using IDOC

    how to acknowledge the customer after a sales order is created?

    Just to add to Pauls reply, along with output determination settings, When you would create the partner profile outbound parameters, use the Message type ORDRSP for order acknowledgement.
    regards,
    Advait

  • How can I save some music locally and the rest to an external drive or NAS?

    I love my MBP w/ 16 GB RAM and SSD drive EXCEPT ... the SSD drive is lacking storage.
    I'm trying to find a way to store select songs/photos/videos locally and the rest on an external drive or better yet a NAS, while still getting the convenient use of iPhoto and iTunes.  Ideally, I would configure certain albums/playlists to stay local while the full library of media is on the external storage and when I plug in my iPhone/iPad the new photos/videos would upload to the external storage.
    Has anyone discovered a way to do this?
    Do I need to consider other programs like Lightroom to pull this off?

    Setting it up the way you have with the library on the internal and just the media on the external makes it a lot more tricky to move things around. If it was all on the external you could do in the time it takes to copy the files plus about 20 seconds.
    You can use the same library file, except in that file are references pointing to the media files on the USB drive.  Are you planning on doing this with the same USB drive that you are using right now>?  It is possible it may work.  If the configuration is that you have SongA on USB drive Fred, as long as the drive remains named Fred then you should be able to move it to a different point of attachment.  If you are planning on using a different USb drive you can try renaming the new USB drive to the exact same name as the existing one and maybe trick iTunes into not noticing the difference.
    This is where having as much detail as possible when posting an issue is helpful so we don't have to consider every possible configuration.

  • How can I change the pixel height and width of a photo in iPhoto without changing the dpi

    I want to change the dimensions of a photo. Current dimensions are 480 pixels on each side. I want to make a copy that is 100 pixels on each side, but I want the dpi to stay the same. In iPhoto I tried exporting the copy using the new dimensions, but the result was a blurred image. Is there another way to do this?

    to change the pixels crop to 100x100 and export with maximum dimension of 100 - see the user tip on exporting foo details on Export options - Exporting From iPhoto
    As to DPI - digital photos have no DPI since DPI is Dots Per Inch and digital photos have no inches hence no DPI - when you print a photo then DPI is a mathematical calculation - dots divided by inches - it is not a setting
    Print a 480 pixel photos as a 1" square and the print it 480 DPI (480 / 1 = 480) and print the 100 pixel image as a 1" square it will be 100 DPI (100 / 1 = 100) - print a 480 pixel photo as a 4.8 inch square and it is 100 dpi (480 / 4.8 = 100) - just a calculation - not a setting
    LN

  • I have updated my ipod touch but i have to update iphone and ipad 1 and ipad2 . How can I save the udated software in order to avoid teh time for downloading it again each time

    I have updated my ipod touch but i have to update iphone and ipad 1 and ipad2 . How can I save the udated software in order to avoid teh time for downloading it again each time

    Even though the downloads are for the same iOS version number, they are different downloads and you can't use an iPod iOS update to update an iPhone or iPad etc. The iPad 1 and iPad 2 are also different downloads. So you will need to download different updates for your iPod Touch, iPhone, iPad 1 and the iPad 2.

  • How can I save a page and all its component parts in a single file, like IE does as an MHT - it's much easier for mailing to people where page address not available?? (as in output from an airline booking site, for example)

    how can I save a page and all its component parts in a single file, like IE does as an MHT?
    It's much easier for mailing to people where page address not available?? (as in output from an airline booking site, for example)
    It is simply too painful to have to zip everything up into a single file to send. MHT format has been available for years now from IE, and with every new FF release it's the first thing I look for. I have been using FF for years, and hate having to come out of it, over into IE |(which I even took out of startup) and key everything in again, in order to send somebody something in a convenient format that they can open with a single click.
    I can't believe this hasn't been asked before, so have you looked at it and rejected it? Have MS kept the file format secret?
    Thanks
    MG

    This is not really an answer just my comments on your question.
    I am sure I recollect efforts being made to get mhtml to work with FF.
    Probably the important thing to remember about .mhtml is that if other browsers do support it they may need addons, and may not necessarily render the content correctly/consistently.
    There are FF addons designed for archiving webpages, you could try them, but that then assumes the recipient has the same software.
    You could simply save the page from FF to your XP pc; then offline open it with and save it using IE, before then emailing using FF, and attaching the .mht or mhtml file that you have now created on your PC.
    As an alternative method, in some cases it could be worth considering taking a screen grab of the required page, then sending that to the recipient as a single email attatchment using either a bitmap or jpeg file format for instance.
    Something such as an airline booking may be designed with a print option, possibly it could be worthwile looking at sending the print file itself as an email attachment.

Maybe you are looking for