Hiding and restoring table columns from file?

how i handle hiding and unhiding columns in a jtable is that i have a checkbox for each column, depending on which is checked "on" the tablecolumn is found and added to a vector and removed from the table.
when the checkbox is checked "off" this vector is searched for the correct tablecolumn, and then added back to the table. this works fine.
when i close out of the program, i go thru the table and write the visible column names along with its size to file.
when i re-open the program, i create the table normally, then go thru the file and hide(remove) the tablecolumns found in it..this works fine.
but when i go back to this checkbox list and try to unhide the tablecolumn, i get an exception
java.lang.IllegalArgumentException: Cannot format given Object as a Number
     at java.text.NumberFormat.format(NumberFormat.java:219)
     at java.text.Format.format(Format.java:133)
     at javax.swing.JTable$DoubleRenderer.setValue(JTable.java:3397)
     at javax.swing.table.DefaultTableCellRenderer.getTableCellRendererComponent(DefaultTableCellRenderer.java:160)
     at javax.swing.JTable.prepareRenderer(JTable.java:3731)
     at javax.swing.plaf.basic.BasicTableUI.paintCell(BasicTableUI.java:1149)
     at javax.swing.plaf.basic.BasicTableUI.paintCells(BasicTableUI.java:1051)
     at javax.swing.plaf.basic.BasicTableUI.paint(BasicTableUI.java:974)
     at javax.swing.plaf.ComponentUI.update(ComponentUI.java:142)
     at javax.swing.JComponent.paintComponent(JComponent.java:541)
     at javax.swing.JComponent.paint(JComponent.java:808)
     at javax.swing.JComponent.paintChildren(JComponent.java:647)
     at javax.swing.JComponent.paint(JComponent.java:817)
     at javax.swing.JViewport.paint(JViewport.java:722)
     at javax.swing.JComponent.paintChildren(JComponent.java:647)
     at javax.swing.JComponent.paint(JComponent.java:817)
     at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4787)
     at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4740)
     at javax.swing.JComponent._paintImmediately(JComponent.java:4685)
     at javax.swing.JComponent.paintImmediately(JComponent.java:4488)
     at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:410)
     at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:117)
     at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
     at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
     at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
     at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)before i unhide the columns, the table is already populated with values. so it might have something to do with that...cuz there is no problems unhiding them if the table contains no data
any ideas?
thanks

