(Component focused)
| 3022 | /// |
| 3023 | /// - `focused`: the newly focused component or null for no focus |
| 3024 | public void setFocused(Component focused) { |
| 3025 | if (this.focused == focused && focused != null) { //NOPMD CompareObjectsWithEquals |
| 3026 | this.focused.repaint(); |
| 3027 | return; |
| 3028 | } |
| 3029 | Component oldFocus = this.focused; |
| 3030 | this.focused = focused; |
| 3031 | boolean triggerRevalidate = false; |
| 3032 | if (oldFocus != null) { |
| 3033 | triggerRevalidate = changeFocusState(oldFocus, false); |
| 3034 | //if we need to revalidate no need to repaint the Component, it will |
| 3035 | //be painted from the Form |
| 3036 | if (!triggerRevalidate && oldFocus.getParent() != null) { |
| 3037 | oldFocus.repaint(); |
| 3038 | } |
| 3039 | } |
| 3040 | // a listener might trigger a focus change event essentially |
| 3041 | // invalidating focus so we shouldn't break that |
| 3042 | if (focused != null && this.focused == focused) { //NOPMD CompareObjectsWithEquals |
| 3043 | triggerRevalidate = changeFocusState(focused, true) || triggerRevalidate; |
| 3044 | //if we need to revalidate no need to repaint the Component, it will |
| 3045 | //be painted from the Form |
| 3046 | if (!triggerRevalidate) { |
| 3047 | focused.repaint(); |
| 3048 | } |
| 3049 | } |
| 3050 | if (triggerRevalidate) { |
| 3051 | revalidateLater(); |
| 3052 | } |
| 3053 | } |
| 3054 | |
| 3055 | /// {@inheritDoc} |
| 3056 | @Override |
no test coverage detected