# Change ScrollBar Width through scripting

**URL:** <https://forum.inductiveautomation.com/t/change-scrollbar-width-through-scripting/6070>\
**Category:** Ignition\
**Created:** [March 21, 2013, 12:02pm UTC](https://forum.inductiveautomation.com/t/change-scrollbar-width-through-scripting/6070 "2013-03-21T12:02:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![djones](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@djones](https://forum.inductiveautomation.com/u/djones)\
**Post date:** [March 21, 2013, 12:02pm UTC](https://forum.inductiveautomation.com/t/change-scrollbar-width-through-scripting/6070/1 "2013-03-21T12:02:37Z")

</div>

Here is an example of how to change the scrollbar width through scripting.

This example uses the javax.swing and java.awt to access the prefferedsize() property of the scrollbar. From what I gather, accessing the .width property for the JScrollBar directy is undesirable as it would bypass the LayoutManager inside Java (also, I couldn’t get it to work - says .width is not a valid property). So instead I set the preferredsize() property. This allows the layout manager to change the width property and appropriately handle resizing.

```auto
from javax.swing import JScrollBar
from java.awt import Dimension

D=Dimension(50,20)

event.source.parent.getComponent("Table").getVerticalScrollBar().setPreferredSize(D)

```

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [March 21, 2013, 4:02pm UTC](https://forum.inductiveautomation.com/t/change-scrollbar-width-through-scripting/6070/2 "2013-03-21T16:02:17Z")

</div>

Thanks for posting that example.

---

<div class="post-metadata">

**Author:** ![Steve\_Laubach](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/steve_laubach/32/60900_2.png) [@Steve\_Laubach](https://forum.inductiveautomation.com/u/Steve_Laubach)\
**Post date:** [March 17, 2021, 1:29pm UTC](https://forum.inductiveautomation.com/t/change-scrollbar-width-through-scripting/6070/3 "2021-03-17T13:29:12Z")

</div>

Thanks. Useful code for touch screen implementations.
