本文整理匯總了Java中javafx.scene.input.MouseEvent.MOUSE_RELEASED屬性的典型用法代碼示例。如果您正苦於以下問題:Java MouseEvent.MOUSE_RELEASED屬性的具體用法?Java MouseEvent.MOUSE_RELEASED怎麽用?Java MouseEvent.MOUSE_RELEASED使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類javafx.scene.input.MouseEvent
的用法示例。
在下文中一共展示了MouseEvent.MOUSE_RELEASED屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: handle
@Override
public void handle(MouseEvent event) {
if(event.getEventType()==MouseEvent.MOUSE_MOVED){
move.handle(event.getX(),event.getY());
}else if(event.getEventType()==MouseEvent.MOUSE_PRESSED){
if(event.getButton()==MouseButton.PRIMARY){
press.handle(event.getX(),event.getY());
}else if(event.getButton()==MouseButton.SECONDARY){
rightPress.handle(event.getX(),event.getY());
}
}else if(event.getEventType()==MouseEvent.MOUSE_RELEASED){
if(event.getButton()==MouseButton.PRIMARY){
release.handle(event.getX(),event.getY());
}else if(event.getButton()==MouseButton.SECONDARY){
rightRelease.handle(event.getX(),event.getY());
}
}
}
示例2: handle
@Override public void handle(MouseEvent e) {
if (e.getEventType() == MouseEvent.MOUSE_PRESSED) {
requestFocus();
if (new_rectangle_is_being_drawn == false) {
starting_point_x = e.getX();
starting_point_y = e.getY();
newRect = new Annotation();
newRect.setFill(SELECTED_ANNOTATION_COLOR);
new_rectangle_is_being_drawn = true;
anchorPane.getChildren().add(newRect);
}
}
if (e.getEventType() == MouseEvent.MOUSE_DRAGGED) {
if (!edit) {
return;
}
if (new_rectangle_is_being_drawn == true) {
double current_ending_point_x = e.getX();
double current_ending_point_y = e.getY();
if (current_ending_point_x < 0) {
current_ending_point_x = 0;
}
if (current_ending_point_y < 0) {
current_ending_point_y = 0;
}
if (current_ending_point_x > canvas.getWidth()) {
current_ending_point_x = canvas.getWidth();
}
if (current_ending_point_y > canvas.getHeight()) {
current_ending_point_y = canvas.getHeight();
}
adjust_rectangle_properties(starting_point_x, starting_point_y, current_ending_point_x, current_ending_point_y,
newRect);
ensureVisible(scrollPane, newRect);
}
}
if (e.getEventType() == MouseEvent.MOUSE_RELEASED) {
anchorPane.getChildren().remove(newRect);
newRect.setFill(ANNOTATION_COLOR);
newRect.setText("Annotation");
if (newRect.getWidth() > 10 && newRect.getHeight() > 10) {
System.out.println("ImagePanel.ImagePanelMouseListener.handle(" + newRect + ")");
annotations.add(newRect);
}
drawGraphics();
newRect = null;
new_rectangle_is_being_drawn = false;
}
}