Example usage for java.awt Point getY

List of usage examples for java.awt Point getY

Introduction

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

Prototype

public double getY() 

Source Link

Usage

From source file:business.ImageManager.java

public void doDrawPathPcAlly(Graphics2D big, Point ori, Point dest) {
    final int x = 04 + 7 / 2 + 4;
    final int y = 22 + 13 / 2 - 3 + 2;
    doDrawPath(big, new Point((int) ori.getX() + x, (int) ori.getY() + y),
            new Point((int) dest.getX() + x, (int) dest.getY() + y), colorAlly);
}

From source file:com.jgeppert.struts2.jquery.chart.components.ChartData.java

@SuppressWarnings("rawtypes")
public void evaluateExtraParams() {
    super.evaluateExtraParams();
    if (color != null)
        addParameter("color", findString(color));
    if (label != null)
        addParameter("label", findString(label));
    if (lines != null)
        addParameter("lines", findString(lines));
    if (bars != null)
        addParameter("bars", findString(bars));
    if (points != null)
        addParameter("points", findString(points));
    if (xaxis != null)
        addParameter("xaxis", findValue(xaxis, Integer.class));
    if (yaxis != null)
        addParameter("yaxis", findValue(yaxis, Integer.class));
    if (clickable != null)
        addParameter("clickable", findValue(this.clickable, Boolean.class));
    if (hoverable != null)
        addParameter("hoverable", findValue(this.hoverable, Boolean.class));
    if (shadowSize != null)
        addParameter("shadowSize", findValue(shadowSize, Integer.class));
    if (fillBetween != null)
        addParameter("fillBetween", findString(fillBetween));
    if (curvedLines != null)
        addParameter("curvedLines", findValue(this.curvedLines, Boolean.class));
    if (curvedLinesFit != null)
        addParameter("curvedLinesFit", findValue(this.curvedLinesFit, Boolean.class));
    if (curvedLinesFill != null)
        addParameter("curvedLinesFill", findValue(this.curvedLinesFill, Boolean.class));
    if (curvedLinesFillColor != null)
        addParameter("curvedLinesFillColor", findString(curvedLinesFillColor));
    if (curvedLinesLineWidth != null)
        addParameter("curvedLinesLineWidth", findValue(curvedLinesLineWidth, Integer.class));
    if (stack != null)
        addParameter("stack", findString(stack));

    if ((this.id == null || this.id.length() == 0)) {
        // resolves Math.abs(Integer.MIN_VALUE) issue reported by FindBugs
        // http://findbugs.sourceforge.net/bugDescriptions.html#RV_ABSOLUTE_VALUE_OF_RANDOM_INT
        int nextInt = RANDOM.nextInt();
        nextInt = nextInt == Integer.MIN_VALUE ? Integer.MAX_VALUE : Math.abs(nextInt);
        this.id = "chartdata" + String.valueOf(nextInt);
        addParameter("id", this.id);
    }/*from www  .j  av a  2s.  com*/

    Chart chart = (Chart) findAncestor(Chart.class);
    if (chart != null) {
        addParameter("chart", chart.getId());
    }

    if (this.href != null && !this.href.equals("#")) {
        if (list != null) {
            addParameter("remoteList", findString(list.toString()));
        }
        if (listKey != null) {
            addParameter("remoteListKey", findString(listKey));
        }
        if (listValue != null) {
            addParameter("remoteListValue", findString(listValue));
        }
    } else if (data != null) {
        addParameter("data", findString(data));
    } else {
        if (list == null) {
            list = parameters.get("list");
        }

        Object listObject = findValue(list.toString());

        if (listObject instanceof String) {
            addParameter("data", listObject);
        } else if (listObject instanceof Map) {
            Map map = (Map) listObject;
            Set keySet = map.keySet();

            StringBuffer data = new StringBuffer();
            data.append("[");

            boolean setComma = false;
            for (Object key : keySet) {
                if (setComma) {
                    data.append(",");
                }
                if (!setComma) {
                    setComma = true;
                }
                data.append("[");
                if (key instanceof Date) {
                    data.append(((Date) key).getTime());
                } else {
                    data.append(key.toString());
                }
                data.append(",");
                data.append(map.get(key));
                data.append("]");
            }
            data.append("]");
            addParameter("data", data.toString());
        } else {
            Iterator iterator = null;
            if (listObject instanceof Collection) {
                iterator = ((Collection) listObject).iterator();
            } else {
                iterator = MakeIterator.convert(listObject);
            }

            if (iterator != null) {
                StringBuffer data = new StringBuffer();
                data.append("[");

                Object item = iterator.next();
                boolean iterat = true;
                int count = 0;
                while (iterat) {
                    count++;
                    if (item == null) {
                        data.append("null");
                    } else {
                        if (item instanceof Point) {
                            data.append("[");
                            Point point = (Point) item;
                            data.append(point.getX());
                            data.append(",");
                            data.append(point.getY());
                            data.append("]");
                        } else {
                            data.append("[");
                            if (listKey != null) {
                                String key = findString(listKey);
                                Object itemKey = null;
                                try {
                                    itemKey = PropertyUtils.getSimpleProperty(item, key);
                                } catch (IllegalAccessException e) {
                                    LOG.warn("Cannot read listKey", e);
                                } catch (InvocationTargetException e) {
                                    LOG.warn("Cannot read listKey", e);
                                } catch (NoSuchMethodException e) {
                                    LOG.warn("Cannot read listKey", e);
                                }

                                if (itemKey != null) {
                                    if (itemKey instanceof Date) {
                                        data.append(((Date) itemKey).getTime());
                                    } else {
                                        data.append(itemKey.toString());
                                    }
                                } else {
                                    data.append(count);
                                }
                            } else {
                                data.append(count);
                            }

                            data.append(",");

                            if (listValue != null) {
                                String value = findString(listValue);
                                Object itemValue = null;
                                try {
                                    itemValue = PropertyUtils.getSimpleProperty(item, value);
                                } catch (IllegalAccessException e) {
                                    LOG.warn("Cannot read listValue", e);
                                } catch (InvocationTargetException e) {
                                    LOG.warn("Cannot read listValue", e);
                                } catch (NoSuchMethodException e) {
                                    LOG.warn("Cannot read listValue", e);
                                }

                                if (itemValue != null) {
                                    if (itemValue instanceof Date) {
                                        data.append(((Date) itemValue).getTime());
                                    } else {
                                        data.append(itemValue.toString());
                                    }
                                } else {
                                    data.append(item.toString());
                                }
                            } else {
                                data.append(item.toString());
                            }
                            data.append("]");
                        }
                    }

                    if (iterator.hasNext()) {
                        data.append(",");
                        item = iterator.next();
                    } else {
                        iterat = false;
                    }
                }

                data.append("]");
                addParameter("data", data.toString());
            }
        }
    }
}

From source file:openqcm.mainGUI.java

private void chartDataMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_chartDataMouseMoved
    // TODO add your handling code here:
    //this will be some mouse-moved stuff
    PointerInfo a = MouseInfo.getPointerInfo();
    Point b = a.getLocation();
    int x = (int) b.getX();
    int y = (int) b.getY();
    String xycoords = "x: " + Integer.toString(x) + " y:" + Integer.toString(y);
    System.out.println(xycoords);
    jTextField2.setText(xycoords);/*w w w  .  ja  va2s  .  co  m*/
}

From source file:business.ImageManager.java

public void doDrawPathPcOrder(Graphics2D big, Point ori, Point dest) {
    final int x = 04 + 7 / 2 - 4;
    final int y = 22 + 13 / 2 + 2;
    doDrawPathOrdem(big, new Point((int) ori.getX() + x, (int) ori.getY() + y),
            new Point((int) dest.getX() + x, (int) dest.getY() + y), colorMineOrdem);
}

From source file:ScribbleDragAndDrop.java

/**
 * This is the key method of DropTargetListener. It is invoked when the user
 * drops something on us.//from   ww w  . j a v a 2 s . c  o  m
 */
public void drop(DropTargetDropEvent e) {
    this.setBorder(normalBorder); // Restore the default border

    // First, check whether we understand the data that was dropped.
    // If we supports our data flavors, accept the drop, otherwise reject.
    if (e.isDataFlavorSupported(Scribble.scribbleDataFlavor)
            || e.isDataFlavorSupported(DataFlavor.stringFlavor)) {
        e.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
    } else {
        e.rejectDrop();
        return;
    }

    // We've accepted the drop, so now we attempt to get the dropped data
    // from the Transferable object.
    Transferable t = e.getTransferable(); // Holds the dropped data
    Scribble droppedScribble; // This will hold the Scribble object

    // First, try to get the data directly as a scribble object
    try {
        droppedScribble = (Scribble) t.getTransferData(Scribble.scribbleDataFlavor);
    } catch (Exception ex) { // unsupported flavor, IO exception, etc.
        // If that doesn't work, try to get it as a String and parse it
        try {
            String s = (String) t.getTransferData(DataFlavor.stringFlavor);
            droppedScribble = Scribble.parse(s);
        } catch (Exception ex2) {
            // If we still couldn't get the data, tell the system we failed
            e.dropComplete(false);
            return;
        }
    }

    // If we get here, we've got the Scribble object
    Point p = e.getLocation(); // Where did the drop happen?
    droppedScribble.translate(p.getX(), p.getY()); // Move it there
    scribbles.add(droppedScribble); // add to display list
    repaint(); // ask for redraw
    e.dropComplete(true); // signal success!
}

