本文整理匯總了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();
}