Java 8 Point - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Point class.

This code example shows how to use the following methods:
   } 
 
   @Override 
   public void globalMouseMoved(int x, int y) {
       
      current = new Point(x,y);
      repaint(); 
       
      if (target.getRect().contains(current)){
         setVisible(false); 
         dispose(); 
         listener.transitionOccurred(this);
          
      } 
   } 
 
 
} 
7
CodeRank
This code example shows how to use the following methods:
    // format = (xxxx,yyyyy) 
    return ClassDelegatePointParser.parse(s); 
  } 
 
} 
6
CodeRank
This code example shows how to use the following methods:
         ((SklView) destination).setActualLocation(location.x + dragX, location.y + dragY);
      else 
         destination.setLocation(location.x + dragX, location.y + dragY);
 
       
      Point newLocation = new Point(location.x + dragX, location.y + dragY);
      if (draggedMoveListener != null)
         draggedMoveListener.componentMoved(source, origin, newLocation);
   } 
 
 
 
   /* 
 
    *  Determine how far the mouse has moved from where dragging started 
 
    *  (Assume drag direction is down and right for positive drag distance) 
 
    */ 
 
6
CodeRank
This code example shows how to use the following methods:getX, getY
		case 1: //  left side 
			return new Point(0, rnd(0, height));
		case 2: // right side 
			return new Point(width, rnd(0, height));
		case 3: // top side 
			return new Point(rnd(0, width), 0);
		case 4: 
		default: // bottom side 
			return new Point(rnd(0, width), height);
		} 
	} 
 
 
	private AffineTransform getRandomTransformation(int shearXRange, int shearYRange) {
		// create a slightly random affine transform  
		double shearX = rndd(-1 * (shearXRange * (rnd(50, 150) / 100d)), (shearXRange* (rndd(50, 150) / 100d))) / 100d ;
		double shearY = rndd(-1 * (shearYRange * (rnd(50, 150) / 100d)), (shearYRange * (rndd(50, 150) / 100d))) / 100d ;
		 
		AffineTransform transformation = new AffineTransform();
		transformation.shear(shearX, shearY);

6
CodeRank
This code example shows how to use the following methods:
	 
	boolean paintSummaryEdge(Graphics2D g, NodeView source, NodeView target) {
		if(! hasSummaryEdge()) 
			return false; 
		final Point start1 = new Point(currentX, currentY1);
		final Point start2 = new Point(currentX, currentY2);
		final NodeView parentView = target.getParentView();
		UITools.convertPointToAncestor(parentView, start1, source);
		UITools.convertPointToAncestor(parentView, start2, source);
		final EdgeView edgeView = new SummaryEdgeView(source, target, source);
		edgeView.setStart(start1);
		edgeView.paint(g);
		edgeView.setStart(start2);
		edgeView.paint(g);
		return true; 
	} 
 
	int getY1(){ 
		return currentY1;
	} 
6
CodeRank
This code example shows how to use the following methods:
    
   public RecordedClickEvent(File file) throws IOException{
      String filename = file.getName();
      String[] toks = filename.split("_");
       
      clickLocation = new Point(Integer.parseInt(toks[1]),Integer.parseInt(toks[2])); 
      screenImage = ImageIO.read(file);      
   } 
    
   String encodeFilename(){
      Date d = new Date();
      return "capture" + "_" + clickLocation.x + "_" + clickLocation.y + "_" + d.getTime() + ".png";
   } 
    
   public void export(){ 
       
      BufferedImage exportedImage = new BufferedImage(screenImage.getWidth(),screenImage.getHeight(),BufferedImage.TYPE_INT_RGB);
      Graphics2D g = (Graphics2D) exportedImage.getGraphics();
      g.drawImage(screenImage,0,0,null);
       
6
CodeRank
This code example shows how to use the following methods:
		ColorModel colorModel = PlanarImage.createColorModel(sampleModel);
 
		TiledImage tiledImage = new TiledImage(
			0, 0, width, height, 0, 0, sampleModel, colorModel);
 
		Raster raster = RasterFactory.createWritableRaster(
			sampleModel, dataBuffer, new Point(0, 0));
 
		tiledImage.setData(raster);
 
		/*javax.media.jai.JAI.create( 
			"filestore", tiledImage, "test.png", "PNG"); 
 
		printImage(renderedImage); 
		printImage(tiledImage);*/ 
 
		return tiledImage;
	} 
 
	protected void printImage(RenderedImage renderedImage) {
6
CodeRank
This code example shows how to use the following methods:
  @Test
  public void testShouldBeAbleToAddCustomDataTypes() throws Exception {
    DataType.registerUserDefinedDataTypes(Point.class.getName(), new PointDataType());
    DataType returnedDataType = DataType.instance(Point.class.getName());
    assertEquals("(5,5)", returnedDataType.addTo("(5,5)", new Point(1, 1), 0));
    assertEquals("(6,6)", returnedDataType.addTo("(5,5)", new Point(1, 1), 1));
    assertEquals("(10,10)", returnedDataType.addTo("(5,5)", new Point(1, 1), 5));
  } 
 
  @Test
  public void testShouldBeAbleToRemoveSpecificCustomDataTypes() throws Exception {
    DataType.registerUserDefinedDataTypes(Point.class.getName(), new PointDataType());
    DataType returnedDataType = DataType.instance(Point.class.getName());
    assertEquals("(6,6)", returnedDataType.addTo("(5,5)", new Point(1, 1), 1));
    DataType.clearUserDefinedDataTypes(Point.class.getName());
    returnedDataType = DataType.instance(Point.class.getName());
    assertEquals("(5,5)java.awt.Point[x=1,y=1]", returnedDataType.addTo("(5,5)", new Point(1, 1), 1));
  } 
 
  @Test
6
CodeRank
This code example shows how to use the following methods:
    int indexOfOpenParanthesis = 0;
    int indexOfComma = s.indexOf(",");
    int indexOfClosingParanthesis = s.length() - 1;
    int x = Integer.parseInt(substring(s, indexOfOpenParanthesis, indexOfComma));
    int y = Integer.parseInt(substring(s, indexOfComma, indexOfClosingParanthesis));
    return new Point(x, y);
  } 
 
  private static void validateFormat(String s) {
    if ("(x,y)".length() > s.length() || !s.contains("(") || !s.contains(",") || !s.contains(")")) {
      throw new IllegalArgumentException(s + " is not a valid format. (x,y) is the correct format");
    } 
  } 
 
  private static String substring(String s, int startingIndex, int endingIndex) {
    return s.substring(startingIndex + 1, endingIndex);
  } 
 
} 
6
CodeRank
This code example shows how to use the following methods:
 
  @Test 
  public void should_click_Component_with_given_mouse_button_and_given_number_of_times_at_given_point() { 
    JTextField textField = window().textField(); 
    ClickRecorder recorder = attachTo(textField); 
    Point point = new Point(10, 10); 
    robot().click(textField, point, button, times); 
    assertThat(recorder).clicked(button).timesClicked(times).clickedAt(point); 
  } 
} 
6
CodeRank
See Code Examples for Java 8 Point Methods: