Tabnine Logo
Size2D.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.jfree.ui.Size2D
constructor

Best Java code snippets using org.jfree.ui.Size2D.<init> (Showing top 20 results out of 315)

origin: jfree/jcommon

/**
 * Calculates the dimensions of the text fragment.
 * 
 * @param g2  the graphics device.
 * 
 * @return The width and height of the text.
 */
public Size2D calculateDimensions(final Graphics2D g2) {
  final FontMetrics fm = g2.getFontMetrics(this.font);
  final Rectangle2D bounds = TextUtilities.getTextBounds(this.text, g2, 
      fm);
  final Size2D result = new Size2D(bounds.getWidth(), bounds.getHeight());
  return result;
}
 
origin: org.jfree/jcommon

/**
 * Calculates the dimensions of the text fragment.
 * 
 * @param g2  the graphics device.
 * 
 * @return The width and height of the text.
 */
public Size2D calculateDimensions(final Graphics2D g2) {
  final FontMetrics fm = g2.getFontMetrics(this.font);
  final Rectangle2D bounds = TextUtilities.getTextBounds(this.text, g2, 
      fm);
  final Size2D result = new Size2D(bounds.getWidth(), bounds.getHeight());
  return result;
}
 
origin: org.jfree/com.springsource.org.jfree

/**
 * Calculates the dimensions of the text fragment.
 * 
 * @param g2  the graphics device.
 * 
 * @return The width and height of the text.
 */
public Size2D calculateDimensions(final Graphics2D g2) {
  final FontMetrics fm = g2.getFontMetrics(this.font);
  final Rectangle2D bounds = TextUtilities.getTextBounds(this.text, g2, 
      fm);
  final Size2D result = new Size2D(bounds.getWidth(), bounds.getHeight());
  return result;
}
 
origin: org.codehaus.jtstand/jtstand-chart

/**
 * Performs the layout with no constraint, so the content size is
 * determined by the bounds of the shape and/or line drawn to represent
 * the series.
 *
 * @param g2  the graphics device.
 *
 * @return  The content size.
 */
protected Size2D arrangeNN(Graphics2D g2) {
  Rectangle2D contentSize = new Rectangle2D.Double();
  if (this.line != null) {
    contentSize.setRect(this.line.getBounds2D());
  }
  if (this.shape != null) {
    contentSize = contentSize.createUnion(this.shape.getBounds2D());
  }
  return new Size2D(contentSize.getWidth(), contentSize.getHeight());
}
origin: org.codehaus.jtstand/jtstand-chart

/**
 * Arranges the content for this title assuming a fixed width and no bounds
 * on the height, and returns the required size.  This will reflect the
 * fact that a text title positioned on the left or right of a chart will
 * be rotated by 90 degrees.
 *
 * @param g2  the graphics target.
 * @param w  the width.
 *
 * @return The content size.
 */
protected Size2D arrangeFN(Graphics2D g2, double w) {
  g2.setFont(getFont());
  FontMetrics fm = g2.getFontMetrics(getFont());
  Rectangle2D bounds = TextUtilities.getTextBounds(getText(), g2, fm);
  if (bounds.getWidth() <= w) {
    return new Size2D(w, bounds.getHeight());
  }
  else {
    return new Size2D(0.0, 0.0);
  }
}
origin: org.jfree/jcommon

/**
 * Calculates the width and height of the text line.
 * 
 * @param g2  the graphics device.
 * 
 * @return The width and height.
 */
public Size2D calculateDimensions(final Graphics2D g2) {
  double width = 0.0;
  double height = 0.0;
  final Iterator iterator = this.fragments.iterator();
  while (iterator.hasNext()) {
    final TextFragment fragment = (TextFragment) iterator.next();
    final Size2D dimension = fragment.calculateDimensions(g2);
    width = width + dimension.getWidth();
    height = Math.max(height, dimension.getHeight());
  }
  return new Size2D(width, height);
}
 
