本文整理汇总了Java中javafx.scene.control.TextField.positionCaret方法的典型用法代码示例。如果您正苦于以下问题:Java TextField.positionCaret方法的具体用法?Java TextField.positionCaret怎么用?Java TextField.positionCaret使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.TextField
的用法示例。
在下文中一共展示了TextField.positionCaret方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: reload
import javafx.scene.control.TextField; //导入方法依赖的package包/类
@Override
@FXThread
protected void reload() {
final float[] element = getPropertyValue();
final TextField valueField = getValueField();
final int caretPosition = valueField.getCaretPosition();
if (element == null) {
valueField.setText(StringUtils.EMPTY);
} else {
valueField.setText(ArrayUtils.toString(element, " ", false, false));
}
valueField.positionCaret(caretPosition);
}
示例2: reload
import javafx.scene.control.TextField; //导入方法依赖的package包/类
@Override
@FXThread
protected void reload() {
final int[] element = getPropertyValue();
final TextField valueField = getValueField();
final int caretPosition = valueField.getCaretPosition();
if (element == null) {
valueField.setText(StringUtils.EMPTY);
} else {
valueField.setText(ArrayUtils.toString(element, " ", false, false));
}
valueField.positionCaret(caretPosition);
}
示例3: processScroll
import javafx.scene.control.TextField; //导入方法依赖的package包/类
/**
* The process of scrolling value.
*/
private void processScroll(@NotNull final ScrollEvent event) {
if (!event.isControlDown()) return;
final TextField source = (TextField) event.getSource();
final String text = source.getText();
float value;
try {
value = parseFloat(text);
} catch (final NumberFormatException e) {
return;
}
long longValue = (long) (value * 1000);
longValue += event.getDeltaY() * 1;
final String result = String.valueOf(max(min(longValue / 1000F, 1F), 0F));
source.setText(result);
source.positionCaret(result.length());
processChange((KeyEvent) null);
}
示例4: reload
import javafx.scene.control.TextField; //导入方法依赖的package包/类
@Override
@FXThread
protected void reload() {
final String value = getPropertyValue();
final TextField valueField = getValueField();
final int caretPosition = valueField.getCaretPosition();
valueField.setText(value == null ? "" : value);
valueField.positionCaret(caretPosition);
}
示例5: reload
import javafx.scene.control.TextField; //导入方法依赖的package包/类
/**
* Reload this element.
*/
public void reload() {
final AlphaInfluencerControl control = getControl();
final AlphaInfluencer influencer = control.getInfluencer();
final Float alpha = influencer.getAlpha(getIndex());
final TextField editableControl = getEditableControl();
final int caretPosition = editableControl.getCaretPosition();
editableControl.setText(alpha.toString());
editableControl.positionCaret(caretPosition);
super.reload();
}