Flicker when updating jTable

I have an application using a jTable. When updating this jTable with a new row there is some annoing flicker - especially if i have many rows in my table.
Seems like when swing is repainting i have the last marked line twice in the table, both on top an in the bottom. It gives a lot of distraction for the users trying to key in payments.
My guess is it is happening when swing is repainting the table (it is apparently outside my application). My tablemodel is extending the abstractTableModel.
Does anybody have any good suggestions to get rid of this???

Thanks everyone for the feedback.
I just did a day's worth of testing using C# and .NET for Windows Mobile (in Visual Studio 2005) and was able to reproduce the same interface without any flickering issues. Not having to poll the device's hardware buttons is also a positive
The key is to override the main form's OnPaintBackground() method.
From "Crafting Smartphone User Interfaces Using .NET Compact Framework":
OnPaintBackground
This method needs to be over ridden to prevent the OS from repainting the background each time the user navigates the ListView, causing flicker. If you don't need a background then just override this method but provide no implementation.
So it looks like I'll be doing things in C# for this project. As the mobile device won't be used for data acquisition, the Mobile Module isn't a necessity. I just hope .NET's serial functionality is as good as LabVIEW's!

Similar Messages

  • PDA screen flicker when updating control properties

    Hi all,
    I'm developing a mobile application for Windows Mobile 5 using LabVIEW 2009 SP1 and the Mobile Module. After coming to terms with many of the limitations, I've got a simple menu driven interface working. The interface consists of a transparent 240x320 picture control to which I draw the menu item text using the Draw Text At Point VI, along with an icon representing the menu item. Behind this picture control is a second picture control which contains the selection graphic to show which menu item is highlighted.
    The problem I'm now facing is an annoying screen flicker every time a control property for the selection graphic is set. Specifically when the user navigates the menu using the up/down arrows on the device, the menu selection on the screen is moved using the Position->Top property to move it to highlight the correct menu item. Whenever this property is set, the whole screen flashes white and redraws.
    Presumably this is due to the top level picture control being redrawn when the underlying control is updated (which makes perfect sense), but I wish it wasn't so noticeable.
    So a couple of questions:
    1. Is there any way to enable double-buffering of the display from the Mobile Module or on the device itself?
    2. Is my picture control behind picture control design flawed? I would use a system listbox for the menu but it's a bit ugly, and doesn't support icons/symbols under the Mobile Module. Other limitations of the Module Mobile (like string controls that can't have transparent backgrounds) led me to use picture controls as the best overall solution.
    Cheers,
    Michael

    Thanks everyone for the feedback.
    I just did a day's worth of testing using C# and .NET for Windows Mobile (in Visual Studio 2005) and was able to reproduce the same interface without any flickering issues. Not having to poll the device's hardware buttons is also a positive
    The key is to override the main form's OnPaintBackground() method.
    From "Crafting Smartphone User Interfaces Using .NET Compact Framework":
    OnPaintBackground
    This method needs to be over ridden to prevent the OS from repainting the background each time the user navigates the ListView, causing flicker. If you don't need a background then just override this method but provide no implementation.
    So it looks like I'll be doing things in C# for this project. As the mobile device won't be used for data acquisition, the Mobile Module isn't a necessity. I just hope .NET's serial functionality is as good as LabVIEW's!

  • Re: ArrayIndexOutOfBoundsException when updating JTable from SwingWorker

    This is a common threading bug and there is a simple fix. You may only modify a visible component from the Event Dispatcher Thread.
    You are modifying the table model (which is part of a visible component) from an application thread (the swing worker).
    Even through you lock it or something like that, thats not the right way to do it. Don't write to the table model from another thread.
    The actual exception is that the EDT thread is painting the table rows while the swing worker is removing table rows, so you have the classic producer/consumer thread problem. The fix is not to use locks but instead use the Swing single thread rule, which is that only the EDT thread may modify a visible component. There is a lot of info on the java tutorials about swing threading.

    Thanks a lot, for some reason I neglected to try using SwingUtilities.invokeLater in my attempts to fix the problem! This has solved it.

  • JScrollPane freezes when updating JTable in viewport

    I have the same problem that is described in this bug:
    http://developer.java.sun.com/developer/bugParade/bugs/4495213.html
    I don't understand the workaround. Is that the developer's class (BasicTableUI.java)? Anyone else experiencing this problem? How long does it generally take for these bugs to be fixed?
    Thanks.

    BasicTableUI is one of the JDK's classes:
    javax.swing.plaf.basic.BasicTableUI
    They are suggesting altering the source code for that class and replacing the class in your JVMs standard rt.jar with the modified class.

  • Why do I get a red or green flicker when i update my current iMovie project?

    Why do I get a red or green flicker when i update my current iMovie project?

    Hi Cactusbarb,
    If the LCD screen is turning red, your camcorder will require service to correct this issue.  If you're seeing the red "Rec" dot, then the recording stops, you may need to use a faster memory card.
    We recommend the use of Speed Class 6 or 10 memory cards with this camcorder.
    If you determine that y our camcorder requires service, please contact us at [email protected] for service options.  Let us know the model camcorder and your zip code.
    Did this answer your question? Please click the Accept as Solution button so that others may find the answer as well.

  • Update JTable cells via setValueAt

    Hello all,
    I'm trying to implement a setValueAt method using an arrayList.....no success.What listeners should I have set up(For JTable or my table model)? I am new at this and I'm trying to update the JTable cells after a query from some db. Could anyone help?
    When trying to change the a value in the table I get these errors:
    "Exception occurred during event dispatching:
    java.lang.ClassCastException: java.lang.String
    at CachingResultSetTableModel.getValueAt(CachingResultSetTableModel.java:37)
    at javax.swing.JTable.getValueAt(JTable.java:1711)
    at javax.swing.JTable.prepareRenderer(JTable.java:3530)"
    public void setValueAt(Object avalue, int r, int c){
    if(r < cache.size()){
    row[c] = (Object[])cache.set(r, avalue);
    fireTableCellUpdated(r, c);
    }//setValueAt
    *********For reference here's the getValueAt method*************************
    public Object getValueAt(int r, int c){
    if(r < cache.size()){
    row = (Object[])cache.get(r);
    return row[c];
    else
    return null;
    }//getValueAt

    I would think that everone who starts off with JTable will have a couple of concept problems. I am also going thru this learnig curve. It looks to me ( the blind leading the blind etc) like your basic table has strange data in it. The problem is occuring when the JTable is trying to setup the data from the table model.
    I don't think its anything to do with setValueAt.
    I kept going back to TableMap, TableSorter and JDBCAdaptor examples and copying the code from them to come right.> I debug by putting a System.out .... in all the methods until I get to where the code is giving trouble.
    Good luck [email protected]
    Hello all,
    >
    I'm trying to implement a setValueAt method using an
    arrayList.....no success.What listeners should I have
    set up(For JTable or my table model)? I am new at
    this and I'm trying to update the JTable cells after a
    query from some db. Could anyone help?
    When trying to change the a value in the table I get
    these errors:
    "Exception occurred during event dispatching:
    java.lang.ClassCastException: java.lang.String
    at
    CachingResultSetTableModel.getValueAt(CachingResultSetT
    bIleModel.java:37)
    at javax.swing.JTable.getValueAt(JTable.java:1711)
    at
    javax.swing.JTable.prepareRenderer(JTable.java:3530)"
    public void setValueAt(Object avalue, int r, int c){
    if(r < cache.size()){
    row[c] = (Object[])cache.set(r, avalue);
    fireTableCellUpdated(r, c);
    }//setValueAt
    *********For reference here's the getValueAt
    method*************************
    public Object getValueAt(int r, int c){
    if(r < cache.size()){
    row = (Object[])cache.get(r);
    return row[c];
    else
    return null;
    }//getValueAt

  • Update Jtable from access database

    as the title suggests help me guys... till now i have a database and some contents in it.. when the application starts the table is filled with contents of the database.. now whenever i add or remove a row in the databse i want to show it in the table... i have a Vector called dbData with the present contents of the database.. i want to update jtable with contents of dbData.... how to do it??

    the best things i can see to do is
    JTable table = new Jtable(.....); // this was ur table before;
    deleteRow(table); // you deleted the row
    // now you have a vector containing all the data for the rows;
    // but you need a vector containing the columns for the rows too
    //so now you do
    table = new JTable(dbData,columnnames);
    repaint();dbData must be a vector of vectors;
    dbData.elementAt(1) return a vector with all the data for row one
    so dbData.elementAt(1).elementAt(1) will be the data for row 1 column 1
    // dbData will be the data still remaining in the table
    or instead of the above you could use a nested for loop and set each element one at a time
    Object temp;
    int numberofRows = dbData.elementCount();
    int numberofColumns = db.elementAt(0).elementCount();
    for(int row = 0; row < numberofColumns;row++)
    for( int column = 0; column < numberofRows; column++)
      temp = dbData.elementAt(row).elementAt(column);
      table.setValueAt(temp,row,column);
    }

  • W530 External Moniters Flicker when opening when opening programs

    So I have been having issues with all my external screens fliscker and generally freaking out anytime i open an application that utilizes the nvidia GPU (K200M in my case), such as Photoshop.  While freaking out the windows, the title bars also get knocked out of whack, for example having transparency just fail for the minimize/maximize/close buttons disappearing to show what is under the window.
    I have the laptop docked with screen closed and 2 U2212HM connected through the displayport connectors and a third U2212HM connected via VGA.  I dont observe the issues normally on the laptop without the externals hooked up.
     I have tried installing the NVIDIA Optimus Display Driver  version 9.18.13.3302 / 8.15.10.2725  which supposedly
    "Version <9.18.13.3302 / 8.15.10.2725>
    (Fix) Fixed an issue where the screen of some external monitors might flicker when launching applications."
    but there is no improvement.  Updating ti the latest Nvidia drivers doesnt help either.

    Hi,
    Is there any problem when you open a Word or Excel file from local drive?
    Please try to add the network share location to the Trusted Location to check if it helps. 
    If you have any security program installed, please temporarily turn off it to test the issue again.
    In addition, we can also perform a Windows clean boot to check of this issue is caused by software conflict. See:
    http://support.microsoft.com/kb/929135/en-us
    If above didn’t fix the issue, please open the Windows event viewer and check if we can find some related logs.
    Best Regards,
    Steve Fan
    Forum Support
    Come back and mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback on our support, please click
    here

  • Clear and update JTable.

    Hi. this is a follow up from [Original Tread in "New To Java"|http://forums.sun.com/thread.jspa?messageID=10886612&#65533;]
    Hope you can help me here. For you who dont read the link. This application is build only to lay up here. So the Layout aint pretty. It compiles and run tho. What i want and cant get to work is to reload table when i push my JTabbedPane.
    Main Class
    package test;
    import javax.swing.*;
    import javax.swing.event.*;
    public class Main {
        public Main() {
            run();
        public void run(){
         frame();
        // clear and update JTable in class three
        public void clearThree() {
            Three t = new Three();
             t.clearVector();
        public JFrame frame() {
            JFrame frame = new JFrame();
            JTabbedPane tab = new JTabbedPane();
            tab.addTab("two",new Two());
            tab.addTab("three", new Three());
            tab.addChangeListener(new ChangeListener() {
                public void stateChanged(ChangeEvent e) {
                    clearThree();// this dont work
            frame.add(tab);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(800,400);
             frame.setVisible(true);
             frame.pack();
            return frame;
        public static void main(String[] args) {
             java.awt.EventQueue.invokeLater(new Runnable() {
                         public void run(){
           new Main();
    }// class two
    package test;
    import java.awt.event.*;
    import java.util.Vector;
    import javax.swing.*;
    // class two&#347; only purpose is to  call clear() in class Three
    public class Two extends JPanel{
    public Two(){
    toolBar();
      public void clearThree () {
       Three t = new Three();
       t.clearVector();
      public void toolBar(){
      JToolBar bar = new JToolBar();
      JButton button = new JButton("clear");
      button.addActionListener(new ActionListener (){
          public void actionPerformed(ActionEvent e){
          clearThree(); // this dont work
    bar.add(button);
    add(bar);
    }// class three hold the table.
    package test;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.util.Vector;
    import javax.swing.*;
    import javax.swing.table.DefaultTableModel;
    public class Three extends JPanel{ 
            DefaultTableModel model;
            JTable table;
            Vector v = new Vector();
            Vector a = new Vector();
            Vector<Vector> r = new Vector<Vector>();
        public Three() {
            jBar();
            jTable();
        public void clearVector(){
            v.removeAllElements();
            a.removeAllElements();
            r.removeAllElements();
            model.fireTableDataChanged();
        public void jBar() {
            JToolBar bar = new JToolBar();
            JButton button =  new JButton("clear");
            button.addActionListener(new ActionListener(){
                public void actionPerformed(ActionEvent e){
                    clearVector();// this does work
            bar.add(button);
            add(bar);
        public JScrollPane jTable(){
            v.addElement("ID");
            v.addElement("Name");
            a.addElement("01");
            a.addElement("Magnus");
            r.add(a);
            model = new DefaultTableModel(r,v);
            table = new JTable(model);
             JScrollPane pane = new JScrollPane(table);
             add(pane);
             return pane;
    }

    Thank you for your replay, I have taken all of your tips and modifed my original application. but the problem is still there. This has been a very messy thread. and it is becouse i thougth it were a table/model problem. But it&#347; not. In the code below I have a JTextField. When i push the JTabbedPanes i want the setText(); to kick in. this compile and run.
    // class One
    package test;
    import javax.swing.*;
    import javax.swing.event.*;
    public class Main {
        public Main() {
            run();
        public void run(){
         frame();
        public JFrame frame() {
            JTabbedPane tab = new JTabbedPane();
            final  Three t = new Three();
            JFrame frame = new JFrame();
            JPanel panel = new JPanel();
            tab.addTab("two",new Two());
            tab.addTab("three", new Three());
            tab.addChangeListener(new ChangeListener() {
                public void stateChanged(ChangeEvent e) {
                      t.setText(); // should call setText() in class Three.
            frame.add(panel);
            frame.add(tab);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(800,400);
             frame.setVisible(true);
             frame.pack();
            return frame;
        public static void main(String[] args) {
             java.awt.EventQueue.invokeLater(new Runnable() {
                         public void run(){
           new Main();
    }class Two. Does nothing more then holding an empty tab
    package test;
    import javax.swing.*;
    public class Two extends JPanel{
    public Two(){
    emptyPane();
      public void emptyPane () {
      JLabel  label = new JLabel("Just an empty JTabbedPane");
      add(label);
      }class Three
    package test;
    import javax.swing.*;
    public class Three extends JPanel{ 
             JTextField text;
        public Three() {
            text();
        public void setText() {
            text.setText("Hello"); // this piece of code i want to insert in my JTextField
            validate();                // when i push the JTabbedPanes.
            repaint();
            updateUI();
        public JTextField text(){
             JToolBar bar = new JToolBar();
            text = new JTextField("",20);
            bar.add(text);
            add(bar);
            return text;
    }

  • Error message when updating Itunes...can not open Itunes program

    I am recieving error message when updating Itunes for my computer.  The error message reads "MSVCR80.dll is missing and the other error message reads Error 7  (Windows error 126)"  I can not open my Itunes.  I have reloaded the Itunes onto my computer but still have the same error messages.  Please help.

    Click here and follow the instructions. You may need to completely remove and reinstall iTunes and all related components, or run the process multiple times; this won't normally affect its library, but that should be backed up anyway.
    (99364)

  • IPad app store "unknown error" message when updating app

    iPad app store "unknown error" message appears when updating app

    Kathryn,
    Had the problem also.  Found in the forums and it worked for me:
    go to settings
    go to app store or "store" on my ipad
    click on the apple id
    sign out
    sign in, again with id and password
    then do update.
    Hope this helps.

  • HT4623 please help me when update my i phone 3G i finish update but face problem , appear me msg There is no SIM card installed in the iPhone You ar attempting to activate. Please disconnect

    please help me < when update my i phone 3G < i finish update but face problem , appear me msg There is no SIM card installed in the iPhone You ar attempting to activate. Please disconnect

    Sounds like your phone was hacked to use with your carrier.  Updating it has relocked the phone to it's original carrier.  You will not get the phone working again without a SIM from the original carrier.

  • My ITunes got corrupted and I kept getting a message when updating iTunes64msi missing so I uninstalled all files and I thought I removed all registry values but  when reinstalling I get an older version is installed and cannot be removed. I need a soluti

    My ITunes got corrupted and I kept getting a message when updating iTunes64msi missing so I uninstalled all files and I thought I removed all registry values but  when reinstalling I get an older version is installed and cannot be removed. I need a solution.

    (1) Download the Windows Installer CleanUp utility installer file (msicuu2.exe) from the following Major Geeks page (use one of the links under the "DOWNLOAD LOCATIONS" thingy on the Major Geeks page):
    http://majorgeeks.com/download.php?det=4459
    (2) Doubleclick the msicuu2.exe file and follow the prompts to install the Windows Installer CleanUp utility. (If you're on a Windows Vista or Windows 7 system and you get a Code 800A0046 error message when doubleclicking the msicuu2.exe file, try instead right-clicking on the msicuu2.exe file and selecting "Run as administrator".)
    (3) In your Start menu click All Programs and then click Windows Install Clean Up. The Windows Installer CleanUp utility window appears, listing software that is currently installed on your computer.
    (4) In the list of programs that appears in CleanUp, select any Bonjour entries and click "Remove", as per the following screenshot:
    (5) Quit out of CleanUp, restart the PC and try another iTunes install. Does it go through properly this time?

  • After itunes 6.0.2 and 1-10 updater - both ipods crash itunes when updating

    I'm annoyed.
    I upgraded my to iTunes 6.0.2 (Windows XP) and ran the 1-10 updater on two ipods - a mini and a 20GB pre-photo model (I guess that's a 3rd gen?). After doing so, iTunes crashes when updating begins. If I plug an ipod in without iTunes, everything is OK and I can see the unit and directory structure in Explorer. When the ipod is disconnected and I run iTunes, everything is fine - no problems. But when you connect an ipod, iTunes sees it, and then shows "Updating ipod", it sits like that for awhile, then I hear the hard drive in the iPod click, and a few seconds later I get:
    "iTunes has encountered a problem and needs to close" etc. etc.
    I tried doing a restore of one of my ipods (the 3rd gen) to the 2005-11-17 firmware by running that updater and doing "Restore". The problem is still happening, but now my ipod is empty because I did the restore!
    Unfortunately, I can't tell what the problem is - iTunes or the 1-10 update.
    Has anyone else had any problems like this? Any ideas? Can I downgrade iTunes?
    Please help!
    Chris

    Has anyone come up with a method to resolve this issue? I uninstalled and reinstalled iTunes, and no luck.
    One very obvious thing I can see is that 2006-1-10 update clearly bombs iTunes fast. I downgrade my firmware to 2005-11-17 and it appears to want to update. I'm attempting to update again (about the 30th time since I've had this problem a few days ago). Let's see how it goes since I've actually done this before... One thing I'm doing differently though is syncing just the podcasts, no music. It shouldn't make a difference, but maybe there's something odd in there with DRM?
    Another observation - when I connected the iPod with the My Computer window open, I saw the H: drive (my ipod) appear for a few seconds. It then disappeared from there, iTunes came up, and then reappeared. iTunes tried to sync, but then bombed out.
    I hope this helps someone..
    I can't believe that Apple hasn't responded to this issue yet. This has to be impacting more than a few hundred users on this site.

  • How can I get my iPhone to stop promting me to enter my wife's Apple ID when updating apps? I've checked settings for iTunes

    How can I get my iPhone 6 to stop prompting me to enter my wife's Apple ID when updating apps? I have verified in settings that my acct is listed in itunes & App Store, as well as icloud. i can download new apps fine. Have shut down phone and re-powered, have tried plugging into my iMac while signed into my iTunes acct. Can't figure out what to do next?

    Is the comp a synced device to your apple ID and approved as an active device for this synchronization?
    Just cloud the sync once, activate the comp to your apple I'd in iTunes, ensure all software is up to date, turn on home sharing between the devices and you can reinstall the apps from the apple id purchase history via download.
    You basically cleaned out the canonical data apple uses to validate all that, which was backup data. Like iOS devices have the purchased option on the App Store now, syncing the devices via the home sharing and properly activating them will give your comp the purchased cloud and free up 10gs of space on the precious solid states smaller drives.
    Hope that helps...
    If you need to know the menu to find this info, let me know. But the info is easily accessible in the help menu.

Maybe you are looking for

  • How can I get a refund for a book

    Can I get a refund for a book I purchased in iBooks? I did not like it, it was stupid and want my money back.

  • Bit of a pickle (to use JTextArea or JTextPane)

    Basically what i'm trying to do is print out array of numbers into a JTextArea or JTexPane. Initially i started printing into a JTextArea. This work fine, it printed without problems. However, i needed to center this prints and i couldn't do that in

  • Oracle roadmap for Interactive Reporting

    Hello Gurus,        This is just an opinion I need from you guys.       Currently, there is System 9.3.1 in which only Interactive Reporting is in use.  Now, client has decided to migrate from 9.3.1 to 11.1.2.2.       I was just going through Oracle

  • Document won't open in workspace

    Am using a PC, with Windows 8, Photoshop CS5.  When open a document, the document tab appears, but not the document in the workspace.  If drag on the tab, the document appears, but disappears once the drag is released. Had this problem once before, b

  • How do I know if it's really a "Free App?"

    I saw this game called Grabimo and in the picture of it it says that it's free but, when I clicked on it it said .99. So, is it free?