Tabnine Logo
Container.setLayout
Code IndexAdd Tabnine to your IDE (free)

How to use
setLayout
method
in
java.awt.Container

Best Java code snippets using java.awt.Container.setLayout (Showing top 20 results out of 5,697)

Refine searchRefine arrow

  • Window.setVisible
  • Container.add
  • JFrame.setDefaultCloseOperation
  • JFrame.<init>
  • Window.pack
  • JPanel.<init>
origin: stanfordnlp/CoreNLP

private void initAboutBox() {
 aboutBox = new JDialog(this, "About Tregex");
 aboutBox.getContentPane().setLayout(new BorderLayout());
 aboutBox.getContentPane().add(new JLabel("<html><b>Tregex and Tsurgeon</b></html>", SwingConstants.CENTER), BorderLayout.NORTH);
 aboutBox.getContentPane().add(new JLabel("<html>Tregex by Galen Andrew and Roger Levy<br>Tsurgeon by Roger Levy<br>Graphical interface by Anna Rafferty<br>Additional features and development by Chris Manning<br></html>", SwingConstants.CENTER), BorderLayout.CENTER);
 aboutBox.getContentPane().add(new JLabel("<html><font size=2>\u00A92007 The Board of Trustees of The Leland Stanford Junior University.<br>Distributed under the GNU General Public License</font></html>", SwingConstants.CENTER), BorderLayout.SOUTH);
}
origin: jMonkeyEngine/jmonkeyengine

private static void createTabs(){
  tabbedPane = new JTabbedPane();
  canvasPanel1 = new JPanel();
  canvasPanel1.setLayout(new BorderLayout());
  tabbedPane.addTab("jME3 Canvas 1", canvasPanel1);
  canvasPanel2 = new JPanel();
  canvasPanel2.setLayout(new BorderLayout());
  tabbedPane.addTab("jME3 Canvas 2", canvasPanel2);
  frame.getContentPane().add(tabbedPane);
  currentPanel = canvasPanel1;
}
origin: jMonkeyEngine/jmonkeyengine

private static void createWindowForPanel(AwtPanel panel, int location){
  JFrame frame = new JFrame("Render Display " + location);
  frame.getContentPane().setLayout(new BorderLayout());
  frame.getContentPane().add(panel, BorderLayout.CENTER);
  frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  frame.addWindowListener(new WindowAdapter() {
    @Override
    public void windowClosed(WindowEvent e) {
      if (++panelsClosed == 2){
        app.stop();
      }
    }
  });
  frame.pack();
  frame.setLocation(location, Toolkit.getDefaultToolkit().getScreenSize().height - 400);
  frame.setVisible(true);
}

origin: winder/Universal-G-Code-Sender

  private static void frameLauncher(String title, Component c) {
    JFrame frame = new JFrame(title);

    frame.getContentPane().setLayout(new BorderLayout());
    frame.getContentPane().add(c, BorderLayout.CENTER);

    frame.pack();
    frame.setVisible(true);
  }
}
origin: stanfordnlp/CoreNLP

private void createAndShowGUI() {
 //Make sure we have nice window decorations.
 JFrame.setDefaultLookAndFeelDecorated(true);
 //Create and set up the window.
 frame = new JFrame("Stanford Named Entity Recognizer");
 frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
 frame.getContentPane().setLayout(new BorderLayout());
 frame.getContentPane().setSize(WIDTH, HEIGHT);
 frame.setJMenuBar(addMenuBar());
 //frame.setSize(new Dimension(WIDTH, HEIGHT));
 frame.setSize(WIDTH, HEIGHT);
 buildTagPanel();
 buildContentPanel();
 //Display the window.
 frame.pack();
 frame.setSize(WIDTH, HEIGHT);
 frame.setVisible(true);
}
origin: stackoverflow.com

JLabel versionLabel = new JLabel("java.version=" + System.getProperty("java.version"));
JLabel javaHomeLabel = new JLabel("java.home=" + System.getProperty("java.home"));
setLayout(new BorderLayout());
add(versionLabel, BorderLayout.PAGE_START);
add(javaHomeLabel, BorderLayout.PAGE_END);
JFrame frame = new JFrame("MyJavaMacOSXApp");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
MyJavaMacOSXApp newContentPane = new MyJavaMacOSXApp();
newContentPane.setOpaque(true); 
frame.setContentPane(newContentPane);
frame.pack();
frame.setVisible(true);
origin: alibaba/jstorm

                   String[] prompt,
                   boolean[] echo) {
panel = new JPanel();
panel.setLayout(new GridBagLayout());
panel.add(new JLabel(instruction), gbc);
gbc.gridy++;
  gbc.gridx = 0;
  gbc.weightx = 1;
  panel.add(new JLabel(prompt[i]), gbc);
    texts[i] = new JPasswordField(20);
  panel.add(texts[i], gbc);
  gbc.gridy++;
origin: cmusphinx/sphinx4

public VUMeterMonitor() {
  vumeter = new VUMeter();
  vuMeterPanel = new VUMeterPanel();
  vuMeterPanel.setVu(vumeter);
  vuMeterPanel.start();
  vuMeterDialog = new JDialog();
  vuMeterDialog.setBounds(100, 100, 100, 400);
  vuMeterDialog.getContentPane().setLayout(new BorderLayout());
  vuMeterDialog.getContentPane().add(vuMeterPanel);
  vuMeterDialog.setVisible(true);
}
origin: opensourceBIM/BIMserver

  public static void main(String[] args) {
    JFrame f = new JFrame();
    Container c = f.getContentPane();
    c.setLayout(new GridLayout(0, 1));
    StringBuffer sb = new StringBuffer();
    for (int ii = 0; ii < 10; ii++) {
      c.add(new AutoSelectTextField(sb.toString()));
      sb.append("Ha ");
    }
    f.pack();
    f.setVisible(true);
  }
}
origin: stanfordnlp/CoreNLP

private void createAndShowGUI() {
 //Make sure we have nice window decorations.
 JFrame.setDefaultLookAndFeelDecorated(true);
 //Create and set up the window.
 frame = new JFrame("Stanford Named Entity Recognizer");
 frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
 frame.getContentPane().setLayout(new BorderLayout());
 frame.getContentPane().setPreferredSize(new Dimension(WIDTH, HEIGHT));
 frame.setJMenuBar(addMenuBar());
 buildTagPanel();
 buildContentPanel();
 buildExtractButton();
 extractButton.setEnabled(false);
 extract.setEnabled(false);
 //Display the window.
 frame.pack();
 frame.setVisible(true);
}
origin: stackoverflow.com

setLayout(new BorderLayout());
JPanel jp = new JPanel();
jp.setLayout(new BorderLayout());
JTabbedPane tb = new JTabbedPane();
tb.setUI(new CustomTabbedPaneUI());
tb.add("Tab4", new JTextArea(""));
tb.add("Tab5", new JTextArea(""));
jp.add(tb, BorderLayout.CENTER);
add(jp, BorderLayout.CENTER);
tb.setEnabledAt(1, false);
tb.setEnabledAt(3, false);
JFrame frame = new JFrame();
frame.getContentPane().add(new TabbedPane());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(500, 200);
frame.setVisible(true);
origin: wiztools/rest-client

private void initLayout() {
  Container c = this.getContentPane();
  c.setLayout(new BorderLayout(5, 5));
    JPanel jp = new JPanel(new GridLayout(2, 1));
    jp.add(new JLabel(" Subtype (multipart/?): "));
    jp.add(new JLabel(" Mode: "));
    c.add(jp, BorderLayout.WEST);
    JPanel jp = new JPanel(new GridLayout(2, 1));
    jp.add(jcb_subtype);
    jp.add(jcb_mode);
    c.add(jp, BorderLayout.CENTER);
    JPanel jp = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    jp.add(jb_cancel);
    jp.add(jb_ok);
    c.add(jp, BorderLayout.SOUTH);
origin: opentripplanner/OpenTripPlanner

  public RouteDialog(JFrame owner, String initialFrom) {
    super(owner, true);
    fromField = new JTextField(initialFrom, 30);
    toField = new JTextField(30);
    goButton = new JButton("Go");
    
    Container pane = getContentPane();
    
    pane.setLayout(new BoxLayout(pane, BoxLayout.PAGE_AXIS));
    pane.add(new JLabel("From"));
    pane.add(fromField);
    pane.add(new JLabel("To"));
    pane.add(toField);
    pane.add(goButton);
    pack();
    final RouteDialog outer = this;
    goButton.addActionListener(new ActionListener() {

      public void actionPerformed(ActionEvent e) {
        from = fromField.getText().trim();
        to = toField.getText().trim();
        outer.setVisible(false);
      }
      
    });
    setVisible(true);
  }
}
origin: apache/shiro

refreshButton.addActionListener(this);
JPanel valuePanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
valuePanel.add(valueField);
valuePanel.add(saveButton);
secureMethod3Button.addActionListener(this);
JPanel methodPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
methodPanel.add(secureMethod1Button);
methodPanel.add(secureMethod2Button);
methodPanel.add(secureMethod3Button);
frame = new JFrame("Apache Shiro Sample Application");
frame.setSize(500, 200);
panel.setLayout(new BorderLayout());
panel.add(logo, BorderLayout.NORTH);
panel.add(valuePanel, BorderLayout.CENTER);
panel.add(methodPanel, BorderLayout.SOUTH);
origin: pmd/pmd

