Package charva.awt

Examples of charva.awt.Dimension


     * Calculate the minimum-size rectangle that can enclose all the components
     * in the given container.
     */
    public Dimension minimumSize(Container container_) {

        Dimension size = new Dimension(0, 0);

        Component[] components = container_.getComponents();
        for (int i = 0; i < components.length; i++) {
            Component c = components[ i];
            Dimension d = c.minimumSize();
            if (_axis == X_AXIS) {
                size.width += d.width;
                if (d.height > size.height) size.height = d.height;
            } else {
                size.height += d.height;
View Full Code Here


     * calculated. It just lays out the components according to the specified
     * alignment.
     */
    public void doLayout(Container container_) {

        Dimension containersize = container_.getSize();
        Dimension minsize = minimumSize(container_);

        /*
         * Ensure that the container is at least as large as the minimum size.
         */
        if (containersize.width < minsize.width)
                containersize.width = minsize.width;
        if (containersize.height < minsize.height)
                containersize.height = minsize.height;
        container_.setSize(containersize);

        Component[] components = container_.getComponents();
        int hoffset = container_.getInsets().left;
        int voffset = container_.getInsets().top;
        for (int i = 0; i < components.length; i++) {

            Component c = components[ i];

            /*
             * Get the contained container to lay itself out at its preferred
             * size.
             */
            if (c instanceof Container) {
                Container cont = (Container) c;
                cont.setSize(cont.minimumSize());
                cont.doLayout();
            }

            Dimension componentsize = c.getSize();
            if (_axis == X_AXIS) {
                float alignment = c.getAlignmentY();
                if (alignment == Component.TOP_ALIGNMENT)
                    voffset = container_.getInsets().top;
                else if (alignment == Component.CENTER_ALIGNMENT) {
View Full Code Here

    /**
     * Return the size of the text field. Overrides the method in the
     * Component superclass.
     */
    public Dimension getSize() {
  return new Dimension(this.getWidth(), this.getHeight());
    }
View Full Code Here

      if (s.length() > width)
    width = s.length();
      height++;
  }

  return new Dimension(width, height);
    }
View Full Code Here

        int width = 0;
        for (int i = 0; i < getMenuCount(); i++) {
            width += getMenu(i).getText().length() + 1;
        }

        return new Dimension(width, 1);
    }
View Full Code Here

        return new Dimension(width, 1);
    }

    public Dimension getSize() {
        return new Dimension(this.getWidth(), getHeight());
    }
View Full Code Here

      }
  }
    }

    public Dimension getSize() {
  return new Dimension(this.getWidth(), this.getHeight());
    }
View Full Code Here

  _viewportSizeSet = true;
    }

    public Dimension getPreferredScrollableViewportSize() {
  if (_viewportSizeSet)
      return new Dimension(_viewportSize);
  else
      return minimumSize();
    }
View Full Code Here

  return this.getSize();
    }

    public Dimension getSize()
    {
  return new Dimension(this.getWidth(), this.getHeight());
    }
View Full Code Here

    }

    /** Get the screen size of the scrollbar.
     */
    public Dimension getSize() {
  return new Dimension(this.getWidth(), this.getHeight());
    }
View Full Code Here

TOP

Related Classes of charva.awt.Dimension

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.