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

x33g5p2x  于2022-01-29 转载在 其他  
字(11.0k)|赞(0)|评价(0)|浏览(108)

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

StyledDocument.setLogicalStyle介绍

暂无

代码示例

代码示例来源:origin: net.sf.jt400/jt400

/**
Sets the logical style for a given offset within the document.

@param offset   The offset within the document.
@param style    The logical style.
**/
  public synchronized void setLogicalStyle (int offset, Style style)
  {
    document_.setLogicalStyle (offset, style);
  }

代码示例来源:origin: org.swinglabs.swingx/swingx-all

/**
 * {@inheritDoc}
 */
@Override
public void setLogicalStyle(int pos, Style s) {
  ((StyledDocument) delegate).setLogicalStyle(pos, s);
}

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

/**
 * {@inheritDoc}
 */
public void setLogicalStyle(int pos, Style s) {
  ((StyledDocument) delegate).setLogicalStyle(pos, s);
}

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

public void setLogicalStyle(int pos, Style s) {
  ((StyledDocument) original).setLogicalStyle(pos, s);
}

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

public void setLogicalStyle(int pos, Style s) {
  ((StyledDocument)original).setLogicalStyle (pos, s);
}

代码示例来源:origin: tmyroadctfig/swingx

/**
 * {@inheritDoc}
 */
@Override
public void setLogicalStyle(int pos, Style s) {
  ((StyledDocument) delegate).setLogicalStyle(pos, s);
}

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

public void setLogicalStyle(int pos, Style s) {
  ((StyledDocument)original).setLogicalStyle (pos, s);
}

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

/**
 * Mark a line as normal (no special attributes).
 * This uses the dummy style named {@link #NORMAL_STYLE_NAME}.
 * This method should be used to undo the effect of {@link #markBreakpoint}, {@link #markError} and {@link #markCurrent}.
 * @param doc the document
 * @param offset identified the line to unmark
 * @exception NullPointerException If the <code>doc</code> parameter
 *                                 is <code>null</code>.
 *
 * @deprecated since 1.20. Use addAnnotation() instead
 */
@Deprecated
public static void markNormal(StyledDocument doc, int offset) {
  checkDocParameter(doc);
  Style st = doc.getStyle(NORMAL_STYLE_NAME);
  if (st == null) {
    st = doc.addStyle(NORMAL_STYLE_NAME, null);
  }
  if (st != null) {
    doc.setLogicalStyle(offset, st);
  }
}

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

/**
 * Mark a line as normal (no special attributes).
 * This uses the dummy style named {@link #NORMAL_STYLE_NAME}.
 * This method should be used to undo the effect of {@link #markBreakpoint}, {@link #markError} and {@link #markCurrent}.
 * @param doc the document
 * @param offset identified the line to unmark
 * @exception NullPointerException If the <code>doc</code> parameter
 *                                 is <code>null</code>.
 *
 * @deprecated since 1.20. Use addAnnotation() instead
 */
public static void markNormal (StyledDocument doc, int offset) {
  checkDocParameter(doc);
  Style st = doc.getStyle (NORMAL_STYLE_NAME);
  if (st == null)
    st = doc.addStyle (NORMAL_STYLE_NAME, null);
  if (st != null) {
    doc.setLogicalStyle (offset, st);
  }
}

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

/**
 * Mark a line as normal (no special attributes).
 * This uses the dummy style named {@link #NORMAL_STYLE_NAME}.
 * This method should be used to undo the effect of {@link #markBreakpoint}, {@link #markError} and {@link #markCurrent}.
 * @param doc the document
 * @param offset identified the line to unmark
 * @exception NullPointerException If the <code>doc</code> parameter
 *                                 is <code>null</code>.
 *
 * @deprecated since 1.20. Use addAnnotation() instead
 */
public static void markNormal (StyledDocument doc, int offset) {
  checkDocParameter(doc);
  Style st = doc.getStyle (NORMAL_STYLE_NAME);
  if (st == null)
    st = doc.addStyle (NORMAL_STYLE_NAME, null);
  if (st != null) {
    doc.setLogicalStyle (offset, st);
  }
}

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

