javax.swing.text.Document.getProperty()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(116)

本文整理了Java中javax.swing.text.Document.getProperty()方法的一些代码示例,展示了Document.getProperty()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Document.getProperty()方法的具体详情如下:
包路径:javax.swing.text.Document
类名称:Document
方法名:getProperty

Document.getProperty介绍

暂无

代码示例

代码示例来源:origin: bobbylight/RSyntaxTextArea

/**
 * Returns the tab size set for the document, defaulting to 5.
 *
 * @return The tab size.
 */
private int getTabSize() {
  Integer i = (Integer)getDocument().getProperty(
                PlainDocument.tabSizeAttribute);
  int size = (i != null) ? i.intValue() : 5;
  return size;
}

代码示例来源:origin: bobbylight/RSyntaxTextArea

/**
 * Returns the tab size set for the document, defaulting to 5.
 *
 * @return the tab size
 */
protected int getTabSize() {
  Integer i = (Integer) getDocument().
            getProperty(PlainDocument.tabSizeAttribute);
  int size = (i != null) ? i.intValue() : 5;
  return size;
}

代码示例来源:origin: bobbylight/RSyntaxTextArea

/**
 * Returns the line separator used when writing this file (e.g.
 * "<code>\n</code>", "<code>\r\n</code>", or "<code>\r</code>").<p>
 *
 * Note that this value is an <code>Object</code> and not a
 * <code>String</code> as that is the way the {@link Document} interface
 * defines its property values.  If you always use
 * {@link #setLineSeparator(String)} to modify this value, then the value
 * returned from this method will always be a <code>String</code>.
 *
 * @return The line separator.  If this value is <code>null</code>, then
 *         the system default line separator is used (usually the value
 *         of <code>System.getProperty("line.separator")</code>).
 * @see #setLineSeparator(String)
 * @see #setLineSeparator(String, boolean)
 */
public Object getLineSeparator() {
  return getDocument().getProperty(
            RTextAreaEditorKit.EndOfLineStringProperty);
}

代码示例来源:origin: org.netbeans.api/org-openide-awt

title = (String) d.getProperty(HTMLDocument.TitleProperty);

代码示例来源:origin: bobbylight/RSyntaxTextArea

Object old = doc.getProperty(
        RTextAreaEditorKit.EndOfLineStringProperty);
