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:it.unibo.alchemist.boundary.monitors.Generic2DDisplay.java

private static boolean isInsideRectangle(final Point viewPoint, final int rx, final int ry, final int width,
        final int height) {
    final double x = viewPoint.getX();
    final double y = viewPoint.getY();
    return x >= rx && x <= rx + width && y >= ry && y <= ry + height;
}

From source file:Main.java

public void mouseDragged(MouseEvent e) {
    Point current = this.getScreenLocation(e);
    Point offset = new Point((int) current.getX() - (int) start_drag.getX(),
            (int) current.getY() - (int) start_drag.getY());
    JFrame frame = this.getFrame(target);
    Point new_location = new Point((int) (this.start_loc.getX() + offset.getX()),
            (int) (this.start_loc.getY() + offset.getY()));
    frame.setLocation(new_location);
}

From source file:Main.java

Point getScreenLocation(MouseEvent e) {
    Point cursor = e.getPoint();/*from  w  w  w. j  a v a  2  s .co m*/
    Point target_location = this.target.getLocationOnScreen();
    return new Point((int) (target_location.getX() + cursor.getX()),
            (int) (target_location.getY() + cursor.getY()));
}

From source file:com.db2eshop.gui.dialog.BaseDialog.java

/**
 * <p>relocate.</p>/*from  www.j  a va  2s.  c  o m*/
 */
public void relocate() {
    log.debug("Relocation.");

    Point location = mainFrame.getLocation();
    Point newLocation = new Point((int) location.getX() + 40, (int) location.getY() + 40);
    this.setLocation(newLocation);
}

From source file:com.db2eshop.gui.component.tab.menu.TabRightClickPopupMenu.java

/**
 * <p>relocate.</p>//from   ww w.ja va 2 s  .c  o m
 *
 * @param point a {@link java.awt.Point} object.
 */
public void relocate(Point point) {
    Point mainFrameLocation = mainFrame.getLocation();
    this.setLocation((int) (mainFrameLocation.getX() + point.getX()) + 40,
            (int) (mainFrameLocation.getY() + point.getY()) + 70);
}

From source file:org.kalypso.ogc.gml.widgets.base.PanToWidget.java

@Override
public void mouseReleased(final MouseEvent e) {
    if (!ArrayUtils.contains(m_mouseButtons, e.getButton()))
        return;// w  ww  .j av  a2  s . com

    if (m_world2screen == null)
        return;

    final Point point = e.getPoint();

    final GM_Position pixelPos = GeometryFactory.createGM_Position(point.getX(), point.getY());
    m_endPoint = m_world2screen.getSourcePoint(pixelPos);

    perform();
}

From source file:com.bdb.weather.display.day.ItemRenderer.java

/**
 * Plots the data for a given series.//from w  ww.j  a v  a  2 s  .  com
 * 
 * @param g2  the drawing surface.
 * @param dataArea  the data area.
 * @param info  collects plot rendering info.
 * @param plot  the plot.
 * @param dataset  the dataset.
 * @param seriesIndex  the series index.
 */
@Override
public void drawSeries(Graphics2D g2, Rectangle2D dataArea, PlotRenderingInfo info, PolarPlot plot,
        XYDataset dataset, int seriesIndex) {
    Shape point = new Rectangle2D.Double(-2, -2, 4, 4);

    int numPoints = dataset.getItemCount(seriesIndex);

    g2.setPaint(lookupSeriesPaint(seriesIndex));
    g2.setStroke(lookupSeriesStroke(seriesIndex));

    for (int i = 0; i < numPoints; i++) {
        double theta = dataset.getXValue(seriesIndex, i);
        double radius = dataset.getYValue(seriesIndex, i);

        Point p = plot.translateToJava2D(theta, radius, plot.getAxis(), dataArea);

        Shape shape = ShapeUtilities.createTranslatedShape(point, p.getX(), p.getY());

        g2.fill(shape);
    }
}

From source file:modelibra.designer.metaconceptgraphic.MetaConceptGraphic.java

public void setLocation(Point point) {
    Double xDouble = point.getX();
    Integer x = new Integer(xDouble.intValue());
    setX(x);/*w ww.  j a v a  2s  . c o  m*/

    Double yDouble = point.getY();
    Integer y = new Integer(yDouble.intValue());
    setY(y);
}

From source file:org.kalypso.ogc.gml.widgets.base.PanToWidget.java

@Override
public void mouseDragged(final MouseEvent e) {
    final IMapPanel mapPanel = getMapPanel();
    if (mapPanel == null)
        return;//from w w  w  .j a v a 2  s  .c om

    final Point point = e.getPoint();

    if (m_world2screen != null && m_startPoint != null) {
        final GM_Position pixelPos = GeometryFactory.createGM_Position(point.getX(), point.getY());
        m_endPoint = m_world2screen.getSourcePoint(pixelPos);

        final GM_Envelope panExtent = calcPanExtent();
        mapPanel.setBoundingBox(panExtent, false, false);
    }
}

From source file:net.chaosserver.timelord.swingui.PreviousDayPanel.java

/**
 * Listens for action from this panel. If the pick date button is choosen
 * displays a Calendar allowing a user to select a date for display.
 *
 * @param evt the event triggering things
 *//*from  ww w.  j a  v a2 s .  c  o  m*/
public void actionPerformed(ActionEvent evt) {
    if (ACTION_PICK_DAY.equals(evt.getActionCommand())) {
        Frame ownerFrame = (Frame) SwingUtilities.getAncestorOfClass(Frame.class, this);
        JCalendarDialog calendarDialog = new JCalendarDialog(ownerFrame, getDisplayDate());

        calendarDialog.pack();

        Point ownerFrameLocation = ownerFrame.getLocation();
        ownerFrameLocation.setLocation(ownerFrameLocation.getX() + LayoutConstants.CHILD_FRAME_X_OFFSET,
                ownerFrameLocation.getY() + LayoutConstants.CHILD_FRAME_Y_OFFSET);

        calendarDialog.setLocation(ownerFrameLocation);
        calendarDialog.setVisible(true);

        Date choosenDate = calendarDialog.getChoosenDate();

        if (choosenDate != null) {
            setDisplayDate(choosenDate);
        }
    }
}