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

How to use
getLayout
method
in
java.awt.Container

Best Java code snippets using java.awt.Container.getLayout (Showing top 20 results out of 828)

Refine searchRefine arrow

  • Container.add
origin: log4j/log4j

protected void wrapStringOnPanel(String message,
  Container container) {
 GridBagConstraints c = getDefaultConstraints();
 c.gridwidth = GridBagConstraints.REMAINDER;
 // Insets() args are top, left, bottom, right
 c.insets = new Insets(0, 0, 0, 0);
 GridBagLayout gbLayout = (GridBagLayout) container.getLayout();
 while (message.length() > 0) {
  int newLineIndex = message.indexOf('\n');
  String line;
  if (newLineIndex >= 0) {
   line = message.substring(0, newLineIndex);
   message = message.substring(newLineIndex + 1);
  } else {
   line = message;
   message = "";
  }
  Label label = new Label(line);
  label.setFont(DISPLAY_FONT);
  gbLayout.setConstraints(label, c);
  container.add(label);
 }
}
origin: 4thline/cling

public void addGridComponent(Component component) {
  GridLayout l = (GridLayout) getContentPane().getLayout();
  // Make more sections if necessary
  int availableSections = l.getColumns() * l.getRows();
  if (availableSections == getContentPane().getComponentCount()) {
    getContentPane().setLayout(new GridLayout(l.getColumns() + 1, l.getRows() + 1));
  }
  getContentPane().add(component);
  validate();
}
origin: stackoverflow.com

