本文整理匯總了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();
}
}