예제 #1
0
 public void mouseMoved(MouseEvent e) {
   if (cropping.clip != null) {
     Point p = e.getPoint();
     if (!isOverRect(p)) {
       if (cropping.getCursor() != Cursor.getDefaultCursor()) {
         // If cursor is not over rect reset it to the default.
         cropping.setCursor(Cursor.getDefaultCursor());
       }
       return;
     }
     // Locate cursor relative to center of rect.
     int outcode = getOutcode(p);
     Rectangle r = cropping.clip;
     switch (outcode) {
       case Rectangle.OUT_TOP:
         if (Math.abs(p.y - r.y) < PROX_DIST) {
           cropping.setCursor(Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR));
         }
         break;
       case Rectangle.OUT_TOP + Rectangle.OUT_LEFT:
         if (Math.abs(p.y - r.y) < PROX_DIST && Math.abs(p.x - r.x) < PROX_DIST) {
           cropping.setCursor(Cursor.getPredefinedCursor(Cursor.NW_RESIZE_CURSOR));
         }
         break;
       case Rectangle.OUT_LEFT:
         if (Math.abs(p.x - r.x) < PROX_DIST) {
           cropping.setCursor(Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR));
         }
         break;
       case Rectangle.OUT_LEFT + Rectangle.OUT_BOTTOM:
         if (Math.abs(p.x - r.x) < PROX_DIST && Math.abs(p.y - (r.y + r.height)) < PROX_DIST) {
           cropping.setCursor(Cursor.getPredefinedCursor(Cursor.SW_RESIZE_CURSOR));
         }
         break;
       case Rectangle.OUT_BOTTOM:
         if (Math.abs(p.y - (r.y + r.height)) < PROX_DIST) {
           cropping.setCursor(Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR));
         }
         break;
       case Rectangle.OUT_BOTTOM + Rectangle.OUT_RIGHT:
         if (Math.abs(p.x - (r.x + r.width)) < PROX_DIST
             && Math.abs(p.y - (r.y + r.height)) < PROX_DIST) {
           cropping.setCursor(Cursor.getPredefinedCursor(Cursor.SE_RESIZE_CURSOR));
         }
         break;
       case Rectangle.OUT_RIGHT:
         if (Math.abs(p.x - (r.x + r.width)) < PROX_DIST) {
           cropping.setCursor(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR));
         }
         break;
       case Rectangle.OUT_RIGHT + Rectangle.OUT_TOP:
         if (Math.abs(p.x - (r.x + r.width)) < PROX_DIST && Math.abs(p.y - r.y) < PROX_DIST) {
           cropping.setCursor(Cursor.getPredefinedCursor(Cursor.NE_RESIZE_CURSOR));
         }
         break;
       default: // center
         cropping.setCursor(Cursor.getDefaultCursor());
     }
   }
 }
 void updateTabButton(int index, int selectedIndex, int buttonsCount) {
   if (buttonsCount == 1) {
     tabButton.setFocusable(false);
     tabButton.setCursor(Cursor.getDefaultCursor());
     setBackground(BACKGROUND_COLOR_NORMAL);
     setBorder(
         TabbedCaptionBorder.get(
             BORDER_COLOR_NORMAL, BORDER_COLOR_NORMAL, COLOR_NONE, COLOR_NONE));
   } else if (index == selectedIndex) {
     tabButton.setFocusable(true);
     tabButton.setCursor(Cursor.getDefaultCursor());
     setBackground(BACKGROUND_COLOR_HIGHLIGHT);
     setBorder(
         TabbedCaptionBorder.get(
             BORDER_COLOR_HIGHLIGHT,
             BORDER_COLOR_HIGHLIGHT,
             COLOR_NONE,
             BORDER_COLOR_HIGHLIGHT));
   } else {
     tabButton.setFocusable(true);
     tabButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
     setBackground(BACKGROUND_COLOR_NORMAL);
     Color topColor = BORDER_COLOR_NORMAL;
     Color leftColor = index == 0 ? BORDER_COLOR_NORMAL : null;
     Color bottomColor = BORDER_COLOR_HIGHLIGHT;
     Color rightColor =
         index == selectedIndex - 1
             ? null
             : index == buttonsCount - 1 ? COLOR_NONE : TABS_SEPARATOR;
     setBorder(TabbedCaptionBorder.get(topColor, leftColor, bottomColor, rightColor));
   }
 }
    private void updateCursor(MouseEvent e) {
      Container component = getDisplayerParent();
      Insets insets = component.getInsets();

      boolean valid =
          e.getComponent() == component && e.getY() <= insets.top
              || e.getY() >= component.getHeight() - insets.bottom
              || e.getX() <= insets.left
              || e.getX() >= component.getWidth() - insets.right;

      if (valid) {
        int corner = corner();

        boolean top = e.getY() <= corner;
        boolean left = e.getX() <= corner;
        boolean bottom = e.getY() >= component.getHeight() - corner;
        boolean right = e.getX() >= component.getWidth() - corner;

        if (top && left) {
          setCursor(Cursor.getPredefinedCursor(Cursor.NW_RESIZE_CURSOR));
          position = Position.NW;
        } else if (top && right) {
          setCursor(Cursor.getPredefinedCursor(Cursor.NE_RESIZE_CURSOR));
          position = Position.NE;
        } else if (bottom && right) {
          setCursor(Cursor.getPredefinedCursor(Cursor.SE_RESIZE_CURSOR));
          position = Position.SE;
        } else if (bottom && left) {
          setCursor(Cursor.getPredefinedCursor(Cursor.SW_RESIZE_CURSOR));
          position = Position.SW;
        } else if (top) {
          int width = component.getWidth();
          if (getConfiguration().isMoveOnBorder()
              && e.getX() > width / 3
              && e.getX() < width / 3 * 2) {
            setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
            position = Position.MOVE;
          } else {
            setCursor(Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR));
            position = Position.N;
          }
        } else if (bottom) {
          setCursor(Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR));
          position = Position.S;
        } else if (left) {
          setCursor(Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR));
          position = Position.W;
        } else if (right) {
          setCursor(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR));
          position = Position.E;
        } else {
          setCursor(Cursor.getDefaultCursor());
          position = Position.NOTHING;
        }
      } else {
        setCursor(Cursor.getDefaultCursor());
        position = Position.NOTHING;
      }
      updateBorder();
    }
 @Override
 public Cursor getCursor(int line) {
   if (devMotivePanel == null) {
     return Cursor.getDefaultCursor();
   }
   VcsRevisionNumber revisionNumber = annotation.getLineRevisionNumber(line);
   if (revisionNumber != null) {
     Collection<WorkItem> workItems =
         devMotivePanel.getWorkItemsByRevisionNumber(revisionNumber, true);
     if (workItems != null && !workItems.isEmpty()) {
       return Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);
     }
   }
   return Cursor.getDefaultCursor();
 }
