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

fix: Set focus to first field in macro popup #2474

Merged
merged 2 commits into from
Mar 4, 2024
Merged

Conversation

warmans
Copy link
Contributor

@warmans warmans commented Mar 2, 2024

Resolves: #2473

I've not touched Java in many years so this solution is taken mostly from here:

https://tips4java.wordpress.com/2010/03/14/dialog-focus/

It seems to behave differently on different platforms. HierarchyListener was the only listener that worked on Linux.

@warmans warmans changed the title fix: Add focus to first field in macro popup fix: Set focus to first field in macro popup Mar 2, 2024
@breiler
Copy link
Collaborator

breiler commented Mar 3, 2024

Nice, thanks!

Can you move the RequestFocusListener to the package com.willwinder.universalgcodesender.uielements.components and also add a comment that credits the original source, something like:

/**
 * Used for focusing the field in an JOptionDialog. 
 * Source from: https://tips4java.wordpress.com/2010/03/14/dialog-focus/
 */
public class RequestFocusListener implements HierarchyListener {
...

@breiler breiler merged commit 7e27f64 into winder:master Mar 4, 2024
2 checks passed
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

Successfully merging this pull request may close these issues.

Automatically focus macro placeholder input
3 participants