Adding data dynamically to JTable with a filter - getting error

Hello,
I am using JTable, and adding data and displaying it worked fine
until I tried adding a filter,
can anyone tell me what am I doing wrong or
why am I getting this Error?
The Error message
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
        at javax.swing.DefaultRowSorter.convertRowIndexToModel(DefaultRowSorter.java:501)
        at javax.swing.JTable.convertRowIndexToModel(JTable.java:2620)
        at javax.swing.JTable.getValueAt(JTable.java:2695)
        at javax.swing.JTable.prepareRenderer(JTable.java:5712)
        at javax.swing.plaf.basic.BasicTableUI.paintCell(BasicTableUI.java:2075)
        at javax.swing.plaf.basic.BasicTableUI.paintCells(BasicTableUI.java:1977)
        at javax.swing.plaf.basic.BasicTableUI.paint(BasicTableUI.java:1773)
        at javax.swing.plaf.ComponentUI.update(ComponentUI.java:143)
        at javax.swing.JComponent.paintComponent(JComponent.java:763)
        at javax.swing.JComponent.paint(JComponent.java:1027)
        at javax.swing.JComponent.paintChildren(JComponent.java:864)
        at javax.swing.JComponent.paint(JComponent.java:1036)
        at javax.swing.JViewport.paint(JViewport.java:747)
        at javax.swing.JComponent.paintChildren(JComponent.java:864)
        at javax.swing.JComponent.paint(JComponent.java:1036)
        at javax.swing.JComponent.paintToOffscreen(JComponent.java:5122)
        at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:277)
        at javax.swing.RepaintManager.paint(RepaintManager.java:1217)
        at javax.swing.JComponent._paintImmediately(JComponent.java:5070)
        at javax.swing.JComponent.paintImmediately(JComponent.java:4880)
        at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:803)
        at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:714)
        at javax.swing.RepaintManager.seqPaintDirtyRegions(RepaintManager.java:694)
        at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:128)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)I am also using my own class that extends "AbstractTableModel"