if (!separator.equals(old)) {

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-modelimpl

private TransformationTable getCachedMacroTable(Document doc) {
  Object o = doc.getProperty(MACRO_EXPANSION_MACRO_TABLE);
  if (o != null && o instanceof TransformationTable) {
    TransformationTable tt = (TransformationTable) o;
    return tt;
  }
  return null;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/**
* @param doc
* @return filename from which the document is loaded.
*/
private static String getFilename(Document doc) {
  String ret = (String) doc.getProperty(javax.swing.text.Document.TitleProperty);
  return (ret == null ? "UNKNOWN" : ret); // NOI18N
}

代码示例来源:origin: net.java.abeille/abeille

/**
 * Display the identity of the document together with the title property and
 * stream-description property.
 */
public static String debugDocument(Document doc) {
  return "<" + System.identityHashCode(doc) + ", title='" + doc.getProperty(Document.TitleProperty) + "', stream='"
      + doc.getProperty(Document.StreamDescriptionProperty) + ", " + doc.toString() + ">";
}

代码示例来源:origin: antlr/stringtemplate4

protected int toComponentPosition(JTextComponent component, int position) {
  int[] windowsLineEndings = (int[])component.getDocument().getProperty(WINDOWS_LINE_ENDINGS);
  if (windowsLineEndings == null || windowsLineEndings.length == 0) {
    return position;
  }
  int index = Arrays.binarySearch(windowsLineEndings, position);
  if (index >= 0) {
    return position - index;
  }
  return position - (-index - 1);
}

代码示例来源:origin: jsevellec/cassandra-unit

protected int toComponentPosition(JTextComponent component, int position) {
  int[] windowsLineEndings = (int[])component.getDocument().getProperty(WINDOWS_LINE_ENDINGS);
  if (windowsLineEndings == null || windowsLineEndings.length == 0) {
    return position;
  }
  int index = Arrays.binarySearch(windowsLineEndings, position);
  if (index >= 0) {
    return position - index;
  }
  return position - (-index - 1);
}

代码示例来源:origin: org.antlr/ST4

protected int toComponentPosition(JTextComponent component, int position) {
  int[] windowsLineEndings = (int[])component.getDocument().getProperty(WINDOWS_LINE_ENDINGS);
  if (windowsLineEndings == null || windowsLineEndings.length == 0) {
    return position;
  }
  int index = Arrays.binarySearch(windowsLineEndings, position);
  if (index >= 0) {
    return position - index;
  }
  return position - (-index - 1);
}

代码示例来源:origin: org.netbeans.api/org-openide-text

public Object getProperty(Object key) {
  if (key == DocumentFilter.class && original instanceof AbstractDocument) {
    return ((AbstractDocument)original).getDocumentFilter();
  }
  return original.getProperty(key);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-editor

private String getShortName() {
  String longname = (String) getDocument().getProperty(Document.TitleProperty);
  int slash = longname.lastIndexOf(File.separatorChar);
  if (slash != -1) {
    return longname.substring(slash + 1);
  } else {
    return longname;
  }
}

代码示例来源:origin: org.nuiton.thirdparty/rsyntaxtextarea

/**
 * Returns the tab size set for the document, defaulting to 5.
 *
 * @return the tab size
 */
protected int getTabSize() {
  Integer i = (Integer) getDocument().
            getProperty(PlainDocument.tabSizeAttribute);
  int size = (i != null) ? i.intValue() : 5;
  return size;
}

代码示例来源:origin: org.codehaus.jtstand/jtstand-editor

/**
 * Returns the tab size set for the document, defaulting to 5.
 *
 * @return The tab size.
 */
protected int getTabSize() {
  Integer i = (Integer)getDocument().getProperty(
                PlainDocument.tabSizeAttribute);
  int size = (i != null) ? i.intValue() : 5;
  return size;
}

代码示例来源:origin: com.fifesoft/rsyntaxtextarea

/**
 * Returns the tab size set for the document, defaulting to 5.
 *
 * @return The tab size.
 */
private int getTabSize() {
  Integer i = (Integer)getDocument().getProperty(
                PlainDocument.tabSizeAttribute);
  int size = (i != null) ? i.intValue() : 5;
  return size;
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-editor-document

public static @NonNull DocumentCharacterAcceptor get(Document doc) {
  DocumentCharacterAcceptor acceptor = (DocumentCharacterAcceptor) doc.getProperty(
      DocumentCharacterAcceptor.class);
  if (acceptor == null) {
    acceptor = DefaultDocumentCharacterAcceptor.INSTANCE;
  }
  return acceptor;
}

代码示例来源:origin: dcaoyuan/nbscala

static synchronized OffsetsBag getHighlightsBag(Document doc) {
  OffsetsBag bag = (OffsetsBag) doc.getProperty(DebuggerAnnotation.class);
  if (bag == null) {
    doc.putProperty(DebuggerAnnotation.class, bag = new OffsetsBag(doc, true));
  }
  return bag;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-debugger-jpda-projects

static synchronized OffsetsBag getHighlightsBag(Document doc) {
  OffsetsBag bag = (OffsetsBag) doc.getProperty(DebuggerAnnotation.class);
  if (bag == null) {
    doc.putProperty(DebuggerAnnotation.class, bag = new OffsetsBag(doc, true));
  }
  return bag;
}

代码示例来源:origin: net.java.abeille/abeille

public void focusGained(FocusEvent evt) {
  if (debugCaretFocus) {
    System.err.println("BaseCaret.focusGained() in doc=" + component.getDocument().getProperty(Document.TitleProperty));
  }
  JTextComponent c = component;
  if (c != null) {
    updateType();
    setVisible(c.isEnabled()); // invisible caret if disabled
  }
}

相关文章