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(int x, int y) 

Source Link

Document

Constructs and initializes a point at the specified (x,y) location in the coordinate space.

Usage

From source file:org.mwc.cmap.grideditor.chart.FixedChartComposite.java

/**
 * Decreases the length of the range axis, centered about the given coordinate
 * on the screen. The length of the range axis is reduced by the value of
 * {@link #getZoomInFactor()}.//from w  w  w. j av a 2s  . co  m
 * 
 * @param x
 *          the x-coordinate (in screen coordinates).
 * @param y
 *          the y coordinate (in screen coordinates).
 */
public void zoomInRange(final double x, final double y) {
    final Plot p = this.chart.getPlot();
    if (p instanceof Zoomable) {
        final Zoomable z = (Zoomable) p;
        z.zoomRangeAxes(this.zoomInFactor, this.info.getPlotInfo(),
                translateScreenToJava2D(new Point((int) x, (int) y)));
    }
}

From source file:com.mirth.connect.client.ui.editors.filter.FilterPane.java

/**
 * Shows the popup menu when the trigger button (right-click) has been pushed.
 *///from  w w w  .  j a  va2  s  .com
private void checkSelectionAndPopupMenu(java.awt.event.MouseEvent evt) {
    int row = filterTable.rowAtPoint(new Point(evt.getX(), evt.getY()));

    if (evt.isPopupTrigger()) {
        if (row != -1) {
            filterTable.setRowSelectionInterval(row, row);
        }
        filterPopupMenu.show(evt.getComponent(), evt.getX(), evt.getY());
    }
}

From source file:org.mwc.cmap.grideditor.chart.FixedChartComposite.java

/**
 * Increases the length of the domain axis, centered about the given
 * coordinate on the screen. The length of the domain axis is increased by the
 * value of {@link #getZoomOutFactor()}.
 * /*  www .ja va2  s. c o  m*/
 * @param x
 *          the x coordinate (in screen coordinates).
 * @param y
 *          the y-coordinate (in screen coordinates).
 */
public void zoomOutDomain(final double x, final double y) {
    final Plot p = this.chart.getPlot();
    if (p instanceof Zoomable) {
        final Zoomable z = (Zoomable) p;
        z.zoomDomainAxes(this.zoomOutFactor, this.info.getPlotInfo(),
                translateScreenToJava2D(new Point((int) x, (int) y)));
    }
}

From source file:com.mirth.connect.client.ui.browsers.event.EventBrowser.java

/**
 * Shows the popup menu when the trigger button (right-click) has been pushed. Deselects the
 * rows if no row was selected./*from  w w w.  ja va  2 s. c  o  m*/
 */
private void checkSelectionAndPopupMenu(java.awt.event.MouseEvent evt) {
    int row = eventTable.rowAtPoint(new Point(evt.getX(), evt.getY()));
    if (row == -1) {
        deselectRows();
    }

    if (evt.isPopupTrigger()) {
        if (row != -1) {
            eventTable.setRowSelectionInterval(row, row);
        }
        parent.eventPopupMenu.show(evt.getComponent(), evt.getX(), evt.getY());
    }
}

From source file:com.mirth.connect.client.ui.editors.transformer.TransformerPane.java

/**
 * Shows the popup menu when the trigger button (right-click) has been pushed.
 *///from   ww  w .j  a v a  2s  .  co m
private void checkSelectionAndPopupMenu(java.awt.event.MouseEvent evt) {
    int row = transformerTable.rowAtPoint(new Point(evt.getX(), evt.getY()));

    if (evt.isPopupTrigger()) {
        if (row != -1) {
            transformerTable.setRowSelectionInterval(row, row);
        }
        transformerPopupMenu.show(evt.getComponent(), evt.getX(), evt.getY());
    }
}

From source file:org.mwc.cmap.grideditor.chart.FixedChartComposite.java

/**
 * Increases the length the range axis, centered about the given coordinate on
 * the screen. The length of the range axis is increased by the value of
 * {@link #getZoomOutFactor()}./*from www. j a v  a 2s .  c  o m*/
 * 
 * @param x
 *          the x coordinate (in screen coordinates).
 * @param y
 *          the y-coordinate (in screen coordinates).
 */
public void zoomOutRange(final double x, final double y) {
    final Plot p = this.chart.getPlot();
    if (p instanceof Zoomable) {
        final Zoomable z = (Zoomable) p;
        z.zoomRangeAxes(this.zoomOutFactor, this.info.getPlotInfo(),
                translateScreenToJava2D(new Point((int) x, (int) y)));
    }
}

From source file:org.mwc.cmap.grideditor.chart.FixedChartComposite.java

/**
 * Zooms in on a selected region./*from   w  ww.j ava 2 s .c  om*/
 * 
 * @param selection
 *          the selected region.
 */