예제 #5
0
 private void setBussyMouse(boolean wait) {
   if (wait) {
     this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
   } else {
     this.setCursor(Cursor.getDefaultCursor());
   }
 }
예제 #6
0
  private void cargarEdicion() {
    try {

      this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
      Cliente cliente = ClienteNegocio.Obtener(id);
      if (cliente != null) {

        txtNombre.setText(cliente.getNombre());
        txtCalle.setText(cliente.getDireccion().getCalle());
        txtCelular.setText(cliente.getCelular());
        txtCiudad.setText(cliente.getDireccion().getCiudad());
        txtColonia.setText(cliente.getDireccion().getColonia());
        txtCorreo.setText(cliente.getCorreo());
        txtNumero.setText(cliente.getDireccion().getNumero());
        txtTelefono.setText(cliente.getTelefono());
      }
    } catch (Exception e) {
      JOptionPane.showMessageDialog(
          this,
          ResourceBundle.getBundle("gdm/entidades/clases/resource").getString("ErrorMensaje"),
          ResourceBundle.getBundle("gdm/entidades/clases/resource").getString("TituloError"),
          JOptionPane.INFORMATION_MESSAGE);

    } finally {
      this.setCursor(Cursor.getDefaultCursor());
    }
  }
예제 #7
0
 private void disableUnderline() {
   setCursor(Cursor.getDefaultCursor());
   myUnderline = false;
   setIcon(myInactiveIcon);
   setStatusBarText(null);
   setActive(false);
 }
 public void mouseExited(MouseEvent e) {
   if (!pressed && e.getButton() == MouseEvent.NOBUTTON) {
     setCursor(Cursor.getDefaultCursor());
     position = Position.NOTHING;
     updateBorder();
   }
 }