origin: org.jfree/com.springsource.org.jfree

/**
 * Calculates the width and height of the text line.
 * 
 * @param g2  the graphics device.
 * 
 * @return The width and height.
 */
public Size2D calculateDimensions(final Graphics2D g2) {
  double width = 0.0;
  double height = 0.0;
  final Iterator iterator = this.fragments.iterator();
  while (iterator.hasNext()) {
    final TextFragment fragment = (TextFragment) iterator.next();
    final Size2D dimension = fragment.calculateDimensions(g2);
    width = width + dimension.getWidth();
    height = Math.max(height, dimension.getHeight());
  }
  return new Size2D(width, height);
}
 
origin: org.jfree/jcommon

/**
 * Returns the width and height of the text block.
 * 
 * @param g2  the graphics device.
 * 
 * @return The width and height.
 */
public Size2D calculateDimensions(final Graphics2D g2) {
  double width = 0.0;
  double height = 0.0;
  final Iterator iterator = this.lines.iterator();
  while (iterator.hasNext()) {
    final TextLine line = (TextLine) iterator.next();
    final Size2D dimension = line.calculateDimensions(g2);
    width = Math.max(width, dimension.getWidth());
    height = height + dimension.getHeight();
  }
  return new Size2D(width, height);
}
 
origin: jfree/jcommon

/**
 * Calculates the width and height of the text line.
 * 
 * @param g2  the graphics device.
 * 
 * @return The width and height.
 */
public Size2D calculateDimensions(final Graphics2D g2) {
  double width = 0.0;
  double height = 0.0;
  final Iterator iterator = this.fragments.iterator();
  while (iterator.hasNext()) {
    final TextFragment fragment = (TextFragment) iterator.next();
    final Size2D dimension = fragment.calculateDimensions(g2);
    width = width + dimension.getWidth();
    height = Math.max(height, dimension.getHeight());
  }
  return new Size2D(width, height);
}
 
origin: jfree/jcommon

/**
 * Returns the width and height of the text block.
 * 
 * @param g2  the graphics device.
 * 
 * @return The width and height.
 */
public Size2D calculateDimensions(final Graphics2D g2) {
  double width = 0.0;
  double height = 0.0;
  final Iterator iterator = this.lines.iterator();
  while (iterator.hasNext()) {
    final TextLine line = (TextLine) iterator.next();
    final Size2D dimension = line.calculateDimensions(g2);
    width = Math.max(width, dimension.getWidth());
    height = height + dimension.getHeight();
  }
  return new Size2D(width, height);
}
 
origin: org.jfree/com.springsource.org.jfree

/**
 * Returns the width and height of the text block.
 * 
 * @param g2  the graphics device.
 * 
 * @return The width and height.
 */
public Size2D calculateDimensions(final Graphics2D g2) {
  double width = 0.0;
  double height = 0.0;
  final Iterator iterator = this.lines.iterator();
  while (iterator.hasNext()) {
    final TextLine line = (TextLine) iterator.next();
    final Size2D dimension = line.calculateDimensions(g2);
    width = Math.max(width, dimension.getWidth());
    height = height + dimension.getHeight();
  }
  return new Size2D(width, height);
}
 
origin: org.codehaus.jtstand/jtstand-chart

/**
 * Arranges the blocks without any constraints.  This puts all blocks
 * into a single row.
 *
 * @param container  the container.
 * @param g2  the graphics device.
 *
 * @return The size after the arrangement.
 */
protected Size2D arrangeNN(BlockContainer container, Graphics2D g2) {
  List blocks = container.getBlocks();
  Block b = (Block) blocks.get(0);
  Size2D s = b.arrange(g2, RectangleConstraint.NONE);
  b.setBounds(new Rectangle2D.Double(0.0, 0.0, s.width, s.height));
  return new Size2D(s.width, s.height);
}
origin: org.codehaus.jtstand/jtstand-chart

