Touch screen of scrolling fingers to the iPhone

I'm developing a simple kiosk application to be used by customers in a store. The input method is a thouch screen. The app will have a JTable (or another object showing multiple records) within a get. Now, since most of the people are now used to scrolling with their finger on the object instead of using the scroll bars in a touchscreen device, I was wondering if I could develop this behavior in the application.

Is that what I can do with these objects? Are there other objects Part 3 introduce this feature?

First of all, you must confirm if taps and drags on the touch screen to generate the corresponding mouse events. If this is the case, you could leverage a MouseListener and MouseMotionListener for scrolling of the window display.

DB

The edit that I had this class lying around. Use: DragScrollHandler.createDragScrollHandlerFor (component view viewport);

import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JComponent;
import javax.swing.SwingUtilities;
import javax.swing.Timer;

public class DragScrollHandler extends MouseAdapter {

  private JComponent component;
  private Point pressedPoint, draggedPoint, lastPoint;
  private Rectangle visiRect;
  private Timer timer;
  private boolean pressed;
  private int deltaX, deltaY;

  public DragScrollHandler(JComponent c) {
    component = c;
    c.addMouseListener(this);
    c.addMouseMotionListener(this);

    timer = new Timer(50, new ActionListener() {

      public void actionPerformed(ActionEvent e) {
        if (pressed) {
          deltaX = draggedPoint.x - lastPoint.x;
          deltaY = draggedPoint.y - lastPoint.y;
          lastPoint = new Point(draggedPoint);
        } else {
          visiRect.x -= deltaX;
          visiRect.y -= deltaY;
          component.scrollRectToVisible(visiRect);
          SwingUtilities.invokeLater(new Runnable() {

            public void run() {
              final Rectangle newRect = component.getVisibleRect();
              if (newRect.x != visiRect.x && newRect.y != visiRect.y) {
                timer.stop();
              }
            }
          });
        }
      }
    });
  }

  public static void createDragScrollHandlerFor(JComponent component) {
    new DragScrollHandler(component);
  }

  public void dispose() {
    component.removeMouseListener(this);
    component.removeMouseMotionListener(this);
    timer.stop();
  }

  @Override
  public void mousePressed(MouseEvent e) {
    pressed = true;
    pressedPoint = e.getPoint();
    draggedPoint = e.getPoint();
    lastPoint = e.getPoint();
    timer.start();
    visiRect = component.getVisibleRect();
  }

  @Override
  public void mouseDragged(MouseEvent e) {
    draggedPoint = e.getPoint();
    visiRect.x += (pressedPoint.x - draggedPoint.x);
    visiRect.y += (pressedPoint.y - draggedPoint.y);
    component.scrollRectToVisible(visiRect);
    SwingUtilities.invokeLater(new Runnable() {

      public void run() {
        Rectangle newRect = component.getVisibleRect();
        pressedPoint.x += newRect.x - visiRect.x;
        pressedPoint.y += newRect.y - visiRect.y;
        visiRect = newRect;
      }
    });
  }

  @Override
  public void mouseReleased(MouseEvent e) {
    pressed = false;
  }
}

Note that this may be incomplete - I honestly don't remember not whether and to what extent I tested it. Use at your own risk.

Published by: Darryl Burke

Tags: Java

