Places the selected text into the clipboard. If no selection is made, the whole line with caret will be selectd.
()
| 1748 | * If no selection is made, the whole line with caret will be selectd. |
| 1749 | */ |
| 1750 | public void copy() { |
| 1751 | if (selectionStart == selectionEnd) { |
| 1752 | selectLine(getCaretLine()); |
| 1753 | } |
| 1754 | Clipboard clipboard = getToolkit().getSystemClipboard(); |
| 1755 | String selection = getSelectedText(); |
| 1756 | if (selection != null) { |
| 1757 | int repeatCount = inputHandler.getRepeatCount(); |
| 1758 | StringBuilder sb = new StringBuilder(); |
| 1759 | for(int i = 0; i < repeatCount; i++) { |
| 1760 | sb.append(selection); |
| 1761 | } |
| 1762 | clipboard.setContents(new StringSelection(sb.toString()), null); |
| 1763 | } |
| 1764 | } |
| 1765 | |
| 1766 | |
| 1767 | /** |
no test coverage detected