/** * Returns the preferred size of a text field with the specified number of rows and columns. * * @param rows The number of rows to get the preferred size for. * @param columns The number of columns to get the preferred size for. */ public Dimension getPreferredSize(int rows, int columns) { TextAreaPeer tap = (TextAreaPeer) getPeer(); if (tap == null) { // Sun's JDK just seems to return Dimension(0,0) in this case. // we do the same. return new Dimension(0, 0); } return (tap.getPreferredSize(rows, columns)); }