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

How to use
getInsets
method
in
java.awt.Container

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

Refine searchRefine arrow

  • Dimension.<init>
  • Container.getComponentCount
  • Container.getComponent
  • Component.getPreferredSize
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)) {
return new Dimension(reqdWidth+insets.left+insets.right, y);
int miny = Integer.MIN_VALUE;
boolean found_one = false;
int n = target.getComponentCount();
 return new Dimension(minx, miny);
return new Dimension(0, 0);
origin: stackoverflow.com

super.addImpl(comp, constraints, index);
if(maximumVisibleRows < getComponentCount()-1) {
  getScrollBar().setVisible(true);
if(maximumVisibleRows >= getComponentCount()-1) {
  getScrollBar().setVisible(false);
  int height = heightMargin + extent;
  setPopupSize(new Dimension(width, height));
  Dimension dim = new Dimension();
  for(Component comp :parent.getComponents()){
    if(comp.isVisible()) {
        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: tomighty/tomighty

@Override
public void layoutContainer(Container parent) {
  Insets insets = parent.getInsets();
  int x = insets.left;
  int y = insets.top;
  int width = parent.getWidth() - insets.left - insets.right;
  for(Component child : parent.getComponents()) {
    Dimension preferredSize = child.getPreferredSize();
    int height = preferredSize.height;
    child.setBounds(x, y, width, height);
    y += child.getPreferredSize().height + gap;
  }
}
origin: com.thesett/swing_utils

/** {@inheritDoc} */
public Dimension minimumLayoutSize(Container parent)
{
  Insets insets = parent.getInsets();
  return new Dimension(insets.left + insets.right, insets.top + insets.bottom);
}
origin: tinyMediaManager/tinyMediaManager

@Override
public Dimension preferredLayoutSize(Container container) {
 Insets insets = container.getInsets();
 Component[] children = container.getComponents();
 Dimension dim[] = dimensions(children);
 int usedWidth = dim[1].width;
 int usedHeight = dim[1].height;
 return new Dimension(insets.left + usedWidth + insets.right, insets.top + usedHeight + insets.bottom);
}
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: com.github.insubstantial/flamingo

@Override
public Dimension preferredLayoutSize(Container c) {
  Insets ins = c.getInsets();
  int pw = 0;
  int gap = getBandGap();
  for (Component regComp : ribbon.getTaskbarComponents()) {
    pw += regComp.getPreferredSize().width;
    pw += gap;
  }
  return new Dimension(pw + ins.left + ins.right, getTaskbarHeight()
      + ins.top + ins.bottom);
}
origin: org.microemu/microemu-javase-swing

public void layoutContainer(Container target) {
  Insets insets = target.getInsets();
  int count = target.getComponentCount();
  for (int i = 0; i < count; i++) {
    Component component = target.getComponent(i);
    if (component.isVisible()) {
      Rectangle r = getComponentBounds(component, true);
      component.setBounds(insets.left + r.x, insets.top + r.y, r.width, r.height);
    }
  }
}
origin: org.cytoscape/work-swing-impl

@Override
public Dimension preferredLayoutSize(Container parent) {
  Component current = findCurrentComponent(parent);
  if (current != null) {
    Insets insets = parent.getInsets();
    Dimension pref = current.getPreferredSize();
    pref.width += insets.left + insets.right;
    pref.height += insets.top + insets.bottom;
    return pref;
  }
  return super.preferredLayoutSize(parent);
}
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();
return new Dimension(
  insets.left + insets.right + nw + (ncols - 1) * getHgap(),
  insets.top + insets.bottom + nh + (nrows - 1) * getVgap());
origin: net.java.dev.swing-layout/swing-layout

private Dimension adjustSize(int width, int height) {
  Insets insets = host.getInsets();
  return new Dimension(width + insets.left + insets.right,
      height + insets.top + insets.bottom);
}

origin: tomighty/tomighty

@Override
public Dimension preferredLayoutSize(Container parent) {
  int height = 0;
  int width = 0;
  Component[] components = parent.getComponents();
  for(int index = 0; index < components.length; index++) {
    Component child = components[index];
    Dimension size = child.getPreferredSize();
    width = Math.max(width, size.width);
    height += size.height;
    if(index > 0) {
      height += gap;
    }
  }
  Insets insets = parent.getInsets();
  width += insets.left + insets.right;
  height += insets.top + insets.bottom;
  return new Dimension(width, height);
}
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: stackoverflow.com

 class ShowingSizeCardLayout extends CardLayout {

  public Dimension preferredLayoutSize(Container container) {

    Insets insets = container.getInsets();

    Dimension dim = null;

    for (Component component : container.getComponents()) {
      if (component.isVisible()) {
        dim = component.getPreferredSize();
      }
    }

    dim.width += insets.left + insets.right;
    dim.height += insets.top + insets.bottom;

    return dim;

  }
}
origin: net.java.abeille/abeille

/**
 * @param parent
 */
public void layoutContainer(Container parent) {
  Insets insets = parent.getInsets();
  for (int index = 0; index < parent.getComponentCount(); index++) {
    Component comp = parent.getComponent(index);
    comp.setLocation(insets.left, insets.top);
    comp.setSize(parent.getWidth() - insets.left - insets.right, parent.getHeight() - insets.top - insets.bottom);
  }
}
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: org.codehaus.jtstand/jtstand-desktop

private Dimension sizeWithInsets(Container parent, Dimension size) {
 Insets insets = parent.getInsets();
 int width = size.width + insets.left + insets.right;
 int height = size.height + insets.top + insets.bottom;
 return new Dimension(width, height);
}
 
origin: BaseXdb/basex

@Override
public Dimension preferredLayoutSize(final Container cont) {
 synchronized(cont.getTreeLock()) {
  int w = 0, h = 0;
  for(final Component comp : cont.getComponents()) {
   final Dimension d = comp.getPreferredSize();
   w += gap + d.width;
   h = Math.max(h, d.height);
  }
  final Insets in = cont.getInsets();
  return new Dimension(in.left + Math.max(w - gap, 0) + in.right, in.top + h + in.bottom);
 }
}
origin: BaseXdb/basex

 @Override
 public void layoutContainer(final Container cont) {
  synchronized(cont.getTreeLock()) {
   int x = 0;
   final Insets in = cont.getInsets();
   for(final Component comp : cont.getComponents()) {
    final Dimension d = comp.getPreferredSize();
    comp.setBounds(in.left + x, in.top, d.width, d.height);
    x += gap + d.width;
   }
  }
 }
}
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;
      }
    }
  }
}
java.awtContainergetInsets

Javadoc

Determines the insets of this container, which indicate the size of the container's border.

A Frame object, for example, has a top inset that corresponds to the height of the frame's title bar.

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
  • getComponentCount
    Gets the number of components in this panel.
  • remove
    Removes the specified component from this container.
  • getWidth
  • 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)
  • Github Copilot alternatives
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