01: package com.pagosoft.plaf;
02:
03: import javax.swing.*;
04: import java.awt.event.FocusEvent;
05: import java.awt.event.FocusListener;
06:
07: public class TextComponentFocusListener implements FocusListener {
08: private static TextComponentFocusListener instance;
09:
10: public static TextComponentFocusListener getInstance() {
11: if (instance == null) {
12: instance = new TextComponentFocusListener();
13: }
14: return instance;
15: }
16:
17: private TextComponentFocusListener() {
18: }
19:
20: public void focusGained(FocusEvent e) {
21: Object source = e.getSource();
22: if (source instanceof JComponent) {
23: ((JComponent) source).repaint();
24: }
25: }
26:
27: public void focusLost(FocusEvent e) {
28: Object source = e.getSource();
29: if (source instanceof JComponent) {
30: ((JComponent) source).repaint();
31: }
32: }
33: }
|