Browse Source

Replace usage of #requestFocus with #requestFocusInWindow

pull/214/head
weisj 4 years ago
parent
commit
ce4693fddf
  1. 2
      core/src/main/java/com/github/weisj/darklaf/components/DefaultButton.java
  2. 2
      core/src/main/java/com/github/weisj/darklaf/components/tabframe/JTabFrame.java
  3. 2
      core/src/main/java/com/github/weisj/darklaf/components/tabframe/PanelPopup.java
  4. 2
      core/src/main/java/com/github/weisj/darklaf/settings/ThemeSettings.java
  5. 2
      core/src/main/java/com/github/weisj/darklaf/ui/colorchooser/DarkColorChooserPanel.java
  6. 2
      core/src/main/java/com/github/weisj/darklaf/ui/combobox/DarkComboBoxListener.java
  7. 2
      core/src/main/java/com/github/weisj/darklaf/ui/filechooser/DarkFileChooserUIBridge.java
  8. 4
      core/src/main/java/com/github/weisj/darklaf/ui/filechooser/DarkFilePane.java
  9. 2
      core/src/main/java/com/github/weisj/darklaf/ui/spinner/DarkSpinnerListener.java
  10. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkScrollableTabSupport.java
  11. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkTabbedPaneHandler.java
  12. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkTabbedPaneLayout.java
  13. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkTabbedPaneScrollLayout.java
  14. 4
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkTabbedPaneUIBridge.java
  15. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/TabbedPaneHandler.java
  16. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/TabbedPaneLayout.java
  17. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/TabbedPaneUtil.java
  18. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tabframe/DarkTabFrameTabContainerUI.java
  19. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tabframe/DarkTabFrameTabLabelUI.java
  20. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tabframe/DarkTabFrameUI.java
  21. 2
      core/src/main/java/com/github/weisj/darklaf/ui/text/DarkCaret.java

2
core/src/main/java/com/github/weisj/darklaf/components/DefaultButton.java

@ -43,7 +43,7 @@ public class DefaultButton extends JButton {
@Override
public void addNotify() {
super.addNotify();
if (requestFocusOnDisplay) requestFocus();
if (requestFocusOnDisplay) requestFocusInWindow();
SwingUtilities.getRootPane(this).setDefaultButton(this);
}
}

2
core/src/main/java/com/github/weisj/darklaf/components/tabframe/JTabFrame.java

@ -556,7 +556,7 @@ public class JTabFrame extends JComponent {
setPopupVisibility(compAtIndex, enabled);
if (enabled) {
getPopupComponentAt(a).doLayout();
getPopupComponentAt(a).requestFocus();
getPopupComponentAt(a).requestFocusInWindow();
}
firePropertyChange(TabFramePopup.KEY_VISIBLE_TAB, new TabFramePosition(a, oldIndex),
new TabFramePosition(a, index));

2
core/src/main/java/com/github/weisj/darklaf/components/tabframe/PanelPopup.java

@ -193,7 +193,7 @@ public class PanelPopup extends JPanel implements TabFramePopup {
parent.openTab(getAlignment(), getIndex());
open = true;
firePropertyChange(KEY_OPEN, oldOpen, true);
requestFocus();
requestFocusInWindow();
}
}

2
core/src/main/java/com/github/weisj/darklaf/settings/ThemeSettings.java

@ -130,7 +130,7 @@ public class ThemeSettings implements ThemePreferenceListener {
throw new IllegalStateException("Can't show dialog while settings panel is used elsewhere");
}
if (dialog != null && dialog.isVisible()) {
dialog.requestFocus();
dialog.requestFocusInWindow();
return;
}
refresh();

2
core/src/main/java/com/github/weisj/darklaf/ui/colorchooser/DarkColorChooserPanel.java

@ -106,7 +106,7 @@ public class DarkColorChooserPanel extends AbstractColorChooserPanel implements
textHex.addAncestorListener(new AncestorAdapter() {
@Override
public void ancestorAdded(final AncestorEvent event) {
textHex.requestFocus();
textHex.requestFocusInWindow();
textHex.removeAncestorListener(this);
}
});

2
core/src/main/java/com/github/weisj/darklaf/ui/combobox/DarkComboBoxListener.java

@ -43,7 +43,7 @@ public class DarkComboBoxListener extends MouseAdapter implements PropertyChange
@Override
public void mousePressed(final MouseEvent e) {
comboBox.getEditor().getEditorComponent().requestFocus();
comboBox.getEditor().getEditorComponent().requestFocusInWindow();
}
@Override

2
core/src/main/java/com/github/weisj/darklaf/ui/filechooser/DarkFileChooserUIBridge.java

@ -264,7 +264,7 @@ public abstract class DarkFileChooserUIBridge extends BasicFileChooserUI {
if (e.getOldValue() == null && e.getNewValue() != null) {
// Ancestor was added, set initial focus
fileNameTextField.selectAll();
fileNameTextField.requestFocus();
fileNameTextField.requestFocusInWindow();
}
break;
}

4
core/src/main/java/com/github/weisj/darklaf/ui/filechooser/DarkFilePane.java

@ -317,7 +317,7 @@ public class DarkFilePane extends DarkFilePaneUIBridge {
editCell.setBounds(r.x, r.y, r.width - editX - gap, r.height);
}
list.putClientProperty("JList.isEditing", true);
editCell.requestFocus();
editCell.requestFocusInWindow();
editCell.selectAll();
break;
@ -511,7 +511,7 @@ public class DarkFilePane extends DarkFilePaneUIBridge {
@Override
public void ancestorAdded(final AncestorEvent event) {
SwingUtilities.invokeLater(() -> {
editorComponent.requestFocus();
editorComponent.requestFocusInWindow();
((JTextComponent) editorComponent).selectAll();
});
}

2
core/src/main/java/com/github/weisj/darklaf/ui/spinner/DarkSpinnerListener.java

@ -50,7 +50,7 @@ public class DarkSpinnerListener extends MouseAdapter implements PropertyChangeL
@Override
public void mousePressed(final MouseEvent e) {
super.mousePressed(e);
spinner.getEditor().requestFocus();
spinner.getEditor().requestFocusInWindow();
}
@Override

2
core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkScrollableTabSupport.java

@ -235,7 +235,7 @@ public class DarkScrollableTabSupport extends ScrollableTabSupport implements Mo
// and invocation of action.
ui.tabPane.setSelectedComponent(comp);
ui.tabPane.doLayout();
comp.requestFocus();
comp.requestFocusInWindow();
}
}
});

2
core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkTabbedPaneHandler.java

@ -169,7 +169,7 @@ public class DarkTabbedPaneHandler extends TabbedPaneHandler {
@Override
public void mousePressed(final MouseEvent e) {
super.mousePressed(e);
ui.tabPane.requestFocus();
ui.tabPane.requestFocusInWindow();
origin = e.getPoint();
pressedIndex = ui.tabForCoordinate(ui.tabPane, e.getX(), e.getY());
}

2
core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkTabbedPaneLayout.java

@ -193,7 +193,7 @@ public class DarkTabbedPaneLayout extends TabbedPaneLayout {
layoutTabComponents();
if (shouldChangeFocus) {
if (!ui.requestFocusForVisibleComponent()) {
ui.tabPane.requestFocus();
ui.tabPane.requestFocusInWindow();
}
}
}

2
core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkTabbedPaneScrollLayout.java

@ -213,7 +213,7 @@ public class DarkTabbedPaneScrollLayout extends TabbedPaneScrollLayout {
layoutTabComponents();
if (shouldChangeFocus) {
if (!ui.requestFocusForVisibleComponent()) {
ui.tabPane.requestFocus();
ui.tabPane.requestFocusInWindow();
}
}
}

4
core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkTabbedPaneUIBridge.java

@ -2209,7 +2209,7 @@ public abstract class DarkTabbedPaneUIBridge extends TabbedPaneUI implements Swi
public void actionPerformed(final ActionEvent e) {
String key = getName();
JTabbedPane pane = (JTabbedPane) e.getSource();
DarkTabbedPaneUIBridge ui = (DarkTabbedPaneUIBridge) DarkUIUtil
DarkTabbedPaneUIBridge ui = DarkUIUtil
.getUIOfType(pane.getUI(),
DarkTabbedPaneUIBridge.class);
@ -2243,7 +2243,7 @@ public abstract class DarkTabbedPaneUIBridge extends TabbedPaneUI implements Swi
ui.navigateSelectedTab(SwingConstants.SOUTH);
}
} else if (Objects.equals(key, REQUEST_FOCUS)) {
pane.requestFocus();
pane.requestFocusInWindow();
} else if (Objects.equals(key, REQUEST_FOCUS_FOR_VISIBLE)) {
ui.requestFocusForVisibleComponent();
} else if (Objects.equals(key, SET_SELECTED)) {

2
core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/TabbedPaneHandler.java

@ -171,7 +171,7 @@ public class TabbedPaneHandler implements ChangeListener, ContainerListener, Foc
} else if (ui.tabPane.isRequestFocusEnabled()) {
// Clicking on selected tab, try and give the tabbedpane
// focus. Repaint will occur in focusGained.
ui.tabPane.requestFocus();
ui.tabPane.requestFocusInWindow();
}
}
}

2
core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/TabbedPaneLayout.java

@ -172,7 +172,7 @@ public abstract class TabbedPaneLayout implements LayoutManager {
layoutTabComponents();
if (shouldChangeFocus) {
if (!ui.requestFocusForVisibleComponent()) {
ui.tabPane.requestFocus();
ui.tabPane.requestFocusInWindow();
}
}
}

2
core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/TabbedPaneUtil.java

@ -290,7 +290,7 @@ public class TabbedPaneUtil implements SwingConstants {
protected static void selectTab(final JTabbedPane tabbedPane, final int index) {
SwingUtilities.invokeLater(() -> {
tabbedPane.setSelectedIndex(index);
tabbedPane.requestFocus();
tabbedPane.requestFocusInWindow();
});
}
}

2
core/src/main/java/com/github/weisj/darklaf/ui/tabframe/DarkTabFrameTabContainerUI.java

@ -114,7 +114,7 @@ public class DarkTabFrameTabContainerUI extends DarkPanelUI implements PropertyC
} else {
Component popup = tabFrame.getPopupComponentAt(a, index);
if (!DarkUIUtil.hasFocus(popup)) {
popup.requestFocus();
popup.requestFocusInWindow();
} else {
tabFrame.toggleTab(a, index, false);
}

2
core/src/main/java/com/github/weisj/darklaf/ui/tabframe/DarkTabFrameTabLabelUI.java

@ -197,7 +197,7 @@ public class DarkTabFrameTabLabelUI extends DarkLabelUI implements PropertyChang
} else {
Component popup = tabFrame.getPopupComponentAt(a, index);
if (!DarkUIUtil.hasFocus(popup)) {
popup.requestFocus();
popup.requestFocusInWindow();
} else {
tabFrame.toggleTab(a, index, false);
}

2
core/src/main/java/com/github/weisj/darklaf/ui/tabframe/DarkTabFrameUI.java

@ -552,7 +552,7 @@ public class DarkTabFrameUI extends TabFrameUI implements AWTEventListener {
MouseEvent e = (MouseEvent) event;
Component comp = e.getComponent().getComponentAt(e.getPoint());
if (comp instanceof TabFramePopup || comp instanceof PopupContainer || comp instanceof JTabFrame) {
comp.requestFocus();
comp.requestFocusInWindow();
}
}
}

2
core/src/main/java/com/github/weisj/darklaf/ui/text/DarkCaret.java

@ -302,7 +302,7 @@ public class DarkCaret extends DefaultCaret implements UIResource {
if (inWindow) {
textArea.requestFocusInWindow();
} else {
textArea.requestFocus();
textArea.requestFocusInWindow();
}
}
}

Loading…
Cancel
Save