Ejemplo n.º 1
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);
      }
    }
  }
 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();
   }
 }
Ejemplo n.º 3
0
 @Override
 public void mouseClicked(MouseEvent e) {
   if (e.getClickCount() == 2) {
     doubleClicked((JComponent) e.getSource());
   }
   super.mouseClicked(e);
 }
Ejemplo n.º 4
0
    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;
          }
        }
      }
    }
Ejemplo n.º 5
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;
      }
    }
 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) {
   }
 }
Ejemplo n.º 7
0
    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));
      }
    }
    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);
      }
    }
 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();
   }
 }
Ejemplo n.º 10
0
 @Override
 public void mouseClicked(MouseEvent e) {
   if (e.getClickCount() == 2) {
     JTable table = (JTable) e.getSource();
     ListTableModel<PatientModel> tableModel = getTableModel();
     PatientModel value = (PatientModel) tableModel.getObject(table.getSelectedRow());
     if (value != null) {
       openKarte();
     }
   }
 }
Ejemplo n.º 11
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();
          }
        }
      }
    }
Ejemplo n.º 12
0
    public void mouseClicked(MouseEvent e) {
      if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 1) {
        JButton source = (JButton) e.getSource();

        String value = source.getText();
        int day = Integer.parseInt(value);
        calendar.set(Calendar.DAY_OF_MONTH, day);
        Date selectDate = this.getSelectDate();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
        MyDateChooseBtn.this.setText(simpleDateFormat.format(selectDate));
        Jtext.setText(simpleDateFormat.format(selectDate));

        int year = calendar.get(Calendar.YEAR);
        int month = calendar.get(Calendar.MONTH) + 1;
        //        System.out.println(year + "骞�" + month + "鏈�" + day + "鏃�");
        f.dispose();
      }
    }
Ejemplo n.º 13
0
    public void mouseClicked(MouseEvent evt) {
      // Note: we can't depend on evt.getSource() because of backward
      // compatability
      if (list != null && SwingUtilities.isLeftMouseButton(evt) && (evt.getClickCount() % 2 == 0)) {

        int index = SwingUtilities2.loc2IndexFileList(list, evt.getPoint());
        if (index >= 0) {
          File f = (File) list.getModel().getElementAt(index);
          try {
            // Strip trailing ".."
            f = ShellFolder.getNormalizedFile(f);
          } catch (IOException ex) {
            // That's ok, we'll use f as is
          }
          if (getFileChooser().isTraversable(f)) {
            list.clearSelection();
            changeDirectory(f);
          } else {
            getFileChooser().approveSelection();
          }
        }
      }
    }
Ejemplo n.º 14
0
    // {{{ mouseClicked() method
    @Override
    public void mouseClicked(MouseEvent evt) {
      Point p = evt.getPoint();
      int row = table.rowAtPoint(p);
      int column = table.columnAtPoint(p);
      if (row == -1) return;
      if (column == 0) {
        VFSDirectoryEntryTableModel.Entry entry =
            (VFSDirectoryEntryTableModel.Entry) table.getModel().getValueAt(row, 0);
        if (FileCellRenderer.ExpansionToggleBorder.isExpansionToggle(entry.level, p.x)) {
          return;
        }
      }

      if ((evt.getModifiers() & InputEvent.BUTTON1_MASK) != 0 && evt.getClickCount() % 2 == 0) {
        browser.filesActivated(
            evt.isShiftDown() ? VFSBrowser.M_OPEN_NEW_VIEW : VFSBrowser.M_OPEN, true);
      } else if (GUIUtilities.isMiddleButton(evt.getModifiers())) {
        if (evt.isShiftDown()) table.getSelectionModel().addSelectionInterval(row, row);
        else table.getSelectionModel().setSelectionInterval(row, row);
        browser.filesActivated(
            evt.isShiftDown() ? VFSBrowser.M_OPEN_NEW_VIEW : VFSBrowser.M_OPEN, true);
      }
    } // }}}
  /**
   * When a MenuElement receives an event from a MouseListener, it should never process the event
   * directly. Instead all MenuElements should call this method with the event.
   *
   * @param event a MouseEvent object
   */
  public void processMouseEvent(MouseEvent event) {
    int screenX, screenY;
    Point p;
    int i, c, j, d;
    Component mc;
    Rectangle r2;
    int cWidth, cHeight;
    MenuElement menuElement;
    MenuElement subElements[];
    MenuElement path[];
    Vector<MenuElement> tmp;
    int selectionSize;
    p = event.getPoint();

    Component source = event.getComponent();

    if ((source != null) && !source.isShowing()) {
      // This can happen if a mouseReleased removes the
      // containing component -- bug 4146684
      return;
    }

    int type = event.getID();
    int modifiers = event.getModifiers();
    // 4188027: drag enter/exit added in JDK 1.1.7A, JDK1.2
    if ((type == MouseEvent.MOUSE_ENTERED || type == MouseEvent.MOUSE_EXITED)
        && ((modifiers
                & (InputEvent.BUTTON1_MASK | InputEvent.BUTTON2_MASK | InputEvent.BUTTON3_MASK))
            != 0)) {
      return;
    }

    if (source != null) {
      SwingUtilities.convertPointToScreen(p, source);
    }

    screenX = p.x;
    screenY = p.y;

    tmp = (Vector<MenuElement>) selection.clone();
    selectionSize = tmp.size();
    boolean success = false;
    for (i = selectionSize - 1; i >= 0 && success == false; i--) {
      menuElement = (MenuElement) tmp.elementAt(i);
      subElements = menuElement.getSubElements();

      path = null;
      for (j = 0, d = subElements.length; j < d && success == false; j++) {
        if (subElements[j] == null) continue;
        mc = subElements[j].getComponent();
        if (!mc.isShowing()) continue;
        if (mc instanceof JComponent) {
          cWidth = mc.getWidth();
          cHeight = mc.getHeight();
        } else {
          r2 = mc.getBounds();
          cWidth = r2.width;
          cHeight = r2.height;
        }
        p.x = screenX;
        p.y = screenY;
        SwingUtilities.convertPointFromScreen(p, mc);

        /**
         * Send the event to visible menu element if menu element currently in the selected path or
         * contains the event location
         */
        if ((p.x >= 0 && p.x < cWidth && p.y >= 0 && p.y < cHeight)) {
          int k;
          if (path == null) {
            path = new MenuElement[i + 2];
            for (k = 0; k <= i; k++) path[k] = (MenuElement) tmp.elementAt(k);
          }
          path[i + 1] = subElements[j];
          MenuElement currentSelection[] = getSelectedPath();

          // Enter/exit detection -- needs tuning...
          if (currentSelection[currentSelection.length - 1] != path[i + 1]
              && (currentSelection.length < 2
                  || currentSelection[currentSelection.length - 2] != path[i + 1])) {
            Component oldMC = currentSelection[currentSelection.length - 1].getComponent();

            MouseEvent exitEvent =
                new MouseEvent(
                    oldMC,
                    MouseEvent.MOUSE_EXITED,
                    event.getWhen(),
                    event.getModifiers(),
                    p.x,
                    p.y,
                    event.getXOnScreen(),
                    event.getYOnScreen(),
                    event.getClickCount(),
                    event.isPopupTrigger(),
                    MouseEvent.NOBUTTON);
            currentSelection[currentSelection.length - 1].processMouseEvent(exitEvent, path, this);

            MouseEvent enterEvent =
                new MouseEvent(
                    mc,
                    MouseEvent.MOUSE_ENTERED,
                    event.getWhen(),
                    event.getModifiers(),
                    p.x,
                    p.y,
                    event.getXOnScreen(),
                    event.getYOnScreen(),
                    event.getClickCount(),
                    event.isPopupTrigger(),
                    MouseEvent.NOBUTTON);
            subElements[j].processMouseEvent(enterEvent, path, this);
          }
          MouseEvent mouseEvent =
              new MouseEvent(
                  mc,
                  event.getID(),
                  event.getWhen(),
                  event.getModifiers(),
                  p.x,
                  p.y,
                  event.getXOnScreen(),
                  event.getYOnScreen(),
                  event.getClickCount(),
                  event.isPopupTrigger(),
                  MouseEvent.NOBUTTON);
          subElements[j].processMouseEvent(mouseEvent, path, this);
          success = true;
          event.consume();
        }
      }
    }
  }
Ejemplo n.º 16
0
 public void mouseClicked(MouseEvent e) {
   row = queryTable.getSelectedRow();
   if (e.getClickCount() == 2) {
     startDownload();
   }
 }
Ejemplo n.º 17
0
 /**
  * Listens for double clicks to open the chat room.
  *
  * @param e
  */
 public void mouseClicked(MouseEvent e) {
   if (((e.getModifiers() & InputEvent.BUTTON1_MASK) != 0) && (e.getClickCount() > 1))
     openChatForSelection();
 }
Ejemplo n.º 18
0
 public void mouseClicked(MouseEvent e) {
   if (e.getButton() == 1 && e.getClickCount() == 2) {
     adjustZoom(1, null);
   }
 }
Ejemplo n.º 19
0
 /** On double-click, open image properties dialog. */
 public void mouseClicked(MouseEvent e) {
   if (e.getClickCount() == 2) {}
 }
Ejemplo n.º 20
0
 public void mouseClicked(MouseEvent e) {
   if (e.getClickCount() == 2) invertCM();
   updateColors();
 }