本文整理汇总了Java中javafx.scene.control.ScrollBar.getMax方法的典型用法代码示例。如果您正苦于以下问题:Java ScrollBar.getMax方法的具体用法?Java ScrollBar.getMax怎么用?Java ScrollBar.getMax使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.ScrollBar
的用法示例。
在下文中一共展示了ScrollBar.getMax方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawNode
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
@Override
public Node drawNode() {
ScrollBar scroll = createScroll(0, 100, vertical);
scroll.setValue(50);
scroll.setBlockIncrement(20);
double new_value = scroll.getValue();
double desired = scroll.getMin() + position * (scroll.getMax() - scroll.getMin());
int direction = Double.compare(new_value, desired);
scroll.adjustValue(position);
if (direction != 0 && !Double.isNaN(position)) {
double increment = scroll.getBlockIncrement();
if (Math.abs(desired - new_value) < increment) {
new_value = desired;
} else {
if (direction == 1) {
new_value -= increment;
} else {
new_value += increment;
}
}
if (new_value < scroll.getMin()) {
new_value = scroll.getMin();
}
if (new_value > scroll.getMax()) {
new_value = scroll.getMax();
}
if (Double.compare(scroll.getValue(), new_value) != 0) {
reportGetterFailure("ScrollBar.adjustValue()");
}
}
return scroll;
}
示例2: scrolled
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
void scrolled(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
double value = newValue.doubleValue();
//System.out.println("Scrolled to " + value);
ScrollBar bar = getVerticalScrollbar(tableView);
if (value == bar.getMax()) {
//System.out.println("Adding new persons.");
//double targetValue = value * items.size();
//addPersons();
//bar.setValue(targetValue / items.size());
}
}
示例3: scrolled
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
void scrolled(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
double value = newValue.doubleValue();
System.out.println("Scrolled to " + value);
ScrollBar bar = getVerticalScrollbar(table);
if (value == bar.getMax()) {
System.out.println("Adding new persons.");
double targetValue = value * items.size();
addPersons();
bar.setValue(targetValue / items.size());
}
}
示例4: createChangeListener
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
private ListChangeListener<IMatchBlock> createChangeListener(final TableItem tableItem, final LongProperty previousSelectionTime) {
return new ListChangeListener<IMatchBlock>() {
@Override
public void onChanged(Change<? extends IMatchBlock> c) {
if (c.next()) {
if (!tableItem.getPane().getMatchSelection().isEmpty())
tableView.getSelectionModel().select(tableItem);
}
if (System.currentTimeMillis() - 200 > previousSelectionTime.get()) { // only if sufficient time has passed since last scroll...
final double focusCoordinate;
int focusIndex = tableItem.getPane().getMatchSelection().getFocusIndex();
if (focusIndex >= 0) {
IMatchBlock focusMatch = tableItem.getPane().getMatchSelection().getItems()[focusIndex];
focusCoordinate = 0.5 * (focusMatch.getAlignedQueryStart() + focusMatch.getAlignedQueryEnd());
double leadingWidth = 0;
double lastWidth = 0;
double totalWidth = 0;
{
int numberOfColumns = tableView.getColumns().size();
int columns = 0;
for (TableColumn col : tableView.getColumns()) {
if (col.isVisible()) {
if (columns < numberOfColumns - 1)
leadingWidth += col.getWidth();
else
lastWidth = col.getWidth();
totalWidth += col.getWidth();
}
columns++;
}
}
final double coordinateToShow = leadingWidth + lastWidth * (focusCoordinate / maxReadLength.get());
final ScrollBar hScrollBar = FXUtilities.findScrollBar(tableView, Orientation.HORIZONTAL);
if (hScrollBar != null) { // should never be null, but best to check...
final double newPos = (hScrollBar.getMax() - hScrollBar.getMin()) * ((coordinateToShow) / totalWidth);
Platform.runLater(new Runnable() {
@Override
public void run() {
tableView.scrollTo(tableItem);
hScrollBar.setValue(newPos);
}
});
}
}
}
previousSelectionTime.set(System.currentTimeMillis());
}
};
}
示例5: scrollTo
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
private void scrollTo( ScrollBar scrollBar, double v ) {
double newValue = v;
if( newValue < scrollBar.getMin() ) newValue = scrollBar.getMin();
if( scrollBar.getMax() < newValue ) newValue = scrollBar.getMax();
scrollBar.setValue( newValue );
}