as TableModel,
public class MyTableModel extends AbstractTableModel  {
    ArrayList<TableData> tableData=new ArrayList<TableData>(10);
    String[] columnNames=new String[]{"S/N"," Time (mili)","SD","SA","SSAP","DA","DSAP","FC","DATA"};   
    public void addRow(TableData data){
        tableData.add(data);
        fireTableDataChanged();
    @Override
    public int getRowCount() {
        return tableData.size();
    public TableData getRow(int i){
        return tableData.get(i);
    @Override
    public int getColumnCount() {
        return columnNames.length;
    @Override
    public String getColumnName(int col) {
            return columnNames[col];
    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        return tableData.get(rowIndex).getValue(columnIndex);
    }The Row Filter class
class myRowFilter extends RowFilter<MyTableModel,Integer>{
        @Override
        public boolean include(Entry<? extends MyTableModel, ? extends Integer> entry) {
            // Entry < SomeCostumTableModel , Integer> entry   ; Integer =Identifier= Row Number
            boolean frame_type;
            MyTableModel model=entry.getModel();
            TableData data=model.getRow(entry.getIdentifier());
            frame_type=((SD1&&data.SD==TableData.SD1) ||
                                         (SD2&&data.SD==TableData.SD2) ||
                                         (SD3&&data.SD==TableData.SD3) ||
                                         (SD4&&data.SD==TableData.SD4) ||
                                         (SC&&data.SD==TableData.SC) );
           return frame_type;
    }and How I add the filter to the Table
    private MyTableModel myTableModel=new MyTableModel();
    private RowSelectionListener rowSelectionListener=new RowSelectionListener();
    TableRowSorter<MyTableModel> sorter=new TableRowSorter<MyTableModel>(myTableModel);
    private FilterFrame filterFrame=new FilterFrame(this);
    // then in the constructor of the main frame
    // I call this
        sorter.setRowFilter(filterFrame.filter);
        MainTable.setRowSorter(sorter);
        sorter.setSortsOnUpdates(true);Edited by: YellowMurdoch on Nov 17, 2009 6:31 AM
Edited by: YellowMurdoch on Nov 17, 2009 6:31 AM

Thanks for noting that.
you mean like this?
public void addEntry(TableData data){
        myTableModel.addRow(data);
        javax.swing.SwingUtilities.invokeLater(new Runnable(){
            @Override
            public void run(){
                    myTableModel.fireTableRowsInserted(0,0);
    }both work,
would putting "invokeLater" inside "addEntry" somehow mess other things?
i guess that means addRow() is not supposed to update the table graphically?
Edited by: YellowMurdoch on Nov 17, 2009 9:30 AM
Edited by: YellowMurdoch on Nov 17, 2009 9:33 AM

Similar Messages

  • Epson XP-200 failing on CUPS with a "Filter Failed" error

    After this last update, my printer has stopped working completely, always with a "Filter failed" error. 
    Before the update it worked perfectly, never had an issue. 
    I've tried every combination of turning on and off, reinstalling the drivers, reinstalling cups, etc... nothing got any results.
    None of the related issues I found googling got me anywhere closer to having it work either. 
    If anyone has some fix for this it would be very appreciated

    You show the OS receiving an image from Photoshop, and the OS starting the Epson print driver and handing it part of the image, the driver connects to the printer, then the print driver fails. It looks like a bug in the Epson rasterizer, or the printer communication.
    You really need to talk to Epson.  Photoshop isn't involved in that error.

  • Trying to install Lightroom 5 with CC but getting error code 5 on initial startup of Lightroom.

    Trying to install Lightroom 5 with CC but getting error code 5 on initial startup of Lightroom. Have uninstalled all adobe products including Creative Cloud CC.
    Followed the instructions on the forum by using the CC Cleaner App for OSX. Have restarted a number of times and even tried using disk utility to fix any permission probs. Still no luck.
    The problem started happening from upgrading the previous version of Lightroom to the most up to date version. Im hoping someone can help me with any ideas. Thanks heaps.

    Ended up fixing the problem after finding no answers. Deleted the following file
    com.adobe.acc.AdobeCreativeCloud.plist

  • Using USB to connect to itunes with iphone. Getting error OXE8000084 with pulsating tone. Have reset passowrd, authorized computer, & repaired itunes when reinstalled. Any suggestions on how to successfully connect?

    Using USB to connect to itunes with iphone.  Getting error OXE8000084 with pulsating tone. Have reset password, authorized computer, & repaired itunes when reinstalled it. Any suggestions on how to successfully connect to itunes and what this error message means?  Thanks

    0X is a Windows Error. Take the time to look over on the right under the "More Like This" and look for ones that have the green checkmark as being solved. You should find answers there.

  • Trying to register with ePrint and getting error code.Ajax submit failed: error = 403, Forbidden.

    Trying to register with ePrint and getting error code.Ajax submit failed: error = 403, Forbidden. I need help??

    To bypass this error attempt either a restart of your computer, or use an alernate broser such as firefox or chrome. If you already have another browser the latter may be the easier fix.
    Jon-W
    I work on behalf of HP
    Please click “Accept as Solution ” on the post that solves your issue to help others find the solution.
    Click the KUDOS STAR on the left to say “Thanks” for helping!

  • When i got my new iphone 4, its in recovery mode. while restroing with itunes, im getting error at restoring firmware stage? what could be the reason? pls help me for solution.

    when i got my new iphone 4, its in recovery mode. while restroing with itunes, im getting error at restoring firmware stage? what could be the reason? pls help me for solution.

    You got a new iPhone 4, and out of the box the phone is in recovery mode? If that's the case, return it.
    If you don't want to do that. what error code are you getting?

  • HT4059 want to order text book on iPad 3 with ibook app  get error of not enough memory.   how do i get library full of books

    hello
    want to order text book on iPad 3 with ibook app  get error of not enough memory

    There are some threads on the use of Calibre with the iPad on their forums. This thread might be of help:
    http://www.mobileread.com/forums/showthread.php?t=79093&highlight=Ipad
    and if not searching that forum for "iPad" may turn up additional suggestions.
    Good luck.

  • TS3694 ipod 4gwill not update with computer: i get error 3194 also 1.6gb of other

    ipod will not update with computer: i get error 3194.. i updated itunes and still nothing. tryed to restore,same thing... now i have no music(random) and 1.6 GB of "OTHER"....help me

    This device is not eligible for the requested build: Also sometimes displayed as an "error 3194." If you receive this alert, update to the latest version of iTunes. Third-party security software or router security settings can also cause this issue. To resolve this, follow Troubleshooting security software issues.
    Downgrading to a previous version of iOS is not supported. If you have installed software to perform unauthorized modifications to your iOS device, that software may have redirected connections to the update server (gs.apple.com) within the Hosts file. First you must uninstall the unauthorized modification software from the computer, then edit out the "gs.apple.com" redirect from the hosts file, and then restart the computer for the host file changes to take affect.  For steps to edit the Hosts file and allow iTunes to communicate with the update server, see iTunes: Troubleshooting iTunes Store on your computer, iPhone, iPad, or iPod—follow steps under the heading Blocked by configuration (Mac OS X / Windows) > Rebuild network information > The hosts file may also be blocking the iTunes Store. If you do not uninstall the unauthorized modification software prior to editing the hosts file, that software may automatically modify the hosts file again on restart. Also, using an older or modified .ipsw file can cause this issue. Try moving the current .ipsw file, or try restoring in a new user to ensure that iTunes downloads a new .ipsw.
    Error 3194: Resolve error 3194 by updating to the latest version of iTunes. "This device is not eligible for the requested build" in the updater logs confirms this is the root of the issue. For more Error 3194 steps see: This device is not eligible for the requested build above.
    Above from:
    http://support.apple.com/kb/TS3694#error3194

  • Charactestics with replacement path getting error (ple solve urgent)

    hi frieds,
    how are you. i created 2 queries
    first query (sender)  customer material and quantity
    2nd query (receiver)  customer sales.
    now i went rsbbs and joined 2 queries. i went sender query and gto and rec i got 2 queries.
    now i went sender query used varible characterstics with manual entry/default now i went receiver quer charracterstics with replacement path, when i am creting variable i am getting error like i can use variable in default value.
    why.
    ple let me know solution.
    regards
    ssk

    SSK,
    I'm not totally sure I understand what you mean by getting a characteristic with a replacement path.
    Yes you need two queries for a RRI - one sender and one receiver.
    When you run the sender query you may or may not enter variables into the query to run it. When the query is run you will select a row in your results area, right mouse click, select Got - and then pick the Query you have setup the RRI with from the resulting Context menu. 
    Lets say you are on a row that contains the characteristics Customer / Material and Date. When you execute the jump, the values of the three characteristics for the row that you were on when you did the jump will automatically be passed to your receiver query, as long as those three characteristics exits in your receive query. They should not have any variables on them in the receive query - the jump passes the values from the sender query to the receiver query.
    let me know how you get on.
    Regards
    gill

  • Working with WebLogic81sp2 and getting error while processing a file.

    Hi,
    getting error while working with the weblogic81sp2 and java based application. In this m processing a file. the file gets processed but doing command 'ps -ef' shows process still running. The exception log is like:
    <26-Mar-2008 10:10:48 o'clock GMT> <Warning> <WebLogicServer> <BEA-000337> <ExecuteThread: '21' for queue: 'weblogic.kernel.Default' has been busy for "645" seconds working on the request "Http Request: /shield/xml", which is more than the configured time (StuckThreadMaxTime) of "600" seconds.>
    <01-Apr-2008 06:50:00 o'clock BST> <Error> <HTTP> <BEA-101017> <[ServletContext(id=197633402,name=/shield,context-path=/shield)] Root cause of ServletException.
    javax.servlet.jsp.JspException: Can't insert page '/jsp/layouts/mainLayout.jsp' : Broken pipe
    at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.processException(Ljava.lang.Throwable;Ljava.lang.String;)V(InsertTag.java:956)
    at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag()I(InsertTag.java:884)
    at org.apache.struts.taglib.tiles.InsertTag.doEndTag()I(InsertTag.java:473)
    at jsp_servlet._jsp.__main._jspService(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;)V(main.jsp:2)
    at weblogic.servlet.jsp.JspBase.service(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;)V(JspBase.java:33)
    at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run()Ljava.lang.Object;(ServletStubImpl.java:971)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;Lweblogic.servlet.internal.FilterChainImpl;)V(ServletStubImpl.java:402)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;)V(ServletStubImpl.java:305)
    at weblogic.servlet.internal.RequestDispatcherImpl.forward(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;)V(RequestDispatcherImpl.java:301)
    at org.apache.struts.action.RequestProcessor.doForward(Ljava.lang.String;Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;)V(RequestProcessor.java:1069)
    at org.apache.struts.tiles.TilesRequestProcessor.doForward(Ljava.lang.String;Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;)V(TilesRequestProcessor.java:274)
    at org.apache.struts.action.RequestProcessor.processForwardConfig(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;Lorg.apache.struts.config.ForwardConfig;)V(RequestProcessor.java:455)
    at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;Lorg.apache.struts.config.ForwardConfig;)V(TilesRequestProcessor.java:320)
    at org.apache.struts.action.RequestProcessor.process(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;)V(RequestProcessor.java:279)
    at org.apache.struts.action.ActionServlet.process(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;)V(ActionServlet.java:1482)
    at org.apache.struts.action.ActionServlet.doGet(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;)V(ActionServlet.java:507)
    Please help me!

    Not sure why you want to replace. Since the response of the proxy would remain to hold the request body by default.
    If you have stored the opaque element in a variable ($var_opaque), then you can do the following.
    XPath : .
    In variable : body
    Expression : $var_opaque
    Check - "Replace node content"

  • I can't get my phone to sync with my PC get error -50

    Can't get my iphone 4 to sync with pc. get error message -50

    Here are some troubleshooting steps (from http://support.apple.com/kb/TS3694#error50):
    Error 13, 14, 35 and 50 (or -50)
    These errors are typically resolved by performing one or more of the steps listed below:
    Perform USB isolation troubleshooting, including trying a different USB port directly on the computer. See the advanced steps below for USB troubleshooting.
    Put a USB 2.0 hub between the device and the computer.
    Try a different USB 30-pin dock-connector cable.
    Eliminate third-party security software conflicts.
    There may be third-party software installed that modifies your default packet size in Windows by inserting one or more TcpWindowSize entries into your registry. Your default packet size being set incorrectly can cause this error. Contact the manufacturer of the software that installed the packet-size modification for assistance. Or, follow this article by Microsoft: How to reset Internet Protocol (TCP/IP) to reset the packet size back to the default for Windows.
    Connect your computer directly to your Internet source, bypassing any routers, hubs, or switches. You may need to restart your computer and modem to get online.
    Try to restore from another known-good computer and network.

  • How to sync iPhone 5s with iTunes without getting error Msg: "com.apple.MediaLibraryService quit unexpectedly"?

    I had to restore Mavericks on my MacBook Pro and since the restoration, whenever I sync my iPhone 5s with iTunes, I get the error message "com.apple.MedialLibraryService quit unexpectedly". Any solutions?

    Thanks for the link, Niel.  I'm kind of disappointed with Apple that they're making us buy an upgrade to her OS to get all of her Apple products to work together.  It seems weird that we could have any old Windows machine and this would work great, but the fact that she has a MacBook is screwing this up.

  • How to get the data from a jtable with random order??

    hi everyone,
    i have a jtable i filled with Strring and Float data, i put this data to a MySQL database, and i use vectors and iterators to filled the database. the problem is there are some cells that are empty, and the Floats' columns throws me nullpointerexceptions.
    please if anyone know how to avoid that exception i'd would be great.
    thanks for your time.

    HI Siggi,
    Thank you for your reply..
    I am also planning to do FM to get the data. But it is saying that the Cluster table ZES does not exist (ZES is the the standard table, in SE11 also).
    How can I use the Fields from the that table.?
    What can I do now, can you please explain me about this point.
    Waiting for your reply.
    Thanks and Regards
    Rajesh
    Message was edited by:
            rajesh

  • Adding data to a JTable

    how can I add data (Object[][]) to an existing Jtable without creating the Jtable again or setting up a new TableModel for this Jtable.
    Thanks you

    You can't, unless you've written a custom TableModel that allows you to do this.
    The normal solution is:
    DefaultTableModel model = new DefaultTableModel(...);
    table.setModel( model );

  • Iphone 5 will not sync with itunes. Get error message must update itunes to 10.7 but itunes state it is up to date with 10.6.

    iphone 5 will not sync with itunes stating that I must update itunes to 10.7, itunes tells me it is up to date at 10.6. How can I get my new phone to sync with old computer?

    You need to install Mac OS X 10.6, which requires an Intel Mac and at least 1GB RAM.
    (73676)

Maybe you are looking for