List of usage examples for java.awt Container add
public void add(Component comp, Object constraints)
From source file:Main.java
public Test() { setSize(500, 210);//from w w w .ja v a 2s.com setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JTable tabell = new JTable(cells, name); Container c = getContentPane(); c.setLayout(new FlowLayout()); c.add(new JScrollPane(tabell), BorderLayout.CENTER); }
From source file:MainClass.java
public MainClass() { super();//from w w w.j a va 2 s . c om setSize(300, 200); textPane.setFont(new Font("Serif", Font.PLAIN, 24)); // create some handy attribute sets SimpleAttributeSet red = new SimpleAttributeSet(); StyleConstants.setForeground(red, Color.red); StyleConstants.setBold(red, true); SimpleAttributeSet blue = new SimpleAttributeSet(); StyleConstants.setForeground(blue, Color.blue); SimpleAttributeSet italic = new SimpleAttributeSet(); StyleConstants.setItalic(italic, true); StyleConstants.setForeground(italic, Color.orange); // add the text append("NULL ", null); append("Blue", blue); append("italic", italic); append("red", red); Container content = getContentPane(); content.add(new JScrollPane(textPane), BorderLayout.CENTER); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
From source file:Main.java
public Main() { setSize(300, 300);/* w w w .j ava 2 s. c om*/ setDefaultCloseOperation(EXIT_ON_CLOSE); JPanel controlPane = new JPanel(new GridLayout(2, 1)); controlPane.setOpaque(false); controlPane.add(new JLabel("Please wait...")); controlPane.add(waiter); glass.setOpaque(false); glass.add(padding); glass.add(new JLabel()); glass.add(controlPane); glass.add(new JLabel()); glass.add(new JLabel()); glass.setSize(new Dimension(300, 300)); setGlassPane(glass); JButton startB = new JButton("Start!"); startB.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent A) { glass.setVisible(true); padding.requestFocus(); } }); Container contentPane = getContentPane(); contentPane.add(startB, BorderLayout.SOUTH); }
From source file:Main.java
public Main() { setTitle("ZipTest"); setSize(300, 400);// w w w . j ava 2 s . com JMenuBar mbar = new JMenuBar(); JMenu m = new JMenu("File"); openItem = new JMenuItem("Open"); openItem.addActionListener(this); m.add(openItem); exitItem = new JMenuItem("Exit"); exitItem.addActionListener(this); m.add(exitItem); mbar.add(m); Container contentPane = getContentPane(); contentPane.add(mbar, "North"); }
From source file:FileChooserDemo.java
public FileChooserDemo() { setTitle("ZipTest"); setSize(300, 400);// w w w . jav a 2 s . c o m JMenuBar mbar = new JMenuBar(); JMenu m = new JMenu("File"); openItem = new JMenuItem("Open"); openItem.addActionListener(this); m.add(openItem); exitItem = new JMenuItem("Exit"); exitItem.addActionListener(this); m.add(exitItem); mbar.add(m); Container contentPane = getContentPane(); contentPane.add(mbar, "North"); }
From source file:SimpleTableModel.java
public Main() { this.setDefaultCloseOperation(EXIT_ON_CLOSE); JTable table = new JTable(new SimpleTableModel()); Container contentPane = this.getContentPane(); contentPane.add(new JScrollPane(table), BorderLayout.CENTER); }
From source file:ShowAddListeners.java
public void init() { NameL nameListener = new NameL(); name.addActionListener(nameListener); JPanel top = new JPanel(); top.add(new JLabel("Swing class name (press ENTER):")); top.add(name);//w w w . j av a2 s. c o m Container cp = getContentPane(); cp.add(BorderLayout.NORTH, top); cp.add(new JScrollPane(results)); // Initial data and test: name.setText("JTextArea"); nameListener.actionPerformed(new ActionEvent("", 0, "")); }
From source file:FileChooserTest.java
public FileChooserTest() { JPanel p = new JPanel(); open.addActionListener(new OpenL()); p.add(open);//w w w . j av a 2 s . c om save.addActionListener(new SaveL()); p.add(save); Container cp = getContentPane(); cp.add(p, BorderLayout.SOUTH); dir.setEditable(false); filename.setEditable(false); p = new JPanel(); p.setLayout(new GridLayout(2, 1)); p.add(filename); p.add(dir); cp.add(p, BorderLayout.NORTH); }
From source file:ImageViewer.java
public ImageViewer() { setTitle("ImageViewer"); setSize(300, 400);//from w ww. ja va2 s . c om JMenuBar mbar = new JMenuBar(); JMenu m = new JMenu("File"); openItem = new JMenuItem("Open"); openItem.addActionListener(this); m.add(openItem); exitItem = new JMenuItem("Exit"); exitItem.addActionListener(this); m.add(exitItem); mbar.add(m); setJMenuBar(mbar); label = new JLabel(); Container contentPane = getContentPane(); contentPane.add(label, "Center"); }
From source file:CombinedLayoutManager.java
public CombinedLayoutManager() { Container pane = getContentPane(); pane.setLayout(new BorderLayout()); pane.add(getHeader(), BorderLayout.NORTH); pane.add(getTextArea(), BorderLayout.CENTER); pane.add(getButtonPanel(), BorderLayout.SOUTH); }