mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-26 20:54:22 +01:00
[Find/Replace][Win] grab focus when just opened
Solves https://github.com/arduino/Arduino/issues/6951#issuecomment-351995084
This commit is contained in:
parent
ce70d66095
commit
71418caa4b
@ -62,10 +62,6 @@ public class FindReplace extends javax.swing.JFrame {
|
|||||||
isTranslucencySupported();
|
isTranslucencySupported();
|
||||||
initComponents();
|
initComponents();
|
||||||
|
|
||||||
if (OSUtils.isWindows()) {
|
|
||||||
setAutoRequestFocus(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (OSUtils.isMacOS()) {
|
if (OSUtils.isMacOS()) {
|
||||||
buttonsContainer.removeAll();
|
buttonsContainer.removeAll();
|
||||||
buttonsContainer.add(replaceAllButton);
|
buttonsContainer.add(replaceAllButton);
|
||||||
@ -76,6 +72,9 @@ public class FindReplace extends javax.swing.JFrame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Base.registerWindowCloseKeys(getRootPane(), e -> {
|
Base.registerWindowCloseKeys(getRootPane(), e -> {
|
||||||
|
if (OSUtils.isWindows()) {
|
||||||
|
setAutoRequestFocus(true);
|
||||||
|
}
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
Base.FIND_DIALOG_STATE = findDialogState();
|
Base.FIND_DIALOG_STATE = findDialogState();
|
||||||
});
|
});
|
||||||
@ -86,6 +85,7 @@ public class FindReplace extends javax.swing.JFrame {
|
|||||||
public void windowActivated(WindowEvent e) {
|
public void windowActivated(WindowEvent e) {
|
||||||
if (OSUtils.isWindows()) {
|
if (OSUtils.isWindows()) {
|
||||||
toFront();
|
toFront();
|
||||||
|
setAutoRequestFocus(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
findField.requestFocusInWindow();
|
findField.requestFocusInWindow();
|
||||||
@ -128,6 +128,11 @@ public class FindReplace extends javax.swing.JFrame {
|
|||||||
public void setVisible(boolean b) {
|
public void setVisible(boolean b) {
|
||||||
getRootPane().setDefaultButton(findButton);
|
getRootPane().setDefaultButton(findButton);
|
||||||
|
|
||||||
|
if (OSUtils.isWindows()) {
|
||||||
|
// means we are restoring the window visibility
|
||||||
|
setAutoRequestFocus(true);
|
||||||
|
}
|
||||||
|
|
||||||
super.setVisible(b);
|
super.setVisible(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user