Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package tools.tracesviewer;
 
 
 import java.awt.*;
public class TabbedPaneDemo extends JPanel {
    public TabbedPaneDemo() {
        ImageIcon icon = new ImageIcon("images/middle.gif");
        JTabbedPane tabbedPane = new JTabbedPane();
        Component panel1 = makeTextPanel("Blah");
        tabbedPane.addTab("One"iconpanel1"Does nothing");
        tabbedPane.setSelectedIndex(0);
        Component panel2 = makeTextPanel("Blah blah");
        tabbedPane.addTab("Two"iconpanel2"Does twice as much nothing");
        Component panel3 = makeTextPanel("Blah blah blah");
        tabbedPane.addTab("Three"iconpanel3"Still does nothing");
        Component panel4 = makeTextPanel("Blah blah blah blah");
        tabbedPane.addTab("Four"iconpanel4"Does nothing at all");
        //Add the tabbed pane to this panel.
        setLayout(new GridLayout(1, 1));
        add(tabbedPane);
    }
    protected Component makeTextPanel(String text) {
        JPanel panel = new JPanel(false);
        JLabel filler = new JLabel(text);
        filler.setHorizontalAlignment(.);
        panel.setLayout(new GridLayout(1, 1));
        panel.add(filler);
        return panel;
    }
    public static void main(String[] args) {
        JFrame frame = new JFrame("TabbedPaneDemo");
        frame.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });
        frame.getContentPane().add(new TabbedPaneDemo(), .);
        frame.setSize(400, 125);
        frame.setVisible(true);
    }
New to GrepCode? Check out our FAQ X