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

UI artefact at bottom right corner of scrollpane #35

Closed
Chrriis opened this issue Jan 9, 2020 · 5 comments
Closed

UI artefact at bottom right corner of scrollpane #35

Chrriis opened this issue Jan 9, 2020 · 5 comments

Comments

@Chrriis
Copy link
Contributor

Chrriis commented Jan 9, 2020

Hi,

I noticed a visual glitch when a component in a scrollpane is focused: the bottom corner at the intersection of the 2 scroll bars has an additional edge. Note that it is more or less visible depending on the theme you are using.

Here is a screenshot:
BottomRightScrollArtefact

@DevCharly
Copy link
Collaborator

Is this from a HiDPI screen?

@Chrriis
Copy link
Contributor Author

Chrriis commented Jan 9, 2020

I wish I had a HiDPI screen! 😄

@Chrriis
Copy link
Contributor Author

Chrriis commented Jan 14, 2020

The artefact is the inner focus that gets painted in the scroll pane (0.5 is the default in the above). It is only visible in the bottom right corner because the other sides get painted over by the view and the 2 scroll bars.

If you try with a bigger inner focus width:

	public static void main(String[] args) throws Exception {
		UIManager.setLookAndFeel(new FlatLightLaf());
		UIManager.getDefaults().put("Component.innerFocusWidth", 2);
		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) {
			@Override
			public boolean hasFocus() {
				return true;
			}
		});
		centerPane.add(scrollPane);
		frame.getContentPane().add(centerPane);
		frame.setSize(400, 300);
		frame.setVisible(true);
	}

... you then clearly see it:
ScrollPaneInnerWidthFocus

I think scroll panes should not paint the inner focus.

DevCharly added a commit that referenced this issue Jan 14, 2020
…f both scroll bars are visible, which was caused by `Component.innerFocusWidth` > 0 (issue #35)
@DevCharly
Copy link
Collaborator

Many thanks.

The fix is now in master branch.

@Chrriis
Copy link
Contributor Author

Chrriis commented Jan 14, 2020

Thanks a lot, it works as advertised! 🙂

@Chrriis Chrriis closed this as completed Jan 14, 2020
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

2 participants