textField.setText(pane.getSelectedText());
public String getSelectedData() { return jwtArea.getSelectedText(); }
/** * Asserts that the text area's selection is at the expected location and * has the expected value. * * @param expected * @param offs * @param matchCase */ private void assertSelected(String expected, int offs, boolean matchCase) { String actual = textArea.getSelectedText(); if (matchCase) { assertEquals(expected, actual); } else { assertEqualsIgnoreCase(expected, actual); } int selOffs = textArea.getSelectionStart(); assertEquals("unexpected selection offset: ", offs, selOffs); }
private boolean temTextSelecionado() { return textArea.getSelectedText() != null && !textArea.getSelectedText().isEmpty(); }
@Override public byte[] getSelectedData() { try { return (textArea.getSelectedText()).getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { } return null; }
@Override public boolean isCopyAllowed() { final String selected = this.editor.getSelectedText(); return selected != null && !selected.isEmpty(); }
@Override public boolean isCopyAllowed() { final String selected = this.editor.getSelectedText(); return selected != null && !selected.isEmpty(); }
@Override public boolean isCutAllowed() { final String selected = this.editor.getSelectedText(); return selected != null && !selected.isEmpty(); }
@Override public boolean isCutAllowed() { final String selected = this.editor.getSelectedText(); return selected != null && !selected.isEmpty(); }
@Override public boolean doCopy() { boolean result = false; final String selected = this.editor.getSelectedText(); if (selected != null && !selected.isEmpty()) { final Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(new StringSelection(selected), null); } return result; }
@Override public boolean doCopy() { boolean result = false; final String selected = this.editor.getSelectedText(); if (selected != null && !selected.isEmpty()) { final Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(new StringSelection(selected), null); } return result; }
@Override public boolean doCut() { boolean result = false; final String selected = this.editor.getSelectedText(); if (selected != null && !selected.isEmpty()) { final Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(new StringSelection(selected), null); this.editor.replaceSelection(""); //NOI18N } return result; }
@Override public boolean doCut() { boolean result = false; final String selected = this.editor.getSelectedText(); if (selected != null && !selected.isEmpty()) { final Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(new StringSelection(selected), null); this.editor.replaceSelection(""); //NOI18N } return result; }
public void exibir(RSyntaxTextArea textArea) { rSyntaxTextArea = textArea; procurarTextField.setText(textArea.getSelectedText()); substituirTextField.setText(textArea.getSelectedText()); SwingUtilities.invokeLater(() -> { if(!procurarTextField.getText().isEmpty()) { substituirTextField.requestFocus(); substituirTextField.selectAll(); }else{ procurarTextField.requestFocus(); } }); dialogoPai.setVisible(true); }
public String getCurrentSQLStatement() { String sql = scriptPanel.getSelectedText(); lastSQLStatementToReformatEnd = scriptPanel.getSelectionEnd(); lastSQLStatementToReformatStart = scriptPanel.getSelectionStart(); if (sql == null || sql.trim().length() == 0) { sql = getText(); lastSQLStatementToReformatEnd = -2; // int[] bounds = getBoundsOfCurrentSQLStatement(); // // if (bounds[0] >= bounds[1]) { // sql = ""; // } else { // sql = sql.substring(bounds[0], bounds[1]).trim(); // } } return sql != null ? sql : ""; }
/** * Block comment or uncomment the selected text in the given script panel. * * @param scriptPanel Script panel */ public static void blockCommentOrUncomment(RSyntaxTextArea scriptPanel) { if (scriptPanel.getSelectedText() != null) { if (alreadyBlockCommented(scriptPanel)) { blockUncomment(scriptPanel); } else { blockComment(scriptPanel); } } }
/** * Block comment the selected text in the given script panel. * * @param scriptPanel Script panel */ private static void blockComment(RSyntaxTextArea scriptPanel) { // Recover the index of the start of the selection. final int startOffset = scriptPanel.getSelectionStart(); // Comment the selection. final String commentedSelection = BLOCK_COMMENT_START + scriptPanel.getSelectedText() + BLOCK_COMMENT_END; scriptPanel.replaceSelection(commentedSelection); // Select the commented selection. scriptPanel.setSelectionStart(startOffset); scriptPanel.setSelectionEnd(startOffset + commentedSelection.length()); }
public void commentOutText() { String highlightedTextArea = rSyntaxTextArea.getSelectedText();
private String findStartSymbol() { int carretCoordinates; while (true) { carretCoordinates = rSyntaxTextArea.getSelectionStart(); if (rSyntaxTextArea.getSelectedText().startsWith("\n") || rSyntaxTextArea.getSelectionStart() == 0) { if (rSyntaxTextArea.getSelectionStart() != 0) { rSyntaxTextArea.select(carretCoordinates + 1, rSyntaxTextArea.getSelectionEnd()); } else { rSyntaxTextArea.select(carretCoordinates, rSyntaxTextArea.getSelectionEnd()); } return rSyntaxTextArea.getSelectedText(); } else { carretCoordinates--; rSyntaxTextArea.select(carretCoordinates, rSyntaxTextArea.getSelectionEnd()); } } }
if (textArea.getSelectedText() != null)