本文整理汇总了Java中javax.swing.text.TabStop.ALIGN_DECIMAL属性的典型用法代码示例。如果您正苦于以下问题:Java TabStop.ALIGN_DECIMAL属性的具体用法?Java TabStop.ALIGN_DECIMAL怎么用?Java TabStop.ALIGN_DECIMAL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.swing.text.TabStop
的用法示例。
在下文中一共展示了TabStop.ALIGN_DECIMAL属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: nextTabStop
@Override
public float nextTabStop(float x, int tabOffset) {
float tabBase = this.getTabBase();
// If the text isn't left justified, offset by 10 pixels!
if(createRow().getAlignment(View.X_AXIS) != 0)
return x + 10.0f;
/*
* This hack mimics the following, which is a private variable! ARGH!
*
* if (justification != StyleConstants.ALIGN_LEFT)
* return x + 10.0f;
*/
x -= tabBase;
TabSet tabs = getTabSet();
if (tabs == null) {
// a tab every 72 pixels.
return (tabBase + (((int) x / 72 + 1) * 72));
}
TabStop tab = tabs.getTabAfter(x + .01f);
if (tab == null) {
// no tab, do a default of 5 pixels.
// Should this cause a wrapping of the line?
return tabBase + x + 5.0f;
}
int alignment = tab.getAlignment();
int offset;
switch (alignment) {
default:
case TabStop.ALIGN_LEFT:
// Simple case, left tab.
return tabBase + tab.getPosition();
case TabStop.ALIGN_BAR:
// PENDING: what does this mean?
return tabBase + tab.getPosition();
case TabStop.ALIGN_RIGHT:
case TabStop.ALIGN_CENTER:
offset = findOffsetToCharactersInString(mutantTabChars, tabOffset + 1);
break;
case TabStop.ALIGN_DECIMAL:
offset = findOffsetToCharactersInString(mutantTabDecimalChars,
tabOffset + 1);
break;
}
if (offset == -1) {
offset = getEndOffset();
}
float charsSize = getPartialSize(tabOffset + 1, offset);
switch (alignment) {
case TabStop.ALIGN_RIGHT:
case TabStop.ALIGN_DECIMAL:
// right and decimal are treated the same way, the new
// position will be the location of the tab less the
// partialSize.
return tabBase + Math.max(x, tab.getPosition() - charsSize);
case TabStop.ALIGN_CENTER:
// Similar to right, but half the partialSize.
return tabBase
+ Math.max(x, tab.getPosition() - charsSize / 2.0f);
}
// will never get here!
return x;
}