本文整理了Java中javafx.scene.control.ListView.scrollTo()
方法的一些代码示例,展示了ListView.scrollTo()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ListView.scrollTo()
方法的具体详情如下:
包路径:javafx.scene.control.ListView
类名称:ListView
方法名:scrollTo
暂无
代码示例来源:origin: jfoenixadmin/JFoenix
private final void scrollToYear() {
int yearIndex = Integer.parseInt(selectedYearLabel.getText()) - 1900 - 2;
yearsListView.scrollTo(yearIndex >= 0 ? yearIndex : yearIndex + 2);
}
代码示例来源:origin: speedment/speedment
private Button addButton(final ListView<String> listView) {
final Button button = new Button("Add Item", FontAwesome.PLUS.view());
button.setOnAction(e -> {
final int newIndex = listView.getItems().size();
final Set<String> set = new HashSet<>(strings);
final AtomicInteger i = new AtomicInteger(0);
while (!set.add(DEFAULT_FIELD + i.incrementAndGet())) {}
listView.getItems().add(DEFAULT_FIELD + i.get());
listView.scrollTo(newIndex);
listView.getSelectionModel().select(newIndex);
// There is a strange behavior in JavaFX if you try to start editing
// a field on the same animation frame as another field lost focus.
// Therefore, we wait one animation cycle before setting the field
// into the editing state
runLater(() -> listView.edit(newIndex));
});
return button;
}
代码示例来源:origin: jfoenixadmin/JFoenix
@Override
protected void layoutChildren() {
super.layoutChildren();
if (itemChanged) {
if (suggestionList.getItems().size() > 0) {
suggestionList.getSelectionModel().select(0);
suggestionList.scrollTo(0);
}
itemChanged = false;
}
}
};
代码示例来源:origin: pmd/pmd
private void moveItem(int direction) {
// Checking selected item
if (fileListView.getSelectionModel().getSelectedItem() == null) {
return;
}
// Calculate new index using move direction
int newIndex = fileListView.getSelectionModel().getSelectedIndex() + direction;
if (newIndex < 0 || newIndex >= fileListView.getItems().size()) {
return;
}
File selected = fileListView.getSelectionModel().getSelectedItem();
// Removing removable element
fileListView.getItems().remove(selected);
// Insert it in new position
fileListView.getItems().add(newIndex, selected);
//Restore Selection
fileListView.scrollTo(newIndex);
fileListView.getSelectionModel().select(newIndex);
}
代码示例来源:origin: com.jfoenix/jfoenix
private final void scrollToYear() {
int yearIndex = Integer.parseInt(selectedYearLabel.getText()) - 1900 - 2;
yearsListView.scrollTo(yearIndex >= 0 ? yearIndex : yearIndex + 2);
}
代码示例来源:origin: org.controlsfx/controlsfx
@Override public void run() {
listView.scrollTo(selection);
listView.getSelectionModel().select(selection);
}
});
代码示例来源:origin: Tristan971/Lyrebird
/**
* Requests loading of older tweets.
*/
private void loadMoreTweets() {
getOldestTweetLoaded().ifPresent(oldestStatus -> {
getLogger().debug("Loading tweets before {}", oldestStatus.getId());
timelineBase.loadMoreTweets(oldestStatus.getId());
listView.scrollTo(oldestStatus);
});
}
代码示例来源:origin: at.bestsolution.eclipse/org.eclipse.fx.text.ui
private void updateProposals() {
List<ICompletionProposal> list = this.proposalComputer.apply(new ContentAssistContextData(this.offset,this.viewer.getDocument()/*,prefix*/));
if( ! list.isEmpty() ) {
this.proposalList.setItems(FXCollections.observableArrayList(list));
this.proposalList.scrollTo(0);
this.proposalList.getSelectionModel().select(0);
} else {
this.stage.hide();
}
}
代码示例来源:origin: com.jfoenix/jfoenix
@Override
protected void layoutChildren() {
super.layoutChildren();
if (itemChanged) {
if (suggestionList.getItems().size() > 0) {
suggestionList.getSelectionModel().select(0);
suggestionList.scrollTo(0);
}
itemChanged = false;
}
}
};
代码示例来源:origin: PhoenicisOrg/phoenicis
@Override
protected void drawStepContent() {
super.drawStepContent();
listViewWidget.setItems(FXCollections.observableArrayList(menuItems));
if (defaultValue != null) {
int idx = menuItems.indexOf(defaultValue);
if (idx != -1) {
listViewWidget.getSelectionModel().select(idx);
listViewWidget.getFocusModel().focus(idx);
listViewWidget.scrollTo(idx);
}
if (StringUtils.isBlank(defaultValue)) {
setNextButtonEnabled(false);
listViewWidget.getSelectionModel().selectedItemProperty()
.addListener((observable, oldValue, newValue) -> {
if (StringUtils.isBlank(newValue)) {
setNextButtonEnabled(false);
} else {
setNextButtonEnabled(true);
}
});
}
}
this.addToContentPane(listViewWidget);
}
代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.dialogs
v.setItems(FXCollections.observableArrayList(Font.getFamilies()));
v.getSelectionModel().select(this.font.get().getFamily());
v.scrollTo(this.font.get().getFamily());
v.setPrefHeight(250);
v.scrollTo(posture);
v.setPrefWidth(120);
v.setPrefHeight(250);
代码示例来源:origin: stackoverflow.com
last_value = maxScroll;
list.scrollTo((int) last_value);
内容来源于网络,如有侵权,请联系作者删除!