GWTのCustomScrollPanelとスクロールバーのカスタマイズ方法を知りましたが、例や設定方法が見つかりません。カスタムスクロールバーを使用している例がありますか?GWT CustomScrollPanelの例
答えて
これはネイティブスクロールバーをカスタマイズする方法ですが、さらにカスタマイズ可能なVerticalScrollbarとHorizontalScrollbarを実装する独自のスクロールバークラスを開発することもできます。
リソース(スタイル)定義:CustomScrollPanel
て
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 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での垂直スクロールバーのなめらかなスクロールバーを取得するには、VerticalScrollbarに次のコードを追加する必要があります。 css。 これはgmailのようにIEでは機能しません。
/* Turn on a 16x16 scrollbar */
::-webkit-scrollbar {
width: 16px;
height: 16px;
}
/* Turn on single button up on top, and down on bottom */
::-webkit-scrollbar-button:start:decrement,
::-webkit-scrollbar-button:end:increment {
display: block;
}
/* Turn off the down area up on top, and up area on bottom */
::-webkit-scrollbar-button:vertical:start:increment,
::-webkit-scrollbar-button:vertical:end:decrement {
display: none;
}
/* Place The scroll down button at the bottom */
::-webkit-scrollbar-button:end:increment {
background-image: url(images/scroll_cntrl_dwn.png);
}
/* Place The scroll up button at the up */
::-webkit-scrollbar-button:start:decrement {
background-image: url(images/scroll_cntrl_up.png);
}
/* Top area above thumb and below up button */
::-webkit-scrollbar-track-piece:vertical:start {
background-image: url(images/scroll_gutter_top.png), url(images/scroll_gutter_mid.png);
background-repeat: no-repeat, repeat-y;
}
/* Bottom area below thumb and down button */
::-webkit-scrollbar-track-piece:vertical:end {
background-image: url(images/scroll_gutter_btm.png), url(images/scroll_gutter_mid.png);
background-repeat: no-repeat, repeat-y;
background-position: bottom left, 0 0;
}
/* The thumb itself */
::-webkit-scrollbar-thumb:vertical {
height: 56px;
-webkit-border-image: url(images/scroll_thumb.png) 8 0 8 0 stretch stretch;
border-width: 8 0 8 0;
}
同様に水平スクロールバーにもできます。詳細については、以下のリンクをご確認ください。 http://almaer.com/blog/creating-custom-scrollbars-with-css-how-css-isnt-great-for-every-task – Saritha
VerticalScrollbar.cssをありがとう、これは本当に多くの助けになりました。 HorizontalScrollbar.cssサンプルがありますか? – MattWeiler
CSSを垂直/水平の両方に使用することに興味がある人は、これが私が使用しているものです。
HorizontalScrollbar.css
/* ***********
* SCROLLBAR *
* ***********/
.nativeHorizontalScrollbar::-webkit-scrollbar
{
width: 10px;
height: 10px;
}
/* *************
* BUTTON AREA *
* *************/
.nativeHorizontalScrollbar::-webkit-scrollbar-button:horizontal
{
background-color: transparent;
}
/* Increment scroll left/right button. */
.nativeHorizontalScrollbar::-webkit-scrollbar-button:start:decrement,
.nativeHorizontalScrollbar::-webkit-scrollbar-button:end:increment
{
display: block;
width: 10px;
height: 8px;
background-repeat: no-repeat;
background-size: 10px 8px;
}
/* Increment scroll left button. */
.nativeHorizontalScrollbar::-webkit-scrollbar-button:start:decrement
{
background-image: url('images/scroll-left.png');
}
/* Increment scroll right button. */
.nativeHorizontalScrollbar::-webkit-scrollbar-button:end:increment
{
background-image: url('images/scroll-right.png');
}
/* Jump left/right buttons. */
.nativeHorizontalScrollbar::-webkit-scrollbar-button:horizontal:start:increment,
.nativeHorizontalScrollbar::-webkit-scrollbar-button:horizontal:end:decrement
{
display: none;
}
/* ******************
* TRACKING SECTION *
* ******************/
.nativeHorizontalScrollbar::-webkit-scrollbar-track:horizontal
{
background-color: transparent;
}
/* Area between the thumb and the left button. */
.nativeHorizontalScrollbar::-webkit-scrollbar-track-piece:horizontal:start
{
}
/* Area between the thumb and and right button. */
.nativeHorizontalScrollbar::-webkit-scrollbar-track-piece:horizontal:end
{
}
/*
* The tracking area.
* This is the area that the thumb travels along.
*/
.nativeHorizontalScrollbar::-webkit-scrollbar-track-piece
{
background-color: rgba(255, 255, 255, 0.1);
}
/* The tracking piece. */
.nativeHorizontalScrollbar::-webkit-scrollbar-thumb:horizontal
{
height: 15px;
background-color: rgba(255, 255, 255, 0.75);
border: none;
-webkit-border-top-left-radius: 6px;
-webkit-border-top-right-radius: 6px;
-webkit-border-bottom-left-radius: 6px;
-webkit-border-bottom-right-radius: 6px;
-moz-border-radius-topleft: 6px;
-moz-border-radius-topright: 6px;
-moz-border-radius-bottomleft: 6px;
-moz-border-radius-bottomright: 6px;
border-top-left-radius: 6px;
border-top-right-radius: 6px;
border-bottom-left-radius: 6px;
border-bottom-right-radius: 6px;
}
/* ********
* CORNER *
* ********/
.nativeHorizontalScrollbar::-webkit-scrollbar-corner:horizontal
{
background-color: transparent;
}
/* *********
* RESIZER *
* *********/
.nativeHorizontalScrollbar::-webkit-scrollbar-resizer:horizontal
{
background-color: transparent;
}
VerticalScrollbar.css /* *********** * SCROLLBAR * * ********* **/
.nativeVerticalScrollbar::-webkit-scrollbar
{
width: 10px;
height: 10px;
}
/* *************
* BUTTON AREA *
* *************/
.nativeVerticalScrollbar::-webkit-scrollbar-button:vertical
{
background-color: transparent;
}
/* Increment scroll up/down buttons. */
.nativeVerticalScrollbar::-webkit-scrollbar-button:start:decrement,
.nativeVerticalScrollbar::-webkit-scrollbar-button:end:increment
{
display: block;
width: 10px;
height: 8px;
background-repeat: no-repeat;
background-size: 10px 8px;
}
/* Increment scroll up button. */
.nativeVerticalScrollbar::-webkit-scrollbar-button:start:decrement
{
background-image: url('images/scroll-up.png');
}
/* Increment scroll down button. */
.nativeVerticalScrollbar::-webkit-scrollbar-button:end:increment
{
background-image: url('images/scroll-down.png');
}
/* Jump up/down buttons. */
.nativeVerticalScrollbar::-webkit-scrollbar-button:vertical:start:increment,
.nativeVerticalScrollbar::-webkit-scrollbar-button:vertical:end:decrement
{
display: none;
}
/* ******************
* TRACKING SECTION *
* ******************/
.nativeVerticalScrollbar::-webkit-scrollbar-track:vertical
{
background-color: transparent;
}
/* Area between the thumb and the up button. */
.nativeVerticalScrollbar::-webkit-scrollbar-track-piece:vertical:start
{
}
/* Area between the thumb and and down button. */
.nativeVerticalScrollbar::-webkit-scrollbar-track-piece:vertical:end
{
}
/*
* The tracking area.
* This is the area that the thumb travels along.
*/
.nativeVerticalScrollbar::-webkit-scrollbar-track-piece
{
background-color: rgba(255, 255, 255, 0.1);
}
/* The tracking piece. */
.nativeVerticalScrollbar::-webkit-scrollbar-thumb:vertical
{
height: 15px;
background-color: rgba(255, 255, 255, 0.75);
border: none;
-webkit-border-top-left-radius: 6px;
-webkit-border-top-right-radius: 6px;
-webkit-border-bottom-left-radius: 6px;
-webkit-border-bottom-right-radius: 6px;
-moz-border-radius-topleft: 6px;
-moz-border-radius-topright: 6px;
-moz-border-radius-bottomleft: 6px;
-moz-border-radius-bottomright: 6px;
border-top-left-radius: 6px;
border-top-right-radius: 6px;
border-bottom-left-radius: 6px;
border-bottom-right-radius: 6px;
}
/* ********
* CORNER *
* ********/
.nativeVerticalScrollbar::-webkit-scrollbar-corner:vertical
{
background-color: transparent;
}
/* *********
* RESIZER *
* *********/
.nativeVerticalScrollbar::-webkit-scrollbar-resizer:vertical
{
background-color: transparent;
}
- 1. GWT RequestFactoryの例?
- 2. GWTのライブ例
- 3. GWTのライブ例
- 4. GWTデシリアライズ例外
- 5. GWT Celllistマウスイベントのダブルクリックの例?
- 6. GWT RPCアプリケーションの例外
- 7. 単純なGWT OpenIDの例
- 8. GWT 2.1アクティビティのない場所の例
- 9. GWTのクライアント側未チェックの例外
- 10. GWT - RPCのシリアル化例外とMapDB
- 11. GWT(Google Web Toolkit)のクライアントに例外をスローする
- 12. 着信RPC呼び出しをディスパッチする際の例外 - GWT
- 13. Googleマップを使用した例v3 + gwt〜jsni
- 14. GWT RequestFactory: "No type for token ..."を取得しています。例外
- 15. コンパイル済みGWTコードを使用したJavaScript例外
- 16. GWT:[FATAL]キャッチされていないJavaScript例外[スクリプトエラー。] in line 0
- 17. GWTキャッチされない例外がエスケープされました
- 18. GWT-RPCによるGWT-EXTデータグリッドのページング?
- 19. HTMLPanel GWT
- 20. GWTとExt-GWT:比較
- 21. GWTコードまたはGWTデザイナー?
- 22. GWTとExt-GWT:比較
- 23. Gwt-Ext Column内のGwt-Extグリッド
- 24. GWTプロジェクトのGWTプロジェクトをコンパイルする
- 25. GWTのfavicon.icoを返すエラー(GWTとJava)
- 26. GWT/Twitterブートストラップ:GWT要素のPopover?
- 27. Smart-GWTのライブグリッドに相当するGWT
- 28. gwt-setStyle on gwt-MenuBarPopup(複数のポップアップ)?
- 29. GWT
- 30. GWT
カスタマイズを許可するCSSファイルですか? VerticalScrollbar.cssのサンプルを提供できますか? – sworded
はい、そうですが、ネイティブのスクロールバーを使用しているためにたくさんのことを行うことはできません。完全にカスタム化されたDOM実装を作成したい場合は、多くのカスタマイズが必要な場合があります。たとえば、gwt-user.jarを解凍し、com \ google \ gwt \ user \ client \ uiをAbstractNativeScrollbar.java、NativeVerticalScrollbar.java NativeVerticalScrollbar.ui.xmlおよびNativeVerticalScrollbarTransparent.cssで検索すると、GWTソースをチェックアウトする必要があります。 – LINEMAN78