Source Code : JTabPane with TextField in the tab

Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com. Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com. Click Here or search from google with Libraries Name you get jar file related it

JTabPane with TextField in the tab

 

import java.awt.BorderLayout;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;

public class JDK6TabSample {
  static void addIt(JTabbedPane tabbedPane, String text) {
    JLabel label = new JLabel(text);
    JButton button = new JButton(text);
    JPanel panel = new JPanel();
    panel.add(label);
    panel.add(button);
    tabbedPane.addTab(text, panel);
    tabbedPane.setTabComponentAt(tabbedPane.getTabCount() - 1, new JTextField(text));
  }

  public static void main(String args[]) {
    JFrame f = new JFrame("Got JTabbedPane?");
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JTabbedPane tabbedPane = new JTabbedPane();
    addIt(tabbedPane, "Tab One");
    addIt(tabbedPane, "Tab Two");
    addIt(tabbedPane, "Tab Three");
    addIt(tabbedPane, "Tab Four");
    addIt(tabbedPane, "Tab Five");
    f.add(tabbedPane, BorderLayout.CENTER);
    f.setSize(300, 200);
    f.setVisible(true);

  }
}

        

Thank with us