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();
   }
 }
コード例 #2
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;
          }
        }
      }
    }
コード例 #3
0
 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 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) {
   }
 }
コード例 #5
0
ファイル: TextPanel.java プロジェクト: dimitarp/basex
  @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);
    }
  }
コード例 #6
0
ファイル: FTACanvas.java プロジェクト: jandcmoore/OpenFTA
  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);
      }
    }
  }
コード例 #7
0
ファイル: BaseXEditor.java プロジェクト: godmar/basex
  @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);
    }
  }
コード例 #8
0
 @Override
 public void mouseClicked(MouseEvent e) {
   if (e.getClickCount() == 2) {
     doubleClicked((JComponent) e.getSource());
   }
   super.mouseClicked(e);
 }
コード例 #9
0
ファイル: JEditTextArea.java プロジェクト: zeph/grinder
    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;
      }
    }
コード例 #10
0
ファイル: BehaviorTree.java プロジェクト: northern-bites/tool
  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;
    }
  }
コード例 #11
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));
      }
    }
コード例 #12
0
    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);
      }
    }
コード例 #13
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();
   }
 }
  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();
    }
  }
コード例 #16
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);
    }
コード例 #17
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();
     }
   }
 }
コード例 #18
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;
   }
 }
コード例 #19
0
ファイル: TestHTML.java プロジェクト: maeyler/PlainJava
 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);
 }
コード例 #20
0
    @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();
      }
    }
コード例 #21
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();
      }
    }
  }
コード例 #22
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);
     }
   }
 }
コード例 #23
0
ファイル: ArenaFrame.java プロジェクト: supercube/oop_final
  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;
          }
        }
      }
    }
  }
コード例 #24
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();
          }
        }
      }
    }
コード例 #25
0
 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));
 }
 private void dateTableMouseClicked(MouseEvent e) {
   if (e.getClickCount() == 2) {
     try {
       DomainEditor domainEditor =
           new DomainEditor(
               ArchDescriptionDates.class,
               editorField.getParentEditor(),
               "Dates",
               new ArchDescriptionDatesFields());
       domainEditor.setCallingTable(dateTable);
       domainEditor.setNavigationButtonListeners(domainEditor);
       editRelatedRecord(dateTable, ArchDescriptionDates.class, true, domainEditor);
     } catch (UnsupportedTableModelException e1) {
       new ErrorDialog("Error creating editor for Dates", e1).showDialog();
     }
   }
 }
コード例 #27
0
ファイル: MyDateChooseBtn.java プロジェクト: singleD/se2
    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();
      }
    }
コード例 #28
0
  /**
   * Propagates certain mouse events, such as MOUSE_CLICKED, MOUSE_RELEASED etc. to the deepest
   * component.
   *
   * @param e The MouseEvent to be propagated.
   */
  protected void propagateMouseListenerEvent(MouseEvent e) {
    if (POPUP_IS_MODAL == false) {

      Component deepestComponent = getDeepestComponent(e.getPoint());

      if (deepestComponent != null) {
        MouseListener[] mouseListeners = deepestComponent.getMouseListeners();

        int eventID;

        // Get the event type
        eventID = e.getID();

        Point pt = e.getPoint();

        Point convertedPt = SwingUtilities.convertPoint(glassPane, e.getPoint(), deepestComponent);

        MouseEvent evt =
            new MouseEvent(
                deepestComponent,
                e.getID(),
                System.currentTimeMillis(),
                e.getModifiers(),
                convertedPt.x,
                convertedPt.y,
                e.getClickCount(),
                e.isPopupTrigger(),
                e.getButton());

        // Distibute the event to the component's listeners.
        for (int i = 0; i < mouseListeners.length; i++) {

          // Forward the appropriate mouse event
          if (eventID == MouseEvent.MOUSE_PRESSED) {
            mouseListeners[i].mousePressed(evt);
          } else if (eventID == MouseEvent.MOUSE_RELEASED) {
            mouseListeners[i].mouseReleased(evt);
          } else if (eventID == MouseEvent.MOUSE_CLICKED) {
            mouseListeners[i].mouseClicked(evt);
          }
        }
      }
    }
  }
コード例 #29
0
 private void dispatchEvent(MouseEvent me) {
   if (rect != null && rect.contains(me.getX(), me.getY())) {
     Point pt = me.getPoint();
     pt.translate(-offset, 0);
     comp.setBounds(rect);
     comp.dispatchEvent(
         new MouseEvent(
             comp,
             me.getID(),
             me.getWhen(),
             me.getModifiers(),
             pt.x,
             pt.y,
             me.getClickCount(),
             me.isPopupTrigger(),
             me.getButton()));
     if (!comp.isValid()) container.repaint();
   }
 }
  private void instancesTableMouseClicked(MouseEvent e) {
    if (e.getClickCount() == 2) {
      // get the current instance record to edit
      DomainObject instanceRecord = null;
      int selectedRow = getInstancesTable().getSelectedRow();
      if (selectedRow != -1) {
        instanceRecord = getInstancesTable().getSortedList().get(selectedRow);
      }

      if (usePluginDomainEditor(false, instanceRecord, getInstancesTable())) {
        return;
      }

      if (handleTableMouseClick(e, getInstancesTable(), ArchDescriptionInstances.class)
          == JOptionPane.OK_OPTION) {
        findLocationForInstance(currentInstance);
      }
    }
  }