Pārlūkot izejas kodu

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 gadus atpakaļ
vecāks
revīzija
c842f98c99

+ 9
- 5
src/com/dmdirc/addons/ui_swing/components/TopicBar.java Parādīt failu

@@ -200,7 +200,7 @@ public class TopicBar extends JComponent implements ActionListener,
200 200
                 controller.getDomain(), "showfulltopic", this);
201 201
         IdentityManager.getGlobalConfig().addChangeListener(
202 202
                 controller.getDomain(), "hideEmptyTopicBar", this);
203
-        
203
+
204 204
         topicText.setFocusable(false);
205 205
         topicText.setEditable(false);
206 206
         topicCancel.setVisible(false);
@@ -258,6 +258,7 @@ public class TopicBar extends JComponent implements ActionListener,
258 258
                 if (channel.getCurrentTopic() != null) {
259 259
                     topicText.setText(channel.getCurrentTopic().getTopic());
260 260
                 }
261
+                applyAttributes();
261 262
                 topicText.setCaretPosition(0);
262 263
                 topicText.setFocusable(true);
263 264
                 topicText.setEditable(true);
@@ -306,6 +307,12 @@ public class TopicBar extends JComponent implements ActionListener,
306 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 317
      * Sets the caret position in this topic bar.
311 318
      *
@@ -508,10 +515,7 @@ public class TopicBar extends JComponent implements ActionListener,
508 515
 
509 516
                 @Override
510 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
         }

Notiek ielāde…
Atcelt
Saglabāt