Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-19-2007, 12:08 PM
Super Moderator
 
Join Date: Apr 2007
Posts: 30
johnt is on a distinguished road
How can i set the table's column dragable/movable false and cell editable
How can i set the table's column dragable/movable false and cell editable false in table column. If you double click on tables column then you can write any thing but i dont want to write any thing dynamically on column in table. I tried so many ways but i am not able to do.

Please give me sample code for this..
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-19-2007, 12:09 PM
Senior Member
 
Join Date: Dec 2006
Posts: 748
levent is on a distinguished road
Quote:
How can i set the table's column dragable/movable
false

table.getTableHeader().setReorderingAllowed(false) ;



Quote:
and cell edittable false in table column.
Create your own table model ad override the isCellEditable method.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 05-19-2007, 12:11 PM
Super Moderator
 
Join Date: Apr 2007
Posts: 30
johnt is on a distinguished road
Quote:
Create your own table model ad override the isCellEditable method.
Please tell me how can i create a TableModel?
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 05-19-2007, 12:12 PM
Senior Member
 
Join Date: Dec 2006
Posts: 748
levent is on a distinguished road
Something like this:

Code:
public class MyTableModel extends DefaultTableModel { // ... public boolean isCellEditable(int row, int col) { return false; } // ... }
Or even better, extend AbstractTableModel. AbstractTableModel already overrides isCellEditable to return false.

Code:
public class MyTableModel extends AbstractTableModel { // ... }
For more information, you can read Java Tutorial and/or look at JTable Javadoc.

Last edited by levent : 05-19-2007 at 12:14 PM.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 05-19-2007, 12:15 PM
Super Moderator
 
Join Date: Apr 2007
Posts: 30
johnt is on a distinguished road
Thanks a lot.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Limiting the capacity of a cell of JTable rameshraj Advanced Java 0 03-24-2008 03:20 PM
Select specific cell Echilon New To Java 1 01-01-2008 08:47 AM
insert row and column and delete row and column daredavil82 New To Java 7 11-30-2007 11:32 AM
Jtree - making parts editable kmarie AWT / Swing 1 07-27-2007 03:34 AM
hibernate lazy=False Ed Database 2 07-02-2007 08:54 PM


All times are GMT +3. The time now is 12:45 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org