🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.java.gui
4 messages
4 total messages Started by Raf Lenaerts Wed, 08 Sep 1999 00:00
JTable & JScrollPane
#55
Author: Raf Lenaerts
Date: Wed, 08 Sep 1999 00:00
11 lines
1121 bytes
Hi,

I have written a MyTable (extending JTable) with MyTableModel and
MyTreeCellRenderer. The data that gets displayed is correct, but I am having
troubles with the displaying of the data. All columns have a fixed width (I
don't know why) and don't adjust to the width of my table.  Either their is
some space after the last column, or the last column does not get displayed.
If I put the MyTable in a JScrollPane then there are never any scrollbars.
Does anybody know how I can solve this problem??

Raf.
Re: JTable & JScrollPane
#56
Author: Holger von Thomsen
Date: Wed, 08 Sep 1999 00:00
23 lines
1818 bytes
In article <7r5lih$9n7$1@news3.Belgium.EU.net>,
  "Raf Lenaerts" <raf.lenaerts@student.luc.ac.be> wrote:
> I have written a MyTable (extending JTable) with MyTableModel and
> MyTreeCellRenderer. The data that gets displayed is correct, but I am
> having troubles with the displaying of the data. All columns have a
> fixed width (I don't know why) and don't adjust to the width of my
> table. Either their is some space after the last column, or the last
> column does not get displayed.
> If I put the MyTable in a JScrollPane then there are never any
> scrollbars.

Check for the scrollBarPolicies of the ScrollPane.
Set them to as_needed or as_always.
Then check the weight and autoscrolls settings for the cells.
Check the insets and internal padding settings for the cells also.
And set fixedWidth to false it there is such property.

HTH
Holger


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Re: JTable & JScrollPane
#57
Author: Raf Lenaerts
Date: Thu, 09 Sep 1999 00:00
24 lines
1832 bytes
> > I have written a MyTable (extending JTable) with MyTableModel and
> > MyTreeCellRenderer. The data that gets displayed is correct, but I am
> > having troubles with the displaying of the data. All columns have a
> > fixed width (I don't know why) and don't adjust to the width of my
> > table. Either their is some space after the last column, or the last
> > column does not get displayed.
> > If I put the MyTable in a JScrollPane then there are never any
> > scrollbars.
>
> Check for the scrollBarPolicies of the ScrollPane.
> Set them to as_needed or as_always.
> Then check the weight and autoscrolls settings for the cells.
> Check the insets and internal padding settings for the cells also.
> And set fixedWidth to false it there is such property.
>
The scrollbars were set as_needed.
And I don't see how I have access to the cells. I only have a TableModel for
MyTable. Do you mean yhay I should use a TableCellRenderer?

I should say that if I change the width of one column, then all other
collumns change their width and the table is displayed correctly. But I want
it displayed correctly from the first moment.

Raf
Re: JTable & JScrollPane
#52
Author: Dirk Ludwig
Date: Mon, 13 Sep 1999 00:00
37 lines
2434 bytes

Raf Lenaerts wrote:

> > > I have written a MyTable (extending JTable) with MyTableModel and
> > > MyTreeCellRenderer. The data that gets displayed is correct, but I am
> > > having troubles with the displaying of the data. All columns have a
> > > fixed width (I don't know why) and don't adjust to the width of my
> > > table. Either their is some space after the last column, or the last
> > > column does not get displayed.
> > > If I put the MyTable in a JScrollPane then there are never any
> > > scrollbars.
> >
> > Check for the scrollBarPolicies of the ScrollPane.
> > Set them to as_needed or as_always.
> > Then check the weight and autoscrolls settings for the cells.
> > Check the insets and internal padding settings for the cells also.
> > And set fixedWidth to false it there is such property.
> >
> The scrollbars were set as_needed.
> And I don't see how I have access to the cells. I only have a TableModel for
> MyTable. Do you mean yhay I should use a TableCellRenderer?
>
> I should say that if I change the width of one column, then all other
> collumns change their width and the table is displayed correctly. But I want
> it displayed correctly from the first moment.
>
> Raf

Maybe you have set the preferredSize of your table columns. When repainting a
JTable, Java always respects the preferredSize of a column. The fact that there
are
noScrollbars may be because of the JTable's autoResizeMode. Scrollbars are only
visible if the autoResizeMode was set to JTable.AUTO_RESIZE_OFF.

Regards,
   Dirk
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads