posted 16 years ago
So How can I add,delete,move rows up & down(1 row up & down).I know that,have to update my Tablemodel & call one of the fire methods.But bit confused about the detailed way.
Look at the source code for the DefaultTableModel class in your sdk/src file. You can get some ideas about how to implement things.
How can I add,delete,move rows up & down(1 row up & down).
You'll have to make up some methods in your table model to do these for you.
I know that,have to update my Tablemodel & call one of the fire methods. But bit confused about the detailed way
DefaultTableModel source code may help with this. Also, look at the class api methods for the classes and interfaces involved (follow the class hierarchy shown at the top of the class api for classes such as DefaultTableModel) for useful methods that you can try/use. Knowing what you want to build and looking through the docs with a little inspiration from source code is the way to build/create new things.
I have a JFrame,where I have placed a Table.By clicking in one of the cells in the Table,a modal pop up Dialog appears. Is it possible to drag a "text content"from the pop up dialog to one of the cells in the table.
I would be wary of using a modal dialog; it could prevent any further action in the drag and drop operation. A non–modal dialog might work okay.
Do I have to call the "setTransferHandler" also in this case.
I think yes, you would need to write a TransferHandler. The tutorial page on drag and drop in the Swing tutorial has enough discussion and example code to get you started. The javadocs are helpful in this, too.