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

x33g5p2x  于2022-02-01 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(72)

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

Utilities.drawTabbedText介绍

暂无

代码示例

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

if (numPrintedLines>startingLineNumber) {
  Utilities.drawTabbedText(currentLineSeg, xOffset,y, g, tabExpander, 0);
  y += fontHeight;
  if (numPrintedLines==startingLineNumber+maxLinesPerPage) {

代码示例来源:origin: net.sf.jped/jedit-syntax

protected void paintPlainLine(Graphics gfx, int line, Font defaultFont,
  Color defaultColor, int x, int y)
{
  paintHighlight(gfx,line,y);
  textArea.getLineText(line,currentLine);
  gfx.setFont(defaultFont);
  gfx.setColor(defaultColor);
  y += fm.getHeight();
  x = Utilities.drawTabbedText(currentLine,x,y,gfx,this,0);
  if(eolMarkers)
  {
    gfx.setColor(eolMarkerColor);
    gfx.drawString(".",x,y);
  }
}

代码示例来源:origin: nativelibs4java/JNAerator

protected void paintPlainLine(Graphics gfx, int line, Font defaultFont,
  Color defaultColor, int x, int y)
{
  paintHighlight(gfx,line,y);
  textArea.getLineText(line,currentLine);
  gfx.setFont(defaultFont);
  gfx.setColor(defaultColor);
  y += fm.getHeight();
  x = Utilities.drawTabbedText(currentLine,x,y,gfx,this,0);
  if(eolMarkers)
  {
    gfx.setColor(eolMarkerColor);
    gfx.drawString(".",x,y);
  }
}

代码示例来源:origin: matsim-org/matsim

graphics.setColor(Color.black);
  doc.getText(p0 + i, start - i, segment);
  x = Utilities.drawTabbedText(segment, x, y, graphics, this, i);
i = end;
doc.getText(p0 + start, i - start, segment);
x = Utilities.drawTabbedText(segment, x, y, graphics, this, start);
graphics.setColor(Color.black);
doc.getText(p0 + i, text.length() - i, segment);
x = Utilities.drawTabbedText(segment, x, y, graphics, this, i);

代码示例来源:origin: iTransformers/netTransformer

graphics.setColor(Color.black);
  doc.getText(p0 + i, start - i, segment);
  x = Utilities.drawTabbedText(segment, x, y, graphics, this, i);
i = end;
doc.getText(p0 + start, i - start, segment);
x = Utilities.drawTabbedText(segment, x, y, graphics, this, start);
graphics.setColor(Color.black);
doc.getText(p0 + i, text.length() - i, segment);
x = Utilities.drawTabbedText(segment, x, y, graphics, this, i);

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-gsf-testrunner-ui

private int drawText(Graphics g,
           int x, int y,
           int startOffset, int endOffset,
           boolean error,
           boolean selected,
           DocElement docElem) throws BadLocationException {
  Segment s = EventQueue.isDispatchThread() ? SEGMENT : new Segment(); 
  s.array = docElem.getChars();
  s.offset = startOffset - docElem.offset;
  s.count = endOffset - startOffset;
  g.setColor(getColor(error, selected));
  return Utilities.drawTabbedText(s, x, y, g, this, startOffset);
}

代码示例来源:origin: RPTools/maptool

/**
   * @see javax.swing.text.PlainView#drawUnselectedText(java.awt.Graphics, int, int, int, int)
   */
  protected int drawUnselectedText(Graphics g, int x, int y, int p0, int p1) throws BadLocationException {
    // Find the text segment
    Document doc = getDocument();
    Segment s = new Segment();
    doc.getText(p0, p1 - p0, s);
    // Calculate the background highlight, it gets painted first.
    TwoToneTextField host = (TwoToneTextField) getContainer();
    Color bg = host.getTwoToneColor();
    Color fg = g.getColor();
    if (bg == null) { // No color set, guess black or white
      float[] hsb = Color.RGBtoHSB(fg.getRed(), fg.getGreen(), fg.getBlue(), null);
      bg = hsb[2] > 0.7 ? Color.BLACK : Color.WHITE;
    } // endif
    g.setColor(bg);
    Utilities.drawTabbedText(s, x + HORIZONTAL_OFFSET, y + VERTICAL_OFFSET, g, this, p0);
    // Draw the foreground
    g.setColor(fg);
    return Utilities.drawTabbedText(s, x, y, g, this, p0);
  }
}

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

public int renderTextPortion(Graphics g, int x, int y, int start, int end, int max, Document doc, AttributeSet attribute)
      throws BadLocationException
  {
    if(g == null)
      return 0;
    int length = end - start;
    if(start + length > max)
      length = max - start;
    save(g);
    applyAttribute(g, attribute);
    Segment text = getLineBuffer();
    doc.getText(start, length, text);
    x = Utilities.drawTabbedText(text, x, y, g, ATERenderingView.this, start);
    restore(g);
    return x;
  }
}

代码示例来源:origin: nz.ac.waikato.cms.weka.thirdparty/bounce