/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 *
 * @return The block size (in Java2D units, never <code>null</code>).
 */
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
  Size2D s = new Size2D(this.image.getWidth(null),
      this.image.getHeight(null));
  return new Size2D(calculateTotalWidth(s.getWidth()),
      calculateTotalHeight(s.getHeight()));
}
origin: org.codehaus.jtstand/jtstand-chart

/**
 * Returns the content size for the title.
 *
 * @param g2  the graphics device.
 * @param widthRange  the width range.
 * @param heightRange  the height range.
 *
 * @return The content size.
 */
protected Size2D arrangeRR(Graphics2D g2, Range widthRange,
    Range heightRange) {
  g2.setFont(getFont());
  FontMetrics fm = g2.getFontMetrics(getFont());
  Rectangle2D bounds = TextUtilities.getTextBounds(getText(), g2, fm);
  if (bounds.getWidth() <= widthRange.getUpperBound()
      && bounds.getHeight() <= heightRange.getUpperBound()) {
    return new Size2D(bounds.getWidth(), bounds.getHeight());
  }
  else {
    return new Size2D(0.0, 0.0);
  }
}
origin: org.codehaus.jtstand/jtstand-chart

/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 *
 * @return The block size (in Java2D units, never <code>null</code>).
 */
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
  Size2D base = new Size2D(getWidth(), getHeight());
  return constraint.calculateConstrainedSize(base);
}
origin: org.codehaus.jtstand/jtstand-chart

/**
 * Arranges the blocks in the container with a fixed width and no height
 * constraint.
 *
 * @param container  the container.
 * @param g2  the graphics device.
 * @param constraint  the constraint.
 *
 * @return The size.
 */
protected Size2D arrangeFN(BlockContainer container, Graphics2D g2,
              RectangleConstraint constraint) {
  List blocks = container.getBlocks();
  Block b = (Block) blocks.get(0);
  Size2D s = b.arrange(g2, RectangleConstraint.NONE);
  double width = constraint.getWidth();
  Rectangle2D bounds = new Rectangle2D.Double((width - s.width) / 2.0,
      0.0, s.width, s.height);
  b.setBounds(bounds);
  return new Size2D((width - s.width) / 2.0, s.height);
}
origin: org.codehaus.jtstand/jtstand-chart

/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 *
 * @return The block size (in Java2D units, never <code>null</code>).
 */
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
  return new Size2D(calculateTotalWidth(getWidth()),
      calculateTotalHeight(getHeight()));
}
origin: org.codehaus.jtstand/jtstand-chart

/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 *
 * @return The block size (in Java2D units, never <code>null</code>).
 */
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
  g2.setFont(this.font);
  Size2D s = this.label.calculateDimensions(g2);
  return new Size2D(calculateTotalWidth(s.getWidth()),
      calculateTotalHeight(s.getHeight()));
}
origin: org.codehaus.jtstand/jtstand-chart

/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 *
 * @return The block size (in Java2D units, never <code>null</code>).
 */
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
  Size2D base = new Size2D(calculateTotalWidth(getWidth()),
      calculateTotalHeight(getHeight()));
  return constraint.calculateConstrainedSize(base);
}
origin: org.codehaus.jtstand/jtstand-chart

/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 *
 * @return The block size (in Java2D units, never <code>null</code>).
 */
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
  RectangleConstraint contentConstraint = toContentConstraint(constraint);
  Size2D contentSize = this.container.arrange(g2, contentConstraint);
  return new Size2D(calculateTotalWidth(contentSize.getWidth()),
      calculateTotalHeight(contentSize.getHeight()));
}
org.jfree.uiSize2D<init>

Javadoc

Creates a new instance with zero width and height.

Popular methods of Size2D

  • getHeight
    Returns the height.
  • getWidth
    Returns the width.

Popular in Java

  • Making http post requests using okhttp
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • setRequestProperty (URLConnection)
  • scheduleAtFixedRate (Timer)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now