@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { if (!textArea.isEditable() || !textArea.isEnabled()) { UIManager.getLookAndFeel().provideErrorFeedback(textArea); return; } int selStart = textArea.getSelectionStart(); int selEnd = textArea.getSelectionEnd(); try { int line1 = textArea.getLineOfOffset(selStart); int startOffs = textArea.getLineStartOffset(line1); int line2 = textArea.getLineOfOffset(selEnd); int endOffs = textArea.getLineEndOffset(line2); // Don't remove the last line if no actual chars are selected if (line2>line1) { if (selEnd==textArea.getLineStartOffset(line2)) { endOffs = selEnd; } } textArea.replaceRange(null, startOffs, endOffs); } catch (BadLocationException ble) { ble.printStackTrace(); // Never happens } }
while (found) { int start = getSelectionStart(); int end = getSelectionEnd(); try { markAllHighlights.add(h.addHighlight(start, end,
while (found) { int start = getSelectionStart(); int end = getSelectionEnd(); try { markAllHighlights.add(h.addHighlight(start, end,
public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { if (!textArea.isEditable() || !textArea.isEnabled()) { UIManager.getLookAndFeel().provideErrorFeedback(textArea); return; } int selStart = textArea.getSelectionStart(); int selEnd = textArea.getSelectionEnd(); try { int line1 = textArea.getLineOfOffset(selStart); int startOffs = textArea.getLineStartOffset(line1); int line2 = textArea.getLineOfOffset(selEnd); int endOffs = textArea.getLineEndOffset(line2); // Don't remove the last line if no actual chars are selected if (line2>line1) { if (selEnd==textArea.getLineStartOffset(line2)) { endOffs = selEnd; } } textArea.replaceRange(null, startOffs, endOffs); } catch (BadLocationException ble) { ble.printStackTrace(); // Never happens } }
public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { if (!textArea.isEditable() || !textArea.isEnabled()) { UIManager.getLookAndFeel().provideErrorFeedback(textArea); return; } int selStart = textArea.getSelectionStart(); int selEnd = textArea.getSelectionEnd(); try { int line1 = textArea.getLineOfOffset(selStart); int startOffs = textArea.getLineStartOffset(line1); int line2 = textArea.getLineOfOffset(selEnd); int endOffs = textArea.getLineEndOffset(line2); // Don't remove the last line if no actual chars are selected if (line2>line1) { if (selEnd==textArea.getLineStartOffset(line2)) { endOffs = selEnd; } } textArea.replaceRange(null, startOffs, endOffs); } catch (BadLocationException ble) { ble.printStackTrace(); // Never happens } }
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { if (!textArea.isEditable() || !textArea.isEnabled()) { UIManager.getLookAndFeel().provideErrorFeedback(textArea); return; } int selStart = textArea.getSelectionStart(); int selEnd = textArea.getSelectionEnd(); try { int line1 = textArea.getLineOfOffset(selStart); int startOffs = textArea.getLineStartOffset(line1); int line2 = textArea.getLineOfOffset(selEnd); int endOffs = textArea.getLineEndOffset(line2); // Don't remove the last line if no actual chars are selected if (line2>line1) { if (selEnd==textArea.getLineStartOffset(line2)) { endOffs = selEnd; } } textArea.replaceRange(null, startOffs, endOffs); } catch (BadLocationException ble) { ble.printStackTrace(); // Never happens } }