I am not getting this program since i beginner to applet programming

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

/*<applet code=Login height=500 width=300></applet>*/

public class Login extends JApplet implements ActionListener
{
JLabel jl1,jl2,jl3,jl4,jl5;
JTextField jt;
JPasswordField jp1,jp2;
JButton jb;
public void init()
{
Container c=getContentPane();
c.setLayout(new FlowLayout());
jl1=new JLabel("Username : ");
jl2=new JLabel("Password : ");
jl3=new JLabel("Confirm password : ");
jl4=new JLabel();
jl5=new JLabel();
jt=new JTextField(20);
jp1=new JPasswordField(20);
jp2=new JPasswordField(20);
jb=new JButton("Login");
jb.addActionListener(this);
c.add(jl1);
c.add(jt);
c.add(jl2);
c.add(jp1);
c.add(jl3);
c.add(jp2);
c.add(jb);
c.add(jl4);
c.add(jl5);
}
public void actionPerformed(ActionEvent ae)
{
String s=ae.getActionCommand();
String p1,p2;
if(jp1==jp2)
{
    jl4.setText("Welcome");
}
else
{
    jl4.setText("Password Mismatch");
}
}
}

everytime i check my program it shows else condition
whether password fields are same or different

is there anyone who can help me?

You should use the equals() method to compare Strings.

Your if test using == compares two variables to see it they both refer to the same object. You want to get the contents of those objects as Strings and compare them.

I totally forgot about equals() method concept in java

i got the output thnx for the help

Note: Login.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

how to solve this issue

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

/*<applet code=Login height=500 width=300></applet>*/

public class Login extends JApplet implements ActionListener
{
JLabel jl1,jl2,jl3,jl4;
JTextField jt;
JPasswordField jp1,jp2;
JButton jb;
public void init()
{
Container c=getContentPane();
c.setLayout(new FlowLayout());
jl1=new JLabel("Username : ");
jl2=new JLabel("Password : ");
jl3=new JLabel("Confirm : ");
jl4=new JLabel();
jt=new JTextField(15);
jp1=new JPasswordField(15);
jp2=new JPasswordField(15);
jb=new JButton("Login");
jb.addActionListener(this);
c.add(jl1);
c.add(jt);
c.add(jl2);
c.add(jp1);
c.add(jl3);
c.add(jp2);
c.add(jb);
c.add(jl4);
}
public void actionPerformed(ActionEvent ae)
{
String s=ae.getActionCommand();
String p1,p2;
p1=jp1.getText();
p2=jp2.getText();
if(p1.equals(p2))
{
    jl4.setText("Welcome, "+jt.getText());
}
else
{
    jl4.setText("Password Mismatch");
}
}
}

but is there anyway to solve this in this program

anyway to solve this in this program

Please explain what the problem is now. What does the program do that you want to change.

Note: Login.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

this program gives this warning how to solve it

The compiler is asking you to add the -Xlint option to the command line for the compiler so that it will display the full text of all the warning messages.
Your program must have some code that the compiler thinks could be a problem.
Add the the -Xlint option to get the full details. Here is the commandline I use for compiling:
F:\Java\jdk1.6.0_29\bin\javac.exe -Xlint -g -deprecation -classpath D:\JavaDevelopment\;.;... SnowMen.java

can u plz give me full details since i am new to applet programming
& never seen such kind of error or warning

Comments
NormR1 has already explained what you are asking in this post.

F:\Java\jdk1.6.0_29\bin\javac.exe -Xlint ...

Change your compiler command line to include the -Xlint option as shown above.

Thnx for the help NormR1 & cOrRuPtG3t!x for helping me
now question is solved

This question has already been answered. Start a new discussion instead.