Example usage for java.awt AWTEvent MOUSE_MOTION_EVENT_MASK

List of usage examples for java.awt AWTEvent MOUSE_MOTION_EVENT_MASK

Introduction

In this page you can find the example usage for java.awt AWTEvent MOUSE_MOTION_EVENT_MASK.

Prototype

long MOUSE_MOTION_EVENT_MASK

To view the source code for java.awt AWTEvent MOUSE_MOTION_EVENT_MASK.

Click Source Link

Document

The event mask for selecting mouse motion events.

Usage

From source file:com.rapidminer.gui.plotter.charts.AbstractChartPanel.java

/**
 * Constructs a JFreeChart panel.// w  ww  .j a v  a 2s . co m
 * 
 * @param chart
 *            the chart.
 * @param width
 *            the preferred width of the panel.
 * @param height
 *            the preferred height of the panel.
 * @param minimumDrawWidth
 *            the minimum drawing width.
 * @param minimumDrawHeight
 *            the minimum drawing height.
 * @param maximumDrawWidth
 *            the maximum drawing width.
 * @param maximumDrawHeight
 *            the maximum drawing height.
 * @param useBuffer
 *            a flag that indicates whether to use the off-screen buffer to improve performance
 *            (at the expense of memory).
 * @param properties
 *            a flag indicating whether or not the chart property editor should be available via
 *            the popup menu.
 * @param copy
 *            a flag indicating whether or not a copy option should be available via the popup
 *            menu.
 * @param save
 *            a flag indicating whether or not save options should be available via the popup
 *            menu.
 * @param print
 *            a flag indicating whether or not the print option should be available via the
 *            popup menu.
 * @param zoom
 *            a flag indicating whether or not zoom options should be added to the popup menu.
 * @param tooltips
 *            a flag indicating whether or not tooltips should be enabled for the chart.
 * 
 * @since 1.0.13
 */
public AbstractChartPanel(JFreeChart chart, int width, int height, int minimumDrawWidth, int minimumDrawHeight,
        int maximumDrawWidth, int maximumDrawHeight, boolean useBuffer, boolean properties, boolean copy,
        boolean save, boolean print, boolean zoom, boolean tooltips) {
    super(chart, width, height, minimumDrawWidth, minimumDrawHeight, maximumDrawWidth, maximumDrawHeight, false,
            properties, copy, save, print, zoom, tooltips);
    setChart(chart);
    this.chartMouseListeners = new EventListenerList();
    this.info = new ChartRenderingInfo();
    setPreferredSize(new Dimension(width, height));

    this.minimumDrawWidth = minimumDrawWidth;
    this.minimumDrawHeight = minimumDrawHeight;
    this.maximumDrawWidth = maximumDrawWidth;
    this.maximumDrawHeight = maximumDrawHeight;
    this.zoomTriggerDistance = DEFAULT_ZOOM_TRIGGER_DISTANCE;

    // set up popup menu...
    this.popup = null;
    if (properties || copy || save || print || zoom) {
        this.popup = createPopupMenu(properties, copy, save, print, zoom);
    }

    enableEvents(AWTEvent.MOUSE_EVENT_MASK);
    enableEvents(AWTEvent.MOUSE_MOTION_EVENT_MASK);
    setDisplayToolTips(tooltips);
    // mouse listener registered in super class
    // addMouseListener(this);
    // addMouseMotionListener(this);

    this.defaultDirectoryForSaveAs = null;
    this.enforceFileExtensions = true;

    // initialize ChartPanel-specific tool tip delays with
    // values the from ToolTipManager.sharedInstance()
    ToolTipManager ttm = ToolTipManager.sharedInstance();
    this.ownToolTipInitialDelay = ttm.getInitialDelay();
    this.ownToolTipDismissDelay = ttm.getDismissDelay();
    this.ownToolTipReshowDelay = ttm.getReshowDelay();

    this.zoomAroundAnchor = false;
    this.selectionOutlinePaint = Color.blue;
    this.selectionFillPaint = new Color(0, 0, 255, 63);

    this.panMask = InputEvent.CTRL_MASK;
    // for MacOSX we can't use the CTRL key for mouse drags, see:
    // http://developer.apple.com/qa/qa2004/qa1362.html
    String osName = System.getProperty("os.name").toLowerCase();
    if (osName.startsWith("mac os x")) {
        this.panMask = InputEvent.ALT_MASK;
    }

    this.overlays = new java.util.ArrayList<>();

    // adding wheel listener
    addMouseWheelListener(new MouseWheelListener() {

        @Override
        public void mouseWheelMoved(MouseWheelEvent e) {
            if (e.getScrollType() != MouseWheelEvent.WHEEL_UNIT_SCROLL) {
                return;
            }
            if (e.getWheelRotation() < 0) {
                shrinkSelectionOnCenter(e.getX(), e.getY(), e);
            } else {
                enlargeSelectionOnCenter(e.getX(), e.getY(), e);
            }
        }
    });
}

