当前位置: 首页>>代码示例>>Java>>正文


Java MouseEvent.MOUSE_PRESSED属性代码示例

本文整理汇总了Java中javafx.scene.input.MouseEvent.MOUSE_PRESSED属性的典型用法代码示例。如果您正苦于以下问题:Java MouseEvent.MOUSE_PRESSED属性的具体用法?Java MouseEvent.MOUSE_PRESSED怎么用?Java MouseEvent.MOUSE_PRESSED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javafx.scene.input.MouseEvent的用法示例。


在下文中一共展示了MouseEvent.MOUSE_PRESSED属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
        }
    }
}
 
开发者ID:whitewoodcity,项目名称:xbrowser,代码行数:18,代码来源:MouseEventHandler.java

示例2: handleRawRecording

public void handleRawRecording(IJSONRecorder recorder, Event event) {
    if (event instanceof MouseEvent && event.getEventType() == MouseEvent.MOUSE_PRESSED) {
        recorder.recordRawMouseEvent(this, (MouseEvent) event);
    }
    if (event instanceof KeyEvent && event.getEventType() != KeyEvent.KEY_RELEASED) {
        recorder.recordRawKeyEvent(this, (KeyEvent) event);
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:8,代码来源:RFXComponent.java

示例3: 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;
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:50,代码来源:ImagePanel.java


注:本文中的javafx.scene.input.MouseEvent.MOUSE_PRESSED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。