private void init() {
  JTextArea errorArea = new JTextArea();
  errorArea.setEditable(false);
  errorArea.setText(exc.getMessage() + "\n");
  getContentPane().setLayout(new BorderLayout());
  JPanel messagePanel = new JPanel(new BorderLayout());
  messagePanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createRaisedBevelBorder(), BorderFactory
      .createTitledBorder(BorderFactory.createEtchedBorder(), NLS.nls("COMPILE_ERROR.PANEL.TITLE"))));
  messagePanel.add(new JScrollPane(errorArea), BorderLayout.CENTER);
  getContentPane().add(messagePanel, BorderLayout.CENTER);
  JPanel btnPane = new JPanel(new FlowLayout(FlowLayout.RIGHT));
  okBtn = new JButton(NLS.nls("COMPILE_ERROR.OK_BUTTON.CAPTION"));
  okBtn.addActionListener(this);
  btnPane.add(okBtn);
  getRootPane().setDefaultButton(okBtn);
  getContentPane().add(btnPane, BorderLayout.SOUTH);
  pack();
  setLocationRelativeTo(getParent());
  setVisible(true);
}
origin: stackoverflow.com

 import java.awt.*;
import javax.swing.*;

 public class DemoJTextFieldWithLimit extends JApplet{
  JTextField textfield1;
  JLabel label1;

  public void init() {
   getContentPane().setLayout(new FlowLayout());
   //
   label1 = new JLabel("max 10 chars");
   textfield1 = new JTextField(15);
   getContentPane().add(label1);
   getContentPane().add(textfield1);
   textfield1.setDocument
    (new JTextFieldLimit(10));
   }
}
origin: stackoverflow.com

private JFrame frame = new JFrame("Test");
private JPanel panel = new JPanel();
private JLabel label = new JLabel("CenteredJLabel");
  panel.setLayout(new GridBagLayout());
  panel.add(label);
  panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
  frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
  frame.add(panel);
  frame.setSize(400, 300);
  frame.setLocationRelativeTo(null);
  frame.setVisible(true);
origin: libgdx/libgdx

private void initializeComponents () {
  getContentPane().setLayout(new GridBagLayout());
  JPanel leftSidePanel = new JPanel();
  leftSidePanel.setLayout(new GridBagLayout());
  getContentPane().add(leftSidePanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER,
    GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    JPanel fontPanel = new JPanel();
    leftSidePanel.add(fontPanel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
      GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
      unicodePanel = new JPanel(new GridBagLayout());
      fontPanel.add(unicodePanel, new GridBagConstraints(2, 3, 2, 1, 0.0, 0.0, GridBagConstraints.EAST,
        GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 5), 0, 0));
  JPanel rightSidePanel = new JPanel();
  rightSidePanel.setLayout(new GridBagLayout());
  getContentPane().add(rightSidePanel, new GridBagConstraints(1, 0, 1, 2, 0.0, 0.0, GridBagConstraints.CENTER,
    GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
origin: wildfly/wildfly

void init() {
  getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
  checkboxes.setLayout(new BoxLayout(checkboxes, BoxLayout.Y_AXIS));
  getContentPane().add(start_discarding_button);
  getContentPane().add(stop_discarding_button);
  start_discarding_button.addActionListener(this);
  stop_discarding_button.addActionListener(this);
  getContentPane().add(checkboxes);
  pack();
  setVisible(true);
  setTitle(localAddress() != null? localAddress().toString() : "n/a");
}
origin: stackoverflow.com

this.setLayout(new GridLayout(N, N, N, N));
this.setBorder(BorderFactory.createEmptyBorder(N, N, N, N));
for (int r = 0; r < N; r++) {
  for (int c = 0; c < N; c++) {
    this.add(create(r + N, r + 1, c + 2));
JFrame f = new JFrame("HTMLFractions");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.add(this);
f.pack();
f.setLocationRelativeTo(null);
f.setVisible(true);
java.awtContainersetLayout

Javadoc

Sets 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
  • 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
  • setBackground
  • repaint,
  • setBackground,
  • getLayout,
  • validate,
  • getTreeLock,
  • removeAll,
  • getPreferredSize,
  • getBackground,
  • getBounds

Popular in Java

  • Finding current android device location
  • startActivity (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • setRequestProperty (URLConnection)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • String (java.lang)
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Top Sublime Text 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