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

Outer focus border issues on panel's edges #792

Open
TLoud opened this issue Jan 11, 2024 · 1 comment
Open

Outer focus border issues on panel's edges #792

TLoud opened this issue Jan 11, 2024 · 1 comment

Comments

@TLoud
Copy link

TLoud commented Jan 11, 2024

We sometimes use nested panels to build and reuse parts of gui. For these nested panels we use MigLayout with zero insets so these panels wont stand out in terms of sizes and insets. The problem is that outer border isnt painting on the panel's edges.

Here is an example on FlatIntelliJLaf - rootPanel with standard insets with added combobox and two nested panels (zero insets) with one and two components respectively. The focus on the first component looks fine, while others have issues

outer_borders_test

	JPanel rootPanel = new JPanel(new MigLayout("insets n n n n"));

	JPanel nestedPanel1 = new JPanel(new MigLayout("insets 0 0 0 0"));
	nestedPanel1.add(new JComboBox<>(), "grow");

	JPanel nestedPanel2 = new JPanel(new MigLayout("insets 0 0 0 0"));
	nestedPanel2.add(new JComboBox<>(), "grow,wrap");
	nestedPanel2.add(new JTextField(), "grow");

	rootPanel.add(new JComboBox<>(), "grow,wrap");
	rootPanel.add(nestedPanel1,"grow,wrap");
	rootPanel.add(nestedPanel2,"grow");

	JFrame jFrame = new JFrame();
	jFrame.add(rootPanel);
	jFrame.pack();
	jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	jFrame.setResizable(true);
	jFrame.setVisible(true);
@TLoud
Copy link
Author

TLoud commented Jan 11, 2024

I've looked through this #317

Turning off MigLayout visualPadding on nested panels isn't much help here as it usually inflates sizes of other components in same row/column and creates bigger insets between components on nested panel while other insets stay the same

Turning zero insets to non-zero in case of the pic above will create non equal vertical insets between the components

Maybe you are now aware of some other FlatLaf or MigLayout related workarounds? Maybe some MigLayout lifehack, which i can use to keep all the visual insets the same in case of panels with nested zero-insets panels?

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

1 participant