Przeglądaj źródła

Fixes issue 3327: TopicBar uses the wrong font-colour the first time it is edited if no topic is set

Change-Id: I1c545a3a86714ae50b9a593ef5a462a868002f8f
Reviewed-on: http://gerrit.dmdirc.com/324
Reviewed-by: Chris Smith <chris@dmdirc.com>
Tested-by: Chris Smith <chris@dmdirc.com>
tags/0.6.3
Gregory Holmes 14 lat temu
rodzic
commit
c842f98c99

+ 9
- 5
src/com/dmdirc/addons/ui_swing/components/TopicBar.java Wyświetl plik

200
                 controller.getDomain(), "showfulltopic", this);
200
                 controller.getDomain(), "showfulltopic", this);
201
         IdentityManager.getGlobalConfig().addChangeListener(
201
         IdentityManager.getGlobalConfig().addChangeListener(
202
                 controller.getDomain(), "hideEmptyTopicBar", this);
202
                 controller.getDomain(), "hideEmptyTopicBar", this);
203
-        
203
+
204
         topicText.setFocusable(false);
204
         topicText.setFocusable(false);
205
         topicText.setEditable(false);
205
         topicText.setEditable(false);
206
         topicCancel.setVisible(false);
206
         topicCancel.setVisible(false);
258
                 if (channel.getCurrentTopic() != null) {
258
                 if (channel.getCurrentTopic() != null) {
259
                     topicText.setText(channel.getCurrentTopic().getTopic());
259
                     topicText.setText(channel.getCurrentTopic().getTopic());
260
                 }
260
                 }
261
+                applyAttributes();
261
                 topicText.setCaretPosition(0);
262
                 topicText.setCaretPosition(0);
262
                 topicText.setFocusable(true);
263
                 topicText.setFocusable(true);
263
                 topicText.setEditable(true);
264
                 topicText.setEditable(true);
306
         StyleConstants.setItalic(as, false);
307
         StyleConstants.setItalic(as, false);
307
     }
308
     }
308
 
309
 
310
+    private void applyAttributes() {
311
+        setAttributes();
312
+        ((DefaultStyledDocument) topicText.getDocument()).setCharacterAttributes(
313
+                0, Integer.MAX_VALUE, as, true);
314
+    }
315
+
309
     /**
316
     /**
310
      * Sets the caret position in this topic bar.
317
      * Sets the caret position in this topic bar.
311
      *
318
      *
508
 
515
 
509
                 @Override
516
                 @Override
510
                 public void run() {
517
                 public void run() {
511
-                    setAttributes();
512
-                    ((DefaultStyledDocument) topicText.getDocument()).
513
-                            setCharacterAttributes(0, Integer.MAX_VALUE, as,
514
-                            true);
518
+                    applyAttributes();
515
                 }
519
                 }
516
             });
520
             });
517
         }
521
         }

Ładowanie…
Anuluj
Zapisz