when does setMaximumSize() used.
basically my code goes like this
private void setIndentTable(){
ViewIndents vi = new ViewIndents();
DefaultTableModel dtm = new DefaultTableModel(){
public boolean isEditable(int row, int col){
// isn't working presently don't know why?
System.out.println("Entered isEditable()");
if(col==(getColumnCount()-1)){
return true;
}
return false;
}
public Class getColumnClass(int col){
if(getValueAt(0,col)!=null){
return getValueAt(0,col).getClass();
}else{
return new Object().getClass();
}
}
};
vi=null;
dtm=null;
dtm.setDataVector(vi.getDataVector(),vi.getColumnNames());
tm.setModel(dtm);
indentMotherVector = vi.getIndentMotherVector();
int headerHeight = (int) tm.getTableHeader().getMinimumSize().getHeight();
int tableHeight = (int) tm.getPreferredSize().getHeight();
int verticalHeight = (int)
js.getVerticalScrollBar().getMinimumSize().getHeight();
int tableWidth = (int) tm.getPreferredSize().getWidth();
int horizontalWidth= (int)
js.getHorizontalScrollBar().getMinimumSize().getWidth();
js.setPreferredSize(new Dimension( (tableWidth+horizontalWidth),
(headerHeight+tableHeight+verticalHeight ) ));
// throws ArithmeticException when the table is empty
// I use this because if the RowCount() exceeds 10 rows then my
JScrollPane should adhere to setMaximumSize()
js.setMaximumSize( new Dimension( (tableWidth+horizontalWidth),
(headerHeight+ ((tableHeight/tm.getRowCount())*10) +verticalHeight ) ));
}
I am doing it the right way or what i understand of setMaximumSize() to do is not what
its meant for.
thanks in advance
Shomal
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing