error while using JTable method
final JTable table =new JTable(data, columnNames);
table.setPreferredScrollableViewportSize(new Dimension(500, 70));
table.setFillsViewportHeight(true);//error here
http://java.sun.com/docs/books/tutorial/uiswing/examples/components/SimpleTableDemoProject/src/components/SimpleTableDemo.java
I was running this example and i get compile time error as
"The method setFillsViewportHeight(boolean) is undefined for the type JTable"
Am i missing anything here?
[665 byte] By [
ysrpa] at [2007-11-27 5:19:50]

# 3
> But please tell me what does that method do. I checked in JTable api online and
> didnt find that method
You'll need the API documentation for 1.6: http://java.sun.com/javase/6/docs/api/javax/swing/JTable.html
But in this case what it says is "Sets whether or not this table is always made large enough to fill the height of an enclosing viewport. If the preferred height of the table is smaller than the viewport, then the table will be stretched to fill the viewport. In other words, this ensures the table is never smaller than the viewport. The default for this property is false."
I suppose this is handy if your table is inside a scroll pane - you can get rid of those unsightly empty bits.