ach
Class SmartScrollPane

java.lang.Object
  extended byach.SmartScrollPane

public class SmartScrollPane
extends java.lang.Object

SmartScrollPane.java
Copyright (c) 1997-2005 Helge Hackbarth, All Rights Reserved.
Controls horizontal and vertical Scrollbars. Implements a ScrollPane similar to AWT 1.1 but can already be used with AWT 1.0x.
Scrollbars are automatically shown or hidden depending on the size of its container and the dimension of the object to be controlled by the scrollbars

THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. THE AUTHOR SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.


Field Summary
 boolean needStepAdjust
          flag if scrollbars need adjustment of page scroll stepsize (depends on Java VM) Your application should compare scrollbar value before and after a page step to determine if an adjustment is required
 int oldHvalue
          old horizontal scrollbar value (before latest event) can be used to determine if step adjustment is required
 int oldVvalue
          old vertical scrollbar value (before latest event) can be used to determine if step adjustment is required
 int sbHlinc
          horizontal line increment
 ScrollComponent sbHoriz
          The horizontal scrollbar
 ScrollComponent sbVert
          The vertical scrollbar
 int sbVlinc
          vertical line increment
 
Constructor Summary
SmartScrollPane(int hvalue, int hvisible, int hminimum, int hmaximum, int vvalue, int vvisible, int vminimum, int vmaximum)
          Constructor for SmartScrollPane Specify the initial value, the visible amount, the minimum and maximum value horizontally and vertically
 
Method Summary
 void disableScrollPane()
          disable and hide both scrollbars
 void doScrollStep(java.lang.Object target, java.awt.Container c, int direction, boolean pageStep)
          adjust step-size and suppress echos of scrollbar events depending on java version and VM supplier
 int getHorizValue(java.awt.Container c, int width)
          get java version dependent corrected value of horizontal scrollbar
 int getVertValue(java.awt.Container c, int height)
          get java version dependent corrected value of vertical scrollbar
 int getVisibleHeight(java.awt.Container c)
          calculate height of visible area in current container
 int getVisibleWidth(java.awt.Container c)
          calculate width of visible area in current container
 boolean isSbHenabled()
          get enabling status of horizontal scroll bar
 boolean isSbVenabled()
          get enabling status of vertical scroll bar
 void restoreValues()
          restore the currently saved values of the scrollbars
 void saveValues()
          save the current values of the scrollbars temporarily
 void setHorizValue(int value, java.awt.Container c, int width)
          set java version dependent corrected value of horizontal scrollbar
 void setVertValue(int value, java.awt.Container c, int height)
          set java version dependent corrected value of vertical scrollbar
 void updateScrollbars(java.awt.Container c, java.awt.Dimension d)
          Check if (and which) Scrollbars are to be displayed and update them
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sbHoriz

public ScrollComponent sbHoriz
The horizontal scrollbar

See Also:
Scrollbar

sbVert

public ScrollComponent sbVert
The vertical scrollbar

See Also:
Scrollbar

needStepAdjust

public boolean needStepAdjust
flag if scrollbars need adjustment of page scroll stepsize (depends on Java VM) Your application should compare scrollbar value before and after a page step to determine if an adjustment is required


sbHlinc

public int sbHlinc
horizontal line increment


sbVlinc

public int sbVlinc
vertical line increment


oldHvalue

public int oldHvalue
old horizontal scrollbar value (before latest event) can be used to determine if step adjustment is required


oldVvalue

public int oldVvalue
old vertical scrollbar value (before latest event) can be used to determine if step adjustment is required

Constructor Detail

SmartScrollPane

public SmartScrollPane(int hvalue,
                       int hvisible,
                       int hminimum,
                       int hmaximum,
                       int vvalue,
                       int vvisible,
                       int vminimum,
                       int vmaximum)
Constructor for SmartScrollPane Specify the initial value, the visible amount, the minimum and maximum value horizontally and vertically

Method Detail

updateScrollbars

public void updateScrollbars(java.awt.Container c,
                             java.awt.Dimension d)
Check if (and which) Scrollbars are to be displayed and update them

Parameters:
c - the container that will contain the scrollbars
d - the dimension of the object scrolled by the scrollbars

isSbHenabled

public boolean isSbHenabled()
get enabling status of horizontal scroll bar

Returns:
true if enabled

isSbVenabled

public boolean isSbVenabled()
get enabling status of vertical scroll bar

Returns:
true if enabled

disableScrollPane

public void disableScrollPane()
disable and hide both scrollbars


getVisibleWidth

public int getVisibleWidth(java.awt.Container c)
calculate width of visible area in current container

Returns:
visible width

getVisibleHeight

public int getVisibleHeight(java.awt.Container c)
calculate height of visible area in current container

Returns:
visible height

getHorizValue

public int getHorizValue(java.awt.Container c,
                         int width)
get java version dependent corrected value of horizontal scrollbar

Parameters:
c - the container that holds the scrollpane
width - the horizontal size of the object to be scrolled
Returns:
value of horizontal scrollbar

getVertValue

public int getVertValue(java.awt.Container c,
                        int height)
get java version dependent corrected value of vertical scrollbar

Parameters:
c - the container that holds the scrollpane
height - the vertical size of the object to be scrolled
Returns:
value of vertical scrollbar

setHorizValue

public void setHorizValue(int value,
                          java.awt.Container c,
                          int width)
set java version dependent corrected value of horizontal scrollbar

Parameters:
value - the current position of the object
c - the container that holds the scrollpane
width - the horizontal size of the object to be scrolled

setVertValue

public void setVertValue(int value,
                         java.awt.Container c,
                         int height)
set java version dependent corrected value of vertical scrollbar

Parameters:
value - the current position of the object
c - the container that holds the scrollpane
height - the vertical size of the object to be scrolled

saveValues

public void saveValues()
save the current values of the scrollbars temporarily


restoreValues

public void restoreValues()
restore the currently saved values of the scrollbars


doScrollStep

public void doScrollStep(java.lang.Object target,
                         java.awt.Container c,
                         int direction,
                         boolean pageStep)
adjust step-size and suppress echos of scrollbar events depending on java version and VM supplier