本文整理了Java中javax.swing.JTextArea.setDocument()
方法的一些代码示例,展示了JTextArea.setDocument()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextArea.setDocument()
方法的具体详情如下:
包路径:javax.swing.JTextArea
类名称:JTextArea
方法名:setDocument
暂无
代码示例来源:origin: winder/Universal-G-Code-Sender
private void initComponents() {
consoleTextArea.setEditable(false);
consoleTextArea.setColumns(20);
consoleTextArea.setDocument(new LengthLimitedDocument(CONSOLE_SIZE));
consoleTextArea.setRows(5);
consoleTextArea.setMaximumSize(new java.awt.Dimension(32767, 32767));
consoleTextArea.setMinimumSize(new java.awt.Dimension(0, 0));
scrollPane.setViewportView(consoleTextArea);
commandLabel.setEnabled(backend.isIdle());
scrollWindowMenuItem.addActionListener(e -> checkScrollWindow());
setLayout(new MigLayout("inset 0 0 5 0, fill, wrap 1", "", "[][min!]"));
add(scrollPane, "grow, growy");
add(commandLabel, "gapleft 5, al left, split 2");
add(commandTextField, "gapright 5, r, grow");
menu.add(showVerboseMenuItem);
menu.add(scrollWindowMenuItem);
SwingHelpers.traverse(this, (comp) -> comp.setComponentPopupMenu(menu));
}
代码示例来源:origin: org.apache.jmeter/jorphan
public void setDocumentModel(Document docModel) {
mTextArea.setDocument(docModel);
}
代码示例来源:origin: pentaho/pentaho-reporting
public void setDocument( final Document doc ) {
if ( documentLocked ) {
throw new IllegalStateException();
}
super.setDocument( doc );
}
代码示例来源:origin: winder/Universal-G-Code-Sender
consoleTextArea.setDocument(new LengthLimitedDocument(consoleSize));
consoleTextArea.setRows(5);
consoleTextArea.setMaximumSize(new java.awt.Dimension(32767, 32767));
代码示例来源:origin: stackoverflow.com
JTextArea left = new JTextArea(10, 20);
JTextArea right = new JTextArea(10, 20);
MirrorDocument leftDoc = new MirrorDocument();
MirrorDocument rightDoc = new MirrorDocument();
left.setDocument(leftDoc);
right.setDocument(rightDoc);
leftDoc.addDocumentListener(new DocumentHandler(rightDoc));
rightDoc.addDocumentListener(new DocumentHandler(leftDoc));
代码示例来源:origin: protegeproject/protege
/**
* Replace the existing document with a place-holder.
*/
private void clearText() {
Document newDoc = new PlainDocument();
textArea.setDocument(newDoc);
textArea.setText("Ontology Not Rendered");
}
代码示例来源:origin: edu.stanford.protege/protege-editor-owl
/**
* Replace the existing document with a place-holder.
*/
private void clearText() {
Document newDoc = new PlainDocument();
textArea.setDocument(newDoc);
textArea.setText("Ontology Not Rendered");
}
代码示例来源:origin: stackoverflow.com
JTextArea input = new JTextArea(...);
JTextArea output = new JTextArea(...);
output.setDocument( input.getDocument() );
代码示例来源:origin: stackoverflow.com
JTextArea textArea1 = new JTextArea(...);
JTextArea textArea2 = new JTextArea();
textArea2.setDocument( textArea1.getDocument() );
代码示例来源:origin: stackoverflow.com
JTextArea textArea1 = new JTextArea();
JTextArea textArea2 = new JTextArea();
textArea2.setDocument( textArea1.getDocument() );
代码示例来源:origin: stackoverflow.com
JTextArea textArea = new JTextArea();
TextUndoManager textAreaUndo = new TextUndoManager();
textArea.setDocument(new TextUndoPlainDocument(textAreaUndo));
代码示例来源:origin: org.apache.jmeter/jorphan
/**
* Constructs a new component with the label displaying the passed text.
*
* @param pLabel
* The text to display in the label.
* @param docModel the document for the text area
*/
public JLabeledTextArea(String pLabel, Document docModel) {
super();
mTextArea = new JTextArea();
mLabel = new JLabel(pLabel);
init();
if (docModel != null) {
mTextArea.setDocument(docModel);
}
}
代码示例来源:origin: edu.stanford.protege/protege-editor-owl
@Override
public void close() throws IOException {
logger.trace("close called");
if (thread != null && !thread.isInterrupted()) {
thread = null;
logger.trace("building doc ");
final PlainDocument doc = new CharInsertableDocument(content);
logger.trace("built doc");
try {
SwingUtilities.invokeAndWait(() -> {
jtextArea.setDocument(doc);
logger.trace("set doc");
});
} catch (InterruptedException | InvocationTargetException e) {
throw new IOException(e);
}
}
}
}
代码示例来源:origin: edu.toronto.cs.savant/savant-core
public JTextArea createTextArea(String fileName) {
JTextArea area = new JTextArea();
Document doc = new PlainDocument();
fillDocument(doc, fileName, maxLineCount);
area.setEditable(false);
area.setDocument(doc);
fileNameToDocumentMap.put(fileName, doc);
return area;
}
代码示例来源:origin: edu.toronto.cs.medsavant/medsavant-client
public JTextArea createTextArea(String fileName) {
JTextArea area = new JTextArea();
Document doc = new PlainDocument();
fillDocument(doc, fileName, maxLineCount);
area.setEditable(false);
area.setDocument(doc);
fileNameToDocumentMap.put(fileName, doc);
return area;
}
代码示例来源:origin: pentaho/pentaho-reporting
public InlineEditTextArea() {
super();
doc = new DocProxy( getDocument() );
super.setDocument( doc );
documentLocked = true;
}
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-ui
/**
* Convenience method for setting the source document
*/
public void setSourceDocument(StyledDocument sDoc) {
jtpSource.getDocument().removeDocumentListener(this);
jtpSource.setDocument(sDoc);
jtpSource.getDocument().addDocumentListener(this);
jtpMain.setText(jtpSource.getText());
((HTMLEditorKit) (jtpMain.getEditorKit())).setDefaultCursor(new Cursor(Cursor.TEXT_CURSOR));
}
代码示例来源:origin: com.jidesoft/jide-oss
@Override
public void setDocument(Document doc) {
Document document = getDocument();
if (document != null && _listener != null) {
document.removeDocumentListener(_listener);
}
super.setDocument(doc);
if (doc != null) {
if (_listener == null) {
_listener = new ResizingDocumentListener();
}
doc.addDocumentListener(_listener);
}
updateSize();
}
代码示例来源:origin: dcaoyuan/nbscala
/** Creates new form CustomizerApplication */
public CustomizerApplication(J2SEProjectProperties props) {
initComponents();
titleTextField.setDocument(props.APPLICATION_TITLE_DOC);
vendorTextField.setDocument(props.APPLICATION_VENDOR_DOC);
descTextArea.setDocument(props.APPLICATION_DESC_DOC);
homepageTextField.setDocument(props.APPLICATION_HOMEPAGE_DOC);
splashTextField.setDocument(props.APPLICATION_SPLASH_DOC);
}
代码示例来源:origin: Multibit-Legacy/multibit-hd
/**
* @param listener The document listener for detecting changes to the content
* @param rows The number of rows (normally 6)
* @param columns The number of columns (normally 60)
*
* @return A new read only length limited text field with default theme
*/
public static JTextArea newReadOnlyLengthLimitedTextArea(DocumentListener listener, int rows, int columns) {
JTextArea textArea = newReadOnlyTextArea(rows, columns);
// Limit the length of the underlying document
DefaultStyledDocument doc = new DefaultStyledDocument();
doc.setDocumentFilter(new DocumentMaxLengthFilter(rows * columns));
textArea.setDocument(doc);
// Ensure we monitor changes
doc.addDocumentListener(listener);
return textArea;
}
内容来源于网络,如有侵权,请联系作者删除!