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 / GUI / August 2004

Tip: Looking for answers? Try searching our database.

Setting isCellEditable for JTable via User Event

Thread view: 
Shane Mingins - 29 Jul 2004 22:45 GMT
Hi

I have a JTable with a custom TableModel which I want to allow the user to
be able to right-click row, select Edit, and have a set column (i.e. only
column 2 will become editable, set within the program) for that selected row
become editable.

What would be a good approach to do this?

The TableModel is given a list of domain objects (Bank Transactions) and
provides the JTable with the parts of the Bank Transactions needed to be
displayed.  An isEditable attribute does not belong on the Bank Transaction
objects ... do I need to maintain a Model and View list within the
TableModel for which the View list objects may wrap the Model objects and
provide view-related attributes like isEditable ???

Thanks
Shane

Signature

Today I want to do something better than when I did it yesterday

Babu Kalakrishnan - 04 Aug 2004 15:23 GMT
> Hi
>
[quoted text clipped - 11 lines]
> TableModel for which the View list objects may wrap the Model objects and
> provide view-related attributes like isEditable ???

You could override the isCellEditable(row,col) method of the JTable and return
true to only the appropriate combination. Just remember that the column number
that is passed to you in this call is that of the View - not the model. So you
would need to call convertColumnIndexToModel(column) in case your JTable allows
the user to reorder columns by dragging on the header.

BK


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.