To convert from AWT to AFC, instances of java.awt.ScrollBar should be transformed into instances of com.ms.UIScrollBar.
ScrollBar extends Component: be sure to see its changes.
AWT's ScrollBar class allows you to customize several features: the orientation of the scrollbar, its initial value, slider size, minimum value and maximum value. AFC's UIScrollBar class gives more options, including the type of the scrollbar and when it can be seen. In addition, you can specify other UIComponents to display for the thumb position, the line up and down buttons, and the page up and down regions.
The constructors for ScrollBar and UIScrollBar work in different orders: while the ones that take no inputs are the same, the others are different. Both have a constructor that takes one int as input: ScrollBar's is a flag that notes HORIZONTAL or VERTICAL, while UIScrollBar's is a bitwise combination of VERTICAL (default is horizontal), NOHIDE (the scrollbar is always visible), NOSHOW (the scrollbar is never visible), NONPROPORTIONAL (the size of the scroll bar's thumb component is not proportional to the scroll bar's range), and NOKEY (the scrollbar does not respond to keyboard input). The third constructors are very different: ScrollBar's takes five integers, in the form
Scrollbar(flag, value, visible, minimum, maximum)
while UIScrollBar's takes six integers, in the form
UIScrollbar(flag, minimum, maximum, visible, line_increment, value)
where line_increment is the number of scroll positions associated with an up/down request.
This is the set of changes you need to make to port all ScrollBar methods to UIScrollBar methods. Any method not listed here or below does not need to be changed.
AWT Code | AFC Code | Comments |
ScrollBar() or Scrollbar(int) or Scrollbar(int, int, int, int, int) |
UIScrollBar() or UIScrollBar(int) or UIScrollBar(int, int, int, int, int, int) |
see above |
getBlockIncrement() | getScrollPage() | |
getLineIncrement() | getScrollLine() | Deprecated in AWT 1.1 |
getMaximum() | getScrollMax() | |
getMinimum() | getScrollMin() | |
getOrientation() | getStyle() | |
getPageIncrement() | getScrollPage() | Deprecated in AWT 1.1 |
getUnitIncrement() | getScrollLine() | |
getValue() | getScrollPos() | |
getVisible() | getScrollPage() | Deprecated in AWT 1.1 |
getVisibleAmount() | getScrollPage() | Deprecated in AWT 1.1 |
setBlockIncrement(int) | setScrollPage(int) | |
setLineIncrement(int) | setScrollLine(int) | Deprecated in AWT 1.1 |
setMaximum(int) | setScrollMax(int) | |
setOrientation(int) | setStyle(int) | |
setPageIncrement(int) | setScrollPage(int) | Deprecated in AWT 1.1 |
setUnitIncrement(int) | setScrollLine(int) | |
setValue(int) | setScrollPos(int) | |
setValues(int, int, int, int) | setScrollInfo(int, int, int, int, int) | same inputs as the constructors, leaving off the first input |
setVisibleAmount(int) | setScrollPage(int) |
Some methods in java.awt.ScrollBar are not directly supported in com.ms.ui.UIScrollBar. Those methods and suggested changes are described here.
AWT Code/Suggested AFC Code | Comments |
paramString() getName(), etc. |
use the appropriate getXXX function to get the information you need. |