当前位置: 首页>>代码示例>>Java>>正文


Java ScrollEvent.isControlDown方法代码示例

本文整理汇总了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);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:26,代码来源:AlphaInterpolationElement.java

示例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();
    }
}
 
开发者ID:quiram,项目名称:build-hotspots,代码行数:17,代码来源:BuildHotspotsApplicationBase.java

示例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();
}
 
开发者ID:kasemir,项目名称:org.csstudio.display.builder,代码行数:19,代码来源:PlotCanvasBase.java

示例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);
    }
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:16,代码来源:SettingsDialog.java

示例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();
	}
}
 
开发者ID:bdh92123,项目名称:share_all,代码行数:10,代码来源:RoomController.java

示例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());
	}
}
 
开发者ID:ivartanian,项目名称:JVx.javafx,代码行数:18,代码来源:FXZoomRegion.java

示例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();
    }
}
 
开发者ID:SaiPradeepDandem,项目名称:javafx-demos,代码行数:10,代码来源:ZoomApp.java


注:本文中的javafx.scene.input.ScrollEvent.isControlDown方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。