Making Dropdown Arrow Bigger - Vision

The resource @lrose linked to has an option to allow the down arrow to scale in size with the button instead of maintaining a fixed size. It also includes an option to keep the button perfectly square no matter how the dropdown is stretched or squished:
image

That said, if you are required to use the stock dropdown, the methods used in the above resource won't directly translate because the type of buttons used are different.

For manipulating the stock dropdown, you'll need to refer to this post I created for manipulating the stock dropdown's SynthArrowButton.
Change the background and icon color of the Dropdown Component’s button

This is the script I developed in that post for altering the appearance of the dropdown's arrow button:

from javax.swing.plaf.synth import SynthArrowButton, SynthButtonUI
from java.awt.image import BufferedImage
from javax.swing import ImageIcon

# Get the dropdown and the internal SynthArrowButton
dropdown = system.gui.getParentWindow(event).getComponentForPath('Root Container.Dropdown')
button = next((component for component in dropdown.getComponents() if isinstance(component, SynthArrowButton)), None)

# Break the existing UI
UI = SynthButtonUI()
button.setUI(UI)

# Determine the desired button size proportional to the height of the button
# ...or this could be changed to suit the use case
size =  button.height / 4 # Proportional to one quarter the button height

# Create a triangle icon
image = BufferedImage(size, size, BufferedImage.TYPE_INT_RGB)
graphics = image.graphics
graphics.color = system.gui.color('white') # background color
graphics.fillRect(0, 0, size, size)
graphics.color = system.gui.color('black') # down arrow color
graphics.drawString(u'â–¼', size/4, (3*size)/4)
icon = ImageIcon(image)

# Set the icon to the button and dispose of the graphics
button.setIcon(icon)
graphics.dispose()

There is also a perhaps better approach in that post that simply overlays a traditional button that programmatically opens or closes the dropdown when it's clicked. This approach uses a down arrow character for the button text, so the size could be dynamically adjusted by changing the button's font size:

Presentation1

3 Likes