本文整理汇总了Java中javafx.scene.input.ScrollEvent.isControlDown方法的典型用法代码示例。如果您正苦于以下问题:Java ScrollEvent.isControlDown方法的具体用法?Java ScrollEvent.isControlDown怎么用?Java ScrollEvent.isControlDown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.input.ScrollEvent
的用法示例。
在下文中一共展示了ScrollEvent.isControlDown方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processScroll
import javafx.scene.input.ScrollEvent; //导入方法依赖的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);
}
示例2: handle
import javafx.scene.input.ScrollEvent; //导入方法依赖的package包/类
@Override
public void handle(ScrollEvent scrollEvent) {
if (scrollEvent.isControlDown()) {
Point2D mousePos = new Point2D(scrollEvent.getSceneX(), scrollEvent.getSceneY());
Point2D scenePositionToCentreZoomAround = m_root.sceneToLocal(new Point2D(scrollEvent.getSceneX(), scrollEvent.getSceneY()));
final double scale = calculateScale(scrollEvent);
m_root.setScaleX(scale);
m_root.setScaleY(scale);
scrollTo(mousePos, scenePositionToCentreZoomAround);
scrollEvent.consume();
}
}
示例3: wheelZoom
import javafx.scene.input.ScrollEvent; //导入方法依赖的package包/类
/** Zoom in/out triggered by mouse wheel
* @param event Scroll event
*/
protected void wheelZoom(final ScrollEvent event)
{
// Invoked by mouse scroll wheel.
// Only allow zoom (with control), not pan.
if (! event.isControlDown())
return;
if (event.getDeltaY() > 0)
zoomInOut(event.getX(), event.getY(), 1.0/ZOOM_FACTOR);
else if (event.getDeltaY() < 0)
zoomInOut(event.getX(), event.getY(), ZOOM_FACTOR);
else
return;
event.consume();
}
示例4: processScroll
import javafx.scene.input.ScrollEvent; //导入方法依赖的package包/类
/**
* The process of scrolling.
*/
@FXThread
private void processScroll(@NotNull final Spinner<Double> spinner, @NotNull final ScrollEvent event) {
if (!event.isControlDown()) return;
final double deltaY = event.getDeltaY();
if (deltaY > 0) {
spinner.increment(1);
} else {
spinner.decrement(1);
}
}
示例5: handle
import javafx.scene.input.ScrollEvent; //导入方法依赖的package包/类
@Override
public void handle(ScrollEvent scrollEvent) {
if (scrollEvent.isControlDown()) {
final double scale = calculateScale(scrollEvent);
nodeToZoom.setScaleX(scale);
nodeToZoom.setScaleY(scale);
scrollEvent.consume();
}
}
示例6: onScroll
import javafx.scene.input.ScrollEvent; //导入方法依赖的package包/类
/**
* Invoked if the mouse wheel scrolls.
*
* @param pScrollEvent the event.
*/
private void onScroll(ScrollEvent pScrollEvent)
{
if (pScrollEvent.isControlDown())
{
pScrollEvent.consume();
double turns = pScrollEvent.getDeltaY() / pScrollEvent.getMultiplierY();
Point2D mousePoint = sceneToLocal(pScrollEvent.getSceneX(), pScrollEvent.getSceneY());
zoom((int)turns, mousePoint.getX(), mousePoint.getY());
}
}
示例7: handle
import javafx.scene.input.ScrollEvent; //导入方法依赖的package包/类
@Override
public void handle(ScrollEvent scrollEvent) {
if (scrollEvent.isControlDown()) {
final double scale = calculateScale(scrollEvent);
nodeToZoom.setScaleX(scale);
nodeToZoom.setScaleY(scale);
scrollEvent.consume();
}
}