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

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
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 Mon, 03 Jun 2013 16:56:52 -0700
Lines 19
Message-ID <030620131656529935%jimsgibson@gmail.com> (permalink)
References <df6f8608-e823-4eb3-ac88-7a43f85b3b22@g9g2000yqh.googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 8bit
X-Trace individual.net UEaZI1NQ9TT8XU7vqtxDhwW2VA0uxtBTsvwOnMOgC6Jlmo2KHS
X-Orig-Path jimsgibson
Cancel-Lock sha1:E/z82izFgeRWLPViE46aIMvodK0=
User-Agent Thoth/1.9.0 (Mac OS X)
Xref csiph.com comp.lang.java.programmer:24279

Show key headers only | 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