Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It appears, that Windows 8 Tablet has a low MultiClickInterval.</p> <p>You can get that value with this line: Toolkit.getDefaultToolkit().getDesktopProperty("awt.multiClickInterval")</p> <p>My workaround is, that you code your own MultiClickInterval with Timer and TimerTask:</p> <p>You need a static <code>Map&lt;java.awt.Component, Integer&gt;</code> that holds the click count for each <code>Component</code>.</p> <pre><code>public static final Map&lt;java.awt.Component, Integer&gt; MULTI_CLICK_MAP = new HashMap&lt;java.awt.Component, Integer&gt;(); </code></pre> <p>You also need a <code>java.util.Timer</code></p> <pre><code>private Timer timer = new Timer(); </code></pre> <p>In the Method you increase the counter for the component. When it's 2 you execute the code. A TimerTask will reset the counter after a defined time.</p> <p>Your method will look like this:</p> <pre><code>private void jListItemsMouseClicked(java.awt.event.MouseEvent evt) { Component comp = evt.getComponent(); //added the component to the map or increase the counter if(MULTI_CLICK_MAP.containsKey(comp)) { MULTI_CLICK_MAP.put(comp, 1); } else { int oldCounter = MULTI_CLICK_MAP.get(comp); MULTI_CLICK_MAP.put(comp, oldCounter + 1); } //check for double click if (MULTI_CLICK_MAP.get(comp) == 2) { MULTI_CLICK_MAP.remove(comp); //here is your logic m_ReturnProduct = (ItemsInfo) jListItems.getSelectedValue(); if (m_ReturnProduct != null) { buttonTransition(m_ReturnProduct); } } else { //start the TimerTask that resets the counter. this will reset after 1 second (1000 milliseconds) this.timer.schedule(new ClickReseter(comp), 1000); } } </code></pre> <p>The ClickReset is a simple TimerTask that holds the <code>Component</code></p> <pre><code>public class ClickReseter extends TimerTask { private Component component; public ClickReseter(Component component) { this.component = component; } @Override public void run() { MULTI_CLICK_MAP.remove(component); } } </code></pre> <p><strong>I hope this works out for you. It didn't test it! if you have any questions, feel free to ask.</strong></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload