Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

adding whitespace jtable cell

 
abracadabration abracadabration
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to add whitespace to jtable cell using setValueAt(), so that all the datas in jtable are arranged in a decorative manner?
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello "abracadabration"-

Welcome to JavaRanch.

On your way in you may have missed that JavaRanch has a policy on display names, and yours does not comply with it; specifically, a first name and a last name are required. Please adjust it accordingly, which you can do right here. Thanks for your prompt attention to this matter.
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by abracadabration abracadabration:
Is there a way to add whitespace to jtable cell using setValueAt(), so that all the datas in jtable are arranged in a decorative manner?


No. SetValueAt is for storing data in the JTable's DataModel. Methods that deal with the appearance of the table's cells include:

setIntercellSpacing
setRowHeight
setRowMargin

You can also configure the width of a column by getting that column's TableColumn object and calling its methods:

setMinWidth
setMaxWidth
setPreferredWidth

If you haven't already, you should study the tutorial: http://java.sun.com/docs/books/tutorial/uiswing/components/table.html

And a tip: GUI questions should go to the GUI forum: Swing / AWT / SWT / JFace
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic