58 * Creates a UI for a JTextArea.
59 *
60 * @param ta a text area
61 * @return the UI
62 */
63 public static ComponentUI createUI(JComponent ta) {
64 return new SynthTextAreaUI();
65 }
66
67 public void focusGained(FocusEvent e) {
68 getComponent().repaint();
69 }
70
71 public void focusLost(FocusEvent e) {
72 getComponent().repaint();
73 }
74
75 protected void installDefaults() {
76 // Installs the text cursor on the component
77 super.installDefaults();
78 updateStyle((JTextComponent)getComponent());
79 getComponent().addFocusListener(this);
80 }
81
82 protected void uninstallDefaults() {
83 SynthContext context = getContext(getComponent(), ENABLED);
84
85 getComponent().putClientProperty("caretAspectRatio", null);
86 getComponent().removeFocusListener(this);
87
88 style.uninstallDefaults(context);
89 context.dispose();
90 style = null;
91 super.uninstallDefaults();
92 }
93
94 public void installUI(JComponent c) {
95 super.installUI(c);
96 }
97
98 private void updateStyle(JTextComponent comp) {
|
58 * Creates a UI for a JTextArea.
59 *
60 * @param ta a text area
61 * @return the UI
62 */
63 public static ComponentUI createUI(JComponent ta) {
64 return new SynthTextAreaUI();
65 }
66
67 public void focusGained(FocusEvent e) {
68 getComponent().repaint();
69 }
70
71 public void focusLost(FocusEvent e) {
72 getComponent().repaint();
73 }
74
75 protected void installDefaults() {
76 // Installs the text cursor on the component
77 super.installDefaults();
78 updateStyle(getComponent());
79 getComponent().addFocusListener(this);
80 }
81
82 protected void uninstallDefaults() {
83 SynthContext context = getContext(getComponent(), ENABLED);
84
85 getComponent().putClientProperty("caretAspectRatio", null);
86 getComponent().removeFocusListener(this);
87
88 style.uninstallDefaults(context);
89 context.dispose();
90 style = null;
91 super.uninstallDefaults();
92 }
93
94 public void installUI(JComponent c) {
95 super.installUI(c);
96 }
97
98 private void updateStyle(JTextComponent comp) {
|