4

I'm creating a java program using swing that should run on touchscreen monitor. Right now I don't have the monitor so I'm programming only with my laptop without touch capability. Will my click event run by touching the monitor and will scroll bar work properly, or I need events specifically coded for touch screen monitors? NOTE: I'm not after touchscreens like tablet, I'm using raspberry pi connected to touch screen monitor via HDMI.

gihooh
  • 303
  • 1
  • 6
  • 16
  • 1
    http://stackoverflow.com/questions/11623777/how-to-implement-a-java-swing-application-to-touch-screen – PHPFan Feb 16 '14 at 13:15
  • I'm assuming it's a yes. – gihooh Feb 16 '14 at 23:09
  • If its anything like a basic windows touchscreen then yes your java events will run on touch, and no you should not need extra code, unless you want to swipe your whole window (not just the scroll bar), or have a keyboard like ElhadiMamoun linked to – sorifiend Feb 17 '14 at 03:13
  • @sorifiend now you mention swiping window. How can my JTable perform the function of scroll bar if I want to scroll the elements by swiping inside the JTable? – gihooh Feb 17 '14 at 03:43
  • 1
    @gihooh as long as you don't need to click on or select the JTable, then you can add a glass pane (jLayer) over top of the JTable and capture any drag events and move the JTable as needed. – sorifiend Feb 17 '14 at 03:45

1 Answers1

1

When you use your touchscreen monitor with your Swing application, the act of touching the monitor will cause mouse clicks to be sent. So if you're already responding to mouse clicks in your Swing application, your program should work when you connect your touchscreen.

David Koelle
  • 20,726
  • 23
  • 93
  • 130