예제 #9
0
 @Override
 public void mouseMoved(MouseEvent e) {
   if (ctrlDown && decompiledTextArea.isEditable()) {
     ctrlDown = false;
     decompiledTextArea.setCursor(Cursor.getDefaultCursor());
   }
 }
예제 #10
0
  /** Get the cursor for the provided ID */
  public static Cursor getCursor(int pID) {

    if (!cursorSupported) {
      return Cursor.getDefaultCursor();
    }
    return CURSORS.get(pID);
  }
예제 #11
0
 /** @see java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent) */
 public void mouseReleased(MouseEvent e) {
   if (isValid(e)) {
     e.getComponent().setCursor(Cursor.getDefaultCursor());
     m_xDown = -1;
     m_yDown = -1;
   }
 }
예제 #12
0
  /**
   * Constructs a new AlgebraicValueEditor.
   *
   * @param valueEditorHierarchyManager
   */
  public AlgebraicValueEditor(ValueEditorHierarchyManager valueEditorHierarchyManager) {
    super(valueEditorHierarchyManager);

    setFocusCycleRoot(true);
    setLayout(new BorderLayout());
    setResizable(true);
    add(contentScrollPane, BorderLayout.CENTER);

    contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS));

    contentScrollPane.getHorizontalScrollBar().setCursor(Cursor.getDefaultCursor());
    contentScrollPane.getVerticalScrollBar().setCursor(Cursor.getDefaultCursor());

    KeyboardFocusManager focusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
    focusManager.addPropertyChangeListener("permanentFocusOwner", focusChangeListener);
  }
예제 #13
0
  public void actionPerformed(ActionEvent evt) {
    if (model.names().isEmpty() || model.files().isEmpty()) {
      return;
    }

    BackgroundMatcher backgroundMatcher =
        new BackgroundMatcher(model, EpisodeMetrics.defaultSequence(true));
    backgroundMatcher.execute();

    Window window = getWindow(evt.getSource());
    window.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

    try {
      // wait a for little while (matcher might finish in less than a second)
      backgroundMatcher.get(2, TimeUnit.SECONDS);
    } catch (TimeoutException ex) {
      // matcher will probably take a while
      ProgressDialog dialog = createProgressDialog(window, backgroundMatcher);
      dialog.setLocation(getOffsetLocation(dialog.getOwner()));

      // display progress dialog and stop blocking EDT
      dialog.setVisible(true);
    } catch (Exception e) {
      Logger.getLogger(getClass().getName()).log(Level.SEVERE, e.toString(), e);
    } finally {
      window.setCursor(Cursor.getDefaultCursor());
    }
  }
 // TODO maybe something more elegant?
 private void restoreDefaultCursor() {
   Cursor defaultCursor = Cursor.getDefaultCursor();
   Frame[] frames = Frame.getFrames();
   for (int i = frames.length; i-- > 0; ) {
     frames[i].setCursor(defaultCursor);
   }
 }
