Article View: borland.public.jbuilder.java.swing
Article #8126Re: JTable and scrollpane
From: ross
Date: Fri, 03 Nov 2000 00:00
Date: Fri, 03 Nov 2000 00:00
35 lines
1556 bytes
1556 bytes
I found that this bit of code was needed
m_tbl.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
ross wrote in message <3a03427f$1_1@dnews>...
>I have a JTable in a JScrollPane and just cant get any scrollbars to
>show. No matter how wide I make the table columns when the frame shows all
>of the columns are shown squished together with no scrollbars. I have both
>scrollbars set to as needed.
>I call this method as the last call in jbInit
>
> private void initColumnSizes() {
> TableColumn column = null;
> Component comp = null;
> int width = 0;
> int colCount = m_tblModel.getColumnCount();
>
> for (int i=0; i<colCount; i++) {
> column = m_tbl.getColumnModel().getColumn(i);
> width = ViewerResource.TABLE_COLUMN_WIDTHS[i];
>
> column.setPreferredWidth(width);
> }
> }
>
>Do I have to have data in the model before this works??
>I never had any problems before using jdk 1.2 but this time I
>am using jdk 1.3. What am I doing wrong?
>
>thanks
>Ross
>
>
>
>
Technical Details
Message-ID:
<3a0357d1$1_2@dnews>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<3a03427f$1_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,a8dcf0d47c78cd3b X-Google-Attributes: gid111d45,public From: "ross" <rperry@commonvision.com> Subject: Re: JTable and scrollpane Date: 2000/11/03 Message-ID: <3a0357d1$1_2@dnews> X-Deja-AN: 689438413 References: <3a03427f$1_1@dnews> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 X-Trace: 3 Nov 2000 16:26:57 -0800, 216.202.63.17 Organization: cv Newsgroups: borland.public.jbuilder.java.swing