Java 8 Dimension2D - 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 Dimension2D class.

This code example shows how to use the following methods:getHeight, getWidth
        } 
        return r;
    } 
 
    public Point2D getOffset(Iterable<?> objects, Dimension2D size) {
        return new Point2D.Double(size.getWidth() / 2, size.getHeight() / 2);
    } 
 
    @SuppressWarnings("unchecked") 
    public void draw(Graphics2D g, Iterable<?> objects) {
        firstCanvas = getFirstCanvas(objects);
        drawCanvasBounds(g, firstCanvas);
        GrobVisualizer.drawGrobs(g, (Iterable<Grob>) objects);
    } 
 
    private void drawCanvasBounds(Graphics2D g, Canvas canvas) {
        Rectangle2D canvasBounds = canvas.getBounds().getRectangle2D();
        g.setColor(Color.DARK_GRAY);
        g.setStroke(new BasicStroke(1f));
        g.draw(canvasBounds);
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getHeight, getWidth
        if (!(o instanceof Dimension2D)) {
            throw new ObjectFactoryException("The given object is no java.awt.geom.Dimension2D."); 
        } 
 
        final Dimension2D dim = (Dimension2D) o;
        final float width = (float) dim.getWidth();
        final float height = (float) dim.getHeight();
 
        setParameter("width", new Float(width));
        setParameter("height", new Float(height));
    } 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setSize
     * Creates an object based on the description. 
     * 
     * @return The object. 
     */ 
    public Object createObject() { 
        final Dimension2D dim = new Dimension();
 
        final float width = getFloatParameter("width");
        final float height = getFloatParameter("height");
        dim.setSize(width, height);
        return dim;
    } 
 
    /** 
     * Returns a parameter value as a float. 
     * 
     * @param param  the parameter name. 
     * 
     * @return The float value. 
     */ 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getHeight, getWidth
    final double topBorder = Double.parseDouble(attrs.getValue(getUri(), "topBorder"));
    final double leftBorder = Double.parseDouble(attrs.getValue(getUri(), "leftBorder"));
    final double bottomBorder = Double.parseDouble(attrs.getValue(getUri(), "bottomBorder"));
    final double rightBorder = Double.parseDouble(attrs.getValue(getUri(), "rightBorder"));
 
    final Paper paper = PageFormatFactory.getInstance().createPaper(pageSize.getWidth(), pageSize.getHeight());
    PageFormatFactory.getInstance().setBorders(paper, topBorder, leftBorder, bottomBorder, rightBorder);
 
    pageFormat = new PageFormat();
    pageFormat.setPaper(paper);
 
  } 
 
  /** 
   * Returns the object for this element or null, if this element does 
   * not create an object. 
   * 
   * @return the object. 
   * @throws SAXException if an parser error occured. 
   */ 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getHeight, getWidth
   */ 
  public void writeObject(final Object o, final ObjectOutputStream out)
      throws IOException
  { 
    final Dimension2D dim = (Dimension2D) o;
    out.writeDouble(dim.getWidth());
    out.writeDouble(dim.getHeight());
  } 
 
  /** 
   * Reads the object from the object input stream. This read the width and height and constructs a new FloatDimension 
   * object. 
   * 
   * @param in the object input stream from where to read the serialized data. 
   * @return the generated object. 
   * @throws IOException            if reading the stream failed. 
   * @throws ClassNotFoundException if serialized object class cannot be found. 
   */ 
  public Object readObject(final ObjectInputStream in)
      throws IOException, ClassNotFoundException
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getHeight, getWidth
    { 
      throw new ObjectFactoryException("The given object is no java.awt.geom.Dimension2D."); 
    } 
 
    final Dimension2D dim = (Dimension2D) o;
    final float width = (float) dim.getWidth();
    final float height = (float) dim.getHeight();
 
    setParameter("width", new Float(width));
    setParameter("height", new Float(height));
  } 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getHeight, getWidth
        this.width = sz.width;
        this.height = sz.height;
    } 
 
    public Size(Dimension2D d) {
        this.width = d.getWidth();
        this.height = d.getHeight();
    } 
 
    public double getWidth() { 
        return width;
    } 
 
    public double getHeight() { 
        return height;
    } 
 
    public Dimension2D getDimension2D() {
        return new Dimension(width, height);
    } 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getHeight, getWidth
 
	@Override 
	protected void drawBackgroundInternalU(UGraphic ug, Area area) {
		final Dimension2D dimensionToUse = area.getDimensionToUse();
		ug = ug.apply(stroke).apply(new UChangeColor(groupBorder));
		final URectangle rect = new URectangle(dimensionToUse.getWidth(), dimensionToUse.getHeight());
		rect.setDeltaShadow(deltaShadow);
		ug.apply(new UChangeBackColor(background)).draw(rect);
	} 
 
	@Override 
	protected void drawInternalU(UGraphic ug, Area area) {
		final Dimension2D dimensionToUse = area.getDimensionToUse();
		ug = ug.apply(stroke).apply(new UChangeColor(groupBorder));
		final URectangle rect = new URectangle(dimensionToUse.getWidth(), dimensionToUse.getHeight());
		ug.draw(rect);
 
		final StringBounder stringBounder = ug.getStringBounder();
		final int textWidth = (int) getTextWidth(stringBounder);
		final int textHeight = (int) getTextHeight(stringBounder);
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getHeight, getWidth
	@Override 
	protected void drawBackgroundInternalU(UGraphic ug, Area area) {
		final Dimension2D dimensionToUse = area.getDimensionToUse();
		ug.apply(new UChangeColor(borderColor)).apply(new UStroke(2))
				.apply(new UChangeBackColor(generalBackgroundColor))
				.draw(new URectangle(dimensionToUse.getWidth(), dimensionToUse.getHeight()));
	} 
 
	@Override 
	protected void drawInternalU(UGraphic ug, Area area) {
		final Dimension2D dimensionToUse = area.getDimensionToUse();
		ug = ug.apply(new UChangeColor(borderColor));
		ug.apply(new UStroke(2)).draw(new URectangle(dimensionToUse.getWidth(), dimensionToUse.getHeight()));
 
		final StringBounder stringBounder = ug.getStringBounder();
		final int textWidth = (int) getTextWidth(stringBounder);
		final int textHeight = (int) getTextHeight(stringBounder);
 
		final UPolygon polygon = new UPolygon();
		polygon.addPoint(0, 0);
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getHeight, getWidth
	public static MinMax fromMax(double maxX, double maxY) {
		return MinMax.getEmpty(true).addPoint(maxX, maxY);
	} 
 
	public static MinMax fromDim(Dimension2D dim) {
		return fromMax(dim.getWidth(), dim.getHeight());
	} 
 
	public final double getMaxX() { 
		return maxX;
	} 
 
	public final double getMaxY() { 
		return maxY;
	} 
 
	public final double getMinX() { 
		return minX;
	} 
 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
See Code Examples for Java 8 Dimension2D Methods: