use of javafx.scene.input.MouseEvent in project Gargoyle by callakrsos.
the class FXMLTextView method show.
public void show(double width, double height) throws IOException {
btnClose.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent event) {
close();
}
});
Scene scene = new Scene(this, width, height);
stage.setScene(scene);
stage.initModality(Modality.APPLICATION_MODAL);
stage.initOwner(SharedMemory.getPrimaryStage());
stage.show();
}
use of javafx.scene.input.MouseEvent in project Gargoyle by callakrsos.
the class JavaTextView method show.
public void show(Window root, double width, double height) throws IOException {
btnClose.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent event) {
close();
}
});
Scene scene = new Scene(this, width, height);
stage.setTitle("JavaTextView Popup");
stage.setScene(scene);
// stage.initModality(Modality.APPLICATION_MODAL);
stage.initOwner(root);
stage.show();
}
use of javafx.scene.input.MouseEvent in project Gargoyle by callakrsos.
the class VoEditorController method initialize.
/**
* 이벤트 초기화
*
* @작성자 : KYJ
* @작성일 : 2015. 10. 15.
*/
@FXML
public void initialize() {
colType.setCellFactory(new ClassTypeCheckBoxCellFactory());
colName.setCellFactory(TextFieldTableCell.forTableColumn());
colSize.setCellFactory(TextFieldTableCell.forTableColumn());
colDesc.setCellFactory(TextFieldTableCell.forTableColumn());
CommonsContextMenu.addMenus(tbVoEditor, (Menus.useCudButtons() | Menus.UP | Menus.DOWN));
// tbVoEditor.setContextMenu();
tbVoEditor.addEventHandler(ActionEvent.ACTION, event -> {
if (event instanceof CommonContextMenuEvent) {
CommonContextMenuEvent _event = (CommonContextMenuEvent) event;
int mode = _event.getMode();
ObservableList<TableModelDVO> items = tbVoEditor.getItems();
int selectedIndex = tbVoEditor.getSelectionModel().getSelectedIndex();
int rowSize = items.size();
boolean isMove = false;
if (Menus.isAdd(mode)) {
items.add(defaultTableModelDVO());
isMove = true;
} else if (Menus.isDelete(mode)) {
items.remove(selectedIndex);
isMove = true;
} else if (Menus.isUp(mode)) {
btnUpOnMouseClick();
} else if (Menus.isDown(mode)) {
btnDownOnMouseClick();
}
if (isMove) {
tbVoEditor.getSelectionModel().select(rowSize - 1);
}
}
});
// 컨트롤 키를 누르면 그리드 데이터 이동처리.
tbVoEditor.setOnKeyPressed(event -> {
if (event.isControlDown()) {
KeyCode code = event.getCode();
switch(code) {
case UP:
btnUpOnMouseClick();
break;
case DOWN:
btnDownOnMouseClick();
break;
default:
break;
}
event.consume();
}
});
btnGenerate.addEventHandler(MouseEvent.MOUSE_CLICKED, this::btnGenerateOnMouseClick);
btnSelect.setOnMouseClicked(this::btnSelectOnMouseClick);
btnDatabase.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent event) {
DatabaseTableView databaseTableView = new DatabaseTableView();
TableDVO show = databaseTableView.show();
if (show != null) {
TableMasterDVO tableMasterDVO = show.getTableMasterDVO();
List<TableModelDVO> tableModelDVOList = show.getTableModelDVOList();
ObservableList<TableModelDVO> items = tbVoEditor.getItems();
if (tableMasterDVO != null) {
txtClassName.setText(tableMasterDVO.getClassName());
txtAreaDesc.setText(tableMasterDVO.getDescription());
}
if (tableModelDVOList != null) {
items.clear();
items.addAll(tableModelDVOList);
}
}
}
});
}
use of javafx.scene.input.MouseEvent in project arquivoProject by fader-azevedo.
the class ListaEstanteController method configurarPainel.
private void configurarPainel(StackPane root) {
paneRegistarEstante = new VBox();
paneRegistarEstante.setPrefSize(boxBounds.getWidth(), boxBounds.getHeight());
paneRegistarEstante.setAlignment(Pos.TOP_RIGHT);
StackPane sp1 = new StackPane();
sp1.setPadding(new Insets(30, 10, 10, 10));
sp1.setAlignment(Pos.TOP_LEFT);
sp1.getStyleClass().add("paneAddNew");
sp1.setPrefSize(boxBounds.getWidth(), boxBounds.getHeight() - ACTION_BOX_HGT);
/*Criando campos de registo*/
JFXTextField txtCodiggo = new JFXTextField();
txtCodiggo.setPromptText("Código");
txtCodiggo.setFocusColor(Paint.valueOf("#a17878"));
txtCodiggo.setUnFocusColor(Paint.valueOf("#a17878"));
txtCodiggo.setLabelFloat(true);
JFXTextArea txtDesc = new JFXTextArea();
txtDesc.setPromptText("Descrição");
txtDesc.setPrefHeight(35);
txtDesc.setWrapText(true);
txtDesc.setPadding(new Insets(0, 5, 0, 5));
txtDesc.setFocusColor(Paint.valueOf("#a17878"));
txtDesc.setUnFocusColor(Paint.valueOf("#a17878"));
txtDesc.setLabelFloat(true);
JFXButton btnSalvar = new JFXButton("Salvar");
MaterialDesignIconView icon = new MaterialDesignIconView(MaterialDesignIcon.CONTENT_SAVE, "20");
icon.setFill(Paint.valueOf("#179e41"));
btnSalvar.setContentDisplay(ContentDisplay.LEFT);
btnSalvar.setGraphic(icon);
btnSalvar.getStyleClass().add("btns");
btnSalvar.setOnAction(e -> {
if (txtCodiggo.getText().isEmpty() || txtCodiggo.getText().isEmpty()) {
db.alertInfo("Preenche todos campos");
return;
}
Calendar c = Calendar.getInstance();
Estante est = new Estante(1, db.tratamento(txtCodiggo.getText().trim()), db.tratamento(txtDesc.getText().trim()), c.getTime());
db.salvar(est);
txtCodiggo.setText("");
txtDesc.setText("");
pnButoes.getChildren().clear();
pnButoes.getChildren().add(scrollBtsEstante());
});
HBox hboxBut = new HBox(btnSalvar);
hboxBut.setPadding(new Insets(12, 8, 0, 0));
hboxBut.setAlignment(Pos.CENTER_RIGHT);
VBox txts = new VBox(txtCodiggo, txtDesc, hboxBut);
txts.getChildren().get(2).setLayoutX(ACTION_BOX_HGT);
txts.setSpacing(20);
sp1.getChildren().add(txts);
StackPane sp2 = new StackPane();
sp2.setPrefSize(130, ACTION_BOX_HGT);
sp2.getChildren().add(lbAdicionarEstante);
sp2.getStyleClass().add("sp");
sp2.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent paramT) {
togglePaneVisibility();
}
});
paneRegistarEstante.getChildren().addAll(GroupBuilder.create().children(sp1).build(), GroupBuilder.create().children(sp2).build());
root.getChildren().add(GroupBuilder.create().children(paneRegistarEstante).build());
}
use of javafx.scene.input.MouseEvent in project org.csstudio.display.builder by kasemir.
the class Tracker method hookEvents.
void hookEvents() {
tracker.setCursor(Cursor.MOVE);
tracker.addEventHandler(MouseEvent.MOUSE_PRESSED, this::mousePressed);
tracker.setOnMouseDragged((MouseEvent event) -> {
if (start_x < 0)
return;
double dx = event.getX() - start_x, dy = event.getY() - start_y;
if (event.isShiftDown()) {
// Restrict to horizontal or vertical move
if (Math.abs(dx) > Math.abs(dy))
dy = 0;
else
dx = 0;
}
final Point2D pos = constrain(orig.getMinX() + dx, orig.getMinY() + dy);
setPosition(pos.getX(), pos.getY(), orig.getWidth(), orig.getHeight());
});
tracker.addEventHandler(MouseEvent.MOUSE_RELEASED, this::mouseReleased);
tracker.setOnKeyPressed(this::handleKeyEvent);
// Keep the keyboard focus to actually get key events.
// The RTImagePlot will also listen to mouse moves and try to keep the focus,
// so the active tracker uses an event filter to have higher priority
tracker.addEventFilter(MouseEvent.MOUSE_MOVED, event -> {
event.consume();
tracker.requestFocus();
});
handle_top_left.setCursor(Cursor.NW_RESIZE);
handle_top_left.setOnMouseDragged((MouseEvent event) -> {
if (start_x < 0)
return;
final double dx = event.getX() - start_x, dy = event.getY() - start_y;
final Point2D tl = constrain(orig.getMinX() + dx, orig.getMinY() + dy);
setPosition(tl.getX(), tl.getY(), orig.getWidth() - (tl.getX() - orig.getMinX()), orig.getHeight() - (tl.getY() - orig.getMinY()));
});
handle_top.setCursor(Cursor.N_RESIZE);
handle_top.setOnMouseDragged((MouseEvent event) -> {
if (start_x < 0)
return;
final double dy = event.getY() - start_y;
final Point2D t = constrain(orig.getMinX(), orig.getMinY() + dy);
setPosition(t.getX(), t.getY(), orig.getWidth() - (t.getX() - orig.getMinX()), orig.getHeight() - (t.getY() - orig.getMinY()));
});
handle_top_right.setCursor(Cursor.NE_RESIZE);
handle_top_right.setOnMouseDragged((MouseEvent event) -> {
if (start_x < 0)
return;
final double dx = event.getX() - start_x, dy = event.getY() - start_y;
final Point2D tr = constrain(orig.getMinX() + orig.getWidth() + dx, orig.getMinY() + dy);
setPosition(orig.getMinX(), tr.getY(), tr.getX() - orig.getMinX(), orig.getHeight() - (tr.getY() - orig.getMinY()));
});
handle_right.setCursor(Cursor.E_RESIZE);
handle_right.setOnMouseDragged((MouseEvent event) -> {
if (start_x < 0)
return;
final double dx = event.getX() - start_x;
final Point2D r = constrain(orig.getMinX() + orig.getWidth() + dx, orig.getMinY());
setPosition(orig.getMinX(), orig.getMinY(), r.getX() - orig.getMinX(), orig.getHeight());
});
handle_bottom_right.setCursor(Cursor.SE_RESIZE);
handle_bottom_right.setOnMouseDragged((MouseEvent event) -> {
if (start_x < 0)
return;
final double dx = event.getX() - start_x, dy = event.getY() - start_y;
final Point2D br = constrain(orig.getMinX() + orig.getWidth() + dx, orig.getMinY() + orig.getHeight() + dy);
setPosition(orig.getMinX(), orig.getMinY(), br.getX() - orig.getMinX(), br.getY() - orig.getMinY());
});
handle_bottom.setCursor(Cursor.S_RESIZE);
handle_bottom.setOnMouseDragged((MouseEvent event) -> {
if (start_x < 0)
return;
final double dy = event.getY() - start_y;
final Point2D b = constrain(orig.getMinX(), orig.getMinY() + orig.getHeight() + dy);
setPosition(orig.getMinX(), orig.getMinY(), orig.getWidth(), b.getY() - orig.getMinY());
});
handle_bottom_left.setCursor(Cursor.SW_RESIZE);
handle_bottom_left.setOnMouseDragged((MouseEvent event) -> {
if (start_x < 0)
return;
final double dx = event.getX() - start_x, dy = event.getY() - start_y;
final Point2D bl = constrain(orig.getMinX() + dx, orig.getMinY() + orig.getHeight() + dy);
setPosition(bl.getX(), orig.getMinY(), orig.getWidth() - (bl.getX() - orig.getMinX()), bl.getY() - orig.getMinY());
});
handle_left.setCursor(Cursor.W_RESIZE);
handle_left.setOnMouseDragged((MouseEvent event) -> {
if (start_x < 0)
return;
final double dx = event.getX() - start_x;
final Point2D l = constrain(orig.getMinX() + dx, orig.getMinY());
setPosition(l.getX(), orig.getMinY(), orig.getWidth() - (l.getX() - orig.getMinX()), orig.getHeight());
});
}
Aggregations