• Post Reply Bookmark Topic Watch Topic
  • New Topic

set JTable cannot be edit..  RSS feed

 
fiddy chan
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i m able to edit the JTable's data and even worse i cn move the whole column by draggin it.. pls help me..thanks..
my codes :
JTable table = new JTable(expenseList, colExpense);
JScrollPane scrollPane = new JScrollPane(table);
table.Editable(false);
Edited to remove urgently from subject line.
[ April 19, 2004: Message edited by: Gregg Bolinger ]
 
Nigel Browne
Ranch Hand
Posts: 703
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Write a custom table model that extends AbtractTableModel. Then override the following methods as follows
and
Then when you create a JTable use the following:
Hope this helps
Nigel
[ April 19, 2004: Message edited by: Nigel Browne ]
 
fiddy chan
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks alot.. i can manage to disable the editable cell..
but i still can drag the column..
i not using AbtractTableModel.
so is there another to prevent draggin the column??
thanks once again..
 
Nigel Browne
Ranch Hand
Posts: 703
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try
regards
Nigel
 
fiddy chan
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nigel.. thanks alot for helping me..
i try ur code but i still can drag my column.. i found this coding in a website.. http://www.javaalmanac.com/cgi-bin/search/find.pl?words=JTable..
n i use this code
table.getTableHeader().setReorderingAllowed(false);
and it unable the user from draggin the colum..
next time, u cn use this code too..
really thanks alot..
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!