JTable will not refresh with new data from database

Hi,
I have a JTable that does not recoginzed when the data has changed. The table is dynmaically populated with data from the database using a table model.
Please help!!
public JTable getUpdateContractTable() {
QueryTableModel model;
String [] dlrs = getSelectedDealers();
String [] stats = getSelectedStatuses();
String sql = buildContractQuery(dlrs, stats);
try {
if(isContractSet) {
model = new QueryTableModel();
model.setQuery(sql);
table.setModel(model);
table.setColumnModel(new UpdtCtrctColumnModel());
table.invalidate();
table.repaint();
//model.fireTableChanged(new TableModelEvent(model));
else {
model = new QueryTableModel();
UpdtCtrctColumnModel column = new UpdtCtrctColumnModel();
model.setQuery(sql);
table = new JTable(model, column);
table.createDefaultColumnsFromModel();
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
table.setPreferredScrollableViewportSize(new Dimension(500, 70));
model.fireTableChanged(null);
isContractSet = true;
catch (Exception e) {
System.out.println(e.getMessage());
//JOptionPane.show
//.showMessageDialog("Error: " + e.getMessage(),
// "Click Ok",
// JOptionPane.INFORMATION_MESSAGE);
return table;
}

thank you for your help. i finally got it to refresh. i have a follow-up question if you don't mind answering it. i have 2 jtables where one depends on the other. when i do a refresh i want the other table to disappear, so i call the getContentPane().remove(component), but the table doesn't disappear. what should i do.
anthony

Similar Messages

  • Spry Data Set will not Refresh with New Data?

    I'm using the Dreamweaver CS4 "Spry Data Set" Wizard and created the following layout on one of my pages:
    In the wizard, under "Specify a Data Source", I chose "HTML", and selected my cfm page that has a simple Table with the datasource below:
    <cfparam name="URL.id_com" default="1">
    <cfquery name="rsTickets" datasource="Ctickets">
    SELECT ticketNum, ticketType, ticketDate, acctNum, firstName, lastName, businessName, city, status, owner, ticketDetails
    FROM tickets
    WHERE acctNum = <cfqueryparam value="#URL.id_com#" cfsqltype="cf_sql_numeric">
    </cfquery>
    When I display the page in IE8, The Spry Master/Detail page will not filter my records based on the URL parameter?
    (Note: All my other "Non-Spry" datasets filter fine by the URL)
    Question: How do I make the Spry data "Refresh" or "Re-run the query" so the data filters properly?
    Thanks,
    jlig

    Ben, Thanks for the reply..
    Here is my Source Data page which I created & selected in the Spry Data Wizard: http://cerberus.clearwave.com/jerry/Spry2.jpg
    (this page takes my query, filtered by the URL Acct field and makes a simple table to feed the Spry Wizard)
    - In the Spry Data Wizard, I selected the file and it properly found the table data: http://cerberus.clearwave.com/jerry/Spry3.jpg
    - Then I clicked Next and changed a few of the field types: http://cerberus.clearwave.com/jerry/Spry4.jpg
    - Next I chose Master-Detail and used the Acct field to be the Master : http://cerberus.clearwave.com/jerry/Spry5.jpg
    - Lastly, I open up the webpage, click on the Tickets Spry Tab: http://cerberus.clearwave.com/jerry/Spry6.jpg
    As you can see in the picture on this page: http://cerberus.clearwave.com/jerry/Spry6.jpg, the URL parameter is = 3902 which is the Acct number
    being passed from the previous page in my application. (Ex..http://192.168.1.77/COE/salespipeline_mi.cfm?id_com=3902)
    The first one is correct, but once I move to a different Acct number the Spry data will not update to reflect the correct Tickets?
    Once I move to say, Acct 4413, the Spry Tickets Tab does not change or update to reflect this Acct's tickets?
    (see link--> http://cerberus.clearwave.com/jerry/Spry7.jpg)
    Here is my code listing for the Tabbed Webpage: http://cerberus.clearwave.com/jerry/Spry8.txt (see images 6 & 7)
    It seems like I'm missing some kind of "Trigger" or "Requery" or "Refresh" that "Re-runs" the Source Data page (http://cerberus.clearwave.com/jerry/Spry2.jpg)..?
    Thanks again,
    jlig

  • UIInput will not refresh with new value

    I have the following JSF component
    <h:inputText id="entryfee" binding="#{entryform.evententryfee}" value=""/>
    in a onchangeevent in another component I have the following
    double entryfee = 100.0;
    FacesContext mycontext = FacesContext.getCurrentInstance();
    evententryfee.setValue(String.valueOf(entryfee));
    evententryfee.updateModel(mycontext);
    evententryfee is updated but the new value is not displayed by the component
    How do I refresh the display to show the new value ?

    Why do you use the component binding instead of a normal value binding?
    You can write
    <h:inputText id="entryfee" value="#(entryform.entryfee}"/>
    Anyway, a component binding does not overwrite the attribute whichi is explictly specifed by the tag.
    So, if you insist to use the component binding, you can write
    <h:inputText id="entryfee" binding="#{entryform.evententryfee}"/>

  • My ipod 5.1.1 (9B206) will not sync with new Itunes version 12.0.1.26. Can anyone help

    My ipod touch 3rd generation OS  5.1.1 (9B206) will not sync with new Itunes version 12.0.1.26. Can anyone help

    What exactly happens when you try to sync?
    Does iTunes see the iPod?
    Was the iPod previous synced to another iTunes library/computer?
    Have you successfully synced from this iTunes library/computer before?
    If so have you done anything like update iTunes on the computer since it last successfully synced?
    Do the songs play in iTunes?          
    Does any media now sync to the iPod?
    Do you have the right boxes checked to sync?
    iTunes: Syncing media content to iOS devices and iPod       
    Try syncing using the manual method                
    Managing content manually on iPhone, iPad, and iPod
    If iTunes does not see the iPod:
    iOS: Device not recognized in iTunes for Mac OS X
    Or
    See
    iOS: Device not recognized in iTunes for Windows
    - I would start with
    Removing and Reinstalling iTunes, QuickTime, and other software components for Windows XP
    or                     
    Removing and reinstalling iTunes and other software components for Windows Vista, Windows 7, or Windows 8
    However, after your remove the Apple software components also remove the iCloud Control Panel via Windows Programs and Features app in the Window Control Panel. Then reinstall all the Apple software components
    - Then do the other actions of:
    iOS: Device not recognized in iTunes for Windows
    paying special attention to item #5
    - New cable and different USB port
    - Run this and see if the results help with determine the cause
    iTunes for Windows: Device Sync Tests
    Also see:
    iPod not recognised by windows iTunes
    Troubleshooting issues with iTunes for Windows updates
    - Try on another computer to help determine if computer or iPod problem

  • I forgot my password and ipod will not sync with new computer

    I forgot my password and ipod will not sync with new computer

    You'll need to connect the iPod Touch to your iTunes library in recovery mode and restore it factory settings.  There is no other way.
    Here are instructions for getting your iPod touch into recovery mode.
    http://support.apple.com/kb/ht1808
    B-rock

  • Will not charge with new cable

    I have an iPod classic 5th gen and it will not charge with any newer cables. Either apple or aftermarket. I have found it will charge when I hook up my Kensington battery pack and it charged with an older cable but I no longer have it. It's their something different about older units and charging accessories?

    There is no difference.  They are exactly the same. So it doesn't charge whether you plug it into an available USB port on your Mac or via a wall adapter?
    Have you check to make sure the iPod's dock connector port was clean and clear of any sort of debris and/or damage such as bent, broken, or corroded pins?
    B-rock

  • Swing Applet in JSP: problem with fetching data from database

    i am facing a problem while fetching data from database using Swing Applet plugged in a JSP page.
    // necessary import statements
    public class NewJApplet extends javax.swing.JApplet {
    private JLabel jlblNewTitle;
    private Vector vec;
    public static void main(String[] args) {
    JFrame frame = new JFrame();
    NewJApplet inst = new NewJApplet();
    frame.getContentPane().add(inst);
    ((JComponent)frame.getContentPane()).setPreferredSize(inst.getSize());
    frame.pack();
    frame.setVisible(true);
    public NewJApplet() {
    super();
    initGUI();
    private void initGUI() {
    try {
    this.setSize(542, 701);
    this.getContentPane().setLayout(null);
    jlblTitle = new JLabel();
    this.getContentPane().add(jlblTitle);
    jlblTitle.setText("TITLE");
    jlblTitle.setBounds(197, 16, 117, 30);
    jlblTitle.setFont(new java.awt.Font("Dialog",1,20));
    jlblNewTitle = new JLabel();
    this.getContentPane().add(jlblNewTitle);
    Vector vecTemp = getDBDatum(); // data fetched fm DB r stored here.
    jlblNewTitle.setText(vecTemp.get(1).toString());
    jlblNewTitle.setBounds(350, 16, 117, 30);
    jlblNewTitle.setFont(new java.awt.Font("Dialog",1,20));
    } catch (Exception e) {
    e.printStackTrace();
    }//end of initGUI()
    private Vector getDBDatum() {
    // fetches datum from oracle database and stores it in a vector
    return lvecData;
    }//end of getDBDatum()
    }//end of class
    in index.jsp page i have included the following code for calling this applet:
    <jsp:plugin type="applet" code="NewJApplet.class" codebase="applets"
    width="600" height="300">
    <jsp:fallback>Could not load applet...</jsp:fallback>
    </jsp:plugin>
    if i view it in using AppletViewer it runs perfectly and display the data in JLabel. (ie, both jlblTitle and jlblNewTitle).(ie, DATA FETCHES FROM db AND DISPLAYS PROPERLY)
    BUT IF I CLICK ON INDEX.JSP, ONLY jlblTitle APPEARS. jlblnNewTitle WILL BE BLANK(this label name is supposed to fetch from database)
    EVERY THING IS DISPAYING PROPERLY EXCEPT DATA FROM DATABASE!!!
    i signed the applet as follows :
    grant {
    permission java.security.AllPermission;
    Can any body help me to figure out the problem?

    This is the Swing Applet java code
    import java.awt.Dimension;
    import java.sql.Connection;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.Vector;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.JScrollPane;
    import javax.swing.JApplet;
    import javax.swing.JButton;
    import javax.swing.JComponent;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JTree;
    import javax.swing.ScrollPaneConstants;
    import javax.swing.SwingConstants;
    public class HaiApplet extends javax.swing.JApplet {
         private JLabel     jlblTitle;
         private JLabel     jlblNewTitle;
         private Vector     vec;
         * main method to display this
         * JApplet inside a new JFrame.
         public static void main(String[] args) {
              JFrame frame = new JFrame();
              NewJApplet inst = new NewJApplet();
              frame.getContentPane().add(inst);
              ((JComponent)frame.getContentPane()).setPreferredSize(inst.getSize());
              frame.pack();
              frame.setVisible(true);
         public HaiApplet() {
              super();
              initGUI();
         private void initGUI() {
              try {               
                   this.setSize(542, 701);
                   this.getContentPane().setLayout(null);
                        jlblTitle = new JLabel();
                        this.getContentPane().add(jlblTitle);
                        jlblTitle.setText("OMMS");
                        jlblTitle.setBounds(197, 16, 117, 30);
                        jlblTitle.setFont(new java.awt.Font("Dialog",1,20));
                        jlblTitle.setHorizontalAlignment(SwingConstants.CENTER);
                        jlblTitle.setForeground(new java.awt.Color(0,128,192));
                        jlblNewTitle = new JLabel();
                        this.getContentPane().add(jlblNewTitle);
                        Vector vecTemp = getDBDatum();
                        jlblNewTitle.setText(vecTemp.get(1).toString());
                        jlblNewTitle.setBounds(350, 16, 117, 30);
                        jlblNewTitle.setFont(new java.awt.Font("Dialog",1,20));     
              } catch (Exception e) {
                   e.printStackTrace();
         }//end of initGUI()
         private Vector getDBDatum() {
              Vector lvecData = new Vector(10,5);
              Connection lcon = null;
              Statement lstmt = null;
              ResultSet lrsResults = null;
              String lstrSQL = null;
              String lstrOut = null;
              try {
                   OmmsDBConnect db = new OmmsDBConnect();
                   lcon = db.connectDb();
                   lstmt = lcon.createStatement(lrsResults.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
                   lstrSQL = "select DT_ID from P_DATATABLES";
                   lrsResults = lstmt.executeQuery(lstrSQL);        
                   int i = 0;
                   lrsResults.last();
                   int length = lrsResults.getRow();
                   System.out.println(length);
                   lrsResults.beforeFirst();
                   int recCount = 0;
                   while (lrsResults.next()) {
                        recCount++;
                        lvecData.addElement(new String(lrsResults.getString("DT_ID")));
                   //     System.out.println("ID :  " + lrsResults.getString(1));
                        i++;
                   }System.out.println("here 3 out fm while");
              catch(SQLException e) {
                   System.out.print("SQLException: ");
                   System.out.println(e.getMessage());
              catch(Exception ex) {
                   lstrOut = "Exception Occured " + ex.getMessage();
              finally {
                   try {
                        lrsResults.close();
                        lstmt.close();
                        lcon.close();
                        System.out.println("[DONE]");
                   catch(Exception e) {
                        System.out.println(e);
             }//end of finally
              return lvecData;
         }//end of getDBDatum()
    }//end of classOfcourse the above code compiles and runs well. in Applet Viewer
    I plugged the above Swing Applet in a JSP page index.jsp
    <jsp:plugin type="applet" code="NewJApplet.class" codebase="applets"
                   width="600" height="300">
         <jsp:fallback>Could not load applet...</jsp:fallback>
    </jsp:plugin>Every thing is working fine in AppletViewer...But if i view this in any browser, then only the jlblTitle is displaying. jlblNewTitle is not displaying(this label name is actually fetching from thedatabase)
    can any body help me regarding this matter.? Thx in Advance.

  • ???need to link 2 adobe ID's that belong to the same person. have over 100 books from old adobe id that will not open with new id??? jan

    ????i have an old and a new adobe ID and a new one. need to link them . i have over 100 books from old id that will not open now on my ereader.
    please help

    Hello,
    Yes this is possible.
    You can join both the adobe id's at: https://adeactivate.adobe.com/adept/en/JoinAccountLoginForm.jsp
    Thanks

  • The Jtree is not refreshing with new values when mouse click on the node

    hi ,
    I am creating a tree from a vector .The values in the vector is coming from the JTable data after satisfing the some condition. But the data in the Jtable is changing time to time so the data in the vector is also changing .
    But the problem is that when first I create a tree with that data the tree is created but for the next time I click on the tree node the tree is not changing i.e. it is not created with the new values that is stored in the vector at that time .what to do .Please help
    I am using DefaultMutableTreeNode for creating the tree .In starting I have created one root and the one it's child .Now the next subtree of the root child have to be created by this vector data. this subtree should be updated according to the values in the vecter.
    public void valueChanged(TreeSelectionEvent e) {
    //code here
    subtreecreat();
    //some function that create tree after cheching the some condition here
    subtreecreat() {
    Enumeration en=vector.elements();
    while(en.hasMoreElements())
    DefaultMutableTreeNode servername = new DefaultMutableTreeNode(en.nextElement());
    node.add(servername);
    Please help it is very urgent
    Thanks in Advance,
    anum

    Well, you can either use a custom TreeModel that tracks your Vector, or you can use a DefaultTreeModel and call model.reload(node) to refresh the tree below the specified node.

  • IPod will not sync with new laptop

    Alright everybody, got a tough one here I can't seem to figure out. I have a 3rd generation iPod touch. I had it synced with my now secondary desktop that has my library and everything on it. I am now trying to get my iPod switched over fully to my new primary laptop. I am running iTunes 10.5 and iOS5. The iPod will sync fine with the desktop but when I try and sync and erase with my laptop absolutely no music will transfer over. I can click the device tab on the left and look at music and they are all grayed out as if they are ghost files. Does anybody have any suggestions? For the record I have tried to restore the iPod and set it up as a new iPod on the laptop but the music files still will not sync. I can go back and plug it in to my desktop and everything syncs fine. Thanks in advance.

    Is your new computer authorized with the same account? About iTunes Store authorization and deauthorization
    Did you try to transfer purchases and back up manually before your sync?
    Connecting to a new computer will erase your device during the first sync. But you can use the manual backup to restore from afterwards. Make sure to have at least onwe contact and event listed on that computer as well, syncing to an empty address book will delete contacts and calendars on the ipod.
    Also check your restrictions, to make sure app installation is allowed.

  • Windows 8 will not activate with new SSD (second) hard drive

    I added a new SSD drive in the second hard drive bay. I used the HP restoration media to install Windows 8 on the new SSD drive. Windows 8 will not activate. After spending 90 minutes on the phone with HP support (and paying $150), they told me to contact Microsoft. After spending some time with Microsoft, they told me that the Windows product key is being locked by HP, and there is nothing they can do.

    Hi badgerbuzz,
    I have brought your issue to the attention of an appropriate team within HP. They will likely request information from you in order to look up your case details or product serial number. Please look for a private message from an identified HP contact. Additionally, keep in mind not to publically post ( serial numbers and case details).
    If you are unfamiliar with how the Forum's private message capability works, you can learn about that here.
    Regards,
    George
    I work for HP

  • Emoticons Will not display with new version

    Downloaded the new version, and now the (finger) and (wtf) emoticons will not display. Every single other one does display. Why is this happening? I have tried restarting my computer,  and redownloading Skype itself. Is there any way to fix this? I know I have the emoticons display on because every one BUT those ones work. 
    Attachments:
    Capture1.JPG ‏16 KB

    These hidden emoticons indeed got removed with 6.14 because of them or their shortcodes having the potential to offend some users. Here's some feedback from users wanting it back, so feel free to show your support there if you are passioante about them: http://community.skype.com/t5/Windows-desktop-clie​nt-Ideas/Restore-6-13-set-of-emotes/idi-p/2958795
    Follow the latest Skype Community News
    ↓ Did my reply answer your question? Accept it as a solution to help others, Thanks. ↓

  • Links will not open in new window from iPad but work in IE on desktop.

    I am trying to set some links to open in a new tab but for some reason they just keep opening in the original tab. External links work fine but when I try to make another page from my website open in new tab, it will not work.
    I have looked at the code and it all looks fine.
    <a class="nonblock nontext shadow rounded-corners clearfix grpelem" id="u105617-9" href="metro_tweets.html" target="_blank"><!-- content --><p id="u105617"> </p><p id="u105617-2"> </p><p id="u105617-3"> </p><p id="u105617-7">Metropolitan<br/>Region TWEETS</p></a>
    I have also ticked the box that says "open the link in a new window or tab".
    Any ideas what the issue could be? It has worked before so I am sure it can be done.
    Would it have anything to do with the site hierarchy?
    Cheers
    Garry

    Hi Aish,
    Thanks for the quick reply.
    I had a feeling you would ask me those questions so I'll give you a bit more background of what I am doing.
    I have created a locally accessed web app as part of project I am working on at Universty. It is a mockup of an iPad app that I will eventually build, although it is fully functional in it's web app state. For this reason it is not hosted on any web server but instead transferred to the iPad via DiskAid and accessed from Mercury Browser.
    Mercury browser is the only browser that I have found that can display html files from within it's own file storage and make it look like it is being served from a server. Safari browser will not let you do this and the only other browser that I found that could do it has been discontinued (Terra Browser).
    Adobe Muse has been fantastic for doing this kind of work and as I said before, the internal links opened in a new tab with Mercury Browser previously, so I am not really sure what is going on.
    Any ideas would be appreciated.
    Cheers
    Garry

  • HotSync will not start with new Tungsten E2

    I'm upgrading my old Tungsten T2 device with an E2.  Following the upgrade instructions, I set up the E2 last night and let it charge overnight, then this evening did a final HotSync with the T2, and ran the installation program on the CD that came with the E2.  At the point where the installer asks me to press the HotSync button on the USB cable I did so, and Windows popped up the notice in the system tray that a new USB device and that the Palm Handheld device was ready for use.  After that, nothing.  A minute or two later the E2 times out and tells me that "The connection between your device and the desktop could not be established.  Please check your setup and try again."
    I've tried re-installing the software, upgrading to Palm Desktop 6.2 from the web site,and restarting the computer several times, but I can never get the HotSync manager to respond to the E2.
    By contrast, the HotSync manager will still synchronize with my old T2.
    Post relates to: Tungsten E2
    This question was solved.
    View Solution.

    Palm Desktop is running on Windows XP.  I have been using version 4.1.0 which came with my T2.  For the E2 I've tried versions 4.1.0, 4.1.4e, and 6.2.
    I should point out that Windows XP in turn is running in VMware Workstation 6.5, on a Fedora 10 (Linux 2.6.27.12-170.2.5.fc10) host.  Last Sunday I tried booting Windows XP natively (which was a royal pain, since I have to switch hard drives to do so), installing Palm Desktop 6.2 there, and hotsyncing.  That configuration worked, as far as the device being able to connect to the PC.
    Unfortunately it only synced my to-do list and a few 3rd-party programs; it lost all of my memos, contacts, calendar events, and photos.  But that's another topic.

  • Z10 will not charge & with new Battery will not turn on

    I have have had my Z10 about a month now, I am gernerally happy with it as a work phone which is similar to my private Iphone5. Unfortunately the Battry life has been reducing on a weekly basis to around 4 hrs between charges. Now it is dead and will not wake up, so I bought a new Battery, now it blinks once the three times but will not turn on.
    Any ideas ? The OS is the latest on the Blackberry site, but as I can turn the phone on I can't be more specific.

    Hello,
    From your description, if your charger is "known good" (e.g., it can charge other devices), then one can only deduce that something (hardware) inside the BB related to passing power from the charger to the battery has broken. Or that something passing power from the battery to the device has broken.
    Regardless, if your charger is 100% fine, then it sounds like a hardware problem for which no amount of OS/software level fixes nor internet-distance diagnostics can be of much value.
    I recommend you seek formal support via your official warranty channel. Normally, that starts with your original place of purchase or an authorized service center -- it varies by region.
    Good luck!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

Maybe you are looking for

  • Getting error message for "user created how tos"  CS3

    I tried to create some new How Tos in CS3 and recieved the following error message when I try to open it: "The Adobe Help application could not load a URL because the specified file could not be found. You may need to re-install the application and t

  • Since Flash CS6 Is not supported for OSX 10.8, can cloud members have Flash CS5?

    Since Flash CS6 Is not supported for OSX 10.8, can cloud members have Flash CS5? I see that Flash CS6 is not supported (http://helpx.adobe.com/flash/kb/mountain-lion-support-flash-professional.html ) . My coworkers and I are not able to see some font

  • WRT54GS cuts internet connection

    Any ideas?  My WRT54GS cuts the connection after 10 min. Then I make a reset and works again for another 10 min and cuts again.

  • How to change iCloud address

    I registered my iCloud account with an email address I no longer have access to.  How do I update the account with my current emailed address?

  • World clock doesn't remembers saved locations

    This is a problem with the world clock that has been unaddressed with all the firmware updates I've installed since buying this phone in December. After saving international locations around the world for quick reviews through out the day in the worl