Search in sources :

Example 16 with KeyCode

use of javafx.scene.input.KeyCode in project Gargoyle by callakrsos.

the class TextSearchAndReplaceView method show.

/**
	 *
	 *
	 * @Date 2015. 10. 21.
	 * @throws IOException
	 * @User KYJ
	 */
public void show() {
    Stage stage = new Stage();
    LOGGER.debug("SHOW SimpleSQLResult View.....");
    LOGGER.debug("call executeSQL function....");
    Scene scene = new Scene(this);
    stage.setScene(scene);
    stage.setResizable(false);
    // stage.setAlwaysOnTop(true);
    stage.initModality(Modality.NONE);
    stage.initOwner(parent.getScene().getWindow());
    stage.setTitle(tabPane.getSelectionModel().getSelectedItem().getText());
    tabPane.getSelectionModel().selectedItemProperty().addListener((oba, oldval, newval) -> {
        String text = newval.getText();
        stage.setTitle(text);
    });
    // esc키를 누르면 팝업 close
    stage.addEventHandler(KeyEvent.ANY, event -> {
        KeyCode code = event.getCode();
        if (KeyCode.ESCAPE == code) {
            event.consume();
            stage.close();
        }
    });
    stage.centerOnScreen();
    stage.showAndWait();
}
Also used : Stage(javafx.stage.Stage) KeyCode(javafx.scene.input.KeyCode) Scene(javafx.scene.Scene)

Example 17 with KeyCode

use of javafx.scene.input.KeyCode in project Gargoyle by callakrsos.

the class TextSearchComposite method show.

/**
	 *
	 *
	 * @Date 2015. 10. 21.
	 * @throws IOException
	 * @User KYJ
	 */
public void show() {
    Stage stage = new Stage();
    LOGGER.debug("SHOW SimpleSQLResult View.....");
    LOGGER.debug("call executeSQL function....");
    Scene scene = new Scene(this);
    stage.setScene(scene);
    stage.setResizable(false);
    // stage.setAlwaysOnTop(true);
    stage.initModality(Modality.NONE);
    stage.initOwner(parent.getScene().getWindow());
    stage.setTitle(tabPane.getSelectionModel().getSelectedItem().getText());
    tabPane.getSelectionModel().selectedItemProperty().addListener((oba, oldval, newval) -> {
        String text = newval.getText();
        stage.setTitle(text);
    });
    // esc키를 누르면 팝업 close
    stage.addEventHandler(KeyEvent.ANY, event -> {
        KeyCode code = event.getCode();
        if (KeyCode.ESCAPE == code) {
            event.consume();
            stage.close();
        }
    });
    stage.centerOnScreen();
    stage.showAndWait();
}
Also used : Stage(javafx.stage.Stage) KeyCode(javafx.scene.input.KeyCode) Scene(javafx.scene.Scene)

Example 18 with KeyCode

use of javafx.scene.input.KeyCode in project Gargoyle by callakrsos.

the class PagedTextSearchAndReplaceView method show.

/**
	 *
	 *
	 * @Date 2015. 10. 21.
	 * @throws IOException
	 * @User KYJ
	 */
public void show() {
    Stage stage = new Stage();
    LOGGER.debug("SHOW SimpleSQLResult View.....");
    LOGGER.debug("call executeSQL function....");
    Scene scene = new Scene(this);
    stage.setScene(scene);
    stage.setResizable(false);
    // stage.setAlwaysOnTop(true);
    stage.initModality(Modality.NONE);
    stage.initOwner(parent.getScene().getWindow());
    stage.setTitle(tabPane.getSelectionModel().getSelectedItem().getText());
    tabPane.getSelectionModel().selectedItemProperty().addListener((oba, oldval, newval) -> {
        String text = newval.getText();
        stage.setTitle(text);
    });
    // esc키를 누르면 팝업 close
    stage.addEventHandler(KeyEvent.ANY, event -> {
        KeyCode code = event.getCode();
        if (KeyCode.ESCAPE == code) {
            event.consume();
            stage.close();
        }
    });
    stage.centerOnScreen();
    stage.showAndWait();
}
Also used : Stage(javafx.stage.Stage) KeyCode(javafx.scene.input.KeyCode) Scene(javafx.scene.Scene)

