本文整理了Java中javax.swing.text.Document.putProperty()
方法的一些代码示例,展示了Document.putProperty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Document.putProperty()
方法的具体详情如下:
包路径:javax.swing.text.Document
类名称:Document
方法名:putProperty
暂无
代码示例来源:origin: bobbylight/RSyntaxTextArea
doc.putProperty(EndOfLineStringProperty, "\r\n");
doc.putProperty(EndOfLineStringProperty, "\r");
doc.putProperty(EndOfLineStringProperty, "\n");
代码示例来源:origin: bobbylight/RSyntaxTextArea
RTextAreaEditorKit.EndOfLineStringProperty);
if (!separator.equals(old)) {
doc.putProperty(RTextAreaEditorKit.EndOfLineStringProperty,
separator);
if (setDirty) {
代码示例来源:origin: magefree/mage
public static void setHTMLEditorKit (JEditorPane editorPane) {
editorPane.getDocument().putProperty("imageCache", imageCache); // Read internally by ImageView, but never written.
代码示例来源:origin: org.netbeans.api/org-openide-awt
doc.putProperty(Document.StreamDescriptionProperty, null);
代码示例来源:origin: bobbylight/RSyntaxTextArea
/**
* We override this method because the super version gives us an entirely
* new <code>Document</code>, thus requiring us to re-attach our Undo
* manager. With this version we just replace the text.
*/
@Override
public void read(Reader in, Object desc) throws IOException {
RTextAreaEditorKit kit = (RTextAreaEditorKit)getUI().getEditorKit(this);
setText(null);
Document doc = getDocument();
if (desc != null) {
doc.putProperty(Document.StreamDescriptionProperty, desc);
}
try {
// NOTE: Resets the "line separator" property.
kit.read(in, doc, 0);
} catch (BadLocationException e) {
throw new IOException(e.getMessage());
}
}
代码示例来源:origin: org.swinglabs.swingx/swingx-all
/**
* {@inheritDoc}
*/
@Override
public void putProperty(Object key, Object value) {
delegate.putProperty(key, value);
}
代码示例来源:origin: org.netbeans.api/org-netbeans-modules-editor-document
/**
* Perform additional initialization of document by this content (set properties).
*
* @param doc non-null document
*/
public void init(Document doc) {
doc.putProperty(CharSequence.class, (CharSequence)charContent);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-editor
private static void setFoldingProperty(Document document, Map<String, List<OffsetRange>> folds) {
if (document != null) {
document.putProperty(LAST_CORRECT_FOLDING_PROPERTY, folds);
}
}
代码示例来源:origin: pentaho/mondrian
jEditorPaneXML.getDocument().putProperty(
PlainDocument.tabSizeAttribute,
new Integer(2));
代码示例来源:origin: de.sciss/jsyntaxpane
private void onWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_onWindowClosed
doc.removeDocumentListener(this);
doc.putProperty(HTMLPreviewAction.HTML_PREVIEW_WINDOW, null);
doc = null;
}//GEN-LAST:event_onWindowClosed
代码示例来源:origin: org.netbeans.api/org-openide-text
public void putProperty(Object key, Object value) {
if (key == DocumentFilter.class && original instanceof AbstractDocument) {
((AbstractDocument)original).setDocumentFilter((DocumentFilter)value);
} else {
original.putProperty(key, value);
}
}
代码示例来源:origin: chatty/chatty
/**
* Set whether to allow linebrekas in the value. Otherwise linebreaks are
* filtered out when editing and replaced by a space. Default is false.
*
* @param allow true to allow linebreaks
*/
public final void setAllowLinebreaks(boolean allow) {
input.getDocument().putProperty("filterNewlines", !allow);
}
代码示例来源:origin: matsim-org/matsim
public XmlView(Element element) {
super(element);
// Set tabsize to 4 (instead of the default 8)
getDocument().putProperty(PlainDocument.tabSizeAttribute, 4);
}
代码示例来源:origin: org.netbeans.api/org-netbeans-modules-editor-document
public ModRootElement(Document doc) {
super(doc);
docText = DocumentUtilities.getText(doc);
doc.putProperty(NAME, this);
}
代码示例来源:origin: br.com.tecsinapse/tecsinapse-data-io
public static String htmlToText(String html) {
EditorKit kit = new HTMLEditorKit();
Document doc = kit.createDefaultDocument();
doc.putProperty("IgnoreCharsetDirective", Boolean.TRUE);
try {
kit.read(new ByteArrayInputStream(html.getBytes(StandardCharsets.UTF_8)), doc, 0);
return doc.getText(0, doc.getLength());
} catch (IOException | BadLocationException e) {
throw new RuntimeException(e);
}
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-core
/** Sets the correct properties of the given StyledDocument
*/
void setDocumentProperties(Document doc) {
DataObject obj = getServlet();
if (obj != null) {
//set document name property
doc.putProperty(javax.swing.text.Document.TitleProperty, obj.getPrimaryFile().getPath());
//set dataobject to stream desc property
doc.putProperty(javax.swing.text.Document.StreamDescriptionProperty, obj);
}
}
代码示例来源:origin: chatty/chatty
/**
* Reloads the current page and jumps to the same position. This is only
* used for testing purposes, because usually the pages shouldn't change
* while the program is running.
*/
private void reload() {
Document doc = textPane.getDocument();
doc.putProperty(Document.StreamDescriptionProperty, null);
scrollPositionAfterLoad = scrollbar.getValue();
loadPage(currentPage);
}
代码示例来源:origin: antlr/antlrworks
public void setEditorKit(StyledEditorKit editorKit) {
textPane.setEditorKit(editorKit);
textPane.getDocument().addDocumentListener(textPaneListener = new TextPaneListener());
// Set by default the end of line property in order to always use the Unix style
textPane.getDocument().putProperty(DefaultEditorKit.EndOfLineStringProperty, unixEndOfLine);
}
代码示例来源:origin: org.swinglabs.swingx/swingx-core
public void visit(LinkModel link) {
try {
// make sure to reload
editorPane.getDocument().putProperty(Document.StreamDescriptionProperty, null);
// JW: editorPane defaults to asynchronous loading
// no need to explicitly start a thread - really?
editorPane.setPage(link.getURL());
link.setVisited(true);
} catch (IOException e1) {
editorPane.setText("<html>Error 404: couldn't show " + link.getURL() + " </html>");
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-editor
private void initCodeStyle(Document doc) {
InputAttributes lexerAttrs = (InputAttributes) doc.getProperty(InputAttributes.class);
if (lexerAttrs == null) {
lexerAttrs = new InputAttributes();
doc.putProperty(InputAttributes.class, lexerAttrs);
}
FortranCodeStyle codeStyle = FortranCodeStyle.get(doc);
lexerAttrs.setValue(getLanguage(), CndLexerUtilities.LEXER_FILTER, CndLexerUtilities.getFortranFilter(), true);
lexerAttrs.setValue(getLanguage(), CndLexerUtilities.FORTRAN_MAXIMUM_TEXT_WIDTH, codeStyle.getRrightMargin(), true);
lexerAttrs.setValue(getLanguage(), CndLexerUtilities.FORTRAN_FREE_FORMAT, codeStyle.getFormatFortran(), true);
}
内容来源于网络,如有侵权,请联系作者删除!