source: josm/trunk/src/org/openstreetmap/josm/tools/bugreport/DebugTextDisplay.java@ 10404

Last change on this file since 10404 was 10306, checked in by Don-vip, 8 years ago

sonar - pmd:ImmutableField + remove unused code

  • Property svn:eol-style set to native
File size: 1.1 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.tools.bugreport;
3
4import java.awt.Dimension;
5
6import javax.swing.JScrollPane;
7
8import org.openstreetmap.josm.gui.widgets.JosmTextArea;
9import org.openstreetmap.josm.tools.Utils;
10
11/**
12 * This is a text area that displays the debug text with scroll bars.
13 * @author Michael Zangl
14 * @since 10055
15 */
16public class DebugTextDisplay extends JScrollPane {
17 private final String text;
18
19 /**
20 * Creates a new text are with the fixed text
21 * @param textToDisplay The text to display.
22 */
23 public DebugTextDisplay(String textToDisplay) {
24 text = "{{{\n" + Utils.strip(textToDisplay) + "\n}}}";
25 JosmTextArea textArea = new JosmTextArea(text);
26 textArea.setCaretPosition(0);
27 textArea.setEditable(false);
28 setViewportView(textArea);
29 setPreferredSize(new Dimension(600, 300));
30 }
31
32 /**
33 * Copies the debug text to the clippboard.
34 * @return <code>true</code> if copy was successful
35 */
36 public boolean copyToClippboard() {
37 return Utils.copyToClipboard(text);
38 }
39}
Note: See TracBrowser for help on using the repository browser.