Java Code Examples for javax.swing.JPanel.addMouseMotionListener()

The following are Jave code examples for showing how to use addMouseMotionListener() of the javax.swing.JPanel class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: LivroJavaComoProgramar10Edicao   File: MouseTrackerFrame.java   View Source Code Vote up 6 votes
public MouseTrackerFrame()
{
   super("Demonstrating Mouse Events");

   mousePanel = new JPanel(); 
   mousePanel.setBackground(Color.WHITE); 
   add(mousePanel, BorderLayout.CENTER); // add panel to JFrame

   statusBar = new JLabel("Mouse outside JPanel"); 
   add(statusBar, BorderLayout.SOUTH); // add label to JFrame

   // create and register listener for mouse and mouse motion events
   MouseHandler handler = new MouseHandler(); 
   mousePanel.addMouseListener(handler); 
   mousePanel.addMouseMotionListener(handler); 
}
 
Example 2
Project: incubator-netbeans   File: ComponentDetailsProvider.java   View Source Code Vote up 5 votes
protected void setupGlassPane(JPanel glassPane) {
    this.glassPane = glassPane;
    if (mouse != null) {
        glassPane.addMouseListener(mouse);
        if (enableInteraction) {
            glassPane.addMouseMotionListener(mouse);
        }
    }
}