/**
   * Converts the specified mouse event's screen point from WebView coordinates to Windows
   * coordinates, and returns a new event who's screen point is in Windows coordinates, with the
   * origin at the upper left corner of the WebView window.
   *
   * @param e The event to convert.
   * @return A new mouse event in the Windows coordinate system.
   */
  protected MouseEvent convertToWindows(MouseEvent e) {
    int x = e.getX();
    int y = e.getY();

    // Translate OpenGL screen coordinates to Windows by moving the Y origin from the lower left
    // corner to
    // the upper left corner and flipping the direction of the Y axis.
    y = this.frameSize.height - y;

    if (e instanceof MouseWheelEvent) {
      return new MouseWheelEvent(
          (Component) e.getSource(),
          e.getID(),
          e.getWhen(),
          e.getModifiers(),
          x,
          y,
          e.getClickCount(),
          e.isPopupTrigger(),
          ((MouseWheelEvent) e).getScrollType(),
          ((MouseWheelEvent) e).getScrollAmount(),
          ((MouseWheelEvent) e).getWheelRotation());
    } else {
      return new MouseEvent(
          (Component) e.getSource(),
          e.getID(),
          e.getWhen(),
          e.getModifiers(),
          x,
          y,
          e.getClickCount(),
          e.isPopupTrigger(),
          e.getButton());
    }
  }
 void jListOnlineUsers_mouseClicked(MouseEvent e) {
   if (e.getClickCount() == 2) {
     jTextFieldTargetUser.setText(((HostItem) jListOnlineUsers.getSelectedValue()).name);
     Flasher.instance().flashBackground(jTextFieldTargetUser, Color.yellow, 2);
     jTextFieldSendMessages.requestFocus();
   }
 }
    public void mouseClicked(MouseEvent ev) {
      Window w = (Window) ev.getSource();
      Frame f = null;

      if (w instanceof Frame) {
        f = (Frame) w;
      } else {
        return;
      }

      Point convertedPoint = SwingUtilities.convertPoint(w, ev.getPoint(), getTitlePane());

      int state = f.getExtendedState();
      if (getTitlePane() != null && getTitlePane().contains(convertedPoint)) {
        if ((ev.getClickCount() % 2) == 0 && ((ev.getModifiers() & InputEvent.BUTTON1_MASK) != 0)) {
          if (f.isResizable()) {
            if ((state & Frame.MAXIMIZED_BOTH) != 0) {
              f.setExtendedState(state & ~Frame.MAXIMIZED_BOTH);
            } else {
              f.setExtendedState(state | Frame.MAXIMIZED_BOTH);
            }
            return;
          }
        }
      }
    }
示例#4
0
    public void mousePressed(MouseEvent evt) {
      requestFocus();

      // Focus events not fired sometimes?
      setCaretVisible(true);
      focusedComponent = JEditTextArea.this;

      if ((evt.getModifiers() & InputEvent.BUTTON3_MASK) != 0 && popup != null) {
        popup.show(painter, evt.getX(), evt.getY());
        return;
      }

      int line = yToLine(evt.getY());
      int offset = xToOffset(line, evt.getX());
      int dot = getLineStartOffset(line) + offset;

      switch (evt.getClickCount()) {
        case 1:
          doSingleClick(evt, line, offset, dot);
          break;
        case 2:
          // It uses the bracket matching stuff, so
          // it can throw a BLE
          try {
            doDoubleClick(evt, line, offset, dot);
          } catch (BadLocationException bl) {
            bl.printStackTrace();
          }
          break;
        case 3:
          doTripleClick(evt, line, offset, dot);
          break;
      }
    }
示例#5
0
  public void processFolderPanelMouseEvent(MouseEvent mouseevent) {
    switch (mouseevent.getID()) {
      case 501:
        if (mouseevent.getClickCount() == 2 && !dragged) {
          visitDocument(mouseevent.isShiftDown());
          return;
        }
        // fall through

      case 502:
        ListItem listitem = hotCanvas.getSelectedItem();
        if (listitem != null && (listitem instanceof Bookmark)) {
          Bookmark bookmark = (Bookmark) listitem;
          Webmark webmark = bookmark.getWebmark();
          String s = webmark.getURL();
          frm.setMessage(s);
        } else {
          frm.setMessage("");
        }
        redispatchEvent(mouseevent);
        dragged = false;
        return;

      case 506:
        redispatchEvent(mouseevent);
        dragged = true;
        return;

      default:
        return;
    }
  }
示例#6
0
  @Override
  public final void mousePressed(final MouseEvent e) {
    if (!isEnabled() || !isFocusable()) return;

    requestFocusInWindow();
    caret(true);

    if (SwingUtilities.isMiddleMouseButton(e)) copy();

    final boolean shift = e.isShiftDown();
    final boolean selected = editor.selected();
    if (SwingUtilities.isLeftMouseButton(e)) {
      final int c = e.getClickCount();
      if (c == 1) {
        // selection mode
        if (shift) editor.startSelection(true);
        select(e.getPoint(), !shift);
      } else if (c == 2) {
        editor.selectWord();
      } else {
        editor.selectLine();
      }
    } else if (!selected) {
      select(e.getPoint(), true);
    }
  }
 public void mousePressed(MouseEvent e) {
   if (e.getButton() != MouseEvent.BUTTON1) {
     return;
   }
   if (e.getClickCount() != 2) {
     return;
   }
   JTable table = (JTable) e.getSource();
   Point p = e.getPoint();
   int row = table.rowAtPoint(p);
   if (row < 0) {
     return;
   }
   FinderTableModel model = getDataModel();
   ICFSecurityISOTimezoneObj o =
       (ICFSecurityISOTimezoneObj) model.getValueAt(row, COLID_ROW_HEADER);
   if (o == null) {
     return;
   }
   JInternalFrame frame = swingSchema.getISOTimezoneFactory().newViewEditJInternalFrame(o);
   ((ICFSecuritySwingISOTimezoneJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View);
   if (frame == null) {
     return;
   }
   Container cont = getParent();
   while ((cont != null) && (!(cont instanceof JInternalFrame))) {
     cont = cont.getParent();
   }
   if (cont != null) {
     JInternalFrame myInternalFrame = (JInternalFrame) cont;
     myInternalFrame.getDesktopPane().add(frame);
     frame.setVisible(true);
     frame.show();
   }
 }
 public void mousePressed(MouseEvent e) {
   if (e.getButton() != MouseEvent.BUTTON1) {
     return;
   }
   if (e.getClickCount() != 2) {
     return;
   }
   JTable table = (JTable) e.getSource();
   Point p = e.getPoint();
   int row = table.rowAtPoint(p);
   if (row < 0) {
     return;
   }
   PickerTableModel model = getDataModel();
   ICFInternetISOCountryObj o =
       (ICFInternetISOCountryObj) model.getValueAt(row, COLID_ROW_HEADER);
   invokeWhenChosen.choseISOCountry(o);
   try {
     Container cont = getParent();
     while ((cont != null) && (!(cont instanceof JInternalFrame))) {
       cont = cont.getParent();
     }
     if (cont != null) {
       ((JInternalFrame) cont).setClosed(true);
     }
   } catch (Exception x) {
   }
 }
示例#9
0
  @Override
  public final void mousePressed(final MouseEvent e) {
    if (!isEnabled() || !isFocusable()) return;

    requestFocusInWindow();
    cursor(true);

    if (SwingUtilities.isMiddleMouseButton(e)) copy();

    final boolean marking = e.isShiftDown();
    final boolean nomark = !text.marked();
    if (SwingUtilities.isLeftMouseButton(e)) {
      final int c = e.getClickCount();
      if (c == 1) {
        // selection mode
        if (marking && nomark) text.startMark();
        rend.select(scroll.pos(), e.getPoint(), marking);
      } else if (c == 2) {
        text.selectWord();
      } else {
        text.selectLine();
      }
    } else if (nomark) {
      rend.select(scroll.pos(), e.getPoint(), false);
    }
  }
示例#10
0
  public void mouseClicked(MouseEvent e) {
    int x;
    int y;

    e.consume();

    if (mouseEventsEnabled) {

      x = Math.round(e.getX() / scale);
      y = Math.round(e.getY() / scale);

      // allow for the canvas margin
      y -= margin;

      // System.out.println("Mouse Click: (" + x + ", " + y + ")");

      if (e.getClickCount() < 2) {
        if (nativeSelectItem(x, y)) {
          parentFTAFrame.updateFrame();
        }
      } else {
        if (nativeSelectItem(x, y)) {
          parentFTAFrame.updateFrame();
        }

        editSelected();
        parentFTAFrame.updateFrame();
      }

      if (focusEventsEnabled) {
        // tell the main Canvas to point to this coordinate
        parentFTAFrame.setCanvasFocus(x, y);
      }
    }
  }
示例#11
0
  /**
   * Called to process events. Mouse events will be rewritten to indicate the position in the
   * document clicked, instead of the position of the panel.
   *
   * @param event to process.
   */
  protected void processEvent(AWTEvent event) {
    try {
      if (event instanceof MouseEvent) {
        final Point scrollPosition = getScrollPosition();

        if (scrollPosition != null) {
          final MouseEvent mouseEvent = (MouseEvent) event;
          event =
              new MouseEvent(
                  (Component) mouseEvent.getSource(),
                  mouseEvent.getID(),
                  mouseEvent.getWhen(),
                  mouseEvent.getModifiers(),
                  mouseEvent.getX() + scrollPosition.x,
                  mouseEvent.getY() + scrollPosition.y,
                  mouseEvent.getClickCount(),
                  mouseEvent.isPopupTrigger());
        }
      }
    } catch (final Throwable exp) {
      exp.printStackTrace(DjVuOptions.err);
      System.gc();
    }

    super.processEvent(event);
  }
示例#12
0
 @Override
 public void mouseClicked(MouseEvent e) {
   if (e.getClickCount() == 2) {
     doubleClicked((JComponent) e.getSource());
   }
   super.mouseClicked(e);
 }
    public void mouseClicked(MouseEvent e) {
      int selRow = tree.getRowForLocation(e.getX(), e.getY());
      TreePath selPath = tree.getPathForLocation(e.getX(), e.getY());

      if (e.getClickCount() == 2) {
        myDoubleClick(selRow, selPath);
      }
    }
 @Override
 public void mouseClicked(MouseEvent evt) {
   if (evt.getClickCount() == 2) {
     multicaster.trackDoubleClick(
         new Point(evt.getX(), evt.getY()), evt.getModifiersEx(), getView());
   }
   evt.consume();
 }
    public void mousePressed(MouseEvent e) {
      if (e.getClickCount() == 2) {
        JList list = (JList) e.getSource();
        int index = list.locationToIndex(e.getPoint());

        optionPane.setInputValue(list.getModel().getElementAt(index));
      }
    }
示例#16
0
  public void mouseClicked(MouseEvent e) {
    // Double Click
    if (e.getClickCount() == 2) {
      System.out.println("Double CLIKC!!\n\n\n");
      if (treeMode == SUBROLE_ID) {
        if (editor.getMode() == PBModePanel.SUB_ROLE_MODE) {
          editor.getSubRolePanel().loadSelected();
        } else if (editor.getMode() == PBModePanel.TEST_MODE) {
          editor.getTestPanel().selectSubRole();
        }
      }

      // Single Click
    } else if (e.getClickCount() == 1) {
      return;
    }
  }
示例#17
0
    public void mouseClicked(MouseEvent e) {
      if (e.getButton() == e.BUTTON1) {
        showButton.setEnabled(list.getSelectedIndex() != -1 ? true : false);

        if (e.getClickCount() == 2) {
          int index = list.locationToIndex(e.getPoint());
          sp.doVisualComparison(index, scores[index]);
        }
      }
    }
 public void mousePressed(MouseEvent e) {
   if (e.getButton() != MouseEvent.BUTTON1) {
     return;
   }
   if (e.getClickCount() != 2) {
     return;
   }
   JTable table = (JTable) e.getSource();
   Point p = e.getPoint();
   int row = table.rowAtPoint(p);
   if (row < 0) {
     return;
   }
   ListTableModel model = getDataModel();
   ICFInternetVersionObj o = (ICFInternetVersionObj) model.getValueAt(row, COLID_ROW_HEADER);
   if (o == null) {
     return;
   }
   JInternalFrame frame = null;
   String classCode = o.getClassCode();
   if (classCode.equals("VERN")) {
     frame = swingSchema.getVersionFactory().newViewEditJInternalFrame(o);
     frame.addInternalFrameListener(getViewEditInternalFrameListener());
     ((ICFInternetSwingVersionJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View);
   } else if (classCode.equals("MJVR")) {
     frame =
         swingSchema
             .getMajorVersionFactory()
             .newViewEditJInternalFrame((ICFInternetMajorVersionObj) o);
     frame.addInternalFrameListener(getViewEditInternalFrameListener());
     ((ICFInternetSwingMajorVersionJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View);
   } else if (classCode.equals("MNVR")) {
     frame =
         swingSchema
             .getMinorVersionFactory()
             .newViewEditJInternalFrame((ICFInternetMinorVersionObj) o);
     frame.addInternalFrameListener(getViewEditInternalFrameListener());
     ((ICFInternetSwingMinorVersionJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View);
   } else {
     frame = null;
   }
   if (frame == null) {
     return;
   }
   Container cont = getParent();
   while ((cont != null) && (!(cont instanceof JInternalFrame))) {
     cont = cont.getParent();
   }
   if (cont != null) {
     JInternalFrame myInternalFrame = (JInternalFrame) cont;
     myInternalFrame.getDesktopPane().add(frame);
     frame.setVisible(true);
     frame.show();
   }
 }
 /**
  * MouseListener method for mouseUp events. Depending on the kind of event the appropriate hook
  * method is called (popupMenuUp for popup trigger, doubleMouseClick for a double click, and
  * mouseUp() and mouseClick() for normal mouse clicks).
  *
  * @param e MouseEvent which should be interpreted
  * @param x x coordinate of the MouseEvent
  * @param y y coordinate of the MouseEvent
  */
 public void mouseUp(MouseEvent e, int x, int y) {
   if (e.isPopupTrigger()) {
     handlePopupMenu(e, x, y);
   } else if (e.getClickCount() == 2) {
     handleMouseDoubleClick(e, x, y);
   } else {
     super.mouseUp(e, x, y);
     handleMouseUp(e, x, y);
     handleMouseClick(e, x, y);
   }
 }
  protected void handleMouseEvent(MouseEvent e, boolean forceUpdate) {
    KeyType selected = getCellKeyForPoint(e.getPoint());
    if (forceUpdate || !Comparing.equal(myKey, selected)) {
      handleSelectionChange(selected, true);
    }

    // Temporary workaround
    if (e.getClickCount() == 2) {
      hideHint();
    }
  }
示例#21
0
    public void mouseClicked(MouseEvent e) {
      details = String.format("You clicked %d", e.getClickCount());

      // isMetaDown() = what kind mouse is used now? one button or two
      // button or more?
      if (e.isMetaDown()) details += "with right mouse button";
      else if (e.isAltDown()) details += "with center mouse button";
      else details += "with left mouse";

      statusBar.setText(details);
    }
示例#22
0
 /**
  * If a genome is single clicked, we just store the selection. When a genome is double clicked, we
  * treat that as the user wanting to load the genome.
  *
  * @param e
  */
 private void genomeListMouseClicked(MouseEvent e) {
   switch (e.getClickCount()) {
     case 1:
       List<GenomeListItem> selValues = genomeList.getSelectedValuesList();
       downloadSequenceCB.setEnabled(selValues != null && selValues.size() == 1);
       break;
     case 2:
       okButtonActionPerformed(null);
       break;
   }
 }
示例#23
0
 public void mouseClicked(MouseEvent e) {
   if (e.getClickCount() != 1) return;
   // String s = html.getToolTipText();
   if (word == null) return;
   setMessage(word);
   String s = text.getText();
   String h =
       s.substring(0, selB)
           + " <FONT color=blue> "
           + s.substring(selB, selE)
           + " </FONT> "
           + s.substring(selE);
   setHTML(h);
 }
    @Override
    public void mouseClicked(MouseEvent e) {
      Point p = e.getPoint();
      CPArtwork artwork = controller.getArtwork();
      int layerIndex = getLayerNb(p);

      if (e.getClickCount() == 2
          && layerIndex >= 0
          && layerIndex < artwork.getLayersNb()
          && p.x > eyeW) {
        showRenameControl(layerIndex);
      } else if (renameField.isVisible()) {
        renameField.renameAndHide();
      }
    }
示例#25
0
  /** {@inheritDoc} */
  @Override
  public void mouseClicked(final MouseEvent aEvent) {
    // Ensure the focus is moved to the main signal diagram component...
    getSignalDiagram().requestFocusInWindow();

    if (getModel().isCursorMode() && (aEvent.getClickCount() == 2)) {
      final MouseEvent event = convertEvent(aEvent);

      final Cursor hoveredCursor = findCursor(event.getPoint());
      if (hoveredCursor != null) {
        editCursorProperties(hoveredCursor);
        // Consume the event to stop further processing...
        aEvent.consume();
      }
    }
  }
示例#26
0
  public void mouseClicked(MouseEvent e) {
    if (e.getClickCount() >= 2) {
      int x = e.getX();
      int y = e.getY();
      if (x >= posX && x < posX + Constant.BATTLEFIELD_WIDTH) {
        if (y >= posY) {
          if (y < posY + Constant.BATTLEFIELD_HEIGHT) {

          } else if (y < posY + Constant.BATTLEFIELD_HEIGHT + Constant.CARDPANEL_HEIGHT) {
            card_panel.doDoubleClick(x - posX, y - (posY + Constant.BATTLEFIELD_HEIGHT));
            return;
          }
        }
      }
    }
  }
示例#27
0
 void this_mouseClicked(MouseEvent e) {
   if (e.getClickCount() == 1) {
     int row = this.getSelectedRow();
     ItemTableDwnld item = (ItemTableDwnld) getMessageList().get(row);
     Container parent = (Container) this;
     while ((parent != null) && !(parent instanceof FrmMain)) parent = parent.getParent();
     if (parent != null) {
       ((FrmMain) parent).setTxtName(item.getTextName());
       ((FrmMain) parent).setTxtTextStart(item.getTextStart());
       ((FrmMain) parent).setTxtTextEnd(item.getTextEnd());
       ((FrmMain) parent).setTxtPath(item.getTextPath());
       ((FrmMain) parent).setCboxType(item.getTextType());
       ((FrmMain) parent).enableBtnUpDown(row);
     }
   }
 }
 void forwardEventToParent(MouseEvent e) {
   getParent()
       .dispatchEvent(
           new MouseEvent(
               getParent(),
               e.getID(),
               e.getWhen(),
               e.getModifiers(),
               e.getX(),
               e.getY(),
               e.getXOnScreen(),
               e.getYOnScreen(),
               e.getClickCount(),
               e.isPopupTrigger(),
               MouseEvent.NOBUTTON));
 }
示例#29
0
    @Override
    public void mouseReleased(MouseEvent evt) {
      if (evt.getClickCount() % 2 != 0 && !GUIUtilities.isMiddleButton(evt.getModifiers())) return;

      int row = parentDirectories.locationToIndex(evt.getPoint());
      if (row != -1) {
        Object obj = parentDirectories.getModel().getElementAt(row);
        if (obj instanceof VFSFile) {
          VFSFile dirEntry = (VFSFile) obj;
          if (!GUIUtilities.isPopupTrigger(evt)) {
            browser.setDirectory(dirEntry.getPath());
            if (browser.getMode() == VFSBrowser.BROWSER) focusOnFileView();
          }
        }
      }
    }
示例#30
0
  public void mouseClicked(MouseEvent e) {
    if (this.isArmed()) {
      if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) {
        Object topObject = null;
        PickedObjectList pickedObjects = this.wwd.getObjectsAtCurrentPosition();
        if (pickedObjects != null) topObject = pickedObjects.getTopObject();

        if (topObject instanceof ControlPointMarker) {
          this.removeVertex((ControlPointMarker) topObject);
          e.consume();
        } else {
          this.addVertex(e.getPoint());
          e.consume();
        }
      }
    }
  }