All pastes #67880 Raw Edit

Miscellany

public java v1 · immutable
#67880 ·published 2006-06-20 18:49 UTC
rendered paste body
import javax.swing.*;import java.awt.*;public class TestWindow extends JWindow{	public TestWindow()	{		setSize(500, 500);		setLayout(null);		// this does work		JButton x = new JButton("Test");		x.setBounds(1, 1, 254, 22);		add(x);		// this doesnt		TestPanel t = new TestPanel();		t.setBounds(10, 10, 100, 100);		t.setBackground(Color.BLACK);		t.setVisible(true);		// neither does this		getContentPane().add(new JButton("Test"));		setVisible(true);	}	public static void main(String[] args)	{		new TestWindow();	}}class TestPanel extends JPanel{	public TestPanel()	{		System.out.println("This does get executed");		// only this just doesnt show		JButton x = new JButton("Test");		x.setBounds(100, 100, 254, 22);		add(x);		add(new TestThing());	}}class TestThing extends JPanel{	public TestThing()	{		super(new GridLayout(4, 4));		add(new JButton("Test"));		add(new JButton("Test"));		add(new JButton("Test"));		add(new JButton("Test"));		JButton b = new JButton("Test met bounds");		b.setBounds(5, 5, 50, 50);		add(b);	}}