From source file:business.ImageManager.java

public void doDrawPathPcAllyOrder(Graphics2D big, Point ori, Point dest) {
    final int x = 04 + 7 / 2 + 4 + 4;
    final int y = 22 + 13 / 2 - 3 - 2;
    doDrawPathOrdem(big, new Point((int) ori.getX() + x, (int) ori.getY() + y),
            new Point((int) dest.getX() + x, (int) dest.getY() + y), colorAllyOrdem);
}

From source file:org.trade.ui.chart.renderer.MACDItemRenderer.java

public void drawItem(Graphics2D g2, XYItemRendererState state, Rectangle2D dataArea, PlotRenderingInfo info,
        XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, double x0, double y0, double x1, double y1,
        int lastItem, int series, int item, CrosshairState crosshairState, int pass, int numX, double minX,
        double maxX, Paint color, XYDataset dataset) {

    boolean itemVisible = getItemVisible(series, item);

    // setup for collecting optional entity info...
    Shape entityArea = null;//from   w w  w  .j  a  v  a 2 s. c o m
    EntityCollection entities = null;
    if (info != null) {
        entities = info.getOwner().getEntityCollection();
    }

    PlotOrientation orientation = plot.getOrientation();
    Paint paint = getItemPaint(series, item);
    paint = color;
    Stroke seriesStroke = getItemStroke(series, item);
    g2.setPaint(paint);
    g2.setStroke(seriesStroke);

    RectangleEdge xAxisLocation = plot.getDomainAxisEdge();
    RectangleEdge yAxisLocation = plot.getRangeAxisEdge();
    double transX1 = domainAxis.valueToJava2D(x1, dataArea, xAxisLocation);
    double transY1 = rangeAxis.valueToJava2D(y1, dataArea, yAxisLocation);

    if (getPlotLines()) {
        if (this.drawSeriesLineAsPath) {
            State s = (State) state;
            if (s.getSeriesIndex() != series) {
                // we are starting a new series path
                s.seriesPath.reset();
                s.lastPointGood = false;
                s.setSeriesIndex(series);
            }

            // update path to reflect latest point
            if (itemVisible && !Double.isNaN(transX1) && !Double.isNaN(transY1)) {
                float x = (float) transX1;
                float y = (float) transY1;
                if (orientation == PlotOrientation.HORIZONTAL) {
                    x = (float) transY1;
                    y = (float) transX1;
                }
                if (s.isLastPointGood()) {
                    // TODO: check threshold
                    s.seriesPath.lineTo(x, y);
                } else {
                    s.seriesPath.moveTo(x, y);
                }
                s.setLastPointGood(true);
            } else {
                s.setLastPointGood(false);
            }
            if (item == lastItem) {
                if (s.seriesIndex == series) {
                    // draw path
                    g2.setStroke(lookupSeriesStroke(series));
                    g2.setPaint(lookupSeriesPaint(series));
                    g2.draw(s.seriesPath);
                }
            }
        }

        else if (item != 0 && itemVisible) {
            // get the previous data point...

            if (!Double.isNaN(x0) && !Double.isNaN(y0)) {
                boolean drawLine = true;
                if (getPlotDiscontinuous()) {
                    // only draw a line if the gap between the current and
                    // previous data point is within the threshold
                    if (this.gapThresholdType == UnitType.ABSOLUTE) {
                        drawLine = Math.abs(x1 - x0) <= this.gapThreshold;
                    } else {
                        drawLine = Math.abs(x1 - x0) <= ((maxX - minX) / numX * getGapThreshold());
                    }
                }
                if (drawLine) {
                    double transX0 = domainAxis.valueToJava2D(x0, dataArea, xAxisLocation);
                    double transY0 = rangeAxis.valueToJava2D(y0, dataArea, yAxisLocation);

                    // only draw if we have good values
                    if (Double.isNaN(transX0) || Double.isNaN(transY0) || Double.isNaN(transX1)
                            || Double.isNaN(transY1)) {
                        return;
                    }

                    if (orientation == PlotOrientation.HORIZONTAL) {
                        state.workingLine.setLine(transY0, transX0, transY1, transX1);
                    } else if (orientation == PlotOrientation.VERTICAL) {
                        state.workingLine.setLine(transX0, transY0, transX1, transY1);
                    }

                    if (state.workingLine.intersects(dataArea)) {
                        g2.draw(state.workingLine);
                    }
                }
            }
        }
    }

    // we needed to get this far even for invisible items, to ensure that
    // seriesPath updates happened, but now there is nothing more we need
    // to do for non-visible items...
    if (!itemVisible) {
        return;
    }

    if (getBaseShapesVisible()) {

        Shape shape = getItemShape(series, item);
        if (orientation == PlotOrientation.HORIZONTAL) {
            shape = ShapeUtilities.createTranslatedShape(shape, transY1, transX1);
        } else if (orientation == PlotOrientation.VERTICAL) {
            shape = ShapeUtilities.createTranslatedShape(shape, transX1, transY1);
        }
        if (shape.intersects(dataArea)) {
            if (getItemShapeFilled(series, item)) {
                g2.fill(shape);
            } else {
                g2.draw(shape);
            }
        }
        entityArea = shape;

    }

    if (getPlotImages()) {
        Image image = getImage(plot, series, item, transX1, transY1);
        if (image != null) {
            Point hotspot = getImageHotspot(plot, series, item, transX1, transY1, image);
            g2.drawImage(image, (int) (transX1 - hotspot.getX()), (int) (transY1 - hotspot.getY()), null);
            entityArea = new Rectangle2D.Double(transX1 - hotspot.getX(), transY1 - hotspot.getY(),
                    image.getWidth(null), image.getHeight(null));
        }

    }

    double xx = transX1;
    double yy = transY1;
    if (orientation == PlotOrientation.HORIZONTAL) {
        xx = transY1;
        yy = transX1;
    }

    // draw the item label if there is one...
    if (isItemLabelVisible(series, item)) {
        drawItemLabel(g2, orientation, dataset, series, item, xx, yy, (y1 < 0.0));
    }

    int domainAxisIndex = plot.getDomainAxisIndex(domainAxis);
    int rangeAxisIndex = plot.getRangeAxisIndex(rangeAxis);
    updateCrosshairValues(crosshairState, x1, y1, domainAxisIndex, rangeAxisIndex, transX1, transY1,
            orientation);

    // add an entity for the item...
    if (entities != null && isPointInRect(dataArea, xx, yy)) {
        addEntity(entities, entityArea, dataset, series, item, xx, yy);
    }
}

