View Javadoc

1   /*
2   This file is part of the xframe software package
3   hosted at http://xframe.sourceforge.net
4   
5   Copyright (c) 2003 Kurt Riede.
6   
7   This library is free software; you can redistribute it and/or
8   modify it under the terms of the GNU Lesser General Public
9   License as published by the Free Software Foundation; either
10  version 2.1 of the License, or (at your option) any later version.
11  
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Lesser General Public License for more details.
16  
17  You should have received a copy of the GNU Lesser General Public
18  License along with this library; if not, write to the Free Software
19  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20  */
21  package net.sf.xframe.swing.scroll;
22  
23  import javax.swing.JComponent;
24  
25  /***
26   * Binds horizontal scrollbars of two or more components.
27   *
28   * <p>All added components must have a
29   * <code>getHorizonzalScrollbar()</code> method that returns a
30   * <code>JScrollBar</code> object.</p>
31   *
32   * @author <a href=mailto:kriede@users.sourceforge.net>Kurt Riede</a>
33   */
34  public final class HScrollBinder extends AbstractScrollBinder {
35  
36      /***
37       * Contructor.
38       */
39      public HScrollBinder() {
40          super();
41      }
42  
43      /***
44       * Adds a horizonal scrollable component to the horizontal scrolling binder.
45       *
46       * <p>The component can be a <code>JScrollPane</code> or any other instance
47       * of a class that has a method
48       * <code>getHorizontalScrollBar()</code>.</p>
49       *
50       * @param component a scroll-enabled component
51       * @see net.sf.xframe.swing.scroll.AbstractScrollBinder#add(javax.swing.JComponent)
52       */
53      public void add(final JComponent component) {
54          add(component, "getHorizontalScrollBar");
55      }
56  
57      /***
58       * @see net.sf.xframe.swing.scroll.AbstractScrollBinder#remove(javax.swing.JComponent)
59       */
60      public void remove(final JComponent component) {
61          remove(component, "getHorizontalScrollBar");
62      }
63  }