Changeset 29574 in osm for applications/editors/josm/plugins/geochat/src
- Timestamp:
- 2013-05-09T22:04:25+02:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/geochat/src/geochat/ChatPaneManager.java
r29571 r29574 72 72 } 73 73 74 p ublic void addLineToChatPane( String userName, String line) {74 private void addLineToChatPane( String userName, String line, boolean italic ) { 75 75 if( line.length() == 0 ) 76 76 return; … … 81 81 Document doc = chatPanes.get(userName).pane.getDocument(); 82 82 try { 83 doc.insertString(doc.getLength(), line, null); 84 } catch( BadLocationException ex ) { 85 // whatever 86 } 87 } 88 89 public void addLineToPublic( String line ) { 90 addLineToChatPane(PUBLIC_PANE, line); 91 } 92 93 /** 94 * Special case: the line contains username, so it must be highlighted. 95 */ 96 public void addLineToPublicEm( String line ) { 97 if( !line.startsWith("\n") ) 98 line = "\n" + line; 99 Document doc = chatPanes.get(PUBLIC_PANE).pane.getDocument(); 100 try { 101 SimpleAttributeSet attrs = new SimpleAttributeSet(); 102 StyleConstants.setItalic(attrs, true); 83 SimpleAttributeSet attrs = null; 84 if( italic ) { 85 attrs = new SimpleAttributeSet(); 86 StyleConstants.setItalic(attrs, true); 87 } 103 88 doc.insertString(doc.getLength(), line, attrs); 104 89 } catch( BadLocationException ex ) { 105 90 // whatever 106 91 } 92 chatPanes.get(userName).pane.setCaretPosition(doc.getLength()); 93 } 94 95 public void addLineToChatPane( String userName, String line ) { 96 addLineToChatPane(userName, line, false); 97 } 98 99 public void addLineToPublic( String line ) { 100 addLineToChatPane(PUBLIC_PANE, line); 107 101 } 108 102 … … 140 134 Font font = chatPane.getFont(); 141 135 chatPane.setFont(font.deriveFont(font.getSize2D() - 2)); 142 DefaultCaret caret = (DefaultCaret)chatPane.getCaret(); 143 caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);136 // DefaultCaret caret = (DefaultCaret)chatPane.getCaret(); // does not work 137 // caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE); 144 138 JScrollPane scrollPane = new JScrollPane(chatPane, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); 145 139 chatPane.addMouseListener(new GeoChatPopupAdapter(panel));
Note:
See TracChangeset
for help on using the changeset viewer.