• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java VerticalDirection类的典型用法和代码示例

java 3次浏览

本文整理汇总了Java中javafx.geometry.VerticalDirection的典型用法代码示例。如果您正苦于以下问题:Java VerticalDirection类的具体用法?Java VerticalDirection怎么用?Java VerticalDirection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

VerticalDirection类属于javafx.geometry包,在下文中一共展示了VerticalDirection类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testGestureDisabling

点赞 3

import javafx.geometry.VerticalDirection; //导入依赖的package包/类
@Test
public void testGestureDisabling() throws Exception {
	pane.setGestureEnabled(false);
	pane.zoomTo(2, pane.targetPointAtViewportCentre());
	Transform expected = target.captureTransform();
	FxRobot robot = new FxRobot();
	robot.moveTo(pane)
			.scroll(2, VerticalDirection.UP)
			.scroll(2, VerticalDirection.DOWN)
			.drag(MouseButton.PRIMARY).dropBy(100, 100);
	assertThat(target.captureTransform()).isEqualToComparingOnlyGivenFields(expected,
			"xx", "xy", "xz",
			"yx", "yy", "yz",
			"zx", "zy", "zz",
			"xt", "yt", "zt");
}
 

开发者ID:tom91136,
项目名称:GestureFX,
代码行数:17,
代码来源:GesturePaneTest.java

示例2: drag

点赞 3

import javafx.geometry.VerticalDirection; //导入依赖的package包/类
private void drag(MouseEvent e) {
  Node node = get();
  if (isEnable() && pressedCorner != null && e.isConsumed() == false && node != null) {
    double dx = e.getScreenX() - startX;
    if (pressedCorner.horizontal == HorizontalDirection.RIGHT) {
      width.set(MathUtil.toRange(startWidth + dx, minWidth.get(), maxWidth.get()));
    } else if (pressedCorner.horizontal == HorizontalDirection.LEFT) {
      width.set(MathUtil.toRange(startWidth - dx, minWidth.get(), maxWidth.get()));
      node.setLayoutX(startWidth + startPosX - width.get());
    }

    double dy = e.getScreenY() - startY;
    if (pressedCorner.vertical == VerticalDirection.DOWN) {
      height.set(MathUtil.toRange(startHeight + dy, minHeight.get(), maxHeight.get()));
    } else if (pressedCorner.vertical == VerticalDirection.UP) {
      height.set(MathUtil.toRange(startHeight - dy, minHeight.get(), maxHeight.get()));
      node.setLayoutY(startHeight + startPosY - height.get());
    }
    e.consume();
  }
}
 

开发者ID:XDean,
项目名称:JavaFX-EX,
代码行数:22,
代码来源:ResizeSupport.java

示例3: testScaleByScroll

点赞 3

import javafx.geometry.VerticalDirection; //导入依赖的package包/类
@Test
public void testScaleByScroll() throws Exception {
	pane.scrollModeProperty().set(ScrollMode.ZOOM);
	pane.zoomTo(5, pane.targetPointAtViewportCentre());
	FxRobot robot = new FxRobot();
	assertThat(pane.getCurrentXScale()).isEqualTo(5d);
	Thread.sleep(100);
	robot.moveTo(pane);
	robot.scroll(5, VerticalDirection.UP); // direction is platform dependent
	Thread.sleep(100);
	double expectedUp = 5 * Math.pow(1 + DEFAULT_SCROLL_FACTOR, 5);
	double expectedDown = 5 * Math.pow(1 - DEFAULT_SCROLL_FACTOR, 5);

	Condition<Double> eitherUpOrDown = new Condition<>(
			v -> Math.abs(v - expectedUp) < 0.01 || Math.abs(v - expectedDown) < 0.01,
			                                                  "either close to %s or %s",
			                                                  expectedUp, expectedDown);
	assertThat(pane.getCurrentXScale()).is(eitherUpOrDown);
	Transform t = target.captureTransform();
	assertThat(t.getMxx()).is(eitherUpOrDown);
	assertThat(t.getMyy()).is(eitherUpOrDown);
}
 

开发者ID:tom91136,
项目名称:GestureFX,
代码行数:23,
代码来源:GesturePaneTest.java

示例4: testOnScroll

点赞 2

import javafx.geometry.VerticalDirection; //导入依赖的package包/类
/**
 * Test zooming in by scrolling the mouse.
 */
@Test
public void testOnScroll() {
	double zoomPrevious;

	zoomPrevious = view.scale.getMxx();
	moveTo(view).scroll(VerticalDirection.UP).sleep(1, TimeUnit.SECONDS);
	assertTrue(view.scale.getMxx() > zoomPrevious);
	assertTrue(view.scale.getMyy() > zoomPrevious);

	zoomPrevious = view.scale.getMxx();
	moveTo(view).scroll(VerticalDirection.DOWN).sleep(1, TimeUnit.SECONDS);
	assertTrue(view.scale.getMxx() < zoomPrevious);
	assertTrue(view.scale.getMyy() < zoomPrevious);
}
 

开发者ID:ProgrammingLife2015,
项目名称:dnainator,
代码行数:18,
代码来源:PhylogeneticViewTest.java

示例5: testTextFieldScrolling

点赞 2

import javafx.geometry.VerticalDirection; //导入依赖的package包/类
/**
 * Testet Wertänderung durch Scrollen innerhalb von Textfeldern.
 */
@Test
public final void testTextFieldScrolling() {
	/*
	 * Zunächst vom Betriebssystem vorgegebene Scrollrichtung ermitteln.
	 * Kann z. B. unter Mac OS X frei festgelegt werden und ist standardmäßig umgekehrt, ergo verringert hochscrollen den Wert.
	 */
	click(hoursTextField);
	scroll(VerticalDirection.UP);
	final boolean scrollingUpIncreasesValue = hoursSlider.getValue() == 1.0;
	if (scrollingUpIncreasesValue) {
		// ursprünglichen Zustand wiederherstellen
		scroll(VerticalDirection.DOWN);
	}

	// Scrollrichtungen entsprechend definieren
	final VerticalDirection increaseValue = scrollingUpIncreasesValue ? VerticalDirection.UP : VerticalDirection.DOWN;
	final VerticalDirection decreaseValue = scrollingUpIncreasesValue ? VerticalDirection.DOWN : VerticalDirection.UP;

	// nun zum eigentlichen Test ...
	final TextFieldScrollingData[] testCases = new TextFieldScrollingData[] {
		new TextFieldScrollingData(minutesTextField, hoursTextField, hoursSlider),
		new TextFieldScrollingData(secondsTextField, minutesTextField, minutesSlider),
		new TextFieldScrollingData(hoursTextField, secondsTextField, secondsSlider),
	};

	for (final TextFieldScrollingData testCase : testCases) {
		click(testCase.focusedTextField); // anderes Feld fokussieren
		// Scrollen über Feld ohne Fokus hat keine Auswirkung
		move(testCase.textField);
		scroll(increaseValue);
		assertEquals(0.0, testCase.slider.getValue(), 0.0);

		click(testCase.textField); // richtiges Feld fokussieren
		scroll(increaseValue);
		assertEquals(1.0, testCase.slider.getValue(), 0.0);
		scroll(decreaseValue);
		assertEquals(0.0, testCase.slider.getValue(), 0.0);
	}
}
 

开发者ID:RMBLWorx,
项目名称:timey,
代码行数:43,
代码来源:TimePickerTest.java

示例6: Corner

点赞 2

import javafx.geometry.VerticalDirection; //导入依赖的package包/类
private Corner(Cursor cursor, HorizontalDirection horizontal, VerticalDirection vertical) {
  this.cursor = cursor;
  this.horizontal = horizontal;
  this.vertical = vertical;
}
 

开发者ID:XDean,
项目名称:JavaFX-EX,
代码行数:6,
代码来源:ResizeSupport.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)