本文整理汇总了Java中javax.swing.text.NavigationFilter.FilterBypass方法的典型用法代码示例。如果您正苦于以下问题:Java NavigationFilter.FilterBypass方法的具体用法?Java NavigationFilter.FilterBypass怎么用?Java NavigationFilter.FilterBypass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.text.NavigationFilter
的用法示例。
在下文中一共展示了NavigationFilter.FilterBypass方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: moveDot
import javax.swing.text.NavigationFilter; //导入方法依赖的package包/类
@Override
public void moveDot(NavigationFilter.FilterBypass fb, int dot, Position.Bias bias) {
NavigationFilter chain = component.getNavigationFilter();
if (chain != null) {
chain.moveDot(fb, dot, bias);
} else {
super.moveDot(fb, dot, bias);
}
}
示例2: setDot
import javax.swing.text.NavigationFilter; //导入方法依赖的package包/类
@Override
public void setDot(NavigationFilter.FilterBypass fb, int dot, Position.Bias bias) {
NavigationFilter chain = component.getNavigationFilter();
if (chain != null) {
chain.setDot(fb, dot, bias);
} else {
super.setDot(fb, dot, bias);
}
}
示例3: setNavigationFilter
import javax.swing.text.NavigationFilter; //导入方法依赖的package包/类
/**
* Sets navigation filter for a certain operation type, defined by {@link MoveCaretsOrigin}.
* <p>
* The registered filter will receive <b>only those caret movements</b>, which correspond to the
* passed {@link MoveCaretsOrigin}. To receive all caret movements, register for {@link MoveCaretsOrigin#DEFAULT}
* or use {@link JTextComponent#setNavigationFilter}.
* </p><p>
* All the key part(s) of MoveCaretOrigin of a caret operation and `origin' parameter in this function must
* match in order for the filter to be invoked.
* </p><p>
* The NavigationFilter implementation <b>may downcast</b> the passed {@link NavigationFilter.FilterBypass FilterBypass}
* parameter to {@link NavigationFilterBypass} to get full infomration about the movement.
* </p>
* @param component the component which will use the filter
* @param origin the origin
* @param naviFilter the installed filter
* @see JTextComponent#setNavigationFilter
* @see NavigationFilterBypass
* @since 2.10
*/
public static void setNavigationFilter(JTextComponent component, MoveCaretsOrigin origin, @NullAllowed NavigationFilter naviFilter) {
if (origin == null) {
origin = MoveCaretsOrigin.DEFAULT;
}
final NavigationFilter prev = getNavigationFilter(component, origin);
if (naviFilter != null) {
// Note:
// if the caller passes in a non-cascading filter, we would loose the filter chain information.
// the alien filter is wrapped by CascadingNavigationFilter delegator, so the previous filter
// link is preserved.
if (!(naviFilter instanceof CascadingNavigationFilter)) {
final NavigationFilter del = naviFilter;
naviFilter = new CascadingNavigationFilter() {
@Override
public void setDot(NavigationFilter.FilterBypass fb, int dot, Position.Bias bias) {
del.setDot(fb, dot, bias);
}
@Override
public void moveDot(NavigationFilter.FilterBypass fb, int dot, Position.Bias bias) {
del.moveDot(fb, dot, bias);
}
@Override
public int getNextVisualPositionFrom(JTextComponent text, int pos, Position.Bias bias, int direction, Position.Bias[] biasRet) throws BadLocationException {
return del.getNextVisualPositionFrom(text, pos, bias, direction, biasRet);
}
};
}
((CascadingNavigationFilter)naviFilter).setOwnerAndPrevious(component, origin, prev);
}
if (MoveCaretsOrigin.DEFAULT == origin) {
component.setNavigationFilter(naviFilter);
} else {
doPutNavigationFilter(component, origin.getActionType(), prev);
}
}
示例4: setDot
import javax.swing.text.NavigationFilter; //导入方法依赖的package包/类
@Override
public void setDot(NavigationFilter.FilterBypass bypass,
int dot,
Position.Bias bias) {
if (dot > classNameLength) {
bypass.setDot(classNameLength, bias);
} else {
super.setDot(bypass, dot, bias);
}
}
示例5: moveDot
import javax.swing.text.NavigationFilter; //导入方法依赖的package包/类
@Override
public void moveDot(NavigationFilter.FilterBypass bypass,
int dot,
Position.Bias bias) {
if (dot > classNameLength) {
bypass.moveDot(classNameLength, bias);
} else {
super.moveDot(bypass, dot, bias);
}
}