< prev index next >
src/java.desktop/windows/native/libawt/windows/awt_ScrollPane.cpp
Print this page
@@ -194,20 +194,12 @@
::SetScrollInfo(GetHWnd(), orient, &si, TRUE);
// scroll position may have changed when thumb is at the end of the bar
// and the page size changes
posAfter = GetScrollPos(orient);
if (posBefore != posAfter) {
- if(max==0 && posAfter==0) {
- // Caller used nMin==nMax idiom to hide scrollbar.
- // On the new themes (Windows XP, Vista) this would reset
- // scroll position to zero ("just inside the range") (6404832).
- //
- PostScrollEvent(orient, SB_THUMBPOSITION, posBefore);
- }else{
PostScrollEvent(orient, SB_THUMBPOSITION, posAfter);
}
- }
}
void AwtScrollPane::RecalcSizes(int parentWidth, int parentHeight,
int childWidth, int childHeight)
{
@@ -261,24 +253,30 @@
env->SetIntField(hAdj, AwtScrollPane::blockIncrementID, parentWidth);
SetScrollInfo(SB_HORZ, childWidth - 1, parentWidth,
(policy == java_awt_ScrollPane_SCROLLBARS_ALWAYS));
env->DeleteLocalRef(hAdj);
} else {
- SetScrollInfo(SB_HORZ, 0, 0,
+ /* Set scroll info to imitate the behaviour and since we don't
+ need to display it, explicitly don't show the bar */
+ SetScrollInfo(SB_HORZ, childWidth - 1, parentWidth,
(policy == java_awt_ScrollPane_SCROLLBARS_ALWAYS));
+ ::ShowScrollBar(GetHWnd(), SB_HORZ, false);
}
if (needsVert) {
jobject vAdj =
env->GetObjectField(target, AwtScrollPane::vAdjustableID);
env->SetIntField(vAdj, AwtScrollPane::blockIncrementID, parentHeight);
SetScrollInfo(SB_VERT, childHeight - 1, parentHeight,
(policy == java_awt_ScrollPane_SCROLLBARS_ALWAYS));
env->DeleteLocalRef(vAdj);
} else {
- SetScrollInfo(SB_VERT, 0, 0,
+ /* Set scroll info to imitate the behaviour and since we don't
+ need to display it, explicitly don't show the bar */
+ SetScrollInfo(SB_VERT, childHeight - 1, parentHeight,
(policy == java_awt_ScrollPane_SCROLLBARS_ALWAYS));
+ ::ShowScrollBar(GetHWnd(), SB_VERT, false);
}
env->DeleteLocalRef(target);
}
< prev index next >