From source file:org.nekorp.workflow.desktop.servicio.reporte.orden.servicio.OrdenServicioDataFactory.java

private void generaSVGImagenDamage(ShapeView fondo, List<DamageDetailsVB> danios, File outputfile, int width,
        int height) {
    // Get a DOMImplementation.
    DOMImplementation domImpl = GenericDOMImplementation.getDOMImplementation();

    // Create an instance of org.w3c.dom.Document.
    String svgNS = "http://www.w3.org/2000/svg";
    Document document = domImpl.createDocument(svgNS, "svg", null);

    // Create an instance of the SVG Generator.
    SVGGraphics2D g2 = new SVGGraphics2D(document);
    // pintar./* w  ww  .  java2  s .  co m*/
    g2.setSVGCanvasSize(new java.awt.Dimension(width, height));
    Point contexto = new Point((width - fondo.getShapeWidth()) / 2, (height - fondo.getShapeHeight()) / 2);
    g2.setColor(Color.WHITE);
    g2.fillRect(0, 0, width, height);
    AffineTransform saveXform = g2.getTransform();
    AffineTransform toCenterAt = new AffineTransform();
    toCenterAt.translate(contexto.getX(), contexto.getY());
    g2.transform(toCenterAt);
    fondo.paint(g2);
    g2.setTransform(saveXform);
    for (DamageDetailsVB x : danios) {
        DamageDetailGraphicsView obj = new DamageDetailGraphicsView();
        obj.setFontSize(esquemaFontSize);
        obj.setPosicion(new Point(x.getX(), x.getY()));
        obj.setContexto(contexto);
        if (x.getX() <= fondo.getShapeWidth() / 2) {
            if (x.getY() <= fondo.getShapeHeight() / 2) {
                obj.setOrientacion(DamageDetailGraphicsView.SuperiorIzquierda);
                //obj.setOrientacion(DamageDetailGraphicsView.SuperiorDerecha);
            } else {
                obj.setOrientacion(DamageDetailGraphicsView.InferiorIzquierda);
                //obj.setOrientacion(DamageDetailGraphicsView.InferiorDerecha);
            }
        } else {
            if (x.getY() <= fondo.getShapeHeight() / 2) {
                obj.setOrientacion(DamageDetailGraphicsView.SuperiorDerecha);
                //obj.setOrientacion(DamageDetailGraphicsView.SuperiorIzquierda);
            } else {
                obj.setOrientacion(DamageDetailGraphicsView.InferiorDerecha);
                //obj.setOrientacion(DamageDetailGraphicsView.InferiorIzquierda);
            }
        }
        obj.setCategoria(x.getCategoria());
        obj.setCaracteristica(x.getCaracteristica());
        obj.paint(g2);
    }
    try {
        g2.stream(outputfile.getCanonicalPath());
    } catch (IOException ex) {
        throw new RuntimeException(ex);
    }
}

From source file:org.jtrfp.trcl.flow.Mission.java

private int pointToHash(Point point) {
    final int key = (int) point.getX() + (int) point.getY() * 65536;
    return key;/* www . j av a2s. c  o m*/
}

From source file:org.kchine.rpf.PoolUtils.java

public static Point deriveLocation(Point origin, double radius) {
    return new Point((int) ((origin.getX() - radius) + (Math.random() * 2 * radius)),
            (int) ((origin.getY() - radius) + (Math.random() * 2 * radius)));
}