congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Container.getComponentCount
Code IndexAdd Tabnine to your IDE (free)

How to use
getComponentCount
method
in
java.awt.Container

Best Java code snippets using java.awt.Container.getComponentCount (Showing top 20 results out of 1,647)

Refine searchRefine arrow

  • Container.getComponent
  • Container.getInsets
  • Component.getPreferredSize
origin: org.netbeans.api/org-openide-util

/** Find a focus-traverable component.
* @param c the component to look in
* @return the same component if traversable, else a child component if present, else <code>null</code>
* @see Component#isFocusTraversable
*/
public static Component getFocusTraversableComponent(Component c) {
  if (c.isFocusable()) {
    return c;
  }
  if (!(c instanceof Container)) {
    return null;
  }
  int i;
  int k = ((Container) c).getComponentCount();
  for (i = 0; i < k; i++) {
    Component v = ((Container) c).getComponent(i);
    if (v != null) {
      return v;
    }
  }
  return null;
}
origin: stackoverflow.com

Insets insets = target.getInsets();
if (insets == null){
 insets = new Insets(0, 0, 0, 0);
int n = target.getComponentCount();
int x = 0;
int y = insets.top + vgap; // FlowLayout starts by adding vgap, so do that here too.
 Component c = target.getComponent(i);
 if (c.isVisible()) {
   Dimension d = c.getPreferredSize();
   if ((x == 0) || ((x + d.width) <= maxwidth)) {
int miny = Integer.MIN_VALUE;
boolean found_one = false;
int n = target.getComponentCount();
 Component c = target.getComponent(i);
 if (c.isVisible()) {
   found_one = true;
   Dimension d = c.getPreferredSize();
   minx = Math.min(minx, d.width);
   miny = Math.min(miny, d.height);
origin: runelite/runelite

final int ncomponents = parent.getComponentCount();
int nrows = getRows();
int ncols = getColumns();
  final Component comp = parent.getComponent(i);
  final Dimension d = sizer.apply(comp);
final Insets insets = parent.getInsets();
origin: org.netbeans.api/org-openide-awt

private int getMaximumWidth(Container target) {
  int maxWidth = 0;
  synchronized (target.getTreeLock()) {
    int nmembers = target.getComponentCount();
    for (int i = 0; i < nmembers; i++) {
      Component m = target.getComponent(i);
      if (m.isVisible()) {
        Dimension d = m.getPreferredSize();
        maxWidth = Math.max(d.width, maxWidth);
      }
    }
  }
  return maxWidth;
}
origin: stackoverflow.com

super.addImpl(comp, constraints, index);
if(maximumVisibleRows < getComponentCount()-1) {
  getScrollBar().setVisible(true);
if(maximumVisibleRows >= getComponentCount()-1) {
  getScrollBar().setVisible(false);
  for(Component comp : getComponents()) {
    if(!(comp instanceof JScrollBar)) {
      Dimension preferredSize = comp.getPreferredSize();
      width = Math.max(width, preferredSize.width);
      if(unit < 0){
        Dimension pref = comp.getPreferredSize();
        dim.width = Math.max(dim.width, pref.width);
        dim.height += pref.height;
  Insets insets = parent.getInsets();
  dim.height = Math.min(dim.height + insets.top + insets.bottom, visibleAmount);
  Insets insets = parent.getInsets();
  dim.height = Math.min(dim.height + insets.top + insets.bottom, visibleAmount);
  Insets insets = parent.getInsets();
origin: com.harium.propan/propan-jogl

@Override
public Dimension preferredLayoutSize(Container parent) {
 if (parent.isPreferredSizeSet() || parent.getComponentCount() == 0) {
  return parent.getPreferredSize();
 } else {
  int x = -1, y = -1;
  for (Component child : parent.getComponents()) {
   Dimension dim = child.getPreferredSize();
   x = Math.max(dim.width, x);
   y = Math.max(dim.height, y);
  }
  return new Dimension(x, y);
 }
}
origin: stackoverflow.com

return (popupMenu == null) ? 0 : popupMenu.getComponentCount();
return (popupMenu == null) ? null : popupMenu.getComponent(n);
origin: eu.mihosoft.vrl/vrl

@Override
public Dimension minimumLayoutSize(Container parent) {
  Dimension dim = new Dimension(0, 0);
  int nComps = parent.getComponentCount();
  //Always add the container's insets!
  Insets insets = parent.getInsets();
  dim.width = minWidth + insets.left + insets.right;
  dim.height = minHeight + insets.top + insets.bottom;
  sizeUnknown = false;
  return dim;
}
origin: runelite/runelite

final Insets insets = parent.getInsets();
final int ncomponents = parent.getComponentCount();
int nrows = getRows();
int ncols = getColumns();
  final Component comp = parent.getComponent(i);
  final Dimension d = comp.getPreferredSize();
  d.width = (int) (sw * d.width);
  d.height = (int) (sh * d.height);
      parent.getComponent(i).setBounds(x, y, w[c], h[r]);
origin: crashinvaders/gdx-texture-packer-gui

public Dimension preferredLayoutSize (Container parent) {
  Dimension size = new Dimension();
  for (int i = 0, n = parent.getComponentCount(); i < n; i++) {
    Dimension pref = parent.getComponent(i).getPreferredSize();
    size.width = Math.max(size.width, pref.width);
    size.height = Math.max(size.height, pref.height);
  }
  return size;
}
origin: igniterealtime/Openfire

/**
 * @return returns true if the component of one of its child has the focus
 */
public static boolean isAncestorOfFocusedComponent(Component c) {
  if (c.hasFocus()) {
    return true;
  } else {
    if (c instanceof Container) {
      Container cont = (Container) c;
      int n = cont.getComponentCount();
      for (int i = 0; i < n; i++) {
        Component child = cont.getComponent(i);
        if (isAncestorOfFocusedComponent(child))
          return true;
      }
    }
  }
  return false;
}
origin: magefree/mage

private Dimension getLayoutSize(Container parent, int type) {
  int width = 0;
  int height = 0;
  int components = parent.getComponentCount();
  int visibleComponents = getVisibleComponents(parent);
  for (int i = 0; i < components; i++) {
    Component component = parent.getComponent(i);
    if (!component.isVisible()) {
      continue;
    }
    Dimension d = getDimension(component, type);
    if (axis == X_AXIS) {
      width += d.width;
      height = Math.max(height, d.height);
    } else {
      width = Math.max(width, d.width);
      height += d.height;
    }
  }
  Insets insets = parent.getInsets();
  int totalGap = ((visibleComponents - 1) * gap) + (2 * borderGap);
  if (axis == X_AXIS) {
    width += insets.left + insets.right + totalGap;
    height += insets.top + insets.bottom;
  } else {
    width += insets.left + insets.right;
    height += insets.top + insets.bottom + totalGap;
  }
  return new Dimension(width, height);
}
origin: brandonborkholder/glg2d

@Override
public Dimension preferredLayoutSize(Container parent) {
 if (parent.isPreferredSizeSet() || parent.getComponentCount() == 0) {
  return parent.getPreferredSize();
 } else {
  int x = -1, y = -1;
  for (Component child : parent.getComponents()) {
   Dimension dim = child.getPreferredSize();
   x = Math.max(dim.width, x);
   y = Math.max(dim.height, y);
  }
  return new Dimension(x, y);
 }
}
origin: eu.mihosoft.vrl/vrl

@Override
public Dimension preferredLayoutSize(Container parent) {
  Dimension dim = new Dimension(0, 0);
  int nComps = parent.getComponentCount();
  setSizes(parent);
  //Always add the container's insets!
  Insets insets = parent.getInsets();
  dim.width = preferredWidth + insets.left + insets.right;
  dim.height = preferredHeight + insets.top + insets.bottom;
  sizeUnknown = false;
  return dim;
}
origin: pengwei1024/AndroidSourceViewer

  @Override
  public void layoutContainer(Container parent) {
    Insets insets = parent.getInsets();
    int maxWidth = parent.getWidth() - (insets.left + insets.right);
    int count = parent.getComponentCount();
    int height = 0;
    int gap = padding;
    for (int i = 0; i < count; i++) {
      Component component = parent.getComponent(i);
      if (component.isVisible()) {
        Dimension size = component.getPreferredSize();
        component.setBounds(gap, height, maxWidth - gap * 2, size.height);
        height += size.height + gap * 2;
      }
    }
  }
}
origin: tahaemara/object-recognition-tensorflow

public Dimension preferredLayoutSize (Container parent) {
  Dimension size = new Dimension();
  for (int i = 0, n = parent.getComponentCount(); i < n; i++) {
    Dimension pref = parent.getComponent(i).getPreferredSize();
    size.width = Math.max(size.width, pref.width);
    size.height = Math.max(size.height, pref.height);
  }
  return size;
}
origin: igniterealtime/Openfire

int n = cont.getComponentCount();
for (int i = 0; i < n; i++) {
  Component child = cont.getComponent(i);
  Component focused = getFocusableComponentOrChild(child, deepest);
  if (focused != null) {
origin: org.netbeans.api/org-openide-awt

synchronized (target.getTreeLock()) {
  Dimension dim = new Dimension(0, 0);
  int nmembers = target.getComponentCount();
    Component m = target.getComponent(i);
  Insets insets = target.getInsets();
  dim.width += (insets.left + insets.right + (getHgap() * 2));
  dim.height += (insets.top + insets.bottom + (getVgap() * 2));
origin: pengwei1024/AndroidSourceViewer

@Override
public Dimension preferredLayoutSize(Container target) {
  synchronized (target.getTreeLock()) {
    Dimension dim = new Dimension(0, 0);
    int count = target.getComponentCount();
    for (int i = 0; i < count; i++) {
      Component m = target.getComponent(i);
      Dimension d = m.getPreferredSize();
      dim.width = Math.max(dim.width, d.width);
      dim.height += d.height + padding;
    }
    Insets insets = target.getInsets();
    dim.width += insets.left + insets.right + padding * 2;
    dim.height += insets.top + insets.bottom + padding * 2;
    return dim;
  }
}
origin: org.jclarion/clarion-runtime

@Override
public Dimension preferredLayoutSize(Container parent) 
{
  int maxHeight=0;
  int width=0;
  for (int scan=0;scan<parent.getComponentCount();scan++) {
    Component base = parent.getComponent(scan);
    Dimension pref = base.getPreferredSize();
    if (sizes[scan]>0) {
      width+=sizes[scan];
    } else {
      width-=sizes[scan];
    }
    if (pref.height>maxHeight) maxHeight=pref.height;
  }
  return new Dimension(width,maxHeight);
}
java.awtContainergetComponentCount

Javadoc

Gets the number of components in this panel.

Popular methods of Container

  • add
    Adds the specified component to this container. This is a convenience method for #addImpl. This meth
  • setLayout
    Sets the layout manager for this container.
  • getComponents
    Gets all the components in this container.
  • getComponent
    Gets the nth component in this container.
  • getParent
  • remove
    Removes the specified component from this container.
  • getWidth
  • getInsets
    Determines the insets of this container, which indicate the size of the container's border. A Frame
  • getSize
  • getHeight
  • repaint
  • setBackground
  • repaint,
  • setBackground,
  • getLayout,
  • validate,
  • getTreeLock,
  • removeAll,
  • getPreferredSize,
  • getBackground,
  • getBounds

Popular in Java

  • Updating database using SQL prepared statement
  • getSharedPreferences (Context)
  • setRequestProperty (URLConnection)
  • getContentResolver (Context)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • Permission (java.security)
    Legacy security code; do not use.
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • Option (scala)
  • From CI to AI: The AI layer in your organization
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