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

public class TabbedPaneDemo extends JPanel {
    public TabbedPaneDemo() {
        super(new GridLayout(1, 1));
        
        JTabbedPane tabbedPane = new JTabbedPane();
        
        JComponent panel1 = makeTextPanel("Panel 1");
        tabbedPane.addTab("Tab 1", panel1);
        
        JComponent panel2 = makeTextPanel("Panel 2");
        tabbedPane.addTab("Tab 2", panel2);
        
        JComponent panel3 = makeTextPanel("Panel 3");
        tabbedPane.addTab("Tab 3", panel3);
        
        JComponent panel4 = makeTextPanel("Panel 4");
        tabbedPane.addTab("Tab 4", panel4);
        
        add(tabbedPane);
    }
    
    JComponent makeTextPanel(String text) {
        JPanel panel = new JPanel(false);
        JLabel label = new JLabel(text);
        label.setHorizontalAlignment(JLabel.CENTER);
        panel.setLayout(new GridLayout(1, 1));
        panel.add(label);
        return panel;
    }
    
    
    public static void main(String[] args) {
        JFrame frame = new JFrame("Bug 436658");
        frame.add(new TabbedPaneDemo(), BorderLayout.CENTER);
        frame.setSize(300, 100);
        frame.setVisible(true);
    }
}