for (int i = 0; i < 5; i++) {
  buttons[i] = new JButton(borderConstraints[i]);
  borderPanel.add(buttons[i], borderConstraints[i]);
contentPane.add(borderPanel);
for (int i = 5; i < 8; i++) {
  buttons[i] = new JButton(Integer.toString(i));
  flowPanel.add(buttons[i]);
contentPane.add(flowPanel);
  @Override
  public void actionPerformed(ActionEvent ae) {
    CardLayout cardLayout = (CardLayout) cardPanel.getLayout();
    cardLayout.next(cardPanel);
origin: camunda/camunda-bpm-platform

protected void wrapStringOnPanel(String message,
  Container container) {
 GridBagConstraints c = getDefaultConstraints();
 c.gridwidth = GridBagConstraints.REMAINDER;
 // Insets() args are top, left, bottom, right
 c.insets = new Insets(0, 0, 0, 0);
 GridBagLayout gbLayout = (GridBagLayout) container.getLayout();
 while (message.length() > 0) {
  int newLineIndex = message.indexOf('\n');
  String line;
  if (newLineIndex >= 0) {
   line = message.substring(0, newLineIndex);
   message = message.substring(newLineIndex + 1);
  } else {
   line = message;
   message = "";
  }
  Label label = new Label(line);
  label.setFont(DISPLAY_FONT);
  gbLayout.setConstraints(label, c);
  container.add(label);
 }
}
origin: stackoverflow.com

this.setPreferredSize(new Dimension(320, 240));
this.setBackground(new Color(random.nextInt()));
this.add(new JLabel(name));
  CardPanel p = new CardPanel("Panel " + String.valueOf(i));
  combo.addItem(p);
  cards.add(p, p.toString());
  public void actionPerformed(ActionEvent e) {
    JComboBox jcb = (JComboBox) e.getSource();
    CardLayout cl = (CardLayout) cards.getLayout();
    cl.show(cards, jcb.getSelectedItem().toString());
control.add(combo);
f.add(cards, BorderLayout.CENTER);
f.add(control, BorderLayout.SOUTH);
origin: stackoverflow.com

this.setPreferredSize(new Dimension(320, 240));
this.setBackground(new Color(random.nextInt()));
this.add(new JLabel(name));
for (int i = 1; i < 9; i++) {
  CardPanel p = new CardPanel("Panel " + String.valueOf(i));
  cards.add(p, p.toString());
control.add(new JButton(new AbstractAction("\u22b2Prev") {
    CardLayout cl = (CardLayout) cards.getLayout();
    cl.previous(cards);
    CardLayout cl = (CardLayout) cards.getLayout();
    cl.next(cards);
origin: magefree/mage

GridBagLayout layout = (GridBagLayout) parent.getLayout();
    parent.add(otherPanel, gbc);
origin: org.seamless/seamless-swing

/**
 * Adds a "middle" field component. Any component may be
 * used. The component will be stretched to take all of
 * the space between the label and the "last" field. All
 * "middle" fields in the layout will be the same width.
 */
public void addMiddleField(Component c, Container parent) {
  GridBagLayout gbl = (GridBagLayout) parent.getLayout();
  gbl.setConstraints(c, middleConstraints);
  parent.add(c);
}
origin: org.seamless/seamless-swing

/**
 * Adds a field component. Any component may be used. The
 * component will be stretched to take the remainder of
 * the current row.
 */
public void addLastField(Component c, Container parent) {
  GridBagLayout gbl = (GridBagLayout) parent.getLayout();
  gbl.setConstraints(c, lastConstraints);
  parent.add(c);
}
origin: org.seamless/seamless-swing

/**
 * Adds an arbitrary label component, starting a new row
 * if appropriate. The width of the component will be set
 * to the minimum width of the widest component on the
 * form.
 */
public void addLabel(Component c, Container parent) {
  GridBagLayout gbl = (GridBagLayout) parent.getLayout();
  gbl.setConstraints(c, labelConstraints);
  parent.add(c);
}
origin: net.sf.jt400/jt400

  protected void add(Container container, Component component, GridBagConstraints constraints, int x, int y, int width, int height)
  {
    constraints.gridx = x;
    constraints.gridy = y;
    constraints.gridwidth = width;
    constraints.gridheight = height;
    LayoutManager layout = container.getLayout();
    if (layout != null && layout instanceof GridBagLayout)
    {
      ((GridBagLayout)layout).setConstraints(component, constraints);
    }
    container.add(component);
  }
}
origin: org.netbeans.api/org-netbeans-modules-java-platform-ui

private static void addComponent (Container container, Component component) {
  GridBagConstraints c = new GridBagConstraints();
  c.gridx = c.gridy = GridBagConstraints.RELATIVE;
  c.gridheight = c.gridwidth = GridBagConstraints.REMAINDER;
  c.fill = GridBagConstraints.BOTH;
  c.anchor = GridBagConstraints.NORTHWEST;
  c.weightx = c.weighty = 1.0;
  ((GridBagLayout)container.getLayout()).setConstraints (component,c);
  container.add (component);
}
origin: dcaoyuan/nbscala

private static void addComponent (Container container, Component component) {
  GridBagConstraints c = new GridBagConstraints();
  c.gridx = c.gridy = GridBagConstraints.RELATIVE;
  c.gridheight = c.gridwidth = GridBagConstraints.REMAINDER;
  c.fill = GridBagConstraints.BOTH;
  c.anchor = GridBagConstraints.NORTHWEST;
  c.weightx = c.weighty = 1.0;
  ((GridBagLayout)container.getLayout()).setConstraints (component,c);
  container.add (component);
}
origin: org.seamless/seamless-swing

  public void addSeparator(Container parent) {
    JSeparator separator = new JSeparator();
    GridBagLayout gbl = (GridBagLayout) parent.getLayout();
    gbl.setConstraints(separator, separatorConstraints);
    parent.add(separator);
  }
}
origin: stackoverflow.com

 String cardName = "college_choices";
Container parent = this.getParent();
parent.add(new CChoice(), cardName); 
CardLayout cl = (CardLayout)parent.getLayout(); 
cl.show(parent, cardName);
origin: sc.fiji/TrakEM2_

private void addGBRow(final Container container, final Component comp, final Component previous) {
  final GridBagLayout gb = (GridBagLayout) container.getLayout();
  GridBagConstraints c = null;
  if (null == previous) {
    c = new GridBagConstraints();
    c.anchor = GridBagConstraints.NORTHWEST;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridy = 0;
  } else {
    c = gb.getConstraints(previous);
    c.gridy += 1;
  }
  gb.setConstraints(comp, c);
  container.add(comp);
}
origin: org.fudaa.framework.ctulu/ctulu-bu

public Pack packAs(Component _c,Component _d)
{
 Container p=_d.getParent();
 if(p.getLayout()!=this)
  throw new IllegalArgumentException("invalid layout");
 Constraint e=(Constraint)constraints_.get(_d);
 if(e==null) e=new Constraint();
 if(_c.getParent()!=p) p.add(_c,e);
 return new Pack(this,_c,e);
}
origin: org.fudaa.framework.ctulu/ctulu-bu

public Pack packIn(Component _c,Container _p)
{
 if(_p.getLayout()!=this)
  throw new IllegalArgumentException("invalid layout");
 Constraint e=(Constraint)constraints_.get(_c);
 if(e==null) e=new Constraint();
 if(_c.getParent()!=_p) _p.add(_c,e);
 return new Pack(this,_c,e);
}
origin: org.geotools/gt2-widgets-swing

/**
 * Add the specified editor. No editor must exists for the specified name prior to this
 * call. The editor will be bring on top of the card layout (i.e. will become the visible
 * panel).
 *
 * @param  name The editor name. Should be one of {@link #NUMBER}, {@link #KERNEL} and
 *         similar constants.
 * @param  editor The editor.
 * @param  scroll {@code true} if the editor should be wrapped into a {@link JScrollPane}
 *         prior its addition to the container.
 */
private void addEditor(final String name, Component editor, final boolean scroll) {
  if (editors.put(name, editor) != null) {
    throw new IllegalStateException(name); // Should not happen.
  }
  if (scroll) {
    editor = new JScrollPane(editor);
  }
  cards.add(editor, name);
  ((CardLayout) cards.getLayout()).show(cards, name);
}
origin: otros-systems/otroslogviewer

public static void main(String[] args) {
 JFrame f = new JFrame("a");
 JToolBar bar = new JToolBar();
 f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 f.getContentPane().setLayout(new FlowLayout());
 System.out.println(f.getContentPane().getLayout().getClass().getName());
 NavBox navBox = new NavBox();
 navBox.setSize(500, 40);
 navBox.setMaximumSize(new Dimension(500, 20));
 navBox.setMinimumSize(new Dimension(500, 20));
 f.getContentPane().add(bar);
 bar.add(navBox);
 bar.add(new JButton("G"));
 f.setSize(300, 60);
 f.setVisible(true);
}
java.awtContainergetLayout

Javadoc

Gets the layout manager for this container.

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
  • getInsets
    Determines the insets of this container, which indicate the size of the container's border. A Frame
  • getSize
  • getHeight
  • repaint
  • getHeight,
  • repaint,
  • setBackground,
  • 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)
  • Best IntelliJ plugins
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