public void zoom(final Rectangle selection) {

    // get the origin of the zoom selection in the Java2D space used for
    // drawing the chart (that is, before any scaling to fit the panel)
    final Point2D selectOrigin = translateScreenToJava2D(new Point(selection.x, selection.y));
    final PlotRenderingInfo plotInfo = this.info.getPlotInfo();
    final Rectangle scaledDataArea = getScreenDataArea((selection.x + selection.width / 2),
            (selection.y + selection.height / 2));
    if ((selection.height > 0) && (selection.width > 0)) {

        final double hLower = (selection.x - scaledDataArea.x) / (double) scaledDataArea.width;
        final double hUpper = (selection.x + selection.width - scaledDataArea.x)
                / (double) scaledDataArea.width;
        final double vLower = (scaledDataArea.y + scaledDataArea.height - selection.y - selection.height)
                / (double) scaledDataArea.height;
        final double vUpper = (scaledDataArea.y + scaledDataArea.height - selection.y)
                / (double) scaledDataArea.height;
        final Plot p = this.chart.getPlot();
        if (p instanceof Zoomable) {
            final Zoomable z = (Zoomable) p;
            if (z.getOrientation() == PlotOrientation.HORIZONTAL) {
                z.zoomDomainAxes(vLower, vUpper, plotInfo, selectOrigin);
                z.zoomRangeAxes(hLower, hUpper, plotInfo, selectOrigin);
            } else {
                z.zoomDomainAxes(hLower, hUpper, plotInfo, selectOrigin);
                z.zoomRangeAxes(vLower, vUpper, plotInfo, selectOrigin);
            }
        }

    }

}

From source file:org.gvsig.remotesensing.scatterplot.chart.ScatterPlotDiagram.java

/**
 * @param selection .//from   w ww.  j  a  v a  2  s.  c  o  m
 * @return range[] rangos del rectangulo
 */
public Range[] getRange(Rectangle2D selection) {

    Range[] rangos = new Range[2];

    // get the origin of the zoom selection in the Java2D space used for
    // drawing the chart (that is, before any scaling to fit the panel)
    Point2D selectOrigin = translateScreenToJava2D(
            new Point((int) Math.ceil(selection.getX()), (int) Math.ceil(selection.getY())));
    PlotRenderingInfo plotInfo = this.info.getPlotInfo();
    Rectangle2D scaledDataArea = getScreenDataArea((int) selection.getCenterX(), (int) selection.getCenterY());
    if ((selection.getHeight() > 0) && (selection.getWidth() > 0)) {

        double hLower = (selection.getMinX() - scaledDataArea.getMinX()) / scaledDataArea.getWidth();
        double hUpper = (selection.getMaxX() - scaledDataArea.getMinX()) / scaledDataArea.getWidth();
        double vLower = (scaledDataArea.getMaxY() - selection.getMaxY()) / scaledDataArea.getHeight();
        double vUpper = (scaledDataArea.getMaxY() - selection.getMinY()) / scaledDataArea.getHeight();

        Plot p = this.chart.getPlot();
        if (p instanceof ScatterPlotChart) {
            ScatterPlotChart z = (ScatterPlotChart) p;
            if (z.getOrientation() == PlotOrientation.HORIZONTAL) {
                rangos[0] = z.getRangeX(vLower, vUpper, plotInfo, selectOrigin);
                rangos[1] = z.getRangeY(hLower, hUpper, plotInfo, selectOrigin);
            } else {
                // devolver las coordenadas del rectangulo.
                rangos[0] = z.getRangeX(hLower, hUpper, plotInfo, selectOrigin);
                rangos[1] = z.getRangeY(vLower, vUpper, plotInfo, selectOrigin);
            }
        }

    }

    return rangos;
}

From source file:edu.ku.brc.services.mapping.LocalityMapper.java

/**
 * Finds the pixel location on the map of the given map location.
 *
 * @param loc the map location/*from  ww w.  ja v a  2 s .c om*/
 * @return the pixel location
 */
protected Point determinePixelCoordsOfMapLocationIFace(MapLocationIFace loc) {
    Pair<Double, Double> latLong = getLatLong(loc);
    double y = latLong.first - mapMinLat;
    double x = latLong.second - mapMinLong;
    y = mapHeight - y * pixelPerLatRatio;
    x = x * pixelPerLongRatio;
    return new Point((int) x, (int) y);
}

From source file:com.mirth.connect.client.ui.browsers.event.EventBrowser.java

private void makeAttributesTable() {
    setEventAttributes(null, true);//from  w  w  w  .  j  ava  2  s  . com

    // listen for trigger button and double click to edit channel.
    eventAttributesTable.addMouseListener(new java.awt.event.MouseAdapter() {

        public void mouseClicked(java.awt.event.MouseEvent evt) {
            if (eventAttributesTable.rowAtPoint(new Point(evt.getX(), evt.getY())) == -1) {
                return;
            }

            if (evt.getClickCount() >= 2) {
                new ViewContentDialog((String) eventAttributesTable.getModel().getValueAt(
                        eventAttributesTable.getSelectedModelIndex(), ATTRIBUTES_VALUE_COLUMN_NUMBER));
            }
        }
    });

    eventAttributesTable.setSelectionMode(0);

    // Disable HTML in a column.
    DefaultTableCellRenderer noHTMLRenderer = new DefaultTableCellRenderer();
    noHTMLRenderer.putClientProperty("html.disable", Boolean.TRUE);
    eventAttributesTable.getColumnExt(ATTRIBUTES_VALUE_COLUMN_NAME).setCellRenderer(noHTMLRenderer);

    eventAttributesPane.setViewportView(eventAttributesTable);
}