From source file:com.isti.traceview.common.TraceViewChartPanel.java

/**
 * Constructs a JFreeChart panel.//www  .j ava2s  .c om
 * 
 * @param chart
 *            the chart.
 * @param width
 *            the preferred width of the panel.
 * @param height
 *            the preferred height of the panel.
 * @param minimumDrawWidth
 *            the minimum drawing width.
 * @param minimumDrawHeight
 *            the minimum drawing height.
 * @param maximumDrawWidth
 *            the maximum drawing width.
 * @param maximumDrawHeight
 *            the maximum drawing height.
 * @param useBuffer
 *            a flag that indicates whether to use the off-screen buffer to improve performance
 *            (at the expense of memory).
 * @param properties
 *            a flag indicating whether or not the chart property editor should be available via
 *            the popup menu.
 * @param save
 *            a flag indicating whether or not save options should be available via the popup
 *            menu.
 * @param print
 *            a flag indicating whether or not the print option should be available via the
 *            popup menu.
 * @param zoom
 *            a flag indicating whether or not zoom options should be added to the popup menu.
 * @param tooltips
 *            a flag indicating whether or not tooltips should be enabled for the chart.
 */
public TraceViewChartPanel(JFreeChart chart, int width, int height, int minimumDrawWidth, int minimumDrawHeight,
        int maximumDrawWidth, int maximumDrawHeight, boolean useBuffer, boolean properties, boolean save,
        boolean print, boolean zoom, boolean tooltips) {

    this.setChart(chart);
    this.chartMouseListeners = new EventListenerList();
    this.info = new ChartRenderingInfo();
    setPreferredSize(new Dimension(width, height));
    this.useBuffer = useBuffer;
    this.refreshBuffer = false;
    this.minimumDrawWidth = minimumDrawWidth;
    this.minimumDrawHeight = minimumDrawHeight;
    this.maximumDrawWidth = maximumDrawWidth;
    this.maximumDrawHeight = maximumDrawHeight;
    this.zoomTriggerDistance = DEFAULT_ZOOM_TRIGGER_DISTANCE;

    // set up popup menu...
    this.popup = null;
    if (properties || save || print || zoom) {
        this.popup = createPopupMenu(properties, save, print, zoom);
    }

    enableEvents(AWTEvent.MOUSE_EVENT_MASK);
    enableEvents(AWTEvent.MOUSE_MOTION_EVENT_MASK);
    setDisplayToolTips(tooltips);
    addMouseListener(this);
    addMouseMotionListener(this);

    this.enforceFileExtensions = true;

    // initialize ChartPanel-specific tool tip delays with
    // values the from ToolTipManager.sharedInstance()
    ToolTipManager ttm = ToolTipManager.sharedInstance();
    this.ownToolTipInitialDelay = ttm.getInitialDelay();
    this.ownToolTipDismissDelay = ttm.getDismissDelay();
    this.ownToolTipReshowDelay = ttm.getReshowDelay();
}

From source file:org.rdv.viz.chart.ChartPanel.java

