本文整理了Java中javax.swing.text.Utilities.getTabbedTextOffset()
方法的一些代码示例,展示了Utilities.getTabbedTextOffset()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utilities.getTabbedTextOffset()
方法的具体详情如下:
包路径:javax.swing.text.Utilities
类名称:Utilities
方法名:getTabbedTextOffset
暂无
代码示例来源: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);
modelPos += Utilities.getTabbedTextOffset(text, g.getFontMetrics(), x, viewX, ATERenderingView.this, start);
x +=Utilities.getTabbedTextWidth(text, g.getFontMetrics(), x, ATERenderingView.this, start);
restore(g);
return x;
}
}
代码示例来源:origin: RPTools/maptool
/**
* Determines the best location (in the model) to break
* the given view.
* This method attempts to break on a whitespace
* location. If a whitespace location can't be found, the
* nearest character location is returned.
*
* @see View#breakView
* @see javax.swing.text.GlyphView.GlyphPainter#getBoundedPosition(javax.swing.text.GlyphView, int, float, float)
*/
public int getBoundedPosition(GlyphView v, int p0, float x, float len) {
sync(v);
TabExpander expander = v.getTabExpander();
Segment s = v.getText(p0, v.getEndOffset());
int index = Utilities.getTabbedTextOffset(s, metrics, (int) x, (int) (x + len),
expander, p0, false);
int p1 = p0 + index;
return p1;
}
代码示例来源:origin: RPTools/maptool
/**
* Provides a mapping from the view coordinate space to the logical
* coordinate space of the model.
*
* @see View#viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[])
* @see javax.swing.text.GlyphView.GlyphPainter#viewToModel(javax.swing.text.GlyphView, float, float, java.awt.Shape, javax.swing.text.Position.Bias[])
*/
public int viewToModel(GlyphView v, float x, float y, Shape a,
Position.Bias[] biasReturn) {
sync(v);
Rectangle alloc = (a instanceof Rectangle) ? (Rectangle) a : a.getBounds();
int p0 = v.getStartOffset();
int p1 = v.getEndOffset();
TabExpander expander = v.getTabExpander();
Segment text = getText(v, p0, p1);
int offs = Utilities.getTabbedTextOffset(text, metrics,
alloc.x, (int) x, expander, p0);
int retValue = p0 + offs;
if (retValue == p1) {
// No need to return backward bias as GlyphPainter1 is used for
// ltr text only.
retValue--;
}
biasReturn[0] = Position.Bias.Forward;
return retValue;
}
代码示例来源:origin: markiewb/nb-codeoutline
int offset = Utilities.getTabbedTextOffset(s, metrics, leftMargin, (int)x - aBounds.x, tx, lineStart);
代码示例来源:origin: notzippy/JALOPY2-MAIN
int offs =
p0
+ Utilities.getTabbedTextOffset(
buffer, metrics, tabBase, x, this, p0);
代码示例来源:origin: nz.ac.waikato.cms.weka.thirdparty/bounce
doc.getText(p0, p1 - p0, s);
tabBase = alloc.x;
int offs = p0 + Utilities.getTabbedTextOffset(s, metrics, tabBase, x, this, p0);
SegmentCache.releaseSharedSegment(s);
return offs;
内容来源于网络,如有侵权,请联系作者删除!