Is it better to use AbstractTableModel or DefaultTableModel...?

Is it better to use AbstractTableModel or DefaultTableModel when subclassing your jtable model? I ask this because while the java tutorial seems to point to the former I've read some people to recommend using the defaulttablemodel. What is the general consensus? Do you have to implement all the methods you need in the defaulttablemodel also? Because right now I think that's the biggest drawback that abstracttablemodel has...

I ask this because while the java tutorial seems to point to the former (AbstractTableModel)Because they are trying to show an example of how to implement a TableModel. This does not mean you need to create a custom TableModel every time you use a JTable
I've read some people to recommend using the defaulttablemodel.Because it is fully functional. DefaultTableModel already extends AbstractTableModel to provide this functionality. If it has the functionality that you require then there is no need to create another custom TableModel
Is it better to use AbstractTableModel or DefaultTableModel...?In general, if the DefaultTableModel does not meet your needs because of the format of your data then you would extend the AbstractTableModel. But if your needs are similiar to the functionality already provided by the DTM then it may be faster/easier to extend it.
You can't use the AbstractTableModel as is and therefore always need to extend it to implement the functionality that you require. Extending the AbstractTableModel every time doesn't make any sense because you keep doing extra work. So if you do need to extend it you should extend it in a generic way that the classes are reusable.
Which is why I created the [List Table Model|http://www.camick.com/java/blog.html?name=list-table-model] and [Bean Table Model|http://www.camick.com/java/blog.html?name=bean-table-model]. The idea is to minimize the coding effort involved. They allow you to work with Lists. They can be used as is, or with smaller customization than required if you use the ATM every time.
Edited by: camickr on May 9, 2009 1:01 AM

Similar Messages

  • My firefox beta 12 using Linux platform does not update to firefox RC1 via the "check for update" function. I know windows' beta version had this fixed, when would Linux get similar support ?

    Current platform : Linux
    Current firefox version : Firefox 4 beta 12
    Issue : does not update to RC 1 using the check for update feature.
    Background : previously downloaded beta 8 and then it automatically updated to beta 12 using update features but for RC1, it does not.
    I know users under Windows platform had same problem but was resolved and they can now update via check for update feature.
    Please implement for Linux users too.
    Thanks !!

    If you can't update then you can download and install the full Firefox 4 RC version.
    * http://www.mozilla.com/firefox/all-beta.html

  • How can we say if Join better than using Sub Queries ??

    Hi all,
    I am trying to understand the rationale behind "Is _Inner Join_ better than using _Sub Query_ ?" for this scenario ...
    I have these tables --
    Table1 { *t1_Col_1* (PrimaryKey), t1_Col_2, t1_Col_3, t1_Col_4 }
    -- Number of rows = ~4Million , t1_Col_3 has say 60% entries non-zero -----> (Condition 4)
    Table2 { *t2_Col_1* (PK), t2_Col_2, t2_Col_3 }
    -- Number of rows = ~150Million, t2_Col_2 maps to t1_Col_1 -----> (Condition 1). This means for every distinct value of t1_Col_1 (its PK) we'll have multiple rows in Table2.
    Table3 { *t3_Col_1* (PK), t3_Col_2, t3_Col_3 }
    -- Number of rows = ~50K, t3_Col_1 maps to t1_Col_2 -----> (Condition 2)
    Table4 { *t4_Col_1* (PK), t4_Col_2, t4_Col_3 }
    -- Number of rows = ~1K, t4_Col_2 maps to t3_Col_2 -----> (Condition 3)
    Now here are the 2 queries: -
    Query using direct join --
    SELECT t1_Col_1, t2_Col_1, t3_Col_1, t4_Col_2
    FROM Table1, Table2, Table3, Table4
    WHERE t1_Col_1=t2_Col_2 -- Condition 1
    AND t1_Col_2=t3_Col_1 -- Condition 2
    AND t3_Col_2=t4_Col_1 -- Condition 3
    AND t1_Col_3 != 0
    Query using SubQuery --
    SELECT t1_Col_1, t2_Col_1, t3_Col_1, t4_Col_2
    FROM Table2,
    (SELECT t1_Col_1, t3_Col_1, t4_Col_2
    FROM Table1,Table3, Table4
    WHERE
    AND t1_Col_2=t3_Col_1 -- Condition 2
    AND t3_Col_2=t4_Col_1 -- Condition 3
    AND t1_Col_3!= 0
    WHERE t1_Col_1=t2_Col_2 -- Condition 1
    Now the golden question is - How can I document with evidence that Type-1 is better than Type-2 or the other way ? I think the 3 things in comparison are: -
    - Number of rows accessed (Type-1 better ?)
    - Memory/Bytes used (Again Type-1 better ?)
    - Cost ( ?? )
    (PS - testing on both MySQL, Oracle10g)
    Thanks,
    A

    So, is it right to conclude that Optimizer uses the optimal path and then processes the query resulting in nearly the same query execution time ?If the optimizer transforms two queries so that they end up the same, then they will run in the same time. Of course, sometimes it cannot do so because of the the way the data is defined (nulls are often a factor; constraints can help it) or the way the query is written, and sometimes it misses a possible optimization due to inaccurate statistics or other information not available to it, or limitations of the optimizer itself.
    Is this the right place to ask for MySQL optimization ?Probably not.

  • HT1443 I need to upgrade from 10.5.8 to 6.0 or better to use a new HP wireless printer.  How do I find the right item to download?

    I need to upgrade from 10.5.8 to 6.0 or better to use a new HP wireless printer.  How do I find the right item to download?

    There is no download; you need to buy a Mac OS X 10.6 DVD.
    (83218)

  • I Mini with an i7 processor. I would like to use Boot Camp to install windows based CAD software on my MAC. Would it be better to use a plugin external hard drive to load my software on and if so what hard drive would you recommend?

    I Mini with an i7 processor. I would like to use Boot Camp to install windows based CAD software on my MAC. Would it be better to use a plugin external hard drive to load my software on and if so what hard drive would you recommend?

    Thank you for your quick response. I can then use a ZIP drive for data storage. I want to keep as much of my hard drive free of data as possible.

  • I have a Mac pro(1 free bay) and a mac mini I need to back both of them  Is it better to use an external NAS HD or an internal hard drive on my mac pro (mid 2010) What option has the faster GB/s?

    I have a Mac pro(1 free bay) and a mac mini I need to back up both of them (time machine)  Is it better to use an external NAS HD or an internal hard drive on my mac pro (mid 2010)
    What option has the faster GB/s?

    Disk drive using native SATA bus interface will allow the drive to copy and always present and ready.
    But once you have backup any hourly changes should be smaller and as long as the NAS and your switch should allow enough.
    You should always have off line backups and don't rely on just one backup set or just TimeMachine.
    WD RED models are designed for RAID and NAS and 7.2k instead of your more standard slower green 5400 rpm green models while still costing less than WD Blacks.
    http://www.amazon.com/gp/product/B008JJLW4M/
    How to clone your system:
    http://macperformanceguide.com/Mac-HowToClone-backup.html
    http://macperformanceguide.com/Mac-HowToClone.html
    http://www.macupdate.com/app/mac/7032/carbon-copy-cloner
    Using Cloning as a Backup Strategy
    http://www.macupdate.com/app/mac/7032/carbon-copy-cloner
    http://www.bombich.com/software/updates/ccc-3.5.html
    Clone to internal, TimeMachine to NAS is one way to go at it.

  • Which one better to use - jsp:useBean or import statement

    Hi,
    I just want to know that which one is better to use jsp:useBean or import statement .
    I can instantiate and call method of myclass -
    1) by importing the class through import tag in jsp as <%@page import="myclass"%. or
    2). by using <jsp:useBean tag....
    i have these two option to do the same thing. i know that basically useBean is used to call setter and getter method of bean class and but it can be used to call a normal java file that have some logic .
    so what should i used , which one is better and why?
    useBean provides scope and object instance so no need to create object by new operator. and with import you have to create an instance .
    but which tag should i use in my jsp?
    i am confused???

    ok, means i can use jsp:useBean tag for all my
    classes that are not actually bean. so it will be
    instantiated at run time and provide efficiency .No. Jsp:useBean is used for java bean components.
    >
    but when should i use import statement in my jsp and
    it happen at translation time so will it create any
    type of burden for my code if i import multiple
    classes.For non-java beans, you need to import the classes, period.
    It's not a burden, it's a necessity.

  • Which is better to use in a corprate enviornment for back up Windows 2008 Vs. Mozy

    Which is better to use in a corprate enviornment for back up Windows 2008 Vs. Mozy

    Hi, 
    Microsoft provide the built-in backup utility Windows Server Backup to backup Windows server 2008. For more detailed information, please refer to the articles below:
    Windows Server Backup Step-by-Step Guide for Windows Server 2008
    http://technet.microsoft.com/en-us/library/cc770266(v=ws.10).aspx
    Save big bucks without risk: Get the most from Windows Server 2008 Backup Utility
    http://www.techrepublic.com/blog/data-center/save-big-bucks-without-risk-get-the-most-from-windows-server-2008-backup-utility/
    Please Note: Since the website is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.
    For Microsoft does not provide any third party software, you need to check with the third party software yourself.
    Regards,
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Why assertion instead of if statement ?  Which is better to use ?

    Why assertion instead of if statement ? Which is better to use ?

    Never assertion instead of if statement. The two have fundamentally different intents. Using assert to control program flow is a bad idea

  • What is better to use: digital out or 5 channel speaker level out

    Hi
    Is it better to use digital out on sound card or 5 channel speaker level output?If you could explain it to me...(i'm new so that's why i am asking this)
    Thank you

    First you need to determine what options you have, if you have an amp/decoder
    use digital out because that then frees up the line-outs which you can use for other devices. Quality wise not much difference.

  • What is better ti use entourage or my .mac account to vidoe chat?

    What is better to use entourage or my .mac account to video chat?
    How do I add a buddy into my entourage buddy list?
    Message was edited by: fotomike

    Entourage is a Microsoft application and is probably Linked to MSN for Mac.
    I have Office:Mac 2000 and this version of MSN does not Video.
    9:24 PM Tuesday; December 18, 2007

  • Which browser is better to use as an option to Safari and how do you download it?

    Which browser is better to use as an option to Safari and how do you safely download it? Thanks

    I use Firefox when a site doesn't work well with Safari. Some people like Google's Chrome, but I find it too instrusive and do not trust Google's security. You can download Firefox from firefox.com.
    Regards.

  • Is it better to use just one project or to jump back and forth?

    Greetings,
    I am using Captivate 4. And I am wondering if it is better to use just one project or to jump back and forth?
    I have one main project and rather than make one big project, I wondered about jumping off to small projects and returning to the main one.
    I was trying to figure out the suggestion of jumping back to slide 10 and jump off to another project and then back to slide 20.
    Do the projects have to be published to see this work?
    I am just learning about Captivate so I am unsure of the best practices.
    Thanks.

    It's not that easy in Captivate projects to jump to a particular slide midway through another project.  Captivate is set up by default to just launch each project from the first slide. 
    There have been workarounds published on this forum that allowed jumping into the middle of another project, but they can require some complex coding in either JavaScript or ActionScript.

  • c:redirect VS RequestDispatcher -WHICH ONE IS BETTER TO USE?

    WHENVER WE WANT TO ACCESS FILES FROM OHTER APPLICATIONS,WHICH ONE IS BETTER TO USE,<c:redirect> OR
    RequestDispatcher

    Please stop shouting. It is considered rude.

  • , c:redirect OR RequestDispatcher -which one is better to use

    WHENVER WE WANT TO ACCESS FILES FROM OHTER APPLICATIONS,WHICH ONE IS BETTER TO USE,<c:redirect> OR
    RequestDispatcher

    <c:redirect> is the JSTL equivalent of the sendRedirect() method of javax.servlet.http.HttpServletResponse.
    Please see here:
    http://forum.java.sun.com/thread.jspa?forumID=45&threadID=405398 or search the forums for "RequestDispatcher redirect"

Maybe you are looking for