Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Chrriis opened this issue Nov 7, 2021 · 5 comments
Open

Comments

@Chrriis
Copy link
Contributor

Chrriis commented Nov 7, 2021

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);
}
@DevCharly
Copy link
Collaborator

Scroll bar arrows are useful...

Hmm, not sure about that 😉
Can't remember when I last pressed any scroll bar arrow.
Since mouses have wheels, I don't use/need them anymore 😄

Modern systems that still show arrow buttons generally hide them unless the scroll bar is hovered.

The only system that I know that does this is Windows 11.
Where have you seen this?

@Chrriis
Copy link
Contributor Author

Chrriis commented Nov 18, 2021

Can't remember when I last pressed any scroll bar arrow.

Our application has lots of tables, and the mouse wheel moves many rows at once. The arrows are a convenient way of moving row by row, keeping a full row at the top (whereas grabbing the scrollbar to move up or down ends up with misaligned rows). This is important e.g. when comparing data between several screens (you align chunks and switch back and forth).

Where have you seen this?

I did on Windows 11. I think I saw it somewhere else but I don't remember where.

@Chrriis
Copy link
Contributor Author

Chrriis commented Nov 18, 2021

I did on Windows 11. I think I saw it somewhere else but I don't remember where.

In fact, Windows 10 has such behavior in areas with modern design, like the start menu or the settings screen.

@Chrriis
Copy link
Contributor Author

Chrriis commented May 9, 2022

And now, in Firefox too:
FirefoxScrollbar

@j-dimension
Copy link

I would love to see that as well, maybe even with an option to have a transparent track.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants