Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #24279

Re: How To Determine Position of JScrollPane in One JTable and Scroll Second JTable

From Jim Gibson <jimsgibson@gmail.com>
Newsgroups comp.lang.java.programmer
Subject Re: How To Determine Position of JScrollPane in One JTable and Scroll Second JTable
Date 2013-06-03 16:56 -0700
Message-ID <030620131656529935%jimsgibson@gmail.com> (permalink)
References <df6f8608-e823-4eb3-ac88-7a43f85b3b22@g9g2000yqh.googlegroups.com>

Show all headers | View raw


In article
<df6f8608-e823-4eb3-ac88-7a43f85b3b22@g9g2000yqh.googlegroups.com>,
Haircuts Are Important <clusardi2k@aol.com> wrote:

> How can I determine how much a  JTable's JScrollPane has been moved,
> and then scroll a second JTable based on that movement.

JScrollPane has two JScrollBar members: horizontalScrollBar and
verticalScrollBar. Use the getVerticalScrollBar() method of
JScrollPane, for example, to get the vertical scroll bar object.

Then use the getValue() method of JScrollBar to find out where the
scrollbar is positioned. You can define an AdjustmentListener object to
listen for scroll bar events. Then use the setValue() method to apply
the same offset to the other JScrollPane (assuming everything else
about the two JScrollPanes is equal).

-- 
Jim Gibson

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How To Determine Position of JScrollPane in One JTable and Scroll Second JTable Haircuts Are Important <clusardi2k@aol.com> - 2013-06-03 11:37 -0700
  Re: How To Determine Position of JScrollPane in One JTable and Scroll Second JTable Jim Gibson <jimsgibson@gmail.com> - 2013-06-03 16:56 -0700
    Re: How To Determine Position of JScrollPane in One JTable and Scroll Second JTable Lew <lewbloch@gmail.com> - 2013-06-03 23:46 -0700
    Re: How To Determine Position of JScrollPane in One JTable and Scroll Second JTable Haircuts Are Important <clusardi2k@aol.com> - 2013-06-04 07:20 -0700

csiph-web