/**
 * Renders the given range in the model as normal unselected text. Uses the
 * foreground or disabled color to render the text.
 * 
 * @param g
 *            the graphics context
 * @param x
 *            the starting X coordinate >= 0
 * @param y
 *            the starting Y coordinate >= 0
 * @param p0
 *            the beginning position in the model >= 0
 * @param p1
 *            the ending position in the model >= 0
 * @return the X location of the end of the range >= 0
 * @exception BadLocationException
 *                if the range is invalid
 */
protected int drawUnselectedText(Graphics g, int x, int y, int p0, int p1) throws BadLocationException {
  g.setColor(unselected);
  Document doc = getDocument();
  Segment s = SegmentCache.getSharedSegment();
  doc.getText(p0, p1 - p0, s);
  int ret = Utilities.drawTabbedText(s, x, y, g, this, p0);
  SegmentCache.releaseSharedSegment(s);
  return ret;
}

代码示例来源:origin: de.sciss/jsyntaxpane

x = Utilities.drawTabbedText(segment, x, y, graphics, e, startOffset);
if ((getFontStyle() & 0x8) != 0) {
  graphics.setColor(Color.RED);

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

public void drawToken(ATERenderingView view, ATERenderingToken t,
             Graphics g, FontMetrics metrics,
             int x, int y, char c, Document doc,
             AttributeSet attribute, Segment text)
      throws BadLocationException
  {
    g.setColor(Color.blue);
    //g.drawLine(beginX, y+2, x, y+2);
    g.drawLine(startToken.getStartX(), y+1, x, y+1);
    // draw the text
    doc.getText(startToken.getStartIndex(), t.getIndex()-startToken.getStartIndex(), text);
    Utilities.drawTabbedText(text, startToken.getStartX(), y, g, view, startToken.getStartIndex());
  }
}

代码示例来源:origin: de.sciss/syntaxpane

x = Utilities.drawTabbedText(segment, x, y, graphics, e, startOffset);
if ((getFontStyle() & 0x8) != 0) {
  graphics.setColor(Color.RED);

代码示例来源:origin: nativelibs4java/JNAerator

x = Utilities.drawTabbedText(line,x,y,gfx,expander,0);
line.offset += length;
offset += length;

代码示例来源:origin: nz.ac.waikato.cms.weka.thirdparty/bounce

/**
 * Renders the given range in the model as selected text. This is
 * implemented to render the text in the color specified in the hosting
 * component. It assumes the highlighter will render the selected
 * background.
 * 
 * @param g
 *            the graphics context
 * @param x
 *            the starting X coordinate >= 0
 * @param y
 *            the starting Y coordinate >= 0
 * @param p0
 *            the beginning position in the model >= 0
 * @param p1
 *            the ending position in the model >= 0
 * @return the location of the end of the range
 * @exception BadLocationException
 *                if the range is invalid
 */
protected int drawSelectedText(Graphics g, int x, int y, int p0, int p1) throws BadLocationException {
  g.setColor(selected);
  Document doc = getDocument();
  Segment s = SegmentCache.getSharedSegment();
  doc.getText(p0, p1 - p0, s);
  int ret = Utilities.drawTabbedText(s, x, y, g, this, p0);
  SegmentCache.releaseSharedSegment(s);
  return ret;
}

代码示例来源:origin: RPTools/maptool

Utilities.drawTabbedText(text, x + HORIZONTAL_OFFSET, y + VERTICAL_OFFSET, g, expander, p0);
g.setColor(fg);
Utilities.drawTabbedText(text, x, y, g, expander, p0);

代码示例来源:origin: nz.ac.waikato.cms.weka.thirdparty/bounce

x = Utilities.drawTabbedText(text, x, y, g, (TabExpander) this, start);

代码示例来源:origin: markiewb/nb-codeoutline

/**
 * Draw a line of text.
 * @param lineIndex  The line number
 * @param g          The graphics context on which to draw
 * @param x          The x-position
 * @param y          The y-position (of the text baseline)
 */
protected void drawLine(int lineIndex, Graphics g, int x, int y)
{
  try {
    Element line = getElement().getElement(lineIndex);
    getDocument().getText(line.getStartOffset(), line.getEndOffset() - line.getStartOffset(), segment);
    TabExpander tx = new MoeTabExpander(tabSize, x);
    Utilities.drawTabbedText(segment, x, y, g, tx, line.getStartOffset());
  }
  catch (BadLocationException ble) {
    throw new RuntimeException(ble);
  }
}

代码示例来源:origin: nz.ac.waikato.cms.weka.thirdparty/bounce

x = Utilities.drawTabbedText(text, x, y, g, (TabExpander) this, start);

代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik

Segment text = getLineBuffer();
    doc.getText(mark, pos - mark, text);
    x = Utilities.drawTabbedText(text, x, y, g, this, mark);
    mark = pos;
Segment text = getLineBuffer();
doc.getText(mark, p1 - mark, text);
x = Utilities.drawTabbedText(text, x, y, g, this, mark);

代码示例来源:origin: apache/batik

Segment text = getLineBuffer();
    doc.getText(mark, pos - mark, text);
    x = Utilities.drawTabbedText(text, x, y, g, this, mark);
    mark = pos;
Segment text = getLineBuffer();
doc.getText(mark, p1 - mark, text);
x = Utilities.drawTabbedText(text, x, y, g, this, mark);

相关文章