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

Window panes not scrolling by page #2446

Closed
BowtieBob opened this issue Mar 3, 2021 · 3 comments · Fixed by #2451
Closed

Window panes not scrolling by page #2446

BowtieBob opened this issue Mar 3, 2021 · 3 comments · Fixed by #2451
Assignees
Labels

Comments

@BowtieBob
Copy link

Environment

What version of MekHQ does your issue apply to? 0.47.17
What operating system are you using? Windows
What java version are you using? openjdk 11

Description

Some of the detail screens are able to scroll by page when you select the bar of the scroll bar (normal Windows behavior), but many of them only scroll one line at a time instead. This makes scrolling tedious when a mouse wheel is not available.
Here are the ones I have found so far that only scroll one line at a time:

TOE tab, Pilot and Unit detail tabs
Briefing Room tab, Mission list
Briefing Room tab, Scenario details
Interstellar Map tab, System details
Personnel tab, Personnel details
Hanger tab, Unit details

@BowtieBob
Copy link
Author

Oddly enough, the Lance Deployment pane on the Briefing Room tab DOES work correctly when clicking on the scroll bar, but when scrolling using a mouse wheel, it only moves a fraction of a line at a time. This is the only pane I've noticed that scrolls that slowly when using a mouse wheel.

@sixlettervariables
Copy link
Contributor

sixlettervariables commented Mar 6, 2021

This is by design for most tables with scroll bars, per JTable's Scrollable interface implementation:

Returns the scroll increment (in pixels) that completely exposes one new row or column (depending on the orientation).
This method is called each time the user requests a unit scroll.

It may be possible to override this, but I'm not sure what a reasonable setting would be.

EDIT: Actually that appears to be a red herring. Most tables seem to work just fine. It appears to be the case when a JScrollPane envelops a JPanel.

@sixlettervariables
Copy link
Contributor

We did it to ourselves:

public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) {
return 16;
}
public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) {
return 16;
}

sixlettervariables added a commit that referenced this issue Mar 7, 2021
…ock-increment-wrong

Issue #2446: Calculate the scrollable block increment correctly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants