I have a Sign up form.Below the form there is a JLabel 'Already have an account?'.I need to create a Linked Label here with 'Sign in' text.how to do that?
In the code below there are two lables such as 'Already have an account?' and 'sign in'. I need to make 'sign in' Lable as a Link to open another GUI form which is made for sign in.How to do that?
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Stackoverflow extends JFrame implements ActionListener {
private Container c;
private JLabel lable;
private JLabel signin;
public Stackoverflow() {
setTitle("Login");
setBounds(300,90,400,200);
setResizable(false);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
c= getContentPane();
c.setLayout(null);
lable = new JLabel("Already have an account?");
lable.setFont(new Font("Arial",Font.ITALIC,12));
lable.setSize(300,20);
lable.setLocation(50,100);
c.add(lable);
signin = new JLabel("Sign in");
signin.setFont(new Font("Arial",Font.ITALIC,12));
signin.setSize(300,20);
signin.setLocation(200,100);
c.add(signin);
setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e) {
}
}
public class Main {
public static void main(String[] args) {
Stackoverflow stack = new Stackoverflow();
}
}