Example 19 with KeyCode

use of javafx.scene.input.KeyCode in project Gargoyle by callakrsos.

the class VariableMappingView method showAndWait.

public void showAndWait(Consumer<Map<String, Object>> resultItem) {
    Stage dialog = new Stage();
    dialog.setScene(new Scene(this));
    Button value2 = new Button("Mapping");
    value2.setPrefWidth(300);
    value2.setOnMouseClicked(e -> {
        doMapping(resultItem);
        dialog.close();
    });
    HBox value3 = new HBox(value2);
    value3.setPrefWidth(HBox.USE_COMPUTED_SIZE);
    value3.setPrefHeight(HBox.USE_COMPUTED_SIZE);
    value3.setAlignment(Pos.CENTER);
    value3.setPadding(new Insets(5, 5, 5, 5));
    this.setBottom(value3);
    dialog.setTitle(TITLE);
    dialog.initModality(Modality.APPLICATION_MODAL);
    dialog.initStyle(StageStyle.UTILITY);
    if (parentStage != null)
        dialog.initOwner(parentStage);
    dialog.setResizable(false);
    dialog.addEventHandler(KeyEvent.KEY_RELEASED, event -> {
        KeyCode code = event.getCode();
        if (KeyCode.ESCAPE == code) {
            dialog.close();
            event.consume();
        }
    });
    dialog.showAndWait();
}
Also used : HBox(javafx.scene.layout.HBox) Insets(javafx.geometry.Insets) Button(javafx.scene.control.Button) Stage(javafx.stage.Stage) KeyCode(javafx.scene.input.KeyCode) Scene(javafx.scene.Scene)

Example 20 with KeyCode

use of javafx.scene.input.KeyCode in project Gargoyle by callakrsos.

the class Drag3DObject method loadControls.