If you're interested, this method hides a table column without any modifications of its content:
   public static void setTableColumnVisible(JTable table, int col,                                                                             
                                              boolean visible, int width) {
      try {
         TableColumn column = table.getColumnModel().getColumn(col);
         if (!visible) {
            column.setMinWidth(0);
            column.setWidth(0);
            column.setMaxWidth(0);
            column.setPreferredWidth(0);
         else {
            column.setWidth(width);
            column.setPreferredWidth(width);
      catch(Exception e) {
         e.printStackTrace();
   }Method use:
. setTableColumnVisible(table, col, false, 0) hides the column
. setTableColumnVisible(table, col, true, 100) restores the column to its size of 100
Hope this helped,
Regards.

Similar Messages

  • After getting the dreaded gray/blue screen, I tried to run disk repair on the internal disk. I got an error message saying "Disk Utility can't repair this disk and restore your backed-up files. The volume Macintosh HD could not be verified completely

    After getting the dreaded gray/blue screen, I tried to run disk repair on the internal disk. I got an error message saying "Disk Utility can't repair this disk and restore your backed-up files. The volume Macintosh HD could not be verified completely." What do I do now? This is an iMac and I'm running 10.6.8.

    Clean Install of Snow Leopard
    Be sure to make a backup first because the following procedure will erase
    the drive and everything on it. See below for how to clone a drive.
         1. Boot the computer using the Snow Leopard Installer Disc or the Disc 1 that came
             with your computer.  Insert the disc into the optical drive and restart the computer.
             After the chime press and hold down the  "C" key.  Release the key when you see
             a small spinning gear appear below the dark gray Apple logo.
         2. After the installer loads select your language and click on the Continue
             button. When the menu bar appears select Disk Utility from the Utilities menu.
             After DU loads select the hard drive entry from the left side list (mfgr.'s ID and drive
             size.)  Click on the Partition tab in the DU main window.  Set the number of
             partitions to one (1) from the Partitions drop down menu, click on Options button
             and select GUID, click on OK, then set the format type to MacOS Extended
             (Journaled, if supported), then click on the Apply button.
         3. When the formatting has completed quit DU and return to the installer.  Proceed
             with the OS X installation and follow the directions included with the installer.
         4. When the installation has completed your computer will Restart into the Setup
             Assistant. Be sure you configure your initial admin account with the exact same
             username and password that you used on your old drive. After you finish Setup
             Assistant will complete the installation after which you will be running a fresh
             install of OS X.  You can now begin the update process by opening Software
             Update and installing all recommended updates to bring your installation current.
    Download and install Mac OS X 10.6.8 Update Combo v1.1.
    You may be able to backup your data if you have an erased external drive you can use. Before you do the above but after you have opened Disk Utility you can try to clone your drive:
    Clone using Restore Option of Disk Utility
      1. Open Disk Utility.
      2. Select the destination volume from the left side list.
      3. Click on the Restore tab in the DU main window.
      4. Select the destination volume from the left side list and drag
           it to the Destination entry field.
      5. Select the source volume from the left side list and drag it to
          the Source entry field.
      6. Double-check you got it right, then click on the Restore button.
    Destination means the external backup drive. Source means the internal startup drive.
    Now this will only work if the drive is accessible and can be cloned by Disk Utility. Otherwise, you would need to access your drive from another Mac that you can connect via Firewire - Target Disk Mode.

  • TS1901 Disk Utility can't repair this disk. Back up as many of your files as possible, reformat the disk, and restore your backed-up files.

    Disk Utility can’t repair this disk. Back up as many of your files as possible, reformat the disk, and restore your backed-up files.
    *** ??? I need to take out the data from a WD320 that shows this error and then format the WD and put the data into again
    THANKS !!!

    I'm sorry, is there a question here? You seem to know precisely what you need to do…

  • Can I fix a disk with this message?-Disk Utility can't repair this disk. Back up as many of your files as possible, reformat the disk, and restore your backed-up files.

    Can I fix a disk with this message?
    Disk Utility can’t repair this disk. Back up as many of your files as possible, reformat the disk, and restore your backed-up files.

    Some problems can indeed be fixed this way. But working from Recovery_HD or Disk Warrior DVDs and working in the restricted environment those provide can be difficult. You can literally spend days working on this problem (while your regular work is unavailable) only to discover the old drive is unsalvageable.
    There is no way to know up front whether you are facing a major Hardware failure or a minor software glitch, or something in between. Often you are forced to work from the drive you no longer trust. I continue to recommend you do this work from a different, fully functioning Mac OS X booted from a different drive.
    If you have had the foresight to (as The hatter often recommends) clone your virgin install onto another drive for use in such situations, you will be able to recover from such problems in record time. If not, my previous recommendations stands:
    Buy a new Drive. Or  two. Install Mac OS X from scratch on a new drive, and get your Mac running again. Later, you can use the full power of Mac OS X to attempt to rescue your data, if needed. Then Zero the old drive, to see if it can hold data again reliably.
    If the old drive eventually provides some needed data, and is salvageable, Merry Christmas.

  • My computer is shutting down before fully booting up.  I am running the disk utilities program and have this message: Error: Disk Utility can't repair this disk . . . disk, and restore your backed-up files.  Can anyone suggest what I should do next?

    My computer is shutting down before fully booting up.  I am running the disk utilities program and have this message: Error: Disk Utility can't repair this disk . . . disk, and restore your backed-up files.  Can anyone suggest what I should do next?

    So, you can't Install OSX to the external?
    Or you can't boot from it when you do?
    You're not the only one wondering... I'm reminded of the Goose that laid the Golden Egg story.

  • How to save and retrive table column values added via view enhancement

    Hi,
    I want to enhance standard webdynpro component FITE_VC_REVIEW.
    I want to add new column to Fight Info Table and also to Hotel Info table.I can do UI changes via view enhancement .
    First Approach: I add new fields to Flight Info and Hotel Info structure.
    Create an additional Coolum in Flight Info and Hotel Info Table and Bind it to newly created field in structures.
    Question :
    What all changes I have to make to save and retrieve values from database table.
    Kindly guide with Steps
    Second Approach: I create a new table/structure for my requirement and bind table column to these fields.
    Question:
    What all changes I have to make to save and retrieve values from database table.
    Kindly guide with Steps
    And which approach will be good.
    Regards,
    Madhvika

    no ans yet

  • How to save and retrieve table column values added via view enhancement

    Hi,
    I want to enhance standard webdynpro component FITE_VC_REVIEW.
    I want to add new column to Fight Info Table and also to Hotel Info table.
    First Approach: I add new fields to Flight Info and Hotel Info structure.
    Create an additional Coolum in Flight Info and Hotel Info Table and Bind it to newly created field in structures.
    Question
    What all changes I have to make to save and retrieve values from database table.
    Kindly guide with Steps
    Second Approach: I create a new table/structure for my requirement and bind table column to these fields.
    Question:
    What all changes I have to make to save and retrieve values from database table.
    Kindly guide with Steps
    And which approach will be good.
    Regards,
    Madhvika
    Moderator message: please have a look in the dedicated "Web Dynpro ABAP" forum.
    Edited by: Thomas Zloch on Feb 16, 2011 3:02 PM

    no ans yet

  • Syntax of DDL options and related (table) column names

    Hi,
    where can I find something like a mapping between DDL options and related table column names?
    For example I do have the table options PCTFREE, FREELISTS and NOCOMPRESS. The related table columns out of user_tables are PCT_FREE, FREELIST and COMPRESS.
    PCT(_)FREE wins an Underscore, FREELIST(S) wins an "S" and it is "NOCOMPRESS" if COMPRESS has a value "Y(es)".
    Hope somebody can help.

    So far I didn't find any information that is not in
    the DDL script gernerated from
    DBMS_METADATA.get_DDL.Alright, I give you an example:
    I create a table with the following DDL:
    "CREATE TABLE IntBuch (
    int_bunr integer NOT NULL,
    int_sdat double precision NOT NULL,
    int_hblz char(8) NOT NULL,
    int_hkto char(7) NOT NULL,
    int_hdat double precision NOT NULL,
    KtoNr char(7) NOT NULL,
    BLZ char(8) NOT NULL,
    CONSTRAINT PK_IntBuch PRIMARY KEY (int_bunr)
    USING INDEX
    PCTFREE 10
    STORAGE (
    INITIAL 1000
    NEXT 500
    PCTINCREASE 0
    MINEXTENTS 1
    MAXEXTENTS 4096
    PCTFREE 20
    LOGGING
    CREATE UNIQUE INDEX intid
    ON IntBuch (int_bunr DESC)
    CREATE INDEX hkto
    ON IntBuch (int_hblz,int_hkto)
    COMMENT ON TABLE IntBuch
    IS 'Kommentar zu DB-Tabelle InBuch'
    COMMENT ON COLUMN IntBuch.int_sdat IS 'Kommentar zu DB-Spalte int_sdat'
    ALTER TABLE IntBuch
    ADD CONSTRAINT Gutschrift FOREIGN KEY (int_hkto,int_hblz) REFERENCES Konto
    ON DELETE CASCADE
    ADD FOREIGN KEY (KtoNr,BLZ) REFERENCES Konto
    ADD FOREIGN KEY (int_bunr) REFERENCES Buchung
    ON DELETE CASCADE
    After that I read the DDL with DBMS_METADATA.get_DDL and I get
    " CREATE TABLE "UOENDE"."INTBUCH"
    (     "INT_BUNR" NUMBER(*,0) NOT NULL ENABLE,
         "INT_SDAT" FLOAT(126) NOT NULL ENABLE,
         "INT_HBLZ" CHAR(8) NOT NULL ENABLE,
         "INT_HKTO" CHAR(7) NOT NULL ENABLE,
         "INT_HDAT" FLOAT(126) NOT NULL ENABLE,
         "KTONR" CHAR(7) NOT NULL ENABLE,
         "BLZ" CHAR(8) NOT NULL ENABLE,
         CONSTRAINT "PK_INTBUCH" PRIMARY KEY ("INT_BUNR")
    USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
    STORAGE(INITIAL 16384 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "USERS" ENABLE,
         CONSTRAINT "GUTSCHRIFT" FOREIGN KEY ("INT_HKTO", "INT_HBLZ")
         REFERENCES "UOENDE"."KONTO" ("KTONR", "BLZ") ON DELETE CASCADE ENABLE,
         FOREIGN KEY ("KTONR", "BLZ")
         REFERENCES "UOENDE"."KONTO" ("KTONR", "BLZ") ENABLE,
         FOREIGN KEY ("INT_BUNR")
         REFERENCES "UOENDE"."BUCHUNG" ("BU_NR") ON DELETE CASCADE ENABLE
    ) PCTFREE 20 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "USERS"
    If there are no more DDLOptions possible than that, it is fine for me. If not, but all kinds of options are to find in only one or two tables of the database ( user_tables for table options, dba_constraints and dba_segments for column options, primary and foreign keys, user_indexes and user_segments for indexes ...), that is fine for me, too. (As long as I get to know which tables are "sufficient" for that.) If it is different than both of that, that's bad.
    However if you want to use defaults instead of
    absolut values, it is better to remove certain parts,
    like the storage clause, from the generated output.I understand this, but I am more interested to have all and not leaving out some of them in order to have the defaults in the database after running the DDL.
    A totally different approach could be to
    a) create a database link from one DB to another.
    b) create table <new_table> as select * from
    <old_table@dbLink> where 1=2;I keep that in mind, thanks for that hint.

  • Just got new macbook pro (13inch) and restored all data from old mac via time machine. Now whenAudio drop out for 3-4 secs every 10 - 15 secs!! What is going on and what can I do?

    Just got brand new macbook pro (13inch) and restored all data from old mac via time machine. Now when I p/back a track in logic I get audio drop out for 3-4 secs every 10 - 15 secs!! What is going on and what can I do? Its the same version of logic and all other functions seem fine!

    First of all, why did you say yes to Nero Back up before researching what it does with files already on the HDD? When I install Nero, the Back Up is the first thing I disable, it is a nagging pain, there are much better backup programs available. There are several file recovery programs out there to recover deleted files, that is, if that is what happened. Also, if you haven't overwritten the files, so you should be able to find them.

  • After moving from Canada to the US, getting a new iPhone 5C, and restoring my backup from iCloud, I can't update my apps. I get an error message that my account is not valid in the Canadian App store and I must change to the US store. How do I do that?

    After moving from Canada to the US, getting a new iPhone 5C, and restoring my backup from iCloud, I can't update my apps. I get an error message that my account is not valid in the Canadian App store and I must change to the US store. How do I do that?

    Change here:
    Settings > iTunes & App Stores > Apple ID: > View Apple ID > Country/Region.
    You must have a verified billing address & be located in the country whose store you are trying to use.

  • Error disk utility can't repair this disk...disk and restore your backed-up files

    I have been working on a project using an external hard disk. I used my Macbook Pro (2010)  to create this project and files (about 31 GB). Now I am trying to open the disk on my iMac (2014) and it doesn't show up. I can see the HDD when I use disk utility but get this message when I try to repair/restore the disc:
    "error disk utility can't repair this disk...disk and restore your backed-up files"
    The funny thing is that the disk works absolutely fine with my Macbook Pro. What am I missing?
    Imac :OSX 10.9.4 , 2.7 GHz Intel Core i5, 8 Gb Ram.

    Nico,
    Did you find a way?
    This just happened to me too.
    https://discussions.apple.com/thread/5981446
    -John

  • "Disk Utility can't repair this disk...and restore the backed up files"

    Hello, my macbook crashed a few days a go  as well and after going to the recovery drive and OX Utilities  tried to verify and repair disk it gives me this error "Disk Utility can't repair this disk...and restore the backed up files" is the second time that occurs after replacing the hard drive for a new SSD, i thought my problem was solved and is not. Any Ideas? the only other thing i can think of is the logic board?

    Backup your files and arrange for an appointment at an Apple store genius bar for a free evaluation.
    Ciao.

  • Disk Utility can't repair this disk...disk, and restore your backuped-up file.

    Computer got uber slow.
    I started to worry.
    Now computer won't start.
    VERY worried.
    Tried to repair disk. Received error message above.
    Any help would be greatly appreciated.

    sulaver wrote:
    Computer got uber slow.
    I started to worry.
    Now computer won't start.
    VERY worried.
    Tried to repair disk. Received error message above.
    Any help would be greatly appreciated.
    You can't have received an error message "Disk Utility can't repair this disk...disk, and restore your backuped-up file." since that is pure gobbledegook and isn't even good English.
    What may have happened is that
    (a) your hard drive has become so full that the operating system can't find any space in which to.... operate.
    (b) as macjack says, it has crashed - possibly as a result of (a).
    (c) you have been allowing Time Machine to back up to your internal hard drive instead of to a backup disk, which has caused (a) to happen.

  • WCF Service and Sharepoint Form library : How i can read a access a form libray and query a item from file name and read form xml in WCF service ?

    WCF Service and Sharepoint Form library : How i can read or access a form libray and query a item from file name and read form xml in WCF service ?
    Ahsan Ranjha

    Hi,
    In SharePoint 2013, we can take use of REST API or Client Object Model to access the SharePoint objects like Form Library.
    SharePoint 2013 REST API
    http://msdn.microsoft.com/en-us/library/office/dn450841(v=office.15).aspx
    http://blogs.technet.com/b/fromthefield/archive/2013/09/05/working-with-sharepoint-list-data-odata-rest-and-javascript.aspx
    SharePoint 2013 Client Object Model
    http://msdn.microsoft.com/en-us/library/office/fp179912(v=office.15).aspx
    http://msdn.microsoft.com/en-us/library/office/jj193041(v=office.15).aspx
    With the retrieved file, we can then use XmlDocument object to parse it and get the values you want:
    http://weblogs.asp.net/jimjackson/opening-and-reading-an-xml-file-in-a-document-library
    http://stackoverflow.com/questions/1968809/programatically-edit-infopath-form-fields
    Best regards
    Patrick Liang
    TechNet Community Support

  • How can I copy and paste table cells from Pages into InDesign with minimum reformating?

    How can I copy and paste table cells from Pages into InDesign with minimum reformating?

    Do you mean you want to retain the formatting from Pages, or retain formatting already applied in ID?

Maybe you are looking for

  • "Effects" panel empty/blank in CS6?

    I am running Adobe Premiere Pro CS6 on Mac OS 10.9.3. Every time I open Adobe Premiere Pro, regardless of the project, the Effects Panel (not the control panel) is empty/blank. There is nothing typed in the search field, and if I do type something or

  • Can there be two fields on one line?

    I want there to be two text fields on one line. Just as you would type and tab in a regular document? Or, does every field have to be below the previous?

  • Swedish "därför" turns out "Därför" when publishing via ftp...

    When I published the new site via ftp all the å, ä, ö letters in swedish got all messy. What do I do? Need some help to solve this... Thanks in advance!

  • Graphics card question

    ok here is the senerio - i have G5 Quad with the Quadro FX4500 - i just ordered the MP with the standard 7300 GT - my idea is to swap cards so i can keep my Quadro and put the 7300GT in the G5 Quad - my question is will this 7300 GT work in the Quad?

  • IOS update caused Ipad to become unusable

    While attempting to update to IOS 8.02 iPad became unusable.  Not able to restore nor restart.  What is solution?