Skip to content

Support mode for scrollbar arrow buttons to show only on mouse hover #418

@Chrriis

Description

@Chrriis

Scroll bar arrows are useful but they add visual clutter when not needed. Modern systems that still show arrow buttons generally hide them unless the scroll bar is hovered. It would be great if FlatLaf supported this: a mode where the buttons only appear when the mouse is over.
One could configure this mode e.g.:
UIManager.getDefaults().put("ScrollBar.showButtons", "auto");

Internally, it is as if the scrollbar that is hovered off/on switched the above property false/true state.

Simple test code to show 2 scrollbars:

public static void main(String[] args) throws Exception {
	UIManager.setLookAndFeel(new FlatLightLaf());
	UIManager.getDefaults().put("ScrollBar.showButtons", false);
	JFrame frame = new JFrame();
	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	JPanel centerPane = new JPanel(new BorderLayout());
	centerPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
	JScrollPane scrollPane = new JScrollPane(new JTextArea(50, 80));
	centerPane.add(scrollPane);
	frame.getContentPane().add(centerPane);
	frame.setSize(400, 300);
	frame.setVisible(true);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions