Get Click Count Mouse Listener on Touch Screen

前端 未结 1 727
一个人的身影
一个人的身影 2021-01-26 03:08

Im running a simple JFrame with a JList.

I encountered an issue just like this guy> Java getClickCount on touchscreen

I know it has been posted already but there

相关标签:
1条回答
  • 2021-01-26 03:47

    Code below is working..

    public class MainTest extends JPanel {
    
     public MainTest() {
    
          addMouseListener(new MouseAdapter() { 
              public void mousePressed(MouseEvent me) { 
                System.out.println(me.getClickCount()); 
              } 
            }); 
    
      }
    
      public static void main(String[] args) {
        JFrame frame = new JFrame();
        frame.getContentPane().add(new MainTest());
    
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    
        frame.setSize(200, 200);
        frame.setVisible(true);
      }
    

    }

    0 讨论(0)
提交回复
热议问题