import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class JavaExampleTabbedPaneOrientationInJApplet extends JApplet implements ActionListener
{
JTabbedPane TbdPn = new JTabbedPane(SwingConstants.BOTTOM);
JButton BtnTop,BtnLft,BtnRght,BtnBtm;
public void init()
{
Container Cntnr= getContentPane();
JPanel BtnPnl = new JPanel();
JPanel PnlOne = new JPanel();
JPanel PnlTwo = new JPanel();
JPanel PnlThree = new JPanel();
TbdPn.setTabPlacement(TbdPn.TOP);
TbdPn.addTab("Panel One",new ImageIcon("tab.jpg"),PnlOne,"This is First Panel");
TbdPn.addTab("Panel Two",new ImageIcon("tab.jpg"),PnlTwo, "This is Second Panel");
TbdPn.addTab("Panel Three",new ImageIcon("tab.jpg"),PnlThree, "This is Third Panel");
BtnTop = new JButton("Top");
BtnLft = new JButton("Left");
BtnRght = new JButton("Right");
BtnBtm = new JButton("Bottom");
BtnPnl.add(BtnTop);
BtnPnl.add(BtnLft);
BtnPnl.add(BtnRght);
BtnPnl.add(BtnBtm);
BtnTop.addActionListener(this);
BtnLft.addActionListener(this);
BtnRght.addActionListener(this);
BtnBtm.addActionListener(this);
Cntnr.setLayout(new BorderLayout());
Cntnr.add(TbdPn, BorderLayout.CENTER);
Cntnr.add(BtnPnl, BorderLayout.SOUTH);
}
public void actionPerformed(ActionEvent e1)
{
if(e1.getSource() == BtnTop)
{
TbdPn.setTabPlacement(TbdPn.TOP);
}
else if(e1.getSource() == BtnLft)
{
TbdPn.setTabPlacement(TbdPn.LEFT);
}
else if(e1.getSource() == BtnRght)
{
TbdPn.setTabPlacement(TbdPn.RIGHT);
}
else if(e1.getSource() == BtnBtm)
{
TbdPn.setTabPlacement(TbdPn.BOTTOM);
}
TbdPn.validate();
}
}
/*<APPLET CODE=JavaExampleTabbedPaneOrientationInJApplet.class WIDTH = 500 HEIGHT = 200 ></APPLET>*/