Example usage for java.awt Point Point

List of usage examples for java.awt Point Point

Introduction

In this page you can find the example usage for java.awt Point Point.

Prototype

public Point(Point p) 

Source Link

Document

Constructs and initializes a point with the same location as the specified Point object.

Usage

From source file:ded.model.Entity.java

/** Deep clone copy constructor. */
public Entity(Entity obj) {
    this.loc = new Point(obj.loc);
    this.size = new Dimension(obj.size);
    this.shape = obj.shape;
    this.fillColor = obj.fillColor;
    this.name = obj.name;
    this.attributes = obj.attributes;
    this.shapeParams = Util.copyArray(obj.shapeParams);
    this.shapeFlags = obj.shapeFlags.clone();
    this.anchorName = obj.anchorName;
    this.imageFileName = obj.imageFileName;
    this.imageFillStyle = obj.imageFillStyle;
}

From source file:com.haulmont.cuba.desktop.sys.DesktopToolTipManager.java

protected Point getCurrentScreenMouseLocation(Point mouseLocation, Rectangle bounds) {
    Point point = new Point(mouseLocation);
    // Subtract the x/y position of the device
    point.x -= bounds.x;/* w  w  w  . ja v  a  2  s.c om*/
    point.y -= bounds.y;
    // Clip negative values...
    if (point.x < 0) {
        point.x *= -1;
    }
    if (point.y < 0) {
        point.y *= -1;
    }
    return point;
}

From source file:juicebox.tools.utils.juicer.arrowhead.MatrixTriangles.java

/**
 * Find the point within the connected component with the highest block score
 *
 * @param blockScore//from www .  ja  v a2  s . c  om
 * @param component
 * @return scorePoint
 */
private Point getHighestScoringPoint(RealMatrix blockScore, Set<Point> component) {
    Point scorePoint = component.iterator().next();
    double highestScore = blockScore.getEntry(scorePoint.x, scorePoint.y);

    for (Point point : component) {
        double score = blockScore.getEntry(point.x, point.y);
        if (score > highestScore) {
            highestScore = score;
            scorePoint = new Point(point);
        }
    }
    return new Point(scorePoint);
}

From source file:it.cnr.icar.eric.client.ui.swing.graph.JBGraph.java

public void insert(Point point) {
    RegistryBrowser.setWaitCursor();/*  w  w w  . j  a va  2  s  .co m*/

    try {
        if (RegistryBrowser.getInstance().getClient().getConnection() == null) {
            RegistryBrowser.displayError("Connect to a registry by specifying Registry Location first.");

            return;
        }

        RegistryObject ro = createRegistryObject();

        // Construct Vertex with no Label
        JBGraphCell vertex = new JBGraphCell(ro, true);

        registryObjectToCellMap.put(ro, vertex);

        // Add one Floating Port
        vertex.add(new DefaultPort());

        // Snap the Point to the Grid
        point = snap(new Point(point));

        // Default Size for the new Vertex
        Dimension size = new Dimension(25, 25);

        // Create a Map that holds the attributes for the Vertex
        Map<?, ?> map = GraphConstants.createMap();

        // Add a Bounds Attribute to the Map
        GraphConstants.setBounds(map, new Rectangle(point, size));

        // Add a Border Color Attribute to the Map
        GraphConstants.setBorderColor(map, Color.black);

        // Add a White Background
        GraphConstants.setBackground(map, Color.white);

        // Make Vertex Opaque
        GraphConstants.setOpaque(map, true);

        // Construct a Map from cells to Maps (for insert)
        Hashtable<DefaultGraphCell, Map<?, ?>> attributes = new Hashtable<DefaultGraphCell, Map<?, ?>>();

        // Associate the Vertex with its Attributes
        attributes.put(vertex, map);

        // Insert the Vertex and its Attributes
        getModel().insert(new Object[] { vertex }, null, null, attributes);
    } catch (JAXRException e) {
        e.printStackTrace();
        RegistryBrowser.displayError(e);
    }

    RegistryBrowser.setDefaultCursor();
}

From source file:net.sf.maltcms.chromaui.chromatogram1Dviewer.ui.panel.Chromatogram1DHeatmapViewerPanel.java

@Override
public void keyPressed(KeyEvent ke) {
    Logger.getLogger(getClass().getName()).log(Level.INFO, "Received key event: {0}", ke.toString());
    if (ke.isControlDown()) {
        modeSpinner.setValue(InstanceContentSelectionHandler.Mode.ON_HOVER.toString());
    }/*from  ww  w .j  a v  a2 s .  co  m*/
    if (getDataPoint() != null) {
        Logger.getLogger(getClass().getName()).info("Data point is not null!");
        Point p = null;
        if (ke.getKeyCode() == KeyEvent.VK_RIGHT) {
            p = new Point(getDataPoint());
            p.translate(1, 0);
        } else if (ke.getKeyCode() == KeyEvent.VK_LEFT) {
            p = new Point(getDataPoint());
            p.translate(-1, 0);
        } else if (ke.getKeyCode() == KeyEvent.VK_UP) {
            p = new Point(getDataPoint());
            p.translate(0, 1);
        } else if (ke.getKeyCode() == KeyEvent.VK_DOWN) {
            p = new Point(getDataPoint());
            p.translate(0, -1);
        }
        setDataPoint(p);
        if (!ke.isShiftDown()) {
            //                triggerMSUpdate();
        }
    }
}