예제 #15
0
  private void sendButtonActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_sendButtonActionPerformed
    // TODO add your handling code here:
    this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    emailbodyText = bodyTextArea.getText();
    System.out.println("text entered is " + emailbodyText);
    //    	ArrayList emailId = new ArrayList();
    ////    	for(int i= 0;i<5;i++){
    //    		emailId.add("*****@*****.**");
    //
    ////    	}
    boolean flag = false;
    //            flag = new SendMail().sendMail(toEmailList, ccEmailList, bccEmailList, emailText,
    // subjectTextField.getText(), userId);
    new ThreadUtil(
            toEmailList,
            ccEmailList,
            bccEmailList,
            subjectTextField.getText(),
            txId,
            emailbodyText,
            this)
        .start();
    JOptionPane.showMessageDialog(null, "E-Mail sent successfully.");
    System.out.println("flag status is " + flag);
    this.dispose();

    this.setCursor(Cursor.getDefaultCursor());
  } // GEN-LAST:event_sendButtonActionPerformed
예제 #16
0
 @Override
 protected void done() {
   try {
     progressBar.setValue(0);
     btn_limpa_dados.setEnabled(true);
     btn_processa.setEnabled(true);
     getContentPane().setCursor(Cursor.getDefaultCursor());
     // Descobre como está o processo. É responsável por lançar
     // as exceptions
     get();
     // JOptionPane.showMessageDialog(getContentPane(),
     // "Processamento de dados realizado com sucesso",
     // "Informação", JOptionPane.INFORMATION_MESSAGE);
   } catch (ExecutionException e) {
     final String msg = String.format("Erro ao exportar dados: %s", e.getCause().toString());
     SwingUtilities.invokeLater(
         new Runnable() {
           @Override
           public void run() {
             JOptionPane.showMessageDialog(
                 getContentPane(),
                 "Erro ao exportar: " + msg,
                 "Erro",
                 JOptionPane.ERROR_MESSAGE);
           }
         });
   } catch (InterruptedException e) {
     System.out.println("Processo de exportação foi interrompido");
   }
 }
  public void actionPerformed(ActionEvent e) {
    Object source = e.getSource();

    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

    if (source == btFirst) {
      prot.firstStep();
    } else if (source == btLast) {
      prot.lastStep();
    } else if (source == btPrev) {
      prot.previousStep();
    } else if (source == btNext) {
      prot.nextStep();
    } else if (source == btPlay) {
      if (isPlaying) {
        player.stopAnimation();
      } else {
        player = new AutomaticPlayer(playDelay);
        player.startAnimation();
      }
    }

    if (prot.isVisible()) prot.scrollToConstructionStep();

    setCursor(Cursor.getDefaultCursor());
  }
예제 #18
0
  private void handleReleaseView(Point point) {
    assert point != null;
    assert mouseLast != null;
    assert Game.hasInstance();
    assert !Game.getInstance().isPaused();

    final int dx = point.x - mouseLast.x;
    final int dy = point.y - mouseLast.y;
    final GameView view = GameView.getInstance();
    if (view.hasActiveTile()) {
      assert !dragBoard;
      deactivateOnRelease = view.dropActiveTile(point, deactivateOnRelease);
      repaint();

    } else if (dragBoard) {
      view.translate(dx, dy);
      dragBoardPixelCount += Math.abs(dx) + Math.abs(dy);

      if (dragBoardPixelCount < DRAG_THRESHOLD) {
        /*
         * Board drags shorter than six pixels (clicks, basically)
         * also serve to alter or un-target the target cell.
         */
        view.toggleTargetCell(point);
      }

      // done dragging the board
      dragBoard = false;
      setCursor(Cursor.getDefaultCursor());
      repaint();
    }
  }
예제 #19
0
 public void mouseMoved(MouseEvent e) {
   Shape pickedShape = myPanel.myDrawing.pickShapeAt(e.getPoint());
   if (pickedShape != null) {
     myPanel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
   } else {
     myPanel.setCursor(Cursor.getDefaultCursor());
   }
 }
 @Override
 public void deactivate(DrawingEditor editor) {
   super.deactivate(editor);
   getView().setCursor(Cursor.getDefaultCursor());
   getView().setActiveHandle(null);
   clearHoverHandles();
   dragLocation = null;
 }
예제 #21
0
 @Override
 public Cursor getCursor() {
   if (currentHandle != null) {
     return currentHandle.getCursor();
   } else {
     return Cursor.getDefaultCursor();
   }
 }
