private void doDefaultInsert(RTextArea textArea) { // FIXME: We need a way to get the "trigger string" (i.e., // the text that was just typed); however, the text area's // template manager might be null (if templates are disabled). // Also, the manager's trigger string doesn't yet match up with // that defined in RSyntaxTextAreaEditorKit.java (which is // hardcoded as a space)... //String str = manager.getInsertTriggerString(); //int mod = manager.getInsertTrigger().getModifiers(); //if (str!=null && str.length()>0 && // ((mod&ActionEvent.ALT_MASK)==(mod&ActionEvent.CTRL_MASK))) { // char ch = str.charAt(0); // if (ch>=0x20 && ch!=0x7F) // textArea.replaceSelection(str); //} textArea.replaceSelection(" "); }
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { if (!textArea.isEditable() || !textArea.isEnabled()) { UIManager.getLookAndFeel().provideErrorFeedback(textArea); return; } Date today = new Date(); DateFormat timeDateStamp = DateFormat.getDateTimeInstance(); String dateString = timeDateStamp.format(today); textArea.replaceSelection(dateString); }
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { if (!textArea.isEditable() || !textArea.isEnabled()) { UIManager.getLookAndFeel().provideErrorFeedback(textArea); return; } String content = e.getActionCommand(); if (content != null) { textArea.replaceSelection(content); } else { UIManager.getLookAndFeel().provideErrorFeedback(textArea); } }
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { if (!textArea.isEditable() || !textArea.isEnabled()) { UIManager.getLookAndFeel().provideErrorFeedback(textArea); return; } textArea.replaceSelection("\n"); }
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { if (!textArea.isEditable() || !textArea.isEnabled()) { UIManager.getLookAndFeel().provideErrorFeedback(textArea); return; } textArea.replaceSelection("\t"); }
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { if (!textArea.isEditable() || !textArea.isEnabled()) { UIManager.getLookAndFeel().provideErrorFeedback(textArea); return; } String selection = textArea.getSelectedText(); if (selection!=null) { StringBuilder buffer = new StringBuilder(selection); int length = buffer.length(); for (int i=0; i<length; i++) { char c = buffer.charAt(i); if (Character.isUpperCase(c)) { buffer.setCharAt(i, Character.toLowerCase(c)); } else if (Character.isLowerCase(c)) { buffer.setCharAt(i, Character.toUpperCase(c)); } } textArea.replaceSelection(buffer.toString()); } textArea.requestFocusInWindow(); }
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { if (!textArea.isEditable() || !textArea.isEnabled()) { UIManager.getLookAndFeel().provideErrorFeedback(textArea); return; } String selection = textArea.getSelectedText(); if (selection!=null) { textArea.replaceSelection(selection.toLowerCase()); } textArea.requestFocusInWindow(); }
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { if (!textArea.isEditable() || !textArea.isEnabled()) { UIManager.getLookAndFeel().provideErrorFeedback(textArea); return; } String selection = textArea.getSelectedText(); if (selection!=null) { textArea.replaceSelection(selection.toUpperCase()); } textArea.requestFocusInWindow(); }
/** * Inserts the selected item into the editor and disposes of this popup. */ private void insertSelectedItem() { Object lvp = list.getSelectedValue(); if (lvp!=null) { listener.uninstallAndHide(); String text = ((LabelValuePair)lvp).value; textArea.replaceSelection(text); ClipboardHistory.get().add(text); // Move this item to the top } }
textArea.replaceSelection("\t");
@Test public void testDiscardAllEdits() { RTextArea textArea = new RTextArea(); textArea.replaceSelection("Hi"); Assert.assertTrue(textArea.canUndo()); textArea.discardAllEdits(); Assert.assertFalse(textArea.canUndo()); }
@Test public void testCanUndo() { RTextArea textArea = new RTextArea(); Assert.assertFalse(textArea.canUndo()); textArea.replaceSelection("Hi"); Assert.assertTrue(textArea.canUndo()); textArea.undoLastAction(); Assert.assertFalse(textArea.canUndo()); }
textArea.replaceSelection("}");
@Test public void testCanRedo() { RTextArea textArea = new RTextArea(); Assert.assertFalse(textArea.canRedo()); textArea.replaceSelection("Hi"); Assert.assertFalse(textArea.canRedo()); textArea.undoLastAction(); Assert.assertTrue(textArea.canRedo()); textArea.redoLastAction(); Assert.assertFalse(textArea.canRedo()); }
public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { if (!textArea.isEditable() || !textArea.isEnabled()) { UIManager.getLookAndFeel().provideErrorFeedback(textArea); return; } Date today = new Date(); DateFormat timeDateStamp = DateFormat.getDateTimeInstance(); String dateString = timeDateStamp.format(today); textArea.replaceSelection(dateString); }
textArea.replaceSelection(replacement);
textArea.setSelectionEnd(matchEnd); String replacement = info.getReplacement(); textArea.replaceSelection(replacement);
public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { if (!textArea.isEditable() || !textArea.isEnabled()) { UIManager.getLookAndFeel().provideErrorFeedback(textArea); return; } textArea.replaceSelection("\t"); }
public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { if (!textArea.isEditable() || !textArea.isEnabled()) { UIManager.getLookAndFeel().provideErrorFeedback(textArea); return; } String selection = textArea.getSelectedText(); if (selection!=null) textArea.replaceSelection(selection.toLowerCase()); textArea.requestFocusInWindow(); }
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { if (!textArea.isEditable() || !textArea.isEnabled()) { UIManager.getLookAndFeel().provideErrorFeedback(textArea); return; } String selection = textArea.getSelectedText(); if (selection!=null) { textArea.replaceSelection(selection.toLowerCase()); } textArea.requestFocusInWindow(); }