Package java.awt

Examples of java.awt.Point


        JLabel lbl2 = new JLabel(mDragNode);
        lbl2.setForeground(Color.white);
        lbl2.setVisible(true);
        lbl2.setFont(this.getFont());

        Point ptDragOrigin = e.getDragOrigin();

        Point ptOffset = new Point();

        TreePath path = getPathForLocation(ptDragOrigin.x, ptDragOrigin.y);
        Point raPath = getPathBounds(path).getLocation();

        ptOffset.setLocation(ptDragOrigin.x - raPath.x, ptDragOrigin.y
            - raPath.y);
        mGhostRect.setRect(ptOffset.x, ptOffset.y,
            lbl2.getPreferredSize().width, lbl2.getPreferredSize().height);

        lbl2.setSize(lbl2.getPreferredSize());
        mGhostImage = new BufferedImage(lbl2.getWidth(), lbl2
            .getHeight(), BufferedImage.TYPE_INT_ARGB_PRE);

        mTreeImage = new BufferedImage(this.getWidth(), this.getHeight(),
            BufferedImage.TYPE_INT_ARGB_PRE);
        Graphics2D g2t = mTreeImage.createGraphics();
        this.paint(g2t);
        g2t.dispose();

        // Get a graphics context for this image
        Graphics2D g2 = mGhostImage.createGraphics();

        // Ask the cell renderer to paint itself into the BufferedImage
        lbl2.paint(g2);

        // Use DST_OVER to cause under-painting to occur
        g2.setComposite(AlphaComposite.getInstance(AlphaComposite.DST_OVER,
            0.5f));

        Color c1 = new Color(UIManager.getDefaults().getColor(
            "Tree.selectionBackground").getRGB());
        c1 = c1.darker();

        g2.setPaint(new GradientPaint(0, 0, c1, getWidth(), 0, new Color(255,
            255, 255, 0)));

        // Paint under the JLabel's text
        g2.fillRect(0, 0, getWidth(), mGhostImage.getHeight());

        // Finished with the graphics context now
        g2.dispose();

        mCurrentPoint = e.getDragOrigin();

        e.startDrag(null, mGhostImage, new Point(15, 5),
            new TransferNode(), this);
      }
    } catch (Exception ee) {

      ((PluginTreeModel) this.getModel()).setDisableUpdate(false);
View Full Code Here


          this.paintImmediately(mCueLine.getBounds());
          mPlugin = null;
          rejected = true;
        }

        Point location = (Point) e.getLocation().clone();

        if (flavors[0].getHumanPresentableName().equals("NodeExport")
            && ((mCurrentPoint.x != location.x) || (mCurrentPoint.y != location.y))) {

          if (!DragSource.isDragImageSupported()) {
View Full Code Here

  public void drop(DropTargetDropEvent e) {
    e.acceptDrop(e.getDropAction());
    final Transferable tr = e.getTransferable();
    final Object src = e.getSource();
    final Point loc = e.getLocation();
    final PluginTree tree = this;
    e.dropComplete(true);
    mDropThread = new Thread("Plugin view drop") {
      public void run() {
        tree.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
View Full Code Here

    @Override
    public Point indexToLocation(JList list, int index) {
        maybeUpdateLayoutState();
        int x = convertItemToX(index);
        int y = convertItemToY(index);
        return ((y == -1) || (x == -1)) ? null : new Point(x, y);
    }
View Full Code Here

    }   
   
    @Override
    public int getLastVisibleIndex() {
        Rectangle r = getVisibleRect();
        Point visibleLR = new Point(0, (r.y + r.height) - 1);
        int index = locationToNearestIndex(visibleLR);
        return index;
    }
View Full Code Here

        return index;
    }
   
    public int getFirstIndexOnLastVisibleRow() {
        Rectangle r = getVisibleRect();
        Point visibleLR = new Point(0, (r.y + r.height) - 1);
        return locationToNearestIndex(visibleLR);
    }   
View Full Code Here

    /**
     * Get the calculated center where the label string is drawn.
     */
    public Point getCenter() {
        return new Point();
    }
View Full Code Here

    /**
     * Get the x, y pixel offsets set for the rendering of the point.
     */
    public Point getOffset() {
        if (offset == null) {
            offset = new Point();
        }
        return offset;
    }
View Full Code Here

    }

    public boolean generate(Projection proj) {
        boolean ret = super.generate(proj);

        Point p = getTextPoint(proj);
        label.setX((int) (p.getX() + getOffset().getX()));
        label.setY((int) (p.getY() + getOffset().getY()));

        if (Debug.debugging("labeled")) {
            Debug.output("Setting label(" + label.getData() + ") to " + p);
        }
View Full Code Here

  }

  protected void resetCursorToCenter() {
    clearEvents();
    accum_dx = accum_dy = 0;
    Point cursor_location = AWTUtil.getCursorPosition(component);
    if (cursor_location != null) {
      last_x = cursor_location.x;
      last_y = cursor_location.y;
    }
  }
View Full Code Here

TOP

Related Classes of java.awt.Point

Copyright © 2015 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.