0

Please correct this...not getting the resulting label(l4) in the output.

import java.awt.*; import java.awt.event.*; class awt3 extends Frame implements ActionListener{ Button b1; TextField t1,t2; Label l1,l2,l3,l4; awt3(){ Button b1=new Button("OK"); Label l1=new Label("Number1"); Label l2=new Label("Number2"); Label l3=new Label("Result: "); Label l4=new Label(null); Panel p1=new Panel(); TextField t1=new TextField(10); TextField t2=new TextField(10); add(p1);p1.add(l1);p1.add(t1); p1.add(l2);p1.add(t2); p1.add(b1); p1.add(l3); p1.add(l4); setSize(200,200);setVisible(true); b1.addActionListener(this); addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent e){ System.exit(0); } }); } public void actionPerformed(ActionEvent e){ int n1,n2; if(e.getSource()==b1){ n1=Integer.parseInt(t1.getText()); n2=Integer.parseInt(t2.getText()); if(n1>n2) l4.setText("n1 is greater"); else if(n1==n2) l4.setText("n1 equals n2"); else

23rd Jul 2019, 3:50 PM
Pranay Bhoir.
Pranay Bhoir. - avatar
2 Respostas
0
whats wrong with the code ?
23rd Jul 2019, 4:05 PM
Taste
Taste - avatar
0
Not getting resulting label(l4) in the output.
23rd Jul 2019, 5:02 PM
Pranay Bhoir.
Pranay Bhoir. - avatar