Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2007

Tip: Looking for answers? Try searching our database.

Cut/Copy/Paste Don't Work for Tables?

Thread view: 
Jason Cavett - 21 Mar 2007 21:25 GMT
I implemented cut/copy/paste for components in a JTree.  I used
Transferable and TransferHandler (works very nicely, BTW).  But, I'm
having a problem.

I can cut/copy/paste any item in the tree - it works as it should.
When I open a view to the items in the tree (a property editor window)
and attempt to cut/copy/paste, it works as it should (closes the
window on cut and the paste works correctly) EXCEPT for one item in
the JTree.

The item I can't copy and paste is exactly like the other items
(inherits from the same base classes, etc.) except for the fact that
it has a class veriable of type DefaultTableModel.  When I remove the
reference to that variable, cut/copy/paste of this component works
fine.

Any idea why?  I can't get any errors/exceptions and my trace ends
somewhere within the Java code (but I can't see the code to see what's
happening).  I thought it might have something to do with
Serializable, but DefaultTableModel is Serializable.

Thanks for any help.
Jason Cavett - 21 Mar 2007 21:41 GMT
> I implemented cut/copy/paste for components in a JTree.  I used
> Transferable and TransferHandler (works very nicely, BTW).  But, I'm
[quoted text clipped - 18 lines]
>
> Thanks for any help.

After a little more research, I have discovered that my problem is
this line...

"productTable.setModel(production.getProducts());"

getProducts() returns a ProductTableModel which extends
DefaultTableModel.  If I remove this line, I am then able to cut/copy/
paste the component.

Two weird things.

1. This line occurs in the creation of my view for the production
object.
2. If the view is open, the problem occurs.  If the view is closed the
problem doesn't.  Either way, the object that I am copying/pasting
(production) still has an object of type ProductTableModel.

I am *really* confused.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.