private void loadControls(Scene scene) {
    //First person shooter keyboard movement  
    scene.setOnKeyPressed(event -> {
        double change = 10.0;
        if (event.isShiftDown()) {
            change = 50.0;
        }
        KeyCode keycode = event.getCode();
        if (keycode == KeyCode.W) {
            camera.setTranslateZ(camera.getTranslateZ() + change);
        }
        if (keycode == KeyCode.S) {
            camera.setTranslateZ(camera.getTranslateZ() - change);
        }
        if (keycode == KeyCode.A) {
            camera.setTranslateX(camera.getTranslateX() - change);
        }
        if (keycode == KeyCode.D) {
            camera.setTranslateX(camera.getTranslateX() + change);
        }
    });
    scene.setOnMousePressed((MouseEvent me) -> {
        mousePosX = me.getSceneX();
        mousePosY = me.getSceneY();
        mouseOldX = me.getSceneX();
        mouseOldY = me.getSceneY();
        PickResult pr = me.getPickResult();
        if (pr != null && pr.getIntersectedNode() != null && pr.getIntersectedNode() instanceof Sphere) {
            distance = pr.getIntersectedDistance();
            s = (Sphere) pr.getIntersectedNode();
            isPicking = true;
            vecIni = unProjectDirection(mousePosX, mousePosY, scene.getWidth(), scene.getHeight());
        }
    });
    scene.setOnMouseDragged((MouseEvent me) -> {
        mouseOldX = mousePosX;
        mouseOldY = mousePosY;
        mousePosX = me.getSceneX();
        mousePosY = me.getSceneY();
        mouseDeltaX = (mousePosX - mouseOldX);
        mouseDeltaY = (mousePosY - mouseOldY);
        if (RUN_JASON) {
            //objPos += mouseMovementx*scale*RightAxis 
            if (isPicking) {
                if (mousePosX < mouseOldX) {
                    System.out.println("moving left");
                    Point3D pos = CameraHelper.pickProjectPlane(camera, mousePosX, mousePosY);
                    s.setTranslateX(s.getTranslateX() + (pos.getX() - mouseOldX) * camera.getNearClip());
                    return;
                } else if (mousePosX > mouseOldX) {
                    System.err.println("moving right");
                    Point3D pos = CameraHelper.pickProjectPlane(camera, mousePosX, mousePosY);
                    s.setTranslateX(s.getTranslateX() - (pos.getX() - mouseOldX) * camera.getNearClip());
                    return;
                }
                if (mousePosY < mouseOldY) {
                    System.out.println("moving up");
                } else if (mousePosY > mouseOldY) {
                    System.err.println("moving down");
                }
                return;
            }
        } else {
            if (isPicking) {
                double modifier = (me.isControlDown() ? 0.2 : me.isAltDown() ? 2.0 : 1) * (30d / camera.getFieldOfView());
                modifier *= (30d / camera.getFieldOfView());
                vecPos = unProjectDirection(mousePosX, mousePosY, scene.getWidth(), scene.getHeight());
                Point3D p = new Point3D(distance * (vecPos.x - vecIni.x), distance * (vecPos.y - vecIni.y), distance * (vecPos.z - vecIni.z));
                s.getTransforms().add(new Translate(modifier * p.getX(), 0, modifier * p.getZ()));
                vecIni = vecPos;
            } else {
                double modifier = 10.0;
                double modifierFactor = 0.1;
                if (me.isControlDown()) {
                    modifier = 0.1;
                }
                if (me.isShiftDown()) {
                    modifier = 50.0;
                }
                if (me.isPrimaryButtonDown()) {
                    cameraTransform.ry.setAngle(// + 
                    ((cameraTransform.ry.getAngle() + mouseDeltaX * modifierFactor * modifier * 2.0) % 360 + 540) % 360 - 180);
                    cameraTransform.rx.setAngle(// - 
                    ((cameraTransform.rx.getAngle() - mouseDeltaY * modifierFactor * modifier * 2.0) % 360 + 540) % 360 - 180);
                } else if (me.isSecondaryButtonDown()) {
                    double z = camera.getTranslateZ();
                    double newZ = z + mouseDeltaX * modifierFactor * modifier;
                    camera.setTranslateZ(newZ);
                } else if (me.isMiddleButtonDown()) {
                    // - 
                    cameraTransform.t.setX(cameraTransform.t.getX() + mouseDeltaX * modifierFactor * modifier * 0.3);
                    // - 
                    cameraTransform.t.setY(cameraTransform.t.getY() + mouseDeltaY * modifierFactor * modifier * 0.3);
                }
            }
        }
    });
    scene.setOnMouseReleased((MouseEvent me) -> {
        if (isPicking) {
            isPicking = false;
        }
    });
}
Also used : Sphere(javafx.scene.shape.Sphere) MouseEvent(javafx.scene.input.MouseEvent) Point3D(javafx.geometry.Point3D) PickResult(javafx.scene.input.PickResult) KeyCode(javafx.scene.input.KeyCode) Translate(javafx.scene.transform.Translate)

Aggregations

KeyCode (javafx.scene.input.KeyCode)48 Scene (javafx.scene.Scene)36 PerspectiveCamera (javafx.scene.PerspectiveCamera)31 MouseEvent (javafx.scene.input.MouseEvent)30 Group (javafx.scene.Group)29 PointLight (javafx.scene.PointLight)24 Rotate (javafx.scene.transform.Rotate)23 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)16 AnimationTimer (javafx.animation.AnimationTimer)14 Point3D (org.fxyz.geometry.Point3D)11 Translate (javafx.scene.transform.Translate)10 ArrayList (java.util.ArrayList)9 AmbientLight (javafx.scene.AmbientLight)8 Sphere (javafx.scene.shape.Sphere)8 Color (javafx.scene.paint.Color)7 OBJWriter (org.fxyz.utils.OBJWriter)7 KeyFrame (javafx.animation.KeyFrame)6 KeyValue (javafx.animation.KeyValue)6 Timeline (javafx.animation.Timeline)6 PhongMaterial (javafx.scene.paint.PhongMaterial)6