This is how you would customize the native scrollbars, however you could also develop your own scrollbar classes that implement VerticalScrollbar and HorizontalScrollbar that are a lot more customizable.
Resource (style) definitions:
public class ScrollResourcesContainer {
public interface ScrollPanelResources extends CustomScrollPanel.Resources
{
@Override
@Source( { "ScrollPanel.css", CustomScrollPanel.Style.DEFAULT_CSS } )
CustomScrollPanel.Style customScrollPanelStyle();
}
public interface HorizontalResources extends NativeHorizontalScrollbar.Resources
{
@Override
@Source( { "HorizontalScrollbar.css", NativeHorizontalScrollbar.StyleTransparant.DEFAULT_CSS } )
NativeHorizontalScrollbar.Style nativeHorizontalScrollbarStyle();
}
public interface VerticalResources extends NativeVerticalScrollbar.Resources
{
@Override
@Source( { "VerticalScrollbar.css", NativeVerticalScrollbar.StyleTransparant.DEFAULT_CSS } )
NativeVerticalScrollbar.Style nativeVerticalScrollbarStyle();
}
}
Usage through CustomScrollPanel
:
CustomScrollPanel csp = new CustomScrollPanel((ScrollResourcesContainer.ScrollPanelResources) GWT.create(ScrollResourcesContainer.ScrollPanelResources.class));
csp.setHorizontalScrollbar(new NativeHorizontalScrollbar((HorizontalResources) GWT.create(HorizontalResources.class)),
AbstractNativeScrollbar.getNativeScrollbarHeight());
csp.setVerticalScrollbar(new NativeVerticalScrollbar((VerticalResources) GWT.create(VerticalResources.class)),
AbstractNativeScrollbar.getNativeScrollbarWidth());
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…