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();
}
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();
}
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();
}
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();
}
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;
}
});
}
Aggregations