예제 #22
0
 /**
  * @see prefuse.controls.Control#itemExited(prefuse.visual.VisualItem, java.awt.event.MouseEvent)
  */
 public void itemExited(VisualItem item, MouseEvent e) {
   if (activeItem == item) {
     activeItem = null;
     setFixed(item, false);
   }
   Display d = (Display) e.getSource();
   d.setCursor(Cursor.getDefaultCursor());
 }
예제 #23
0
파일: HtmlPanel.java 프로젝트: bogas04/gngr
  /**
   * Sets an HTML DOM node and invalidates the component so it is rendered as soon as possible in
   * the GUI thread.
   *
   * <p>If this method is called from a thread that is not the GUI dispatch thread, the document is
   * scheduled to be set later. Note that {@link #setPreferredWidth(int) preferred size}
   * calculations should be done in the GUI dispatch thread for this reason.
   *
   * @param node This should normally be a Document instance obtained with {@link
   *     org.lobobrowser.html.parser.DocumentBuilderImpl}.
   *     <p>
   * @param rcontext A renderer context.
   * @see org.lobobrowser.html.parser.DocumentBuilderImpl#parse(org.xml.sax.InputSource)
   * @see org.lobobrowser.html.test.SimpleHtmlRendererContext
   */
  public void setDocument(final Document node, final HtmlRendererContext rcontext) {
    setCursor(Cursor.getDefaultCursor());

    if (java.awt.EventQueue.isDispatchThread()) {
      this.setDocumentImpl(node, rcontext);
    } else {
      java.awt.EventQueue.invokeLater(() -> HtmlPanel.this.setDocumentImpl(node, rcontext));
    }
  }
예제 #24
0
 public void itemExited(VisualItem item, MouseEvent e) {
   if (activeItem == item) {
     activeItem = null;
     item.setFixed(wasFixed);
   }
   DisplayComponent d = (DisplayComponent) e.getSource();
   d.setToolTipText(null);
   d.setCursor(Cursor.getDefaultCursor());
 }
예제 #25
0
  /** Descripción de Método */
  private void cmd_drill() {
    m_drillDown = comboDrill.getSelectedIndex() < 1; // -1 or 0

    if (m_drillDown) {
      setCursor(Cursor.getDefaultCursor());
    } else {
      setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    }
  } // cmd_drill
예제 #26
0
 /**
  * Handles mouse moved events.
  *
  * @param e the mouse event
  */
 public void mouseMoved(MouseEvent e) {
   TreePath path = tree.getPathForLocation(e.getX(), e.getY());
   if (path == null) return;
   if (e.getX() > tree.getPathBounds(path).x + hotspot - 3
       || e.getX() < tree.getPathBounds(path).x + 2) tree.setCursor(Cursor.getDefaultCursor());
   else {
     tree.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
   }
 }
 public void mouseMoved(MouseEvent e) {
   JTable table = (JTable) e.getSource();
   Object tag = getTagAt(e);
   if (tag == myTag) {
     table.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
   } else {
     table.setCursor(Cursor.getDefaultCursor());
   }
 }
예제 #28
0
 @Override
 @SuppressWarnings("unchecked")
 public void installUI(JComponent c) {
   super.installUI(c);
   JXLayer<JComponent> l = (JXLayer<JComponent>) c;
   l.getGlassPane().setLayout(new GridBagLayout());
   l.getGlassPane().add(unlockButton);
   unlockButton.setCursor(Cursor.getDefaultCursor());
 }
예제 #29
0
 @Override
 public void mouseMoved(MouseEvent e) {
   // задать курсор в виде перекрестья, если он находится внутри квадрата
   if (find(e.getPoint()) == null) {
     setCursor(Cursor.getDefaultCursor());
   } else {
     setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
   }
 }
 @Override
 public void actionPerformed(final ActionEvent e) {
   final Window window = (Window) Application.get().getMainPane();
   try {
     window.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
     actionInvoked(e);
   } finally {
     window.setCursor(Cursor.getDefaultCursor());
   }
 }