GWT CustomScrollPanel 示例 [英] GWT CustomScrollPanel example
本文介绍了GWT CustomScrollPanel 示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我了解了 GWT 的 CustomScrollPanel 以及如何自定义滚动条,但我找不到任何示例或如何设置它.是否有任何示例显示正在使用的自定义滚动条?
I found out about GWT's CustomScrollPanel and how you can customize the scroll bar, but I can't find any examples or how to set it up. Are there any examples out there that show custom scrollbars in use?
推荐答案
这是您自定义本机滚动条的方式,但是您也可以开发自己的滚动条类,以实现更可自定义的 VerticalScrollbar 和 HorizontalScrollbar.
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();
}
}
通过 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());
这篇关于GWT CustomScrollPanel 示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文