Similar Questions

  • Touch digital can be used on the iPhone 6?

    Touch digital can be used on the iPhone 6?

    Hello

    Touch digital can only be sent and received on Apple Watch (any model).

    Apple Watch requires iPhone 5 or later.

    More information:

    Use the touch-Apple Support

    Set up your Apple Watch - Apple Support

  • Computer stops with a blue screen with error fatal when the iPhone is connected

    I know it may not related to windows but I have tried other sites on this issue. My computer stops and a blue screen appears with the message saying fatal error when the iPhone is connected. I tried with or without iTunes installed.

    First without iTunes installed, windows will be asked to USB drivers for the iPhone, but I couldn't find anything on the Apple Web sites if I click No., a message appeared, saying that it might not work properly because he could not recognize my device. Second, I have the latest version of iTunes installed, windows began to recognize my iPhone but stop immediately after that with a blue screen fatal error and messeage saying updating the BIOS. Updated the BIOS of the computer, but nothing helped.

    My computer runs on Windows XP Home Edition SP3, processor Intel Core Duo 1'66 GHz, 2 GB Ram, Intel GMA 950, Intel 945 GM chipset.

    I thought that it requires no USB driver for iPhone on Windows or same iTunes unless I wanted to use it for synchronization or characteristics. Please forgive me if I'm wrong, because I tried it on other computers and it had no problem with the USB drivers and Windows can install by itself.

    Thank you.

    Hi 1980ckc,

    1. have you tried to connect the iPhone to a different USB port?

    You can check out the apple support link and check if it hleps:

    iPhone, iPad and iPod touch: Windows displays a blue screen message or stops when you try to connect to your device.

    http://support.Apple.com/kb/TS1502

    Also check out the apple discussion link:

    http://discussions.Apple.com/message.jspa?MessageID=10339681

    Hope this information is useful.

    Jeremy K
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

    If this post can help solve your problem, please click the 'Mark as answer' or 'Useful' at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • Touch screen does not work on the old Portege M400

    I'm trying to restore an old Toshiba Portege M400. I have WIN XP Tablet 2005 installed and which, according to me, are all the drivers. Everything works perfectly except the touch screen.

    I've been all over the web, downloaded and installed some drivers WACOM Vigneau suggested in another thread here - still no luck.

    Anyone have any ideas or experience on how to solve this problem?

    > I would not be able to use my fingernail or or a pencil eraser to type with (I don't have any kind of pen) just to test?

    To my knowledge, you have the pen in order to use the touch screen.
    As far as I know there are two pens in the portege M400.
    The reserve pen located at the bottom of the unit that there should be a slot that the second pen.

  • Touch screen does not respond in the middle of surfing

    In the middle of surf Facebook my touch screen was freeze and the only way to make it work is to go Task Manager and end the process.  What happens when he "feels like it". There is no model and the intervals are not compatible. I tried troubleshooting, different surveys drivers, monitors and all material that might be associated with the parser. I bought this computer from a friend about 2 years ago and this is the first issue of the magnitude. Help I need help.

    Hello

    Thanks for reaching out.

    We suggest you to update your driver. Click on this Microsoft article for more information. We also recommend you to contact the manufacturer of your computer to help you with your concern for touchscreen.

    Let us know if you have any other questions.

    Best.

  • Touch screen does not work and the message "USB device not recognized".

    I have a Samsung Ativ book 9 Lite. Everything works fine until that recently when my touch screen stopped working (is there a function button that could possibly have it?) and I constantly get a notification from Windows Explorer that says "Device not found USB." When I go to the Device Manager page it constantly keeps refreshing, so you can't click on almost any. There is an element that shows as unknown, but if I try to uninstall or disable, it happens immediately. I just downloaded the latest driver for the printer I only use and still no luck.

    Any help?

    Hey Jake,

    I suggest to download the latest driver available for the touch screen on the manufacturer's Web site and install it.

    Install the latest drivers

    http://Windows.Microsoft.com/en-us/Windows-8/all-drivers

    Also try to update the drivers for the chipset of your PC and check if it helps.

    Let us know the results.

  • touch screen works is not on the new Toshiba Satellite S75-A7221

    The touch screen on my brand new Toshiba laptop with Windows 8 never worked.  Checked the Manager of devices (and why are the 3 names of Interface devices devices?) not named so that we can identify what they drive for the current versions even if it's new, and all show as being updated and active.

    The touch screen on my brand new Toshiba laptop with Windows 8 never worked.  Checked the Manager of devices (and why are the 3 names of Interface devices devices?) not named so that we can identify what they drive for the current versions even if it's new, and all show as being updated and active.

    Contact Toshiba.  If this system has been sold to you as a complete and functional - system it should work from the beginning.

  • touch screen has two lines in the upper part

    I just bought a R5-571 of Best Buy. It's a two in one, but there's an ine doulbe which crosses the top of the screen. However, my initial was that it served a purpose and there was some setting that was originally there, but I couldn't find anything. I took a screenshot, but the lines do not appear in the screenshot. If you use the browser Chrome location would be right in the middle of the tabs down through the entire screen or about 3 mm high and the lines are about 1 mm.

    I would like to take it back to Bestbuy and Exchange.

  • HP Envy 15 "touch screen power LED appears, but the fans does not and the screen does not light

    Hello!

    I'm a student in computer engineering at the University of Waterloo 1A, and I run a very serious problem with my HP Envy 15 "TouchSmart laptop computer running Windows 8.1. It is a problem that just started today, and I'd rather have a first support here before going to see the technical support Office sometimes tomorrow. It has to do with the screen and the fans where the Power LED lights in white, just as when the laptop works properly.

    (I have warranty on the laptop when it was purchased last June, except that if I find that I need to get a replacement, I'll lose all my work, I did on that since I started my semester.) It's so silly of me not to have all my work saved on a backup, because I have an external hard drive. Problem is, I've had too many problems in getting myself organized, I'm not being open-minded as I should, and worse, I'm not a balance between life and work at home.)

    Before I had my MATH 117 conference (Calculus 1 Engineering), I was in a nearby lab where my laptop was open and turned, works correctly. I've had NetBeans IDE running since I wanted to work on the second part of my current assignment of CS 137 (principles of programming). Because it was almost time for my presentation, I closed the laptop by simply moving the screen down on the keyboard, where it goes into mode 'sleep'. (Whenever I flip to the top of the screen, the laptop is supposed to return, and the sliding screen of Windows 8.1 connection will appear.)

    When I took my seat for reading, I wanted to spend a little time to work on my programming assignment. However, after the reversal of the screen to the top, instead of having the login screen appears, I encountered the problem: the power supply light is showing a white light, but I don't hear the fans between the ventilation openings on the left side of the laptop and the screen does not light. I tried to take the power for several seconds and once button at least 10 seconds, except that the power light continues to display on a white light. The Commission of the Wi - Fi light is not displayed.

    Whatever it is, I don't want to take out the battery because I have that on my last laptop, and it's from there that I couldn't turn to the former, a new market. If I leave the Envy laptop battery, it will short-circuit the connections between the battery and the computer, and so several components will FRY. For now, what I do let the laptop is to empty the load on the battery. Then, once I noticed that the power light does not project a white light, or plug in the AC adapter and try turning the laptop on the power button.

    It will take a little while for the circuit drain the load on my battery but...

    Anyway, please would you be kind enough to help me with this problem? I would really appreciate if you can give me several recommendations. Thank you!

    Hello @GregPDesWHP,

    Welcome to the HP Forums, I hope you enjoy your experience! To help you get the most out of the Forums of HP, I would like to draw your attention to the Guide of the Forums HP first time here? Learn how to publish and more.

    I read your post on how your laptop is not on, and I'd be happy to help you in this case!

    In order to restore the features of your computer once more, I recommend you follow the steps described in this document on the computer does not (Windows 8). If the problem persists after having exhausted all the steps in this document, I recommend you contact our technical support at the 800-474-6836. If you do not live in the United States / Canada region, please click the link below to get help from your region number.

    http://WWW8.HP.com/us/en/contact-HP/WW-phone-assist.html

    I hope this helps!

    Concerning

  • touch screen 15R150NR: port on which the USB 3?

    Is there information on this notebook model on the site of HP?

    I could not find any manual/photos/what either.

    Thank you

    If you look into the USB... That's a blue plastic stand inside.

    You can find the manual here:

    http://support.HP.com/us-en/product/HP-15-notebook-PC-series/7234945/model/7415769/manuals?openCLC=true

  • Does not touch the iPhone 6 after 18 months of use.  Apple Service Center is not able to solve the problem it could material being associated and returned the phone, now I'm stuck with this expensive junk, the Iphone above 6 serious problem?

    I am in India, I was using Iphone 6, 16GB, for the last 18 months, bought in Australia, progressively, the touch screen not responding. Then the problem started to happen frequently. I said, all ideas update, (9.3.2) reset, restore, etc., etc., nothing helped, finally the Apple so-called service center has confirmed that it is a hardware problem, is not repairable and advised me to return the phone and scrap it or to pay nearly 60% of the phone cost to get another phone as replacement. (It might be a refurbished phone).  As I see a lot of complaints in the blogs on the problems of the iphone 6, Apple has not taken any measure to solve my problem and trying to make more money on behalf of replacement... Now I'm stuck with such a pricey gadget... should I buy new Iphone?

    Sorry, but an iPhone can be repaired by Apple or a Service provider authorized Apple in the country of purchase. If you think of buying a new device, buy it in the country where you will use it will save you a lot of trouble if you need service.

    And, according to usage, a 16 GB model might not have enough free space left to work properly, which can also cause the phone to lag and unresponsive at times.

  • has dropped iPhone 5s: touch screen no longer works

    I recently left falling m 5s iPhone and when I pressed the home button to turn on, I noticed a horizontal row of white squares to the bottom of the screen and a big white vertical line near the right side. There was also a lot of other smaller lines, and the screen was very low. The touch screen does not work, but the locking buttons and the House doesn't. I got two downs to restart, but when the logo first appeared, the touchscreen still does not work.

    It can be hardware related to your local Genuis Bar or the service provider authorized Apple. -AJ

  • How to detach the screen from the keyboard, and how do I use the touch screen without stylus?

    I have a gateway M285 ta6 t2300 clocked at 1.6 ghz dual core 1 GB 40 GB combo windows 7 tablet laptop 2-1 d. I don't have a pen for the touchscreen, but because I bought it used... I would like to know if I can use the touch screen using my fingers or do I have to buy a pen and if so what kind? Also, I would like to know how to detach the screen from the keyboard.

    Hello

    I suggest that you go to the Gateway Web site and download a manual for the model that will show you how to use it.

    Gateway:

    http://us.gateway.com/GW/en/us/content/drivers-downloads

    See you soon.

  • HP ENVY 15-ae178ca laptop: I disabled the touch screen on my laptop HP ENVY how I get it back?

    I have disabled my touch screen, how do I get it back on?

    @scoop58

    Welcome to the Forums of HP,
    I hope you're well

    I understand that the touch screen no longer works after upgrade to windows 10,
    don't worry, however, as I have a few steps that should solve your problem:

    To activate the touch screen driver in Device Manager:

    1. In Windows, locate and open the Device Manager.
    2. Expand the Human Interface Devices section.
    3. The touchscreen device is labeled HID-compliant screen touch, or similar. Right click on the touch screen device.
    4. If the option to activate the device is included in the menu, click Activate.

    Keep me posted,

    Kind regards

  • Is there a way to disable the touch screen on a TouchSmart 520?

    One of my cats likes to stick his nose in the touchscreen.  Is there a way to simply turn off the touch screen on a 520-1020?

    Hi cs700,.

    Here's how:

    Go to the sounds and then hardware and Control Panel.

    Select the Pen and Touch and go to the contact tab.

    At the top is "Use your finger as input device."  Uncheck the box.

    Click apply and then click OK.

    The touch screen no longer works to the touch.  You should now use the mouse and keyboard, just like any other computer.

    Repeat these steps to reactivate it.  "You also have to check"Enable multi-touch and inking gestures", it turns off when the" use your finger... "is disabled.

    Hope that helps.

    If you like my answer, say thank you with a Kudo. ***

Maybe you are looking for