Example usage for java.awt.event MouseEvent MOUSE_RELEASED

List of usage examples for java.awt.event MouseEvent MOUSE_RELEASED

Introduction

In this page you can find the example usage for java.awt.event MouseEvent MOUSE_RELEASED.

Prototype

int MOUSE_RELEASED

To view the source code for java.awt.event MouseEvent MOUSE_RELEASED.

Click Source Link

Document

The "mouse released" event.

Usage

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

/**
 * Simulates "Repeat" selection./*from w w  w. j a  v  a  2 s .c  o m*/
 */
public void pressRepeat() {
    final MouseEvent rmevt = new MouseEvent(this, MouseEvent.MOUSE_RELEASED, 0, 1, 0, 0, 1, false);
    AccessController.doPrivileged(new PrivilegedAction() {
        public Object run() {
            acRepeat.processEvent(rmevt);
            return null;
        }
    });
}

From source file:org.kalypso.mt.input.MTMouseInput.java

@Override
public void processAction() {
    if (invocCounter++ % 6 == 0 || eventQueue.isEmpty())
        return;//w w w  .j  ava 2s . c  om

    // purge all events waiting if mouse is blocked
    if (m_mouseBlocks > 0) {
        eventQueue.clear();
        return;
    }

    // otherwise process events
    final long time = System.currentTimeMillis();
    while (!eventQueue.isEmpty()) {
        final long dist = time - eventQueue.peekFirst().timestamp;

        if (dist > 200) {
            // ok, process this one
            final MTMouseEventData e = eventQueue.pollFirst();
            switch (e.event.getID()) {
            case MouseEvent.MOUSE_PRESSED:
                this.mousePressed(e.event);
                break;
            case MouseEvent.MOUSE_RELEASED:
                this.mouseReleased(e.event);
                break;
            case MouseEvent.MOUSE_CLICKED:
                this.mouseClicked(e.event);
                break;
            case MouseEvent.MOUSE_DRAGGED:
                this.mouseDragged(e.event);
                break;
            case MouseEvent.MOUSE_MOVED:
                this.mouseMoved(e.event);
                break;
            }

        } else {
            break;
        }

    }

}

From source file:org.tinymediamanager.ui.MainWindow.java

/**
 * Initialize the contents of the frame.
 *//*w  w w  . j a v a  2s.  c o  m*/
private void initialize() {
    // set the logo
    setIconImages(LOGOS);
    setBounds(5, 5, 1100, 727);
    // do nothing, we have our own windowClosing() listener
    // setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    getContentPane().setLayout(new BorderLayout(0, 0));

    JLayeredPane content = new JLayeredPane();
    content.setLayout(new FormLayout(
            new ColumnSpec[] { ColumnSpec.decode("default:grow"), FormFactory.RELATED_GAP_COLSPEC,
                    ColumnSpec.decode("right:270px"), },
            new RowSpec[] { RowSpec.decode("fill:max(500px;default):grow"), }));
    getContentPane().add(content, BorderLayout.CENTER);

    JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new FormLayout(new ColumnSpec[] { ColumnSpec.decode("default:grow") },
            new RowSpec[] { RowSpec.decode("fill:max(500px;default):grow") }));
    content.add(mainPanel, "1, 1, 3, 1, fill, fill");
    content.setLayer(mainPanel, 1);

    JTabbedPane tabbedPane = VerticalTextIcon.createTabbedPane(JTabbedPane.LEFT);
    tabbedPane.setTabPlacement(JTabbedPane.LEFT);
    mainPanel.add(tabbedPane, "1, 1, fill, fill");
    // getContentPane().add(tabbedPane, "1, 2, fill, fill");

    panelStatusBar = new StatusBar();
    getContentPane().add(panelStatusBar, BorderLayout.SOUTH);

    panelMovies = new MoviePanel();
    VerticalTextIcon.addTab(tabbedPane, BUNDLE.getString("tmm.movies"), panelMovies); //$NON-NLS-1$

    panelMovieSets = new MovieSetPanel();
    VerticalTextIcon.addTab(tabbedPane, BUNDLE.getString("tmm.moviesets"), panelMovieSets); //$NON-NLS-1$

    panelTvShows = new TvShowPanel();
    VerticalTextIcon.addTab(tabbedPane, BUNDLE.getString("tmm.tvshows"), panelTvShows); //$NON-NLS-1$

    // shutdown listener - to clean database connections safely
    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            closeTmm();
        }
    });

    MessageManager.instance.addListener(TmmUIMessageCollector.instance);

    // mouse event listener for context menu
    Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
        @Override
        public void eventDispatched(AWTEvent arg0) {
            if (arg0 instanceof MouseEvent && MouseEvent.MOUSE_RELEASED == arg0.getID()
                    && arg0.getSource() instanceof JTextComponent) {
                MouseEvent me = (MouseEvent) arg0;
                JTextComponent tc = (JTextComponent) arg0.getSource();
                if (me.isPopupTrigger() && tc.getComponentPopupMenu() == null) {
                    TextFieldPopupMenu.buildCutCopyPaste().show(tc, me.getX(), me.getY());
                }
            }
        }
    }, AWTEvent.MOUSE_EVENT_MASK);

    // temp info for users using Java 6
    if (SystemUtils.IS_JAVA_1_6) {
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                JOptionPane.showMessageDialog(MainWindow.this, BUNDLE.getString("tmm.java6")); //$NON-NLS-1$
            }
        });
    }

    // inform user is MI could not be loaded
    if (Platform.isLinux() && StringUtils.isBlank(MediaInfo.version())) {
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                JOptionPane.showMessageDialog(MainWindow.this, BUNDLE.getString("mediainfo.failed.linux")); //$NON-NLS-1$
            }
        });
    }
}