/** Attach a breakpoint to a line in the document.
* If the document has a defined style named {@link #BREAKPOINT_STYLE_NAME}, it is used.
* Otherwise, a new style is defined.
*
* @param doc the document
* @param offset identifies the line to set breakpoint to
 * @exception NullPointerException If the <code>doc</code> parameter
 *                                 is <code>null</code>.
*
* @deprecated since 1.20. Use addAnnotation() instead
*/
@Deprecated
public static void markBreakpoint(StyledDocument doc, int offset) {
  checkDocParameter(doc);
  Style bp = doc.getStyle(BREAKPOINT_STYLE_NAME);
  if (bp == null) {
    // create the style
    bp = doc.addStyle(BREAKPOINT_STYLE_NAME, null);
    if (bp == null) {
      return;
    }
    bp.addAttribute(StyleConstants.ColorConstants.Background, Color.red);
    bp.addAttribute(StyleConstants.ColorConstants.Foreground, Color.white);
  }
  doc.setLogicalStyle(offset, bp);
}

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

/** Mark a line as erroneous (e.g.&nbsp;by the compiler).
* If the document has a defined style named {@link #ERROR_STYLE_NAME}, it is used.
* Otherwise, a new style is defined.
*
* @param doc the document
* @param offset identifies the line to mark
 * @exception NullPointerException If the <code>doc</code> parameter
 *                                 is <code>null</code>.
*
* @deprecated since 1.20. Use addAnnotation() instead
*/
@Deprecated
public static void markError(StyledDocument doc, int offset) {
  checkDocParameter(doc);
  Style bp = doc.getStyle(ERROR_STYLE_NAME);
  if (bp == null) {
    // create the style
    bp = doc.addStyle(ERROR_STYLE_NAME, null);
    if (bp == null) {
      return;
    }
    bp.addAttribute(StyleConstants.ColorConstants.Background, Color.green);
    bp.addAttribute(StyleConstants.ColorConstants.Foreground, Color.black);
  }
  doc.setLogicalStyle(offset, bp);
}

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

/** Marks a line as current (e.g.&nbsp;for the debugger).
* If the document has a defined style named {@link #CURRENT_STYLE_NAME}, it is used.
* Otherwise, a new style is defined.
*
* @param doc the document
* @param offset identifies the line to mark
 * @exception NullPointerException If the <code>doc</code> parameter
 *                                 is <code>null</code>.
*
* @deprecated since 1.20. Use addAnnotation() instead
*/
@Deprecated
public static void markCurrent(StyledDocument doc, int offset) {
  checkDocParameter(doc);
  Style bp = doc.getStyle(CURRENT_STYLE_NAME);
  if (bp == null) {
    // create the style
    bp = doc.addStyle(CURRENT_STYLE_NAME, null);
    if (bp == null) {
      return;
    }
    bp.addAttribute(StyleConstants.ColorConstants.Background, Color.blue);
    bp.addAttribute(StyleConstants.ColorConstants.Foreground, Color.white);
  }
  doc.setLogicalStyle(offset, bp);
}

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

/** Marks a line as current (e.g.&nbsp;for the debugger).
* If the document has a defined style named {@link #CURRENT_STYLE_NAME}, it is used.
* Otherwise, a new style is defined.
*
* @param doc the document
* @param offset identifies the line to mark
 * @exception NullPointerException If the <code>doc</code> parameter
 *                                 is <code>null</code>.
*
* @deprecated since 1.20. Use addAnnotation() instead
*/
public static void markCurrent (StyledDocument doc, int offset) {
  checkDocParameter(doc);
  Style bp = doc.getStyle (CURRENT_STYLE_NAME);
  if (bp == null) {
    // create the style
    bp = doc.addStyle (CURRENT_STYLE_NAME, null);
    if (bp == null) return;
    bp.addAttribute (
      StyleConstants.ColorConstants.Background, Color.blue
    );
    bp.addAttribute (
      StyleConstants.ColorConstants.Foreground, Color.white
    );
  }
  doc.setLogicalStyle (offset, bp);
}

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

/** Attach a breakpoint to a line in the document.
* If the document has a defined style named {@link #BREAKPOINT_STYLE_NAME}, it is used.
* Otherwise, a new style is defined.
*
* @param doc the document
* @param offset identifies the line to set breakpoint to
 * @exception NullPointerException If the <code>doc</code> parameter
 *                                 is <code>null</code>.
*
* @deprecated since 1.20. Use addAnnotation() instead
*/
public static void markBreakpoint (StyledDocument doc, int offset) {
  checkDocParameter(doc);
  Style bp = doc.getStyle (BREAKPOINT_STYLE_NAME);
  if (bp == null) {
    // create the style
    bp = doc.addStyle (BREAKPOINT_STYLE_NAME, null);
    if (bp == null) return;
    bp.addAttribute (
      StyleConstants.ColorConstants.Background, Color.red
    );
    bp.addAttribute (
      StyleConstants.ColorConstants.Foreground, Color.white
    );
  }
  doc.setLogicalStyle (offset, bp);
}

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

