I am trying to run a java class fwd_TLit which extends the class layout_ETP which is my layout for a project. It is build using gridBag layout. Now I am facing NullPointerException when I try to run the fwd_TLit.Plz someone helps me what will be the error and get no output. The code for the layout_ETP :-
public class layout_ETP {
static Font f=new Font("Papyrus",Font.BOLD ,50);
static Font f1=new Font("Papyrus",Font.BOLD ,30);
public static JLabel l,l1,l2;
public static JButton clearBtn,convertBtn,obj;
public static JTextArea ta,ta1;
public static JPanel footer;
public static void main(String[] args) {
JFrame.setDefaultLookAndFeelDecorated(true);
JFrame frame = new JFrame();
frame.setSize(600, 600);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setFont(f);
frame.setTitle("Natural Language Processor");
frame.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
// Setting the label for the nlp
l = new JLabel("Natural Language Processor");
l.setFont(f);
c.weightx = 0.0;
c.gridx = 0;
c.gridy = 0;
c.ipady = 20;
c.fill = GridBagConstraints.NONE;
c.anchor = GridBagConstraints.FIRST_LINE_START;
frame.add(l, c);
l1 = new JLabel("English");
l1.setFont(f1);
c.gridy = 1;
c.weighty = 0.0;
frame.add(l1, c);
}
The code for the fwd_TLit :-
public class fwd_TLit extends layout_ETP {
public void transliteration() {
ta.setText("Hello");
String str = ta.getText().toString();
ta1.setText(str);
}
public static void main(String[] args) {
try{
fwd_TLit obj = new fwd_TLit();
obj.transliteration();
} catch(Exception e) {
System.out.println(e);
}
}
}
Sorry for that guys but I am trying to put the smallest code from that class..!! I have all the necessary things such as fonts,there declaration etc...but facing this prob in the fwd_TLit class. I think the problem must be there..!!
PascalCase.