nphnhi
asked on
ScrollPane and Table
Hello,
I have a table (colums and rows not fixed), but table's size is fixed. Now I want to have a scrollpane in both horizontal side and vertical size. I saw several examples which have a scrollpane just in vertical size.
For exp, my table have 20 colums, and 40 rows. Now, in viewport, we can see 10 colums and 20 rows, so I'd like to use scrollpane to view all table.
Please help me as soon as possible
Thanks a lot
NN
I have a table (colums and rows not fixed), but table's size is fixed. Now I want to have a scrollpane in both horizontal side and vertical size. I saw several examples which have a scrollpane just in vertical size.
For exp, my table have 20 colums, and 40 rows. Now, in viewport, we can see 10 colums and 20 rows, so I'd like to use scrollpane to view all table.
Please help me as soon as possible
Thanks a lot
NN
If you just place your table in a JScrollPane you should have vertical as well as horizontal scrollbars
...automatically
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
you can explicitly
JScrollPane.HORIZONTAL_SCR OLLBAR_AS_ NEEDED
JScrollPane.VERTICAL_SCROL LBAR_AS_NE EDED
JScrollPane.HORIZONTAL_SCR
JScrollPane.VERTICAL_SCROL
Not really needed.
The JScrollPane constructor without any paremeters creates a JScrollPane where both horizontal and vertical scrollbars appear when needed
The JScrollPane constructor without any paremeters creates a JScrollPane where both horizontal and vertical scrollbars appear when needed
i know that,
incase you want to have always then you can use above policy enforced.
incase you want to have always then you can use above policy enforced.
>>incase you want to have always then you can use above policy enforced.
Incorrect. Then you can
yourScrollPane.setHorizont alScrollBa rPolicy(JS crollPane. HORIZONTAL _SCROLLBAR _ALWAYS);
yourScrollPane.setVertical ScrollBarP olicy(JScr ollPane.VE RTICAL_SCR OLLBAR_ALW AYS);
( xxx_ALWAYS instead of xxx_AS_NEEDED)
Incorrect. Then you can
yourScrollPane.setHorizont
yourScrollPane.setVertical
( xxx_ALWAYS instead of xxx_AS_NEEDED)
>>Incorrect. Then you can
zzynx,
dont go by literally, what i said is you can explicilty set the scrollbar policy to ALWAYS
JScrollPane.HORIZONTAL_SCR OLLBAR_ALW AYS
JScrollPane.VERTICAL_SCROL LBAR_ALWAY S
and i know the syntax also.
zzynx,
dont go by literally, what i said is you can explicilty set the scrollbar policy to ALWAYS
JScrollPane.HORIZONTAL_SCR
JScrollPane.VERTICAL_SCROL
and i know the syntax also.
ASKER
No, I mean with 20colums, we can see 10 colums, and user srollbar (horizontal) to srcoll to view the rest
Sorry, but this is what you said:
>>you can explicitly
>>JScrollPane.HORIZONTAL_S CROLLBAR_A S_NEEDED
>>JScrollPane.VERTICAL_SCR OLLBAR_AS_ NEEDED
(remark: xxx_AS_NEEDED)
I think a correction was needed for the author of this question not to be mislead. (no offence meant)
>>you can explicitly
>>JScrollPane.HORIZONTAL_S
>>JScrollPane.VERTICAL_SCR
(remark: xxx_AS_NEEDED)
I think a correction was needed for the author of this question not to be mislead. (no offence meant)
>> No, I mean with 20colums, we can see 10 colums, and user srollbar (horizontal) to srcoll to view the rest
The number of columns is irrelevant. The scrollbars will appear ***when needed***.
That means: as much columns as possible will be shown. The rest of the columns will be "reachable" by scrolling
The number of columns is irrelevant. The scrollbars will appear ***when needed***.
That means: as much columns as possible will be shown. The rest of the columns will be "reachable" by scrolling
ASKER
I found an example :)
What do you mean by that?