/** Mark a line as erroneous (e.g.&nbsp;by the compiler).
* If the document has a defined style named {@link #ERROR_STYLE_NAME}, it is used.
* Otherwise, a new style is defined.
*
* @param doc the document
* @param offset identifies the line to mark
 * @exception NullPointerException If the <code>doc</code> parameter
 *                                 is <code>null</code>.
*
* @deprecated since 1.20. Use addAnnotation() instead
*/
public static void markError (StyledDocument doc, int offset) {
  checkDocParameter(doc);
  Style bp = doc.getStyle (ERROR_STYLE_NAME);
  if (bp == null) {
    // create the style
    bp = doc.addStyle (ERROR_STYLE_NAME, null);
    if (bp == null) return;
    bp.addAttribute (
      StyleConstants.ColorConstants.Background, Color.green
    );
    bp.addAttribute (
      StyleConstants.ColorConstants.Foreground, Color.black
    );
  }
  doc.setLogicalStyle (offset, bp);
}

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

/** Attach a breakpoint to a line in the document.
* If the document has a defined style named {@link #BREAKPOINT_STYLE_NAME}, it is used.
* Otherwise, a new style is defined.
*
* @param doc the document
* @param offset identifies the line to set breakpoint to
 * @exception NullPointerException If the <code>doc</code> parameter
 *                                 is <code>null</code>.
*
* @deprecated since 1.20. Use addAnnotation() instead
*/
public static void markBreakpoint (StyledDocument doc, int offset) {
  checkDocParameter(doc);
  Style bp = doc.getStyle (BREAKPOINT_STYLE_NAME);
  if (bp == null) {
    // create the style
    bp = doc.addStyle (BREAKPOINT_STYLE_NAME, null);
    if (bp == null) return;
    bp.addAttribute (
      StyleConstants.ColorConstants.Background, Color.red
    );
    bp.addAttribute (
      StyleConstants.ColorConstants.Foreground, Color.white
    );
  }
  doc.setLogicalStyle (offset, bp);
}

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

/** Mark a line as erroneous (e.g.&nbsp;by the compiler).
* If the document has a defined style named {@link #ERROR_STYLE_NAME}, it is used.
* Otherwise, a new style is defined.
*
* @param doc the document
* @param offset identifies the line to mark
 * @exception NullPointerException If the <code>doc</code> parameter
 *                                 is <code>null</code>.
*
* @deprecated since 1.20. Use addAnnotation() instead
*/
public static void markError (StyledDocument doc, int offset) {
  checkDocParameter(doc);
  Style bp = doc.getStyle (ERROR_STYLE_NAME);
  if (bp == null) {
    // create the style
    bp = doc.addStyle (ERROR_STYLE_NAME, null);
    if (bp == null) return;
    bp.addAttribute (
      StyleConstants.ColorConstants.Background, Color.green
    );
    bp.addAttribute (
      StyleConstants.ColorConstants.Foreground, Color.black
    );
  }
  doc.setLogicalStyle (offset, bp);
}

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

/** Marks a line as current (e.g.&nbsp;for the debugger).
* If the document has a defined style named {@link #CURRENT_STYLE_NAME}, it is used.
* Otherwise, a new style is defined.
*
* @param doc the document
* @param offset identifies the line to mark
 * @exception NullPointerException If the <code>doc</code> parameter
 *                                 is <code>null</code>.
*
* @deprecated since 1.20. Use addAnnotation() instead
*/
public static void markCurrent (StyledDocument doc, int offset) {
  checkDocParameter(doc);
  Style bp = doc.getStyle (CURRENT_STYLE_NAME);
  if (bp == null) {
    // create the style
    bp = doc.addStyle (CURRENT_STYLE_NAME, null);
    if (bp == null) return;
    bp.addAttribute (
      StyleConstants.ColorConstants.Background, Color.blue
    );
    bp.addAttribute (
      StyleConstants.ColorConstants.Foreground, Color.white
    );
  }
  doc.setLogicalStyle (offset, bp);
}

代码示例来源:origin: net.sf.tinylaf/tinylaf

StyleConstants.setItalic(regular, false);
doc.setLogicalStyle(0, regular);

相关文章