InputVerifier and CellEditor - verifying JTable data

I'm trying to verify the data in the cells of a JTable. I want to use an InputVerifier on the Component (JTextField in this case) which is in the CellEditor, so that when the user tabs through the JTable, I can stop the focus xfer when a value fails validation, and pop up an error message.
The AbstractTableModel for my JTable contains all the information I need to validate various columns. It knows the types of data, valid ranges, etc.
The problem I'm having is that I can't figure out a way for the CellEditor to know which column it's current cell lives in. I could assign each column it's own editor and pass the column information to the CellEditor at contruction time, but I would prefer to have a generic editor that will work for all the columns(JTable.setDefaultEditor).
Is there a way for a CellEditor to detect which cell it is currently editing?
Thanks.

Hmmm that might work. I was looking for a way for the CellEditor itself to detect which cell it is editing. I guess if I gave the CellEditor a handle to the JTable it resides on, then it could ask the JTable which cell it is editing. Seems weird the CellEditor would need to ask the JTable, 'Hey what is it Im doing exactly?' but oh well.
I'll give it a try. Thanks again.

Similar Messages

  • Tab between cells and celleditor in JTable

    I placed a cell editor in a JTable column JTextField.
    After I type something in this editor and press tab it stays in the same cell and when I press tab again then it goes to the next column.
    How can I correct this so that After I type something in the cell and press tab I want it to go to the next column directly in JTable.
    Thanks.

    I'd have to see your code to tell you what's wrong. I tried it this way and had no problem.
    TableColumn tc = table.getColumnModel().getColumn(2);
    tc.setCellEditor(new DefaultCellEditor(new JTextField()));by the way, I don't think you need to explicitly set the cell editor component to JTextField. It uses that by default.

  • How to Sort JTable data using Multiple fields (Date, time and string)

    I have to fill the JTable data with some date, time and string values. for example my table data looks like this:
    "1998/12/14","15:14:38","Unicorn1","row1"
    "1998/12/14","15:14:39","Unicorn2","row2"
    "1998/12/14","15:14:40","Unicorn4","row3"
    "1998/12/17","12:14:12","Unicorn4","row6"
    Now the Sorted Table should be in the following way:
    "1998/12/17","12:14:12","Unicorn4","row6"
    "1998/12/14","15:14:40","Unicorn4","row3"
    "1998/12/14","15:14:39","Unicorn2","row2"
    "1998/12/14","15:14:38","Unicorn1","row1"
    ie First Date field should be sorted, if 2 date fields are same then sort based on time. if date and time fields are same then need to be sorted on String field.
    So if any one worked on this please throw some light on how to proceed. I know how to sort based on single column.
    But now i need to sort on multiple columns.So what is code change in the Comparater class.
    Thanks in advance.. This is urgent....

    I think your Schedule objects should implement Comparable. Then you can sort your linked list using the Collections.sort() method without passing in a Comparator.class Schedule(Date date, String class) implements Comparable
      public void compareTo(Object obj)
        Schedule other = (Schedule)obj;
        return date.getTime() - other.getDate().getTime();
    }

  • How to use a JTextField as CellEditor and Renderer in JTable

    Hi, I want to use a JTextField as a CellEditor and CellRenderer in an JTable. How can I do this?
    Thanks for your help.

    For using JTextField as a CellEditor in JTable...try as directed below:
    TableColumnModel tcm = table.getColumnModel();
    JTextField txt = new JTextField();
    /***now specify the column number in which u want to add this textfield, e.g in the example below iam adding this textfield to 1st column***/
    tcm.getColumn(0).setCellEditor(new DefaultCellEditor(qty));
    Rajat.

  • Verify the data between SAP R/3 and SAP BW

    Hi Experts,
    How to verify the data between SAP R/3 and SAP BW at the time of data mismatches in reports.
    give me the proper solution.
    Thanks,
    Syam

    Hello,
    You must know what is the infoprovider source of the data shown in the report.
    Once you know it, check the content filtering by same restrictions as in the mismatch report. Now you have the data in BW.
    Then you have to know the proper transation or table in R/3, from where the extractor retrieves the data to populate the infoprovider; make same restrictions and compare it with data in BW.
    Regards

  • Mirroring a drive and verifying written data

    I have an internal drive that holds some important personal files. I bought an external USB hard disk for the purpose of backing up the files. What would be the best method to mirror the contents of the internal drive to the external drive and then verify that the data is really there.
    The best situation would be that the backup software detects what files have been added / changed (but not deleted), copies them on to the external file and then verifies that the data on the external drive matches the data on the original drive (verifies all the files, not just the recently copied files).
    I'm a bit worried if the data will surely be written on the external drive. I've previously had the problem that I've inserted a memory card in a card reader, then copied some files and "safely removed" the card, but then found out that only the names of the files were written, but the files were all empty. So I want the program to make sure the data actually is on the external drive.
    I do not want any snapshot file or tar file, but just the original drive mirrored as it is.

    ok - here's _one_ way of doing it ...
    #!/bin/sh
    # for the following to work properly, do not use automount!
    # assume the first external disk is /dev/sdb1 and is mounted on /usb
    # assume your backup disk will be /dev/sdc1
    # connect the backup-disk before going to bed at night, start up
    # this script and then remove the backup-disk in the morning
    die() { echo -e "$*"; exit 1; }
    df | grep -q '/usb$' || die "-- /usb is _not_ mounted!"
    test -b /dev/sdc1 || die "-- no backup disk (/dev/sdc1)"
    test -d /backup || mkdir -p /backup
    mount /dev/sdc1 /backup || die "-- could not mount backup disk on /backup!"
    rsync -av --delete /usb/ /backup || echo "-- backup failed!"
    umount /backup
    exit 0
    Obviously - there are dozens of mutations on this one ...
    1) Put the script in crontab and let it run each night
    2) Use it as in 1), but only connect the backup disk on the nights you want it - always make sure to remove it the next morning
    3) Keep the backup disk connected at all times
    Personally I used to use 3) - but I had lightning strike which blew out not only the computer, but both usb-disks as well :-(
    These days I go for 2) because of the lesson learned - if its not connected, nothing (apart from a catastrophy) will touch it in any way.
    YMMV
    Last edited by perbh (2010-01-15 19:39:57)

  • ''verify the date and accept cookie''

    I am trying to create an iTunes account. iTunes asked me to verify my email address: I did. Then I logged in using my newly created account and it says that this new user has never logged on to iTunes and that I need to verify my data. So I click Verify... then a page appears with an error saying that I need to make sure the date is correct and that my computers accepts cookies from iTunes.
    I know my web browser accepts cookies as it is set as 'accept all cookies'.
    Please help me...!

    My reply was in response to the first part of your question "I would like to accept the date & time in excel..." and the code example shows how to flag if a given date-time is/not within two hours of "Now". However you didn't indicate where or how you
    want to include this in Excel or how to link it to InfoPath.
    I'm afraid I don't know anything about InfoPath so can't help you with that aspect, hopefully someone else can. But also I don't follow why Excel is involved in handling the date. Is the objective for users to write their requests in Excel but only if the
    date request is more than two hours later. If so I can help you with that aspect if you give more details.

  • Problem with InputVerifier and JPopupMenu

    Hello, I have a problem related to the usage of InputVerifier and JPopupMenu.
    Consider the following scenario:
    - A frame composed of two components: a JTextField and a JComboBox
    - An InputVerifier that was set in the JComboBox (and in its associated JTextComponent)
    - A JPopupMenu which is enabled by a right mouse click over the components of the frame.
    The verify() method of the InputVerifier class is executed every time the focus is on the JComboBox and is requested by other component.
    Suppose that the focus is on the JComboBox, and a right mouse click is executed over this components. In summary, we have:
    1) The method verify() of the InputVerifier associated to the JComboBox is executed
    2) The focus changes from the JTextComponent (associated to the JComboBox) to the JRootPane (associated to the JTextComponent (that is associated to the JPopupMenu)).
    Now suppose that, the user clicks in the JTextField component (note that the JPopupMenu is visible and has the focus). What happens is that the focus goes from the JRootPane -> JTextComponent (associated to the JComboBox) -> JTextField.
    Despite the focus flow through the JTextComponent, the Swing plattaform, when executing the runInputVerifier() in the JComponent context, get the JRootPane component as the focusOwner instead of the JTextComponent.
    In this way, the Swing platform tries to invoke the InputVerify of the JRootPane (that is set with "null"), and the JComboBox InputVerifier is not executed as expected.
    It works as if the focus is flowing from the JRootPane directly to the JTextField.
    However, if the user clicks on the JComboBox before clicking in the JTextField, the Swing platform executes the correct InputVerifier, i.e., the one associated to the JComboBox (actually, the one associated to the JTextComponent).
    Any thoughts to solve this problem?
    Thanks

    A plus information, I am using jdk1.5.0_22.

  • InputVerifier and JOptionPane.showMessageDialog

    Since I have intalled JDK 1.4. I have got the following Problem:
    in the verify Method there is a call to JOptionPane.showMessageDialog
    in order to show a error message if the input doesn�t match and before false is returned.
    It doesn�t work anymore with 1.4. In case of error, the message Dialog is not coming up and the verify methodis just called in a endless loop.

    try setting the InputVerifier to null before displaying the JOptionPane, then set it back after the JOptionPane.
    textField.setInputVerifier(null)
    JOptionPane.showMessageDialog(...)
    textField.setInputVerifier(this)

  • Drag and Drop from JTable

    Using cntl C and cntl V to copy data from a JTable
    into another file
    j2sdk1.4.0 copied the column names along with the data.
    j2sdk1.4.1_04 does not copy the column names anymore.
    Is there any way to get the previous functionality?

    Does anyone use cut and paste to copy data from a JTable to another file?
    I wonder why the new RE-Version doesn't copy the column headers anymore.

  • Save a JTable (data+settings) ?

    I want to save a complete JTable.
    In my JTable I changed all,
    that means I changed the hight of a row and the length from a coloumn to have the best view of the data.
    I want to save the table with this changes.
    I used for the JTable the AbstractTableModel.
    I tried to save and load the AbstractTableModel Object with the ObjectOutputStream but it doesn't worked.
    Only the Coloumnames was showing, but that's all.
    I hope somebody can help me
    Andreas

    Your post gave me an idea and I didn't think it would work, but it seems to have done just fine. There has to be something wrong with this. It's too bizarre.import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    public class Test3 extends JFrame {
      String[] head = {"One","Two","Three"};
      String[][] data = {{"R1-C1","R1-C2","R1-C3"},
                         {"R2-C1","R2-C2","R2-C3"},
                         {"R3-C1","R3-C2","R3-C3"}};
      JTable jt = new JTable(data, head);
      byte[] bytes;
      Container content = getContentPane();
      int count = 0;
      public Test3() {
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        content.add(new JScrollPane(jt), BorderLayout.CENTER);
        JPanel buttonPanel = new JPanel();
        content.add(buttonPanel, BorderLayout.SOUTH);
        JButton save = new JButton("Save"), restore = new JButton("Restore");
        buttonPanel.add(save);
        buttonPanel.add(restore);
        save.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            try {
              ByteArrayOutputStream baos = new ByteArrayOutputStream();
              ObjectOutputStream oos = new ObjectOutputStream(baos);
              oos.writeObject(jt);
              oos.flush();
              oos.close();
              bytes = baos.toByteArray();
              content.add(new JPanel(), BorderLayout.CENTER);
              content.validate();
            } catch (Exception e) { e.printStackTrace(); }
        restore.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            try {
              ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
              ObjectInputStream ois = new ObjectInputStream(bais);
              JTable newTable = (JTable)ois.readObject();
              content.add(new JScrollPane(newTable), BorderLayout.CENTER);
              content.validate();
            } catch (Exception e) { e.printStackTrace(); }
        setSize(300,300);
      public static void main(String[] args) { new Test3().setVisible(true); }
    }

  • Firewire does not function after uninstalling macfuse and an out of date version of NTFS32 and then installed latest version of Tuxera NTFS for Mac.

    I purchased a 3TB HDD (WD USB 3.0 $100) to replace the 2TB Seagate for a new Time Machine HDD. The 2B was full and backups were deleting older files. The 3TB was formatted NTFS and I want to "recover" the included SW before I reformatted the HDD for the iMac. I discovered that MacFuse was out of date and unsupported and my NTFS-32 was also out of date so I uninstalled both and then installed the most recent version of Tuxera NTFS for Mac. I rebooted and discovered that the FW800 port was unresponsive. Below is the EtreCheck report:
    Problem description:
    Firewire does not function after uninstalling macfuse and an out of date version of NTFS32 and then installed Tuxera NTFS for Mac.
    EtreCheck version: 2.0.8 (95)
    Report generated October 30, 2014 7:11:17 PM EDT
    Hardware Information: ℹ️
      iMac (24-inch Mid 2007) (Verified)
      iMac - model: iMac7,1
      1 2.8 GHz Intel Core 2 Duo CPU: 2-core
      4 GB RAM
      BANK 0/DIMM0
      2 GB DDR2 SDRAM 667 MHz ok
      BANK 1/DIMM1
      2 GB DDR2 SDRAM 667 MHz ok
      Bluetooth: Old - Handoff/Airdrop2 not supported
      Wireless:  en1: 802.11 a/b/g/n
    Video Information: ℹ️
      ATI,RadeonHD2600 - VRAM: 256 MB
      iMac 1920 x 1200
    System Software: ℹ️
      OS X 10.8.5 (12F45) - Uptime: 0:17:34
    Disk Information: ℹ️
      WDC WD5000AAKS-40TMA0 disk0 : (500.11 GB)
      S.M.A.R.T. Status: Verified
      disk0s1 (disk0s1) <not mounted> : 210 MB
      ML 10.8 (disk0s2) /  [Startup]: 499.25 GB (20.92 GB free)
      Recovery HD (disk0s3) <not mounted>  [Recovery]: 650 MB
    USB Information: ℹ️
      Apple Inc. Built-in iSight
      Apple Computer, Inc. IR Receiver
      Logitech USB Receiver
      Apple Inc. Bluetooth USB Host Controller
    Gatekeeper: ℹ️
      Mac App Store and identified developers
    Kernel Extensions: ℹ️
      /Applications/Hardware Monitor ƒ/HardwareMonitor.app
      [loaded] com.bresink.driver.BRESINKx86Monitoring (7.0) Support
      /Applications/Parallels Desktop.app
      [not loaded] com.parallels.kext.hidhook (8.0 18615.948847) Support
      [not loaded] com.parallels.kext.hypervisor (8.0 18615.948847) Support
      [not loaded] com.parallels.kext.netbridge (8.0 18615.948847) Support
      [not loaded] com.parallels.kext.usbconnect (8.0 18615.948847) Support
      [not loaded] com.parallels.kext.vnic (8.0 18615.948847) Support
      /Applications/Toast Titanium v11.1/Spin Doctor.app
      [not loaded] com.hzsystems.terminus.driver (4) Support
      /Applications/Toast Titanium/Toast Titanium v11.1 (1072).app
      [not loaded] com.roxio.TDIXController (2.0) Support
      /Library/Application Support/Symantec/AntiVirus
      [loaded] com.symantec.kext.SymAPComm (12.2f1 - SDK 10.6) Support
      /System/Library/Extensions
      [loaded] com.Logitech.Control Center.HID Driver (3.9.0 - SDK 10.6) Support
      [loaded] com.eltima.ElmediaPlayer.kext (1.58 - SDK 10.4) Support
      [not loaded] com.hzsystems.driver.CDSDAudioCaptureSupport (1.5) Support
      [not loaded] com.increw.kext.speedit (0.32) Support
      [loaded] com.logitech.manager.kernel.driver (4.10.0 - SDK 10.8) Support
      [not loaded] com.olympus.CamBlockCommandsDevice (2.0.0) Support
      [not loaded] com.olympus.CamBlockCommandsDeviceUP (2.0.0) Support
      [not loaded] com.palm.ClassicNotSeizeDriver (3.2.1) Support
      [not loaded] com.roxio.BluRaySupport (1.1.6) Support
      [not loaded] com.seagate.driver.PowSecDriverCore (5.1.1) Support
      [loaded] com.symantec.kext.internetSecurity (5.2f1 - SDK 10.6) Support
      [loaded] com.symantec.kext.ips (3.5f1 - SDK 10.6) Support
      [loaded] com.symantec.kext.ndcengine (1.0f1 - SDK 10.6) Support
      [loaded] com.taoeffect.ispy.kext (2.0.2 - SDK 10.2) Support
      /System/Library/Extensions/OlympusDSCDriver.kext/Contents/PlugIns
      [not loaded] com.olympus.CamFWSerialBusProtocolTransport (2.0.0) Support
      [not loaded] com.olympus.CamUSBMassStorageClass (2.0.0) Support
      /System/Library/Extensions/Seagate Storage Driver.kext/Contents/PlugIns
      [not loaded] com.seagate.driver.PowSecLeafDriver_10_4 (5.1.1) Support
      [not loaded] com.seagate.driver.PowSecLeafDriver_10_5 (5.1.1) Support
      [not loaded] com.seagate.driver.SeagateDriveIcons (5.1.1) Support
      /Users/[redacted]/Downloads/LCC Installer.app
      [not loaded] com.Logitech.Unifying.HID Driver (1.3.1 - SDK 10.8) Support
    Startup Items: ℹ️
      TuxeraNTFSUnmountHelper: Path: /Library/StartupItems/TuxeraNTFSUnmountHelper
      Startup items are obsolete and will not work in future versions of OS X
    Launch Agents: ℹ️
      [running] com.canon.MFManager.plist Support
      [not loaded] com.cooliris.SetLaunchArch.plist Support
      [loaded] com.google.keystone.agent.plist Support
      [running] com.Logitech.Control Center.Daemon.plist Support
      [running] com.logitech.manager.daemon.plist Support
      [running] com.micromat.TechToolProAgent.plist Support
      [loaded] com.oracle.java.Java-Updater.plist Support
      [running] com.seagate.SeagateStorageGauge.plist Support
      [running] com.symantec.uiagent.application.plist Support
    Launch Daemons: ℹ️
      [loaded] com.adobe.fpsaud.plist Support
      [running] com.cleverfiles.cfbackd.plist Support
      [running] com.eltima.ElmediaPlayer.daemon.plist Support
      [loaded] com.embraceware.awaken.plist Support
      [loaded] com.google.keystone.daemon.plist Support
      [loaded] com.macpaw.CleanMyMac2.Agent.plist Support
      [running] com.micromat.TechToolProDaemon.plist Support
      [loaded] com.microsoft.office.licensing.helper.plist Support
      [loaded] com.oracle.java.Helper-Tool.plist Support
      [loaded] com.oracle.java.JavaUpdateHelper.plist Support
      [loaded] com.prosofteng.DriveGenius.locum.plist Support
      [running] com.smithmicro.schedulerdaemon.plist Support
      [loaded] com.symantec.liveupdate.daemon.ondemand.plist Support
      [failed] com.symantec.liveupdate.daemon.plist Support
      [not loaded] com.symantec.sep.migratesettings.plist Support
      [running] com.symantec.sharedsettings.plist Support
      [running] com.symantec.symdaemon.plist Support
      [running] com.taoeffect.ispyd.plist Support
      [running] com.wdc.drivemanagerservice.plist Support
    User Launch Agents: ℹ️
      [loaded] com.adobe.ARM.[...].plist Support
      [loaded] com.macpaw.CleanMyMac2Helper.diskSpaceWatcher.plist Support
      [loaded] com.macpaw.CleanMyMac2Helper.scheduledScan.plist Support
      [loaded] com.macpaw.CleanMyMac2Helper.trashWatcher.plist Support
      [running] com.prosofteng.DGMonitor.plist Support
      [running] com.smithmicro.cleaning.schedulermailer.plist Support
      [running] com.taoeffect.EspionageHelper.plist Support
    User Login Items: ℹ️
      Speedy Mac Application (/Applications/Speedy Mac/Speedy Mac.app)
      AwakenHelper Application (/Users/[redacted]/Library/Application Support/Awaken/AwakenHelper.app)
      GetBackupAgent Application (/Users/[redacted]/Library/Application Support/BeLight Software/Get Backup 2/GetBackupAgent.app)
      WDDriveUtilityHelper Application (/Users/[redacted]/Downloads/WD/WD Drive Utilities.app/Contents/Resources/WDDriveUtilityHelper.app)
      ClustersHelper Application (/Library/PreferencePanes/Clusters.prefPane/Contents/Resources/ClustersHelper.a pp)
      RealPlayer Downloader Agent Application (/Users/[redacted]/Library/Application Support/RealNetworks/RealPlayer Downloader Agent.app)
      SAVDiskMountNotify UNKNOWN (missing value)
      ScanNotification UNKNOWN (missing value)
      Launch Nikon Message Center 2 Application (/Applications/Nikon Software/Nikon Message Center 2/Nikon Message Center 2.app/Contents/SharedSupport/Launch Nikon Message Center 2.app)
    Internet Plug-ins: ℹ️
      EPPEX Plugin: Version: 10.0 Support
      Flash Player: Version: 15.0.0.189 - SDK 10.6 Support
      AdobePDFViewer: Version: 9.4.6 Support
      Unity Web Player: Version: UnityPlayer version 3.5.3f3 - SDK 10.6 Support
      NPVirtools: Version: 4.0 Support
      iPhotoPhotocast: Version: 7.0 - SDK 10.8
      RealPlayer Plugin: Version: (null) Support
      DirectorShockwave: Version: 11.6.8r638 Support
      QuickTime Plugin: Version: 7.7.1
      FlashPlayer-10.6: Version: 15.0.0.189 - SDK 10.6 Support
      GarminGpsControl: Version: 2.9.3.0 Release Support
      ToontownBundleManager: Version: (null) Support
      CANONiMAGEGATEWAYDL: Version: 3.1.0.2 Support
      Silverlight: Version: 5.1.10411.0 - SDK 10.6 Support
      OVSHelper: Version: 1.0 Support
      CoolirisWebKitPlugin: Version: (null) Support
      Google Earth Web Plug-in: Version: 6.1 Support
      Flip4Mac WMV Plugin: Version: 3.2.0.16   - SDK 10.8 Support
      SharePointBrowserPlugin: Version: 14.4.4 - SDK 10.6 Support
      JavaAppletPlugin: Version: Java 7 Update 67 Check version
      OfficeLiveBrowserPlugin: Version: 12.3.6 Support
    User Internet Plug-ins: ℹ️
      BrowserPlus_2.9.2: Version: 2.9.2 Support
      Picasa: Version: 1.0 Support
    Safari Extensions: ℹ️
      DivX Plus Web Player HTML5 <video>
      Open in Internet Explorer
      DivX HiQ
      Aimersoft Video Converter
    3rd Party Preference Panes: ℹ️
      BrowserPlus  Support
      Clusters  Support
      Déjà Vu  Support
      Flash Player  Support
      Flip4Mac WMV  Support
      Java  Support
      Logitech Control Center  Support
      Logi Preference Manager  Support
      MenuMeters  Support
      Perian  Support
      Symantec QuickMenu  Support
      TechTool Protection  Support
      Tuxera NTFS  Support
    Time Machine: ℹ️
      Skip System Files: NO
      Auto backup: YES
      Destinations:
      iMac TimeMachine [Local]
      Total size: 2 TB
      Total number of backups: 80
      Oldest backup: 2011-09-18 05:21:33 +0000
      Last backup: 2014-10-05 20:18:55 +0000
      Size of backup disk: Excellent
      Backup size 2 TB > (Disk size 0 B X 3)
      /sbin excluded from backup!
      /usr excluded from backup!
      /System excluded from backup!
      /bin excluded from backup!
      /private excluded from backup!
      /Library excluded from backup!
      /Applications excluded from backup!
    Top Processes by CPU: ℹ️
          2% WindowServer
          0% Speedy
          0% SystemUIServer
          0% RealPlayer Downloader Agent
          0% ps
    Top Processes by Memory: ℹ️
      288 MB SymDaemon
      150 MB Speedy
      137 MB Safari
      82 MB WebProcess
      82 MB coreservicesd
    Virtual Memory Information: ℹ️
      2.17 GB Free RAM
      1.46 GB Active RAM
      148 MB Inactive RAM
      518 MB Wired RAM
      388 MB Page-ins
      0 B Page-outs
    I hope someone has some ideas! TIA.

    Do you have another cable you can test with? Do you have access to another computer with Firewire you can test with?
    FireWire Device not Working
    FireWire/USB - Quick Assist

  • Java.io.NotSerializableException when overwrite the JTable data into .txt file

    hi everyone
    this is my first time to get help from sun forums
    i had java.io.NotSerializableException: java.lang.reflect.Constructor error when overwrite the JTable data into .txt file.
    At the beginning, the code will be generate successfully and the jtable will be showing out with the data that been save in the studio1.txt previously,
    but after i edit the data at the JTable, and when i trying to click the save button, the error had been showing out and i cannot succeed to save the JTable with the latest data.
    After this error, the code can't be run again and i had to copy the studio1.txt again to let the code run 1 more time.
    I hope i can get any solution at here and this will be very useful for me.
    the following is my code...some of it i create it with the GUI netbean
    but i dunno how to attach my .txt file with this forum
    did anyone need the .txt file?
    this is the code that suspect maybe some error here
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    String filename = "studio1.txt";
              try {
                  FileOutputStream fos = new FileOutputStream(new File(filename));
                  ObjectOutputStream oos = new ObjectOutputStream(fos);
                   oos.writeObject(jTable2);
                   oos.close();
              catch(IOException e) {
                   System.out.println("Problem creating table file: " + e);
                   return;
              System.out.println("JTable correctly saved to file " + filename);
    }the full code will be at the next msg

    this is the part 1 of the code
    this is the full code...i had /*....*/ some of it to make it easier for reading
    package gui;
    import javax.swing.*;
    import java.io.*;
    public class timetables extends javax.swing.JFrame {
        public timetables() {
            initComponents();
        @SuppressWarnings("unchecked")
        private void initComponents() {
            jDialog1 = new javax.swing.JDialog();
            buttonGroup1 = new javax.swing.ButtonGroup();
            buttonGroup2 = new javax.swing.ButtonGroup();
            buttonGroup3 = new javax.swing.ButtonGroup();
            buttonGroup4 = new javax.swing.ButtonGroup();
            jTextField1 = new javax.swing.JTextField();
            jLayeredPane1 = new javax.swing.JLayeredPane();
            jLabel6 = new javax.swing.JLabel();
            jTabbedPane1 = new javax.swing.JTabbedPane();
            jScrollPane3 = new javax.swing.JScrollPane();
            jTable2 = new javax.swing.JTable();
            jScrollPane4 = new javax.swing.JScrollPane();
            jTable3 = new javax.swing.JTable();
            jButton1 = new javax.swing.JButton();
            jButton2 = new javax.swing.JButton();
    /*       org.jdesktop.layout.GroupLayout jDialog1Layout = new org.jdesktop.layout.GroupLayout(jDialog1.getContentPane());
            jDialog1.getContentPane().setLayout(jDialog1Layout);
            jDialog1Layout.setHorizontalGroup(
                jDialog1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(0, 400, Short.MAX_VALUE)
            jDialog1Layout.setVerticalGroup(
                jDialog1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(0, 300, Short.MAX_VALUE)
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            jLayeredPane1.add(jLabel6, javax.swing.JLayeredPane.DEFAULT_LAYER);
            String filename1 = "studio1.txt";
            try {
                   ObjectInputStream ois = new ObjectInputStream(new FileInputStream(filename1));
                   jTable2 = (JTable) ois.readObject();
                   System.out.println("reading for " + filename1);
              catch(Exception e) {
                   System.out.println("Problem reading back table from file: " + filename1);
                   return;
            try {
                   ObjectInputStream ois = new ObjectInputStream(new FileInputStream(filename1));
                   jTable3 = (JTable) ois.readObject();
                   System.out.println("reading for " + filename1);
              catch(Exception e) {
                   System.out.println("Problem reading back table from file: " + filename1);
                   return;
            jTable2.setRowHeight(20);
            jTable3.setRowHeight(20);
            jScrollPane3.setViewportView(jTable2);
            jScrollPane4.setViewportView(jTable3);
            jTable2.getColumnModel().getColumn(4).setResizable(false);
            jTable3.getColumnModel().getColumn(4).setResizable(false);
            jTabbedPane1.addTab("STUDIO 1", jScrollPane3);
            jTabbedPane1.addTab("STUDIO 2", jScrollPane4);
            jTextField1.setText("again n again");
            jLabel6.setText("jLabel5");
            jLabel6.setBounds(0, 0, -1, -1);
            jButton2.setText("jButton2");
            jButton1.setText("jButton1");
            jButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton1ActionPerformed(evt);
          

  • Java.io.NotSerializableException when overwrite the JTable data into .txt

    hi everyone
    i had java.io.NotSerializableException: java.lang.reflect.Constructor error when overwrite the JTable data into .txt file.
    At the beginning, the code will be generate successfully and the jtable
    will be showing out with the data that been save in the studio1.txt
    previously,
    but after i edit the data at the JTable, and when i trying to click the
    save button, the error had been showing out and i cannot succeed to
    save the JTable with the latest data.
    After this error, the code can't be run again and i had to copy the studio1.txt again to let the code run 1 more time.
    I hope i can get any solution at here and this will be very useful for me.
    but i dunno how to attach my .txt file with this forum
    did anyone need the .txt file?
    the following is my suspect code
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    String filename1 = "studio1.txt";
              try {
                  FileOutputStream fos = new FileOutputStream(new File(filename1));
                  ObjectOutputStream oos = new ObjectOutputStream(fos);
                   oos.writeObject(jTable2.getModel());
                   oos.flush();
                   oos.close();
                   fos.close();
              catch(IOException e) {
                   System.out.println("Problem creating table file: " + e);
                            e.printStackTrace();
                   return;
              System.out.println("JTable correctly saved to file " + filename1);
    }this is the reading code
    String filename1="studio1.txt";
            try {
                   ObjectInputStream ois = new ObjectInputStream(new FileInputStream(filename1));
                   TableModel model = (TableModel)ois.readObject();
                    jTable3.setModel(model);
                   System.out.println("reading for " + filename1);
              catch(Exception e) {
                   System.out.println("Problem reading back table from file: " + filename1);
                   return;
              }Edited by: Taufulou on Jan 8, 2009 11:43 PM
    Edited by: Taufulou on Jan 8, 2009 11:44 PM
    Edited by: Taufulou on Jan 8, 2009 11:45 PM

    is this the code u mean?
    i had put this code inside it but the problem still remain the same
    if (jTable2.isEditing()) {
                jTable2.getCellEditor().stopCellEditing();
            }i had found a new thing that when i just double click the cell without change any data inside the table
    and click the button "Save". the same exception which is
    java.io.NotSerializableException: java.lang.reflect.Constructor
    will come out again.

  • Backup and Restore of DQS (Data Quality Service SQL 2012) Databases

    We are currently using DPM 2010 running on Server 2008 R2 as our backup solution.  We will soon be leveraging the Data Quality Services in SQL 2012 along with the Master Data Service.  
    In the SQL 2012 documentation from Microsoft it states, “The backup and restore operations of the DQS databases must be synchronized.” 
    Otherwise the restored Data Quality Server will not be functional.  Currently I believe that DPM will run serialized backups of databases from one SQL server. 
    I was hoping someone could point me towards some documentation for backing up DQS with DPM. 
    Is anybody currently doing this?  If so have you been successful restoring?

    LogicalName cant be same for mdf and ldf. verify again with FILELISTONLY. Also you have put wrong logical name 
    MOVE N'OriginalDB' TO N'D:\sql data\TargetDB.mdf'
    Please paste the output of
    RESTORE FILELISTONLY FROM DISK = 'D:\backup.bak'

Maybe you are looking for