List of usage examples for java.awt Point getY
public double getY()
From source file:com.net2plan.gui.utils.topologyPane.jung.JUNGCanvas.java
@Override public GUILink getEdge(MouseEvent e) { final VisualizationViewer<GUINode, GUILink> vv = (VisualizationViewer<GUINode, GUILink>) e.getSource(); GraphElementAccessor<GUINode, GUILink> pickSupport = vv.getPickSupport(); if (pickSupport != null) { final Point p = e.getPoint(); return pickSupport.getEdge(vv.getModel().getGraphLayout(), p.getX(), p.getY()); }/*from w w w .j a v a 2s . c om*/ return null; }
From source file:com.haulmont.cuba.desktop.gui.components.DesktopPopupButton.java
protected void showPopup() { popup.removeAll();// w ww . ja va 2s .c om for (final Action action : actionList) { if (action.isVisible()) { final JMenuItem menuItem = new JMenuItem(action.getCaption()); menuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { action.actionPerform((Component) action.getOwner()); } }); menuItem.setEnabled(action.isEnabled()); menuItem.setName(action.getId()); initAction(action, menuItem); popup.add(menuItem); } } int popupHeight = popup.getComponentCount() * 25; Point pt = new Point(); SwingUtilities.convertPointToScreen(pt, impl); int y; if (pt.getY() + impl.getHeight() + popupHeight < Toolkit.getDefaultToolkit().getScreenSize().getHeight()) { y = impl.getHeight(); } else { y = -popupHeight; } // do not show ugly empty popup if (popup.getComponentCount() > 0) { popup.show(impl, 0, y); } }
From source file:com.net2plan.gui.utils.topologyPane.jung.JUNGCanvas.java
@Override public GUINode getVertex(MouseEvent e) { final VisualizationViewer<GUINode, GUILink> vv = (VisualizationViewer<GUINode, GUILink>) e.getSource(); GraphElementAccessor<GUINode, GUILink> pickSupport = vv.getPickSupport(); if (pickSupport != null) { final Point p = e.getPoint(); final GUINode vertex = pickSupport.getVertex(vv.getModel().getGraphLayout(), p.getX(), p.getY()); if (vertex != null) return vertex; }//from w ww .ja v a2s .c om return null; }
From source file:edu.purdue.cc.bionet.ui.HeatMap.java
/** * Translates a set of coordinates into it's respective Correlation. * /* w ww. j av a2 s. c o m*/ * @param p The point on the graph to translate. * @return The Correlation corresponding to that point. */ private Correlation getCorrelationFromPoint(Point p) { int xComponent = (int) ((p.getX() - mapPosition.getX()) * moleculeList.size() / mapPosition.getWidth()); int yComponent = moleculeList.size() - 1 - (int) ((p.getY() - mapPosition.getY()) * moleculeList.size() / mapPosition.getHeight()); return this.correlations.getCorrelation(moleculeList.get(xComponent), moleculeList.get(yComponent)); }
From source file:com.offbynull.peernetic.debug.visualizer.JGraphXVisualizer.java
private void changeNode(final ChangeNodeCommand<A> command) { Validate.notNull(command);//from www . ja v a 2 s . c o m SwingUtilities.invokeLater(() -> { A address = command.getNode(); Object vertex = nodeLookupMap.get(address); Validate.isTrue(vertex != null); Point center = command.getLocation(); if (center != null) { mxRectangle rect = graph.getView().getBoundingBox(new Object[] { vertex }); graph.moveCells(new Object[] { vertex }, center.getX() - rect.getCenterX(), center.getY() - rect.getCenterY()); } Double scale = command.getScale(); if (scale != null) { mxGraphView view = graph.getView(); mxRectangle rect = graph.getBoundingBox(vertex); rect.setWidth(rect.getWidth() / view.getScale() * scale); rect.setHeight(rect.getHeight() / view.getScale() * scale); rect.setX(rect.getX() / view.getScale()); rect.setY(rect.getY() / view.getScale()); graph.resizeCell(vertex, rect); } Color color = command.getColor(); if (color != null) { graph.setCellStyle(mxConstants.STYLE_FILLCOLOR + "=" + "#" + String.format("%06x", color.getRGB() & 0x00FFFFFF), new Object[] { vertex }); nodeLookupMap.put(address, vertex); } zoomFit(); }); }
From source file:business.ImageManager.java
public void doDrawPathArmyOrder(Graphics2D big, Point ori, Point dest) { final int x = 30; final int y = 30; doDrawPathOrdemArmy(big, new Point((int) ori.getX() + x, (int) ori.getY() + y), new Point((int) dest.getX() + x, (int) dest.getY() + y), colorMineArmyOrdem); }
From source file:business.ImageManager.java
public void doDrawPathArmyAllyOrder(Graphics2D big, Point ori, Point dest) { final int x = 45; final int y = 45; doDrawPathOrdemArmy(big, new Point((int) ori.getX() + x, (int) ori.getY() + y), new Point((int) dest.getX() + x, (int) dest.getY() + y), colorAllyArmyOrdem); }
From source file:business.ImageManager.java
public void doDrawPathPc(Graphics2D big, Point ori, Point dest) { final int x = 04 + 7 / 2; final int y = 22 + 13 / 2; doDrawPath(big, new Point((int) ori.getX() + x, (int) ori.getY() + y), new Point((int) dest.getX() + x, (int) dest.getY() + y), colorMine); }
From source file:business.ImageManager.java
public void doDrawPathNpc(Graphics2D big, Point ori, Point dest) { final int x = 04 + 7 / 2 + 8; final int y = 22 + 13 / 2 - 2; doDrawPath(big, new Point((int) ori.getX() + x, (int) ori.getY() + y), new Point((int) dest.getX() + x, (int) dest.getY() + y), colorNpc); }
From source file:business.ImageManager.java
public void doDrawPathPcEnemy(Graphics2D big, Point ori, Point dest) { final int x = 04 + 7 / 2 + 6; final int y = 22 + 13 / 2 - 3 + 4; doDrawPath(big, new Point((int) ori.getX() + x, (int) ori.getY() + y), new Point((int) dest.getX() + x, (int) dest.getY() + y), colorEnemy); }