Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / October 2004

Tip: Looking for answers? Try searching our database.

three JScrollPanes on one JScrollBar ?

Thread view: 
Dado - 23 Oct 2004 10:47 GMT
I have three JScrollBars:
jScrollPane1 with JTree in it
jScrollPane2 with JTable in it
and
jScrollPane3 with JPanel in it

all conected on one Vertical JScrollBar:

jScrollPane3.setVerticalScrollBar(jScrollPane1.getVerticalScrollBar());
jScrollPane2.setVerticalScrollBar(jScrollPane1.getVerticalScrollBar());

jScrollPane3 is larger (height) than jScrollPane1 and jScrollPane2 so I see
only the half of last row of JTable (and JTree). And the last row is
struggling while I editing it.

How to solve the problem?
Does JPanel must be the same size as the previous two contents of the
JScrollPanes (JTree and JTable).

Thank you on help which I get on this newsgroup.
Paul Lutus - 23 Oct 2004 19:59 GMT
> I have three JScrollBars:
> jScrollPane1 with JTree in it
[quoted text clipped - 6 lines]
> jScrollPane3.setVerticalScrollBar(jScrollPane1.getVerticalScrollBar());
> jScrollPane2.setVerticalScrollBar(jScrollPane1.getVerticalScrollBar());

Bad idea. Why not place all three components onto one parent component, and
scroll that? This will be much simpler to implement.

> jScrollPane3 is larger (height) than jScrollPane1 and jScrollPane2 so I
> see only the half of last row of JTable (and JTree). And the last row is
> struggling while I editing it.
>
> How to solve the problem?

Start over, see above.

Signature

Paul Lutus
http://www.arachnoid.com

John McGrath - 23 Oct 2004 23:34 GMT
> I have three JScrollBars:
> jScrollPane1 with JTree in it
[quoted text clipped - 12 lines]
>
> How to solve the problem?

I guess the question is, how do you want to solve it?  What do you expect
the thumb size to be based on and how are you expecting the scroll panes
to react to motion of the scroll bar?

Is there some reason that you do not just put all three components in a
single JScrollPane?

Signature

Regards,

John McGrath

Dado - 25 Oct 2004 07:50 GMT
> > I have three JScrollBars:
> > jScrollPane1 with JTree in it
[quoted text clipped - 24 lines]
>
> John McGrath

I put the components in a two JSplitPane so I have a
divider between int.
It works fine when you start the application, but  when you add a new node,
the HEIGHT
is changhed and then I see only the half of last row.
Paul Lutus - 25 Oct 2004 08:30 GMT
/ ...

> I put the components in a two JSplitPane so I have a
> divider between int.
> It works fine when you start the application, but  when you add a new
> node, the HEIGHT
> is changhed and then I see only the half of last row.

So put all the components onto the same JPanel and scroll that. Multiple
componenents, one scroll bar.

Signature

Paul Lutus
http://www.arachnoid.com

John McGrath - 25 Oct 2004 10:10 GMT
> I put the components in a two JSplitPane so I have a
> divider between int.
> It works fine when you start the application, but  when you add a new
> node, the HEIGHT
> is changhed and then I see only the half of last row.

Since you quoted my entire post, I cannot tell what you are responding
to here.  Are you saying that you do not put all of the components in a
single JScrollPane because of the above?  Or did you attempt to follow my
suggestion, and are trying to explain the results of the attempt?

Signature

Regards,

John McGrath

Dado - 25 Oct 2004 13:29 GMT
OK, to simplified my question:

What is the simpliest way to create one JTree, one JTable, and one JPanel
with a Gantt draws in it like sheme bellow?

                                **************************
                                *  | Header| of Gantt| diagram*
*******************   |            |              |             *
*             *                *   |            |              |
*
*  JTree  *   JTable  *   |            |  Gantt    |             *
*             *                *   |            |              |
*
********************************************
               |                |

           divider      divider                                 ScrollBar

for all
components
Paul Lutus - 25 Oct 2004 16:44 GMT
> OK, to simplified my question:
>
> What is the simpliest way to create one JTree, one JTable, and one JPanel
> with a Gantt draws in it like sheme bellow?

1. What?

2. Have you tried placing the entire assemblage on one panel, as suggested
repeatedly? That certainly meets your criterion that it be simple.

3. Why have you not posted your code? Create a short, compilable, working
example of the problem you face.

Signature

Paul Lutus
http://www.arachnoid.com

John McGrath - 25 Oct 2004 18:32 GMT
> What is the simpliest way to create one JTree, one JTable, and one JPanel
> with a Gantt draws in it like sheme bellow?
[quoted text clipped - 15 lines]
> for all
> components

I am not sure, but I think that a random number generator should be
involved somewhere.  :o)

I have suggested placing all three components in a single JScrollPane.
Paul Lutus has mentioned this approach as well, yet you have not addressed
this approach.  Is there some reason that doing that will not accomplish
your goal?

BTW, when you ask for help on something, and people who are trying to help
you ask direct questions about the problem, it is a good idea to actually
answer those questions.  When you do that, you should make it clear which
question you are answering.  The best approach to doing that is to quote
each question and to follow each question with an answer.  For example:

=====================================================================
> What do you expect the thumb size to be based on and how are you
> expecting the scroll panes to react to motion of the scroll bar?

I want the thumb size to be based on the ...

> Is there some reason that you do not just put all three components
> in a single JScrollPane?

I don't think that will work for me because ...
=====================================================================

Got the idea?

Signature

Regards,

John McGrath

Mario_5 - 25 Oct 2004 22:44 GMT
OK,  thank you on your help. I will try with one JScrollPane.

Sorry, because my English is bad (I still don't get it what is the thumb
size) and also sorry because my sheme is not like I drew.
John McGrath - 26 Oct 2004 00:36 GMT
> I still don't get it what is the thumb size

The thumb is the the part of the scroll bar that you can drag to scroll
the scroll pane.  I just checked the JavaDocs for the JScrollBar class and
it metnions the word "thumb", but it mostly refers to it as the "knob".  I
have also heard it referred to as the "slider".

With most systems these days, the thumb is sized so as to indicate the
percentage of the document that is visible in the scroll pane.  The entire
scroll bar represents the entire document and the thumb represents the
visible portion.

If you want multiple scroll panes with a single scroll bar, then the size
of the thumb is an issue.  If one scroll pane shows half of its document
and another shows one third of its document, how would the thumb be sized?
It cannot simultaneously take up one half and one third of the scroll pane.

Signature

Regards,

John McGrath



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.