/**
 * Constructs a JFreeChart panel.//  w  ww  .j  a  va  2s. c  om
 *
 * @param chart  the chart.
 * @param width  the preferred width of the panel.
 * @param height  the preferred height of the panel.
 * @param minimumDrawWidth  the minimum drawing width.
 * @param minimumDrawHeight  the minimum drawing height.
 * @param maximumDrawWidth  the maximum drawing width.
 * @param maximumDrawHeight  the maximum drawing height.
 * @param useBuffer  a flag that indicates whether to use the off-screen
 *                   buffer to improve performance (at the expense of
 *                   memory).
 * @param properties  a flag indicating whether or not the chart property
 *                    editor should be available via the popup menu.
 * @param save  a flag indicating whether or not save options should be
 *              available via the popup menu.
 * @param print  a flag indicating whether or not the print option
 *               should be available via the popup menu.
 * @param zoom  a flag indicating whether or not zoom options should be
 *              added to the popup menu.
 * @param tooltips  a flag indicating whether or not tooltips should be
 *                  enabled for the chart.
 */
public ChartPanel(JFreeChart chart, int width, int height, int minimumDrawWidth, int minimumDrawHeight,
        int maximumDrawWidth, int maximumDrawHeight, boolean useBuffer, boolean properties, boolean save,
        boolean print, boolean zoom, boolean tooltips) {

    this.setChart(chart);
    this.chartMouseListeners = new EventListenerList();
    this.info = new ChartRenderingInfo();
    setPreferredSize(new Dimension(width, height));
    this.useBuffer = useBuffer;
    this.refreshBuffer = false;
    this.minimumDrawWidth = minimumDrawWidth;
    this.minimumDrawHeight = minimumDrawHeight;
    this.maximumDrawWidth = maximumDrawWidth;
    this.maximumDrawHeight = maximumDrawHeight;
    this.zoomTriggerDistance = DEFAULT_ZOOM_TRIGGER_DISTANCE;

    // set up popup menu...
    this.popup = null;
    if (properties || save || print || zoom) {
        this.popup = createPopupMenu(properties, save, print, zoom);
    }

    enableEvents(AWTEvent.MOUSE_EVENT_MASK);
    enableEvents(AWTEvent.MOUSE_MOTION_EVENT_MASK);
    setDisplayToolTips(tooltips);
    addMouseListener(this);
    addMouseMotionListener(this);

    this.defaultDirectoryForSaveAs = null;
    this.enforceFileExtensions = true;

    // initialize ChartPanel-specific tool tip delays with
    // values the from ToolTipManager.sharedInstance()
    ToolTipManager ttm = ToolTipManager.sharedInstance();
    this.ownToolTipInitialDelay = ttm.getInitialDelay();
    this.ownToolTipDismissDelay = ttm.getDismissDelay();
    this.ownToolTipReshowDelay = ttm.getReshowDelay();

    this.zoomAroundAnchor = false;

    this.rangeHistory = new Stack<Range>();
}

From source file:javazoom.jlgui.player.amp.Player.java

/**
 * Instantiate Title Panel with ActiveComponent.
 * Add them to window and ActionListener.
 *//*from ww w.  jav a2s .  co m*/
protected void setTitleBarPanel() {
    int l = 0;
    acTitleBar = new ActiveComponent(releasedTitleIm[0], pressedTitleIm[0],
            AWTEvent.MOUSE_MOTION_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK);
    acTitleBar.setLocation(titleBarLocation[l++], titleBarLocation[l++]);
    add(acTitleBar);
    acTitleBar.setActionCommand("TitleBar");
    acTitleBar.addActionListener(this);
}

From source file:javazoom.jlgui.player.amp.Player.java

/**
 * Instantiate Volume/Balance Panel with ActiveComponent.
 * Add them to window and ActionListener.
 *//*from   ww  w. j av  a  2 s. co  m*/
protected void setVolumeBalancePanel(int vheight, int bheight) {
    // Volume.
    int l = 0;
    if (vheight > 0)
        acVolume = new ActiveComponent(releasedVolumeImage[0], pressedVolumeImage[0],
                AWTEvent.MOUSE_MOTION_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK);
    else
        acVolume = new InvisibleActiveComponent(releasedVolumeImage[0], pressedVolumeImage[0],
                AWTEvent.MOUSE_MOTION_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK);
    acVolume.setLocation(volumeLocation[l++], volumeLocation[l++]);
    add((Component) acVolume);
    acVolume.setActionCommand("Volume");
    acVolume.addActionListener(this);
    for (int k = 0; k < volumeImage.length; k++) {
        volumeImage[k] = (new Taftb(fakeIndex, imVolume, 68, 13, 2, "" + fakeIndex.charAt(k))).getBanner();
    }
    offScreenGraphics.drawImage(
            volumeImage[(int) Math.round(((double) gainValue / (double) maxGain) * (volumeImage.length - 1))],
            volumeBarLocation[0], volumeBarLocation[1], this);

    // Balance
    Image cropBalance = createImage(37, 418);
    Graphics g = cropBalance.getGraphics();
    g.drawImage(imBalance, 0, 0, 37, 418, 9, 0, 9 + 37, 0 + 418, null);

    l = 0;
    if (bheight > 0)
        acBalance = new ActiveComponent(releasedBalanceImage[0], pressedBalanceImage[0],
                AWTEvent.MOUSE_MOTION_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK);
    else
        acBalance = new InvisibleActiveComponent(releasedBalanceImage[0], pressedBalanceImage[0],
                AWTEvent.MOUSE_MOTION_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK);
    acBalance.setLocation(balanceLocation[l++], balanceLocation[l++]);
    add((Component) acBalance);
    acBalance.setActionCommand("Balance");
    acBalance.addActionListener(this);
    for (int k = 0; k < balanceImage.length; k++) {
        balanceImage[k] = (new Taftb(fakeIndex, cropBalance, 37, 13, 2, "" + fakeIndex.charAt(k))).getBanner();
    }
    offScreenGraphics.drawImage(
            balanceImage[(int) Math
                    .round(((double) Math.abs(balanceValue) / (double) 1) * (balanceImage.length - 1))],
            balanceBarLocation[0], balanceBarLocation[1], this);
}

From source file:javazoom.jlgui.player.amp.PlayerApplet.java

/**
 * Instantiate Title Panel with ActiveComponent.
 * Add them to window and ActionListener.
 *///from w w  w .  ja  v  a2  s.  c om
protected void setTitleBarPanel() {
    int l = 0;
    acTitleBar = new ActiveComponent(releasedTitleIm[0], pressedTitleIm[0],
            AWTEvent.MOUSE_MOTION_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK);
    // TODO - Title bar disabled.
    acTitleBar.setEnabled(false);
    acTitleBar.setLocation(titleBarLocation[l++], titleBarLocation[l++]);
    add(acTitleBar);
    acTitleBar.setActionCommand("TitleBar");
    acTitleBar.addActionListener(this);
}

From source file:javazoom.jlgui.player.amp.Player.java

/**
 * Instantiate PosBar Panel with ActiveComponent.
 * Add them to window and ActionListener.
 *///from www . j  av  a2  s .c  o  m
protected void setPosBarPanel() {
    int l = 0;
    acPosBar = new ActiveComponent(releasedPosIm[0], pressedPosIm[0],
            AWTEvent.MOUSE_MOTION_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK);
    acPosBar.setLocation(posBarLocation[l++], posBarLocation[l++]);
    add(acPosBar);
    acPosBar.setActionCommand("Seek");
    acPosBar.addActionListener(this);
    remove(acPosBar);
}

From source file:net.sourceforge.squirrel_sql.fw.gui.debug.DebugEventListener.java

public void setEnabled(boolean enable) {
    Toolkit kit = Toolkit.getDefaultToolkit();
    if (enable) {
        /* register as a listener for mouse events */
        kit.addAWTEventListener(this, AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK);

        /* show all tooltips for ten seconds before hiding */
        ToolTipManager.sharedInstance().setDismissDelay(10000);
    } else {//  w w w.j  a  va 2s  .com
        kit.removeAWTEventListener(this);
    }
}

From source file:op.FrmMain.java

public FrmMain() {
    initPhase = true;/*from   w  w  w. ja  v  a2s.  c o  m*/
    initComponents();

    if (OPDE.isTraining()) {
        pnlMainMessage.setBackground(SYSConst.mediumorchid2.brighter().brighter());
    }

    //        pbTimeout.setToolTipText(SYSTools.xx("opde.mainframe.pbTimeout.tooltip"));
    // for the timeout function
    Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
        @Override
        public void eventDispatched(AWTEvent event) {
            if (OPDE.getLogin() != null) {
                displayManager.touch();
            }
        }
    }, AWTEvent.MOUSE_MOTION_EVENT_MASK);

    Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
        @Override
        public void eventDispatched(AWTEvent event) {
            if (OPDE.getLogin() != null) {
                displayManager.touch();
            }
        }
    }, AWTEvent.KEY_EVENT_MASK);

    currentVisiblePanel = null;
    currentResident = null;
    lblWait.setText(SYSTools.xx("misc.msg.wait"));
    lblWait.setVisible(false);
    listOfNursingrecords = new ArrayList<CollapsiblePane>();
    btnHelp.setToolTipText(SYSTools.xx("opde.mainframe.btnHelp.tooltip"));

    iconPanels = Collections.synchronizedMap(new HashMap<Resident, JPanel>());

    if (OPDE.isDebug()) {
        setSize(1366, 768);
    } else {
        this.setExtendedState(JFrame.MAXIMIZED_BOTH);
    }

    setTitle(SYSTools.getWindowTitle(""));

    displayManager = new DisplayManager(pbMsg, lblMainMsg, lblSubMsg, pnlIcons, pbTimeout, new Closure() {
        @Override
        public void execute(Object o) {
            OPDE.debug("TIMEOUT");
            logout();
            showLogin();
        }
    });
    displayManager.start();

    printProcessor = new PrintProcessor();
    printProcessor.start();

    // StatusBar Setup
    final LabelStatusBarItem label = new LabelStatusBarItem("Line");
    label.setText(OPDE.getUrl() + " [Build " + OPDE.getAppInfo().getBuildnum() + "]" + " [JVM "
            + System.getProperty("java.version") + "]");
    if (OPDE.isCustomUrl()) {
        label.setForeground(Color.RED);
    }
    label.setFont(new Font("Arial", Font.PLAIN, 14));
    statusBar.add(label, JideBoxLayout.FLEXIBLE);
    labelUSER = new LabelStatusBarItem("Line");
    labelUSER.setText("--");
    labelUSER.setAlignment(JLabel.CENTER);
    labelUSER.setFont(new Font("Arial", Font.PLAIN, 14));
    statusBar.add(labelUSER, JideBoxLayout.FLEXIBLE);
    final TimeStatusBarItem time = new TimeStatusBarItem();
    time.setFont(new Font("Arial", Font.PLAIN, 14));
    time.setUpdateInterval(10000);
    time.setTextFormat(DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.SHORT));
    time.setAlignment(JLabel.CENTER);
    statusBar.add(time, JideBoxLayout.FLEXIBLE);
    final MemoryStatusBarItem gc = new MemoryStatusBarItem();
    gc.setFont(new Font("Arial", Font.PLAIN, 14));
    statusBar.add(gc, JideBoxLayout.FLEXIBLE);

    btnResetSplitpane.setToolTipText(SYSTools.xx("opde.mainframe.btnSplitReset.tooltip"));

    initPhase = false;

    //        JDialog dlg = new JDialog(this, false);
    //
    //        JPanel pnl = new JPanel();
    //        pnl.setLayout(new VerticalLayout());
    //
    //        for (float f = 0.0f; f <= 1.0; f = f + 0.01f){
    //            JLabel lbl = new JLabel(Float.toString(f));
    //            lbl.setForeground(GUITools.blend(Color.red, Color.WHITE, f));
    //            pnl.add(lbl);
    //        }
    //
    //        dlg.setContentPane(new JScrollPane(pnl));
    //
    //        dlg.pack();
    //        dlg.setVisible(true);

}

From source file:org.eclipse.jubula.rc.javafx.driver.RobotJavaFXImpl.java

/**
 * Implementation of the mouse move. The mouse is moved into the graphics
 * component.//from w  w  w .  ja  v a  2  s.  c o m
 *
 * @param graphicsComponent
 *            The component to move to
 * @param constraints
 *            The more specific constraints. Use this, for example when you
 *            want the click point to be relative to a part of the component
 *            (e.g. tree node, table cell, etc) rather than the overall
 *            component itself. May be <code>null</code>.
 * @param xPos
 *            xPos in component
 * @param yPos
 *            yPos in component
 * @param xAbsolute
 *            true if x-position should be absolute
 * @param yAbsolute
 *            true if y-position should be absolute
 * @param clickOptions
 *            The click options
 * @throws StepExecutionException
 *             If the click delay is interrupted or the event confirmation
 *             receives a timeout.
 */
private void moveImpl(final Object graphicsComponent, final Rectangle constraints, final int xPos,
        final boolean xAbsolute, final int yPos, final boolean yAbsolute, final ClickOptions clickOptions)
        throws StepExecutionException {
    Rectangle bounds = getComponentBounds(graphicsComponent, clickOptions);
    if (constraints != null) {
        bounds.x += constraints.x;
        bounds.y += constraints.y;
        bounds.height = constraints.height;
        bounds.width = constraints.width;
    }
    Point p = PointUtil.calculateAwtPointToGo(xPos, xAbsolute, yPos, yAbsolute, bounds);
    // Move if necessary
    if (isMouseMoveRequired(p)) {
        if (log.isDebugEnabled()) {
            log.debug("Moving mouse to: " + p); //$NON-NLS-1$
        }
        Point startpoint = m_mouseMotionTracker.getLastMousePointOnScreen();
        if (startpoint == null) {
            // If there is no starting point the center of the root
            // component is used
            if (graphicsComponent instanceof Stage) {
                Stage s = (Stage) graphicsComponent;
                Node root = s.getScene().getRoot();
                startpoint = (root != null) ? getLocation(root, null)
                        : new Point(Rounding.round(s.getWidth() / 2), Rounding.round(s.getHeight() / 2));
            } else {
                Node node = (Node) graphicsComponent;
                Node root = node.getScene().getRoot();
                Node c = (root != null) ? root : node;
                startpoint = getLocation(c, null);
            }
        }
        IRobotEventConfirmer confirmer = null;
        InterceptorOptions options = new InterceptorOptions(new long[] { AWTEvent.MOUSE_MOTION_EVENT_MASK });
        //For drag Events we have to register the confirmer earlier
        //because the drag event is thrown when the movement starts
        if (DragAndDropHelper.getInstance().isDragMode()) {
            confirmer = m_interceptor.intercept(options);
        }
        final Point[] mouseMove = MouseMovementStrategy.getMovementPath(startpoint, p,
                clickOptions.getStepMovement(), clickOptions.getFirstHorizontal());
        for (int i = 0; i < mouseMove.length - 1; i++) {

            m_robot.mouseMove(mouseMove[i].x, mouseMove[i].y);
            m_robot.waitForIdle();
        }
        if (!DragAndDropHelper.getInstance().isDragMode()) {
            confirmer = m_interceptor.intercept(options);
        }

        Point endPoint = mouseMove[mouseMove.length - 1];
        m_robot.mouseMove(endPoint.x, endPoint.y);
        m_robot.waitForIdle();

        if (confirmer != null) {
            confirmMove(confirmer, graphicsComponent);
        }
    }
}