當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。