import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
 public class JTabbedPaneTest extends JFrame implements ActionListener
 {
 private JButton B[];
 private String S[]={"Button 1","Button 2","Button 3",
 "Button 4","Button 5","Button 6"};
 private Container c;

 public JTabbedPaneTest(String s)
 {
 //super(s);
 setLayout(new BorderLayout(5,5));
 B=new JButton[6];
 JTabbedPane jtp=new JTabbedPane();
 for(int i=0;i<B.length;i++)
 {
 B[i]=new JButton(S[i]);
 B[i].addActionListener(this);
 jtp.addTab(S[i],B[i]);
 }
 add(jtp);
 }

 public void actionPerformed(ActionEvent e)
 {
  for(int i=0;i<B.length;i++)
 {
 if(e.getSource()==B[i])
 B[i].setText(S[i]+" Buttonye basıldı");
 else B[i].setText(S[i]);
 }
 validate();
 }
      public static void main(String[] args)
      {
  
        JTabbedPaneTest f = new JTabbedPaneTest("JTabbedPane formatlama Grafik ara yüz (GUI) testi");
        f.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );       f.setSize(800,500);
        f.setVisible(true);  
      }
 }
