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

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

本文整理了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

  1. /**
  2. Sets the logical style for a given offset within the document.
  3. @param offset The offset within the document.
  4. @param style The logical style.
  5. **/
  6. public synchronized void setLogicalStyle (int offset, Style style)
  7. {
  8. document_.setLogicalStyle (offset, style);
  9. }

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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. public void setLogicalStyle(int pos, Style s) {
  6. ((StyledDocument) delegate).setLogicalStyle(pos, s);
  7. }

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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. public void setLogicalStyle(int pos, Style s) {
  5. ((StyledDocument) delegate).setLogicalStyle(pos, s);
  6. }

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

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

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

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

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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. public void setLogicalStyle(int pos, Style s) {
  6. ((StyledDocument) delegate).setLogicalStyle(pos, s);
  7. }

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

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

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

  1. /**
  2. * Mark a line as normal (no special attributes).
  3. * This uses the dummy style named {@link #NORMAL_STYLE_NAME}.
  4. * This method should be used to undo the effect of {@link #markBreakpoint}, {@link #markError} and {@link #markCurrent}.
  5. * @param doc the document
  6. * @param offset identified the line to unmark
  7. * @exception NullPointerException If the <code>doc</code> parameter
  8. * is <code>null</code>.
  9. *
  10. * @deprecated since 1.20. Use addAnnotation() instead
  11. */
  12. @Deprecated
  13. public static void markNormal(StyledDocument doc, int offset) {
  14. checkDocParameter(doc);
  15. Style st = doc.getStyle(NORMAL_STYLE_NAME);
  16. if (st == null) {
  17. st = doc.addStyle(NORMAL_STYLE_NAME, null);
  18. }
  19. if (st != null) {
  20. doc.setLogicalStyle(offset, st);
  21. }
  22. }

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

  1. /**
  2. * Mark a line as normal (no special attributes).
  3. * This uses the dummy style named {@link #NORMAL_STYLE_NAME}.
  4. * This method should be used to undo the effect of {@link #markBreakpoint}, {@link #markError} and {@link #markCurrent}.
  5. * @param doc the document
  6. * @param offset identified the line to unmark
  7. * @exception NullPointerException If the <code>doc</code> parameter
  8. * is <code>null</code>.
  9. *
  10. * @deprecated since 1.20. Use addAnnotation() instead
  11. */
  12. public static void markNormal (StyledDocument doc, int offset) {
  13. checkDocParameter(doc);
  14. Style st = doc.getStyle (NORMAL_STYLE_NAME);
  15. if (st == null)
  16. st = doc.addStyle (NORMAL_STYLE_NAME, null);
  17. if (st != null) {
  18. doc.setLogicalStyle (offset, st);
  19. }
  20. }

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

  1. /**
  2. * Mark a line as normal (no special attributes).
  3. * This uses the dummy style named {@link #NORMAL_STYLE_NAME}.
  4. * This method should be used to undo the effect of {@link #markBreakpoint}, {@link #markError} and {@link #markCurrent}.
  5. * @param doc the document
  6. * @param offset identified the line to unmark
  7. * @exception NullPointerException If the <code>doc</code> parameter
  8. * is <code>null</code>.
  9. *
  10. * @deprecated since 1.20. Use addAnnotation() instead
  11. */
  12. public static void markNormal (StyledDocument doc, int offset) {
  13. checkDocParameter(doc);
  14. Style st = doc.getStyle (NORMAL_STYLE_NAME);
  15. if (st == null)
  16. st = doc.addStyle (NORMAL_STYLE_NAME, null);
  17. if (st != null) {
  18. doc.setLogicalStyle (offset, st);
  19. }
  20. }

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

  1. /** Attach a breakpoint to a line in the document.
  2. * If the document has a defined style named {@link #BREAKPOINT_STYLE_NAME}, it is used.
  3. * Otherwise, a new style is defined.
  4. *
  5. * @param doc the document
  6. * @param offset identifies the line to set breakpoint to
  7. * @exception NullPointerException If the <code>doc</code> parameter
  8. * is <code>null</code>.
  9. *
  10. * @deprecated since 1.20. Use addAnnotation() instead
  11. */
  12. @Deprecated
  13. public static void markBreakpoint(StyledDocument doc, int offset) {
  14. checkDocParameter(doc);
  15. Style bp = doc.getStyle(BREAKPOINT_STYLE_NAME);
  16. if (bp == null) {
  17. // create the style
  18. bp = doc.addStyle(BREAKPOINT_STYLE_NAME, null);
  19. if (bp == null) {
  20. return;
  21. }
  22. bp.addAttribute(StyleConstants.ColorConstants.Background, Color.red);
  23. bp.addAttribute(StyleConstants.ColorConstants.Foreground, Color.white);
  24. }
  25. doc.setLogicalStyle(offset, bp);
  26. }

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

  1. /** Mark a line as erroneous (e.g.&nbsp;by the compiler).
  2. * If the document has a defined style named {@link #ERROR_STYLE_NAME}, it is used.
  3. * Otherwise, a new style is defined.
  4. *
  5. * @param doc the document
  6. * @param offset identifies the line to mark
  7. * @exception NullPointerException If the <code>doc</code> parameter
  8. * is <code>null</code>.
  9. *
  10. * @deprecated since 1.20. Use addAnnotation() instead
  11. */
  12. @Deprecated
  13. public static void markError(StyledDocument doc, int offset) {
  14. checkDocParameter(doc);
  15. Style bp = doc.getStyle(ERROR_STYLE_NAME);
  16. if (bp == null) {
  17. // create the style
  18. bp = doc.addStyle(ERROR_STYLE_NAME, null);
  19. if (bp == null) {
  20. return;
  21. }
  22. bp.addAttribute(StyleConstants.ColorConstants.Background, Color.green);
  23. bp.addAttribute(StyleConstants.ColorConstants.Foreground, Color.black);
  24. }
  25. doc.setLogicalStyle(offset, bp);
  26. }

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

  1. /** Marks a line as current (e.g.&nbsp;for the debugger).
  2. * If the document has a defined style named {@link #CURRENT_STYLE_NAME}, it is used.
  3. * Otherwise, a new style is defined.
  4. *
  5. * @param doc the document
  6. * @param offset identifies the line to mark
  7. * @exception NullPointerException If the <code>doc</code> parameter
  8. * is <code>null</code>.
  9. *
  10. * @deprecated since 1.20. Use addAnnotation() instead
  11. */
  12. @Deprecated
  13. public static void markCurrent(StyledDocument doc, int offset) {
  14. checkDocParameter(doc);
  15. Style bp = doc.getStyle(CURRENT_STYLE_NAME);
  16. if (bp == null) {
  17. // create the style
  18. bp = doc.addStyle(CURRENT_STYLE_NAME, null);
  19. if (bp == null) {
  20. return;
  21. }
  22. bp.addAttribute(StyleConstants.ColorConstants.Background, Color.blue);
  23. bp.addAttribute(StyleConstants.ColorConstants.Foreground, Color.white);
  24. }
  25. doc.setLogicalStyle(offset, bp);
  26. }

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

  1. /** Marks a line as current (e.g.&nbsp;for the debugger).
  2. * If the document has a defined style named {@link #CURRENT_STYLE_NAME}, it is used.
  3. * Otherwise, a new style is defined.
  4. *
  5. * @param doc the document
  6. * @param offset identifies the line to mark
  7. * @exception NullPointerException If the <code>doc</code> parameter
  8. * is <code>null</code>.
  9. *
  10. * @deprecated since 1.20. Use addAnnotation() instead
  11. */
  12. public static void markCurrent (StyledDocument doc, int offset) {
  13. checkDocParameter(doc);
  14. Style bp = doc.getStyle (CURRENT_STYLE_NAME);
  15. if (bp == null) {
  16. // create the style
  17. bp = doc.addStyle (CURRENT_STYLE_NAME, null);
  18. if (bp == null) return;
  19. bp.addAttribute (
  20. StyleConstants.ColorConstants.Background, Color.blue
  21. );
  22. bp.addAttribute (
  23. StyleConstants.ColorConstants.Foreground, Color.white
  24. );
  25. }
  26. doc.setLogicalStyle (offset, bp);
  27. }

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

  1. /** Attach a breakpoint to a line in the document.
  2. * If the document has a defined style named {@link #BREAKPOINT_STYLE_NAME}, it is used.
  3. * Otherwise, a new style is defined.
  4. *
  5. * @param doc the document
  6. * @param offset identifies the line to set breakpoint to
  7. * @exception NullPointerException If the <code>doc</code> parameter
  8. * is <code>null</code>.
  9. *
  10. * @deprecated since 1.20. Use addAnnotation() instead
  11. */
  12. public static void markBreakpoint (StyledDocument doc, int offset) {
  13. checkDocParameter(doc);
  14. Style bp = doc.getStyle (BREAKPOINT_STYLE_NAME);
  15. if (bp == null) {
  16. // create the style
  17. bp = doc.addStyle (BREAKPOINT_STYLE_NAME, null);
  18. if (bp == null) return;
  19. bp.addAttribute (
  20. StyleConstants.ColorConstants.Background, Color.red
  21. );
  22. bp.addAttribute (
  23. StyleConstants.ColorConstants.Foreground, Color.white
  24. );
  25. }
  26. doc.setLogicalStyle (offset, bp);
  27. }

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

  1. /** Mark a line as erroneous (e.g.&nbsp;by the compiler).
  2. * If the document has a defined style named {@link #ERROR_STYLE_NAME}, it is used.
  3. * Otherwise, a new style is defined.
  4. *
  5. * @param doc the document
  6. * @param offset identifies the line to mark
  7. * @exception NullPointerException If the <code>doc</code> parameter
  8. * is <code>null</code>.
  9. *
  10. * @deprecated since 1.20. Use addAnnotation() instead
  11. */
  12. public static void markError (StyledDocument doc, int offset) {
  13. checkDocParameter(doc);
  14. Style bp = doc.getStyle (ERROR_STYLE_NAME);
  15. if (bp == null) {
  16. // create the style
  17. bp = doc.addStyle (ERROR_STYLE_NAME, null);
  18. if (bp == null) return;
  19. bp.addAttribute (
  20. StyleConstants.ColorConstants.Background, Color.green
  21. );
  22. bp.addAttribute (
  23. StyleConstants.ColorConstants.Foreground, Color.black
  24. );
  25. }
  26. doc.setLogicalStyle (offset, bp);
  27. }

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

  1. /** Attach a breakpoint to a line in the document.
  2. * If the document has a defined style named {@link #BREAKPOINT_STYLE_NAME}, it is used.
  3. * Otherwise, a new style is defined.
  4. *
  5. * @param doc the document
  6. * @param offset identifies the line to set breakpoint to
  7. * @exception NullPointerException If the <code>doc</code> parameter
  8. * is <code>null</code>.
  9. *
  10. * @deprecated since 1.20. Use addAnnotation() instead
  11. */
  12. public static void markBreakpoint (StyledDocument doc, int offset) {
  13. checkDocParameter(doc);
  14. Style bp = doc.getStyle (BREAKPOINT_STYLE_NAME);
  15. if (bp == null) {
  16. // create the style
  17. bp = doc.addStyle (BREAKPOINT_STYLE_NAME, null);
  18. if (bp == null) return;
  19. bp.addAttribute (
  20. StyleConstants.ColorConstants.Background, Color.red
  21. );
  22. bp.addAttribute (
  23. StyleConstants.ColorConstants.Foreground, Color.white
  24. );
  25. }
  26. doc.setLogicalStyle (offset, bp);
  27. }

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

  1. /** Mark a line as erroneous (e.g.&nbsp;by the compiler).
  2. * If the document has a defined style named {@link #ERROR_STYLE_NAME}, it is used.
  3. * Otherwise, a new style is defined.
  4. *
  5. * @param doc the document
  6. * @param offset identifies the line to mark
  7. * @exception NullPointerException If the <code>doc</code> parameter
  8. * is <code>null</code>.
  9. *
  10. * @deprecated since 1.20. Use addAnnotation() instead
  11. */
  12. public static void markError (StyledDocument doc, int offset) {
  13. checkDocParameter(doc);
  14. Style bp = doc.getStyle (ERROR_STYLE_NAME);
  15. if (bp == null) {
  16. // create the style
  17. bp = doc.addStyle (ERROR_STYLE_NAME, null);
  18. if (bp == null) return;
  19. bp.addAttribute (
  20. StyleConstants.ColorConstants.Background, Color.green
  21. );
  22. bp.addAttribute (
  23. StyleConstants.ColorConstants.Foreground, Color.black
  24. );
  25. }
  26. doc.setLogicalStyle (offset, bp);
  27. }

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

  1. /** Marks a line as current (e.g.&nbsp;for the debugger).
  2. * If the document has a defined style named {@link #CURRENT_STYLE_NAME}, it is used.
  3. * Otherwise, a new style is defined.
  4. *
  5. * @param doc the document
  6. * @param offset identifies the line to mark
  7. * @exception NullPointerException If the <code>doc</code> parameter
  8. * is <code>null</code>.
  9. *
  10. * @deprecated since 1.20. Use addAnnotation() instead
  11. */
  12. public static void markCurrent (StyledDocument doc, int offset) {
  13. checkDocParameter(doc);
  14. Style bp = doc.getStyle (CURRENT_STYLE_NAME);
  15. if (bp == null) {
  16. // create the style
  17. bp = doc.addStyle (CURRENT_STYLE_NAME, null);
  18. if (bp == null) return;
  19. bp.addAttribute (
  20. StyleConstants.ColorConstants.Background, Color.blue
  21. );
  22. bp.addAttribute (
  23. StyleConstants.ColorConstants.Foreground, Color.white
  24. );
  25. }
  26. doc.setLogicalStyle (offset, bp);
  27. }

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

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

相关文章