import javax.swing.*;
import javax.swing.JButton;
import java.awt.*;
import java.awt.event.*;
public class CreateTabbedPane extends JFrame implements ActionListener
{
JButton b1;
JTextField txt1;
public CreateTabbedPane()
{
JFrame frame = new JFrame("Tabbed Pane Frame");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JTabbedPane tab = new JTabbedPane();
tab.addTab("Jay",new abc());
tab.addTab("RD",ram a);
}
class abc extends JPanel
{
public abc()
{
txt1=new JTextField(15);
b1=new JButton("submit");
b1.addActionListeners(this);
add(b1);
}
}
class ram extends JPanel
{
public ram()
{
String s=txt1.getText();
JLabel la=new JLabel(s);
add(la);
}
}
public void actionPerformed(ActionEvent ae)
{
a=new ram();
}
public static void main(String[] args)
{
frame.setSize(400,400);
frame.setVisible(true);
}
}
Guys this is Advanced java program(Swings)...
this is about JTabbedPane
Details of the program:
I'm trying to make a program in which in first tab there is a textfield and a button...
if i enter any word in that textfield and press the button submit,the same word should be shown in label in the second tab...
but i tried my level best,but it is showing some error which i can't solve or debug...
pls pls help me...i don't hav any1 to teach me so please help me