@Override
  public void mouseMoved(MouseEvent evt) {
    Point point = evt.getPoint();
    updateCursor(editor.findView((Container) evt.getSource()), point);
    DrawingView view = editor.findView((Container) evt.getSource());
    updateCursor(view, point);
    if (view == null || editor.getActiveView() != view) {
      clearHoverHandles();
    } else {
      // Search first, if one of the selected figures contains
      // the current mouse location. Only then search for other
      // figures. This search sequence is consistent with the
      // search sequence of the SelectionTool.
      Figure figure = null;
      Point2D.Double p = view.viewToDrawing(point);
      for (Figure f : view.getSelectedFigures()) {
        if (f.contains(p)) {
          figure = f;
        }
      }
      if (figure == null) {
        figure = view.findFigure(point);
        Drawing drawing = view.getDrawing();
        while (figure != null && !figure.isSelectable()) {
          figure = drawing.findFigureBehind(p, figure);
        }
      }

      updateHoverHandles(view, figure);
    }
  }
Beispiel #2
0
 public void mouseDragged(MouseEvent e) {
   if (isEnabled()) {
     // System.out.println("LinkTool::mouseDragged");
     if (e.getSource() instanceof ONLGraphic)
       buttonAction.setIntermediate(e.getPoint(), (ONLGraphic) e.getSource());
   }
 }
  /**
   * 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());
    }
  }
Beispiel #4
0
  public void mouseExited(MouseEvent event) {

    if (event.getSource() instanceof JButton) {
      JButton entered = (JButton) event.getSource();
      if (entered != back) {
        entered.setForeground(Color.black);
      }
    }
  }
 @Override
 public void mouseClicked(MouseEvent e) {
   // TODO Auto-generated method stub
   if (e.getSource() == login.b1) { // double click event
     card.show(getContentPane(), "WR");
   } else if (e.getSource() == login.b2) {
     card.show(getContentPane(), "");
   }
 }
Beispiel #6
0
 @Override
 public void mouseMoved(MouseEvent e) {
   if (e.getSource() == help) {
     error.setText("The XCar Help");
   } else if (e.getSource() == quit) {
     error.setText("Do you want to quit?");
   } else if (e.getSource() == start) {
     error.setText("Start a XCar session");
   }
 }
  public void mouseExited(MouseEvent e) {
    Object source = e.getSource();
    if (!(source instanceof JLabel)) return;

    if (!tokenMode && !correctionTokenMode) {
      // tile mode
      HexLabel tile = (HexLabel) e.getSource();
      tile.setToolTipText(null);
    }
  }
  // implementation of java.awt.event.MouseMotionListener interface
  public void mouseDragged(MouseEvent e) {
    if (e.getSource() == cs) {
      int i = e.getX();
      int j = e.getY();

      Color c = new Color(cs.getRGB(i, j));

      updateColor(c, e.getSource());
    }
  }
Beispiel #9
0
 public void mouseEntered(MouseEvent evt) {
   if (evt.getSource() instanceof AbstractButton) {
     AbstractButton button = (AbstractButton) evt.getSource();
     Action action = button.getAction();
     if (action != null) {
       String message = (String) action.getValue("LongDescription");
       setMessage(message);
     }
   }
 }
Beispiel #10
0
 public void setBorderType(MouseEvent me, int type) {
   if (type == 1) {
     ((JPanel) me.getSource())
         .setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.RAISED));
     setCursor(new Cursor(Cursor.HAND_CURSOR));
   }
   if (type == 2) {
     ((JPanel) me.getSource())
         .setBorder(new javax.swing.border.MatteBorder(0, 0, 0, 0, Color.white));
     setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
   }
 }
  public void mouseEntered(MouseEvent e) {
    Object source = e.getSource();
    if (!(source instanceof JLabel)) return;

    if (!tokenMode && !correctionTokenMode) {
      // tile mode
      HexLabel tile = (HexLabel) e.getSource();
      String tooltip = tile.getToolTip();
      if (tooltip != "") {
        tile.setToolTipText(tooltip);
      }
    }
  }
Beispiel #12
0
 public void mousePressed(MouseEvent e) {
   if (ltool.isEnabled()) {
     startComponent = ((ONLComponentButton) e.getSource()).getONLComponent();
     if (startComponent instanceof GigEDescriptor) {
       ExpCoordinator.print(
           new String(
               "LinkTool.ComponentListener.mousePressed gige startComponent:"
                   + startComponent.getLabel()),
           TEST_GIGE);
       startComponent = ((GigEDescriptor) startComponent).getUnlinkedPort();
       if (startComponent != null)
         ExpCoordinator.print(
             new String("  unlinked port: " + startComponent.getLabel()), TEST_GIGE);
       else ExpCoordinator.print("  unlinked port: null", TEST_GIGE);
     }
     if (startComponent instanceof HardwareHost)
       startComponent = ((HardwareHost) startComponent).getPort(0);
     endComponent = null;
     if (startComponent.isLinkable() && (!startComponent.isLinked())) {
       LinkDescriptor ld =
           ltool.createLinkDescriptor(
               startComponent); // new LinkDescriptor(ltool.getNextLabel(), startComponent,
                                // ltool.currentBW, ltool.expCoordinator);
       linkGraphic = (LinkGraphic) ld.getGraphic();
       if (linkGraphic.getONLComponent() == null)
         ExpCoordinator.print("LinkTool.ComponentListener::mousePressed onlcomp == null", 2);
       // linkGraphic = new LinkGraphic();
       // linkGraphic.setPoint1(startComponent.getGraphic());
       linkGraphic.setVisible(true);
       ltool
           .getTopologyPanel()
           .addLink(linkGraphic); // expCoordinator.getMainWindow().getTopologyPanel()
       // System.out.println("LinkTool.ComponentListener::mousePressed component " +
       // startComponent.getLabel());
       setIntermediate(
           e.getPoint(), ((ONLComponentButton) e.getSource()).getONLComponent().getGraphic());
     } else {
       ExpCoordinator.print(
           new String(
               "LinkTool::mousePressed startComponent "
                   + startComponent.getLabel()
                   + " is Linked"),
           2);
       startComponent = null;
       ltool.setEnabled(false);
     }
   }
 }
 public void mouseDragged(MouseEvent e) {
   graphContainer
       .getGraphControl()
       .dispatchEvent(
           SwingUtilities.convertMouseEvent(
               (Component) e.getSource(), e, graphContainer.getGraphControl()));
 }
Beispiel #14
0
 @Override
 public void mouseClicked(MouseEvent e) {
   if (e.getClickCount() == 2) {
     doubleClicked((JComponent) e.getSource());
   }
   super.mouseClicked(e);
 }
Beispiel #15
0
 @Override
 public void mouseClicked(MouseEvent e) {
   if (player1 != null) {
     if (e.getSource() == PlayGui.player.pdeck.btnNewButton) {
       if (this.player1.getPhaseActual() == 0) {
         if (player1.cardDrawn == 0) {
           if (PlayGui.player.pdeck.Deck.cardsLeft() != 0) {
             CardGui nueva = null;
             try {
               nueva = new CardGui(PlayGui.player.pdeck.Deck.extractCard(), 0, 0);
             } catch (IOException e1) {
               e1.printStackTrace();
             }
             appear(nueva);
           } else {
             doGameOver();
           }
         } else {
           JOptionPane.showMessageDialog(null, "Sorry , u can pick only a card per turn");
         }
       } else {
         JOptionPane.showMessageDialog(null, "Sorry , u can only pick cards on the draw phase");
       }
     }
   }
 }
    public void mouseClicked(MouseEvent e) {
      JTableHeader h = (JTableHeader) e.getSource();
      TableColumnModel columnModel = h.getColumnModel();
      int viewColumn = columnModel.getColumnIndexAtX(e.getX());
      int column = columnModel.getColumn(viewColumn).getModelIndex();
      if (column != -1) {
        sorting_column = column;

        // 0 == priority icon column
        // 4 == priority text column
        if (column == 0) sorting_column = 4;

        if (e.isControlDown()) sorting_column = -1;
        else opposite = !opposite;

        TaskTable treetable = ((TaskTable) h.getTable());

        // java.util.Collection expanded = treetable.getExpandedTreeNodes();

        treetable.tableChanged();
        // treetable.setExpandedTreeNodes(expanded);
        // h.updateUI();
        h.resizeAndRepaint();
      }
    }
  /**
   * 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);
  }
    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;
          }
        }
      }
    }
 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) {
   }
 }
 public void mouseClicked(MouseEvent e) {
   Tile t = (Tile) e.getSource();
   ImageIcon temp = (ImageIcon) t.getIcon();
   currTileImg = new ImageIcon(scaleImage(temp.getImage(), DISPLAY_SCALE));
   currTileDisplay.setIcon(new ImageIcon(scaleImage(temp.getImage(), DISPLAY_SCALE * 2)));
   currTileLoc = t.getSource();
 }
    public void mouseMoved(MouseEvent ev) {
      JRootPane root = getRootPane();

      if (root.getWindowDecorationStyle() == JRootPane.NONE) {
        return;
      }

      Window w = (Window) ev.getSource();

      Frame f = null;
      Dialog d = null;

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

      // Update the cursor
      int cursor = getCursor(calculateCorner(w, ev.getX(), ev.getY()));

      if (cursor != 0
          && ((f != null && (f.isResizable() && (f.getExtendedState() & Frame.MAXIMIZED_BOTH) == 0))
              || (d != null && d.isResizable()))) {
        w.setCursor(Cursor.getPredefinedCursor(cursor));
      } else {
        w.setCursor(lastCursor);
      }
    }
 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();
   }
 }
Beispiel #23
0
  @Override
  public void mouseExited(MouseEvent c) {
    // TODO Auto-generated method stub

    if (c.getSource() == textfield2) {
      textfield2.setBackground(Color.pink);
    }
  }
Beispiel #24
0
 public void mouseDragged(MouseEvent e) {
   if (ltool.isEnabled()) {
     // System.out.println("LinkTool.ComponentListener::mouseDragged");
     // translate point to real coordinates since point is in relation to the source component
     setIntermediate(
         e.getPoint(), ((ONLComponentButton) e.getSource()).getONLComponent().getGraphic());
   }
 }
 public void mouseReleased(final MouseEvent e) {
   if (e.isPopupTrigger()) {
     Point pt =
         SwingUtilities.convertPoint((Component) e.getSource(), e.getX(), e.getY(), frame);
     popup.show(frame, pt.x, pt.y);
     return;
   }
 }
Beispiel #26
0
 void profileList_mouseClicked(MouseEvent e) {
   JList theList = (JList) e.getSource();
   ListModel aModel = theList.getModel();
   int index = theList.locationToIndex(e.getPoint());
   if (index < 0) return;
   UniProfile aProfile = (UniProfile) aModel.getElementAt(index);
   nameTextField.setText(aProfile.toString());
 }
    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));
      }
    }
Beispiel #28
0
 public void mouseExited(MouseEvent e) {
   if (ltool.isEnabled() && startComponent != null && endComponent != null) {
     if (endComponent == ((ONLComponentButton) e.getSource()).getONLComponent())
       endComponent = null;
     // if (endComponent != null) System.out.println("LinkTool.ComponentListener::mouseEntered
     // component " + endComponent.getLabel());
   }
 }
Beispiel #29
0
 @Override
 public void mouseEntered(MouseEvent e) {
   if (e.getSource() == PlayGui.player.pdeck.btnNewButton) {
     PlayGui.player.pdeck.btnNewButton.setIcon(new ImageIcon("draw3.png"));
     PlayGui.player.pdeck.textField.setBounds(234, 206 + 70, 70, 20);
     PlayGui.player.pdeck.textField.setVisible(true);
   }
 }
Beispiel #30
0
  @Override
  public void mouseEntered(MouseEvent d) {
    // TODO Auto-generated method stub

    if (d.getSource() == textfield2) {
      textfield2.setBackground(Color.red);
    }
  }