[Java/Swing] LookAndFeel Scrollbar button size

Pagina: 1
Acties:

Acties:
  • 0 Henk 'm!

  • Josvds
  • Registratie: November 2004
  • Laatst online: 26-08 20:42
Ik ben een programma aan het maken en wil d.m.v. LAF de stijl van de applicatie bepalen.
Nu heb ik een tekstvak in een JScrollPane geplaatst.

Ik wil nu echter dat de schuifbalk nauwelijks of niet zichtbaar zijn maar de knoppen ophoog en omlaag groter zichtbaar zijn.

Wat ik nu heb:
XML:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
    <!-- The style for scroll pane component. -->
    <style id="Scroll Pane">
        <insets top="2" left="2" bottom="2" right="2"/>
        <opaque value="true"/>
        <state value="ENABLED">
            <imagePainter method="scrollPaneBorder" path="/layout/images/scroll_pane.png" sourceInsets="2 2 2 2" paintCenter="true" stretch="true" center="false"/>
        </state>
        <state value="DISABLED">
            <imagePainter method="scrollPaneBorder" path="/layout/images/scroll_pane.png" sourceInsets="2 2 2 2" paintCenter="true" stretch="true" center="false"/>
        </state>
    </style>
    <bind style="Scroll Pane" type="region" key="JScrollPane" />

    <!-- The style for the scrollbar buttons -->
    <style id="scrollBarArrow">
        <insets top="100" left="100" bottom="100" right="100"/>
        <opaque value="true"/>
        <state>
            <imagePainter method="arrowButtonForeground" path="/layout/images/scroll_up.png" sourceInsets="0 0 0 0" direction="north" stretch="true" />
            <imagePainter method="arrowButtonForeground" path="/layout/images/scroll_right.png" sourceInsets="0 0 0 0" direction="east" stretch="true" />
            <imagePainter method="arrowButtonForeground" path="/layout/images/scroll_down.png" sourceInsets="0 0 0 0" direction="south" stretch="true" />
            <imagePainter method="arrowButtonForeground" path="/layout/images/scroll_left.png" sourceInsets="0 0 0 0" direction="west" stretch="true" />
        </state>
        <state value="PRESSED">
            <imagePainter method="arrowButtonForeground" path="/layout/images/scroll_up.png" sourceInsets="0 0 0 0" direction="north" stretch="true" />
            <imagePainter method="arrowButtonForeground" path="/layout/images/scroll_right.png" sourceInsets="0 0 0 0" direction="east" stretch="true" />
            <imagePainter method="arrowButtonForeground" path="/layout/images/scroll_down.png" sourceInsets="0 0 0 0" direction="south" stretch="true" />
            <imagePainter method="arrowButtonForeground" path="/layout/images/scroll_left.png" sourceInsets="0 0 0 0" direction="west" stretch="true" />
        </state>
    </style>
    <bind style="scrollBarArrow" type="NAME" key="ScrollBar.button" />


    <!-- The style for the scrollbar move block in it -->
    <style id="scrollbarThumbStyle">
        <state>
            <imagePainter method="scrollBarThumbBackground" path="/layout/images/scroll_thumb.png" direction="vertical" sourceInsets="5 5 5 5" />
            <imagePainter method="scrollBarThumbBackground" path="/layout/images/scroll_thumb.png" direction="horizontal" sourceInsets="5 5 5 5" />
        </state>
    </style>
    <bind style="scrollbarThumbStyle" type="REGION" key="ScrollBarThumb" />

    <!-- Central scrollbar information -->
    <style id="scrollBarSize">
        <property key="ScrollBar.thumbHeight" type="integer" value="50" />
        <property key="ScrollBar.maximumThumbSize" type="dimension" value="50 100" />
        <property key="ScrollBar.squareButtons" type="boolean" value="true" />
    </style>
    <bind style="scrollBarSize" type="REGION" key="ScrollBar" />


Hoe kan ik nu instellen dat de thumb kleiner moet zijn maar de buttons groter? Ik heb op internet gezocht maar kon het niet gevonden krijgen. Een button heeft een size, maar dat was dan property "JScrollPane:Button.size" ofzo. Ik wist dan niet hoe ik dat moest instellen. Die had ook maar één int wat dus geen dimensies zijn. Iemand een idee?

Acties:
  • 0 Henk 'm!

  • Josvds
  • Registratie: November 2004
  • Laatst online: 26-08 20:42
Ik heb zojuist verder gezocht en ben er uiteindelijk toch uit gekomen.

XML:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
    <!-- Afmeting van de scrollbalk instellen -->
    <style id="scrollBarArrowStyle">
        <property key="ArrowButton.size" type="integer" value="150" />
        <state>
            <imagePainter method="arrowButtonForeground" path="/layout/images/scroll_up.png" sourceInsets="0 0 0 0" direction="north" stretch="true" />
            <imagePainter method="arrowButtonForeground" path="/layout/images/scroll_right.png" sourceInsets="0 0 0 0" direction="east" stretch="true" />
            <imagePainter method="arrowButtonForeground" path="/layout/images/scroll_down.png" sourceInsets="0 0 0 0" direction="south" stretch="true" />
            <imagePainter method="arrowButtonForeground" path="/layout/images/scroll_left.png" sourceInsets="0 0 0 0" direction="west" stretch="true" />
        </state>
        <state value="PRESSED">
            <imagePainter method="arrowButtonForeground" path="/layout/images/scroll_up.png" sourceInsets="0 0 0 0" direction="north" stretch="true" />
            <imagePainter method="arrowButtonForeground" path="/layout/images/scroll_right.png" sourceInsets="0 0 0 0" direction="east" stretch="true" />
            <imagePainter method="arrowButtonForeground" path="/layout/images/scroll_down.png" sourceInsets="0 0 0 0" direction="south" stretch="true" />
            <imagePainter method="arrowButtonForeground" path="/layout/images/scroll_left.png" sourceInsets="0 0 0 0" direction="west" stretch="true" />
        </state>
    </style>
    <bind style="scrollBarArrowStyle" type="REGION" key="ArrowButton" />

    <!-- ScrollBar arrow breedte -->
    <style id="scrollBarSize">
        <property key="ScrollBar.thumbHeight" type="integer" value="75" />
    </style>
    <bind style="scrollBarSize" type="REGION" key="ScrollBar" />