Changeset 3238 in josm for trunk/src/org
- Timestamp:
- 2010-05-13T09:19:55+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/help/HelpBrowser.java
r3083 r3238 14 14 import java.awt.event.WindowEvent; 15 15 import java.io.BufferedReader; 16 import java.io.IOException;17 16 import java.io.InputStreamReader; 17 import java.io.StringReader; 18 18 import java.util.Locale; 19 19 import java.util.Observable; … … 28 28 import javax.swing.JOptionPane; 29 29 import javax.swing.JPanel; 30 import javax.swing.JScrollBar;31 30 import javax.swing.JScrollPane; 32 31 import javax.swing.JSeparator; … … 102 101 /** the help browser */ 103 102 private JEditorPane help; 104 private JScrollPane spHelp;105 103 106 104 /** the help browser history */ … … 166 164 setContentPane(p); 167 165 168 p.add( spHelp =new JScrollPane(help), BorderLayout.CENTER);166 p.add(new JScrollPane(help), BorderLayout.CENTER); 169 167 170 168 addWindowListener(new WindowAdapter(){ … … 205 203 reader = new HelpContentReader(HelpUtil.getWikiBaseUrl()); 206 204 build(); 205 } 206 207 protected void loadTopic(String content) { 208 Document document = help.getEditorKit().createDefaultDocument(); 209 try { 210 help.getEditorKit().read(new StringReader(content), document, 0); 211 } catch (Exception e) { 212 e.printStackTrace(); 213 } 214 help.setDocument(document); 207 215 } 208 216 … … 235 243 getHelpTopicEditUrl(buildAbsoluteHelpTopic(relativeHelpTopic, Locale.ENGLISH)) 236 244 ); 237 help.setText(message);245 loadTopic(message); 238 246 } 239 247 … … 253 261 e.toString() 254 262 ); 255 help.setText(message); 256 } 257 258 protected void scrollToTop() { 259 JScrollBar sb = spHelp.getVerticalScrollBar(); 260 sb.setValue(sb.getMinimum()); 263 loadTopic(message); 261 264 } 262 265 … … 293 296 return; 294 297 } 295 help.setText(content);298 loadTopic(content); 296 299 history.setCurrentUrl(url); 297 300 this.url = url; 298 scrollToTop();299 301 } 300 302 … … 319 321 return; 320 322 } 321 help.setText(content);323 loadTopic(content); 322 324 history.setCurrentUrl(url); 323 325 this.url = url; 324 scrollToTop();325 326 } 326 327 … … 345 346 this.url = url; 346 347 String content = reader.fetchHelpTopicContent(url, false); 347 help.setText(content);348 loadTopic(content); 348 349 history.setCurrentUrl(url); 349 350 this.url = url; 350 scrollToTop();351 351 } catch(Exception e) { 352 352 HelpAwareOptionPane.showOptionDialog(
Note:
See TracChangeset
for help on using the changeset viewer.