use of javax.swing.text.Document in project beast-mcmc by beast-dev.
the class RealNumberField method createDefaultModel.
protected Document createDefaultModel() {
Document doc = new RealNumberField.RealNumberFieldDocument();
doc.addDocumentListener(this);
return doc;
}
use of javax.swing.text.Document in project beast-mcmc by beast-dev.
the class WholeNumberField method createDefaultModel.
protected Document createDefaultModel() {
Document doc = new WholeNumberFieldDocument();
doc.addDocumentListener(this);
return doc;
}
use of javax.swing.text.Document in project enclojure by EricThorsen.
the class ClojureTemplatePanelVisual method updateTexts.
/**
* Handles changes in the Project name and project directory,
*/
private void updateTexts(DocumentEvent e) {
Document doc = e.getDocument();
if (doc == projectNameTextField.getDocument() || doc == projectLocationTextField.getDocument()) {
try {
// Change in the project name
String projectName = projectNameTextField.getText();
String projectFolder = projectLocationTextField.getText();
File tf = new File(projectFolder);
String cp = tf.getCanonicalPath();
if (cp.endsWith(File.separator))
cp += projectName;
cp += File.separatorChar + projectName;
createdFolderTextField.setText(cp);
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
}
// Notify that the panel changed
panel.fireChangeEvent();
}
use of javax.swing.text.Document in project enclojure by EricThorsen.
the class ReplPanel method resultReceived.
public void resultReceived(JEditorPane pane, String result) {
Document doc = (Document) pane.getDocument();
try {
if (pane != _replEditorPane)
result = "\n" + result;
doc.insertString(doc.getLength(), result, null);
pane.setCaretPosition(doc.getLength());
} catch (BadLocationException ex) {
Logger.getLogger(ReplPanel.class.getName()).log(Level.SEVERE, null, ex);
}
if (pane == jEditorPaneOut && result.contains("Listening for transport dt_socket at address")) {
// Listening for transport dt_socket at address: 58896
String portString = result.substring(result.indexOf(":") + 1);
_debugPort = Integer.parseInt(portString.trim());
}
if (pane == _replEditorPane) {
_promptPos = _replEditorPane.getDocument().getLength();
jTabbedPane1.setSelectedIndex(0);
_undoManager.die();
}
}
use of javax.swing.text.Document in project n2a by frothga.
the class SafeTextTransferHandler method exportToClipboard.
public void exportToClipboard(JComponent comp, Clipboard clipboard, int action) throws IllegalStateException {
JTextComponent text = (JTextComponent) comp;
int p0 = text.getSelectionStart();
int p1 = text.getSelectionEnd();
if (p0 != p1) {
try {
Document doc = text.getDocument();
String srcData = doc.getText(p0, p1 - p0);
StringSelection contents = new StringSelection(srcData);
clipboard.setContents(contents, null);
if (action == TransferHandler.MOVE)
doc.remove(p0, p1 - p0);
} catch (BadLocationException ble) {
}
}
}
Aggregations