This week's giveaway is in the Threads forum.
We're giving away four copies of Java Concurrency Live Lessons and have Doug Schmidt on-line!
See this thread for details.
Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to increase JTable cell size ?  RSS feed

 
Vince Hon
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using JTable and DefaultTableModel.
1.How can I increase the cell size (I mean the no. of character it can hold )of the table ?
2.How to make all the cell of the JTable non-editable by the user?
Thanks
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Each cell can hold a (virtually) unlimited number of characters. To change the displayed size of a cell you can use these two methods...


To make your table uneditable, you'll need to extend DefaultTableModel and override the isCellEditable() method to always return false.
 
Vince Hon
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Nate.
I have solved the problem.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!