0

I wanted to create a Swing GUI , in which there should be a text which in event handling works as a JButton.

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class Gui implements ActionListener
{
JFrame jf=new JFrame("Link");
JLabel jl=new JLabel("CLICK HERE");
Gui()
{
jf.setSize(400,400);
jf.setVisible(true);
jf.setDefaultCloseOperation(jf.EXIT_ON_CLOSE);
jf.setLayout(null);
Font f=new Font("Arial",)
jl.setBounds(50,50,100,50);
jf.add(jl);
jl.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
JOptionPane.showMessageDialoge(null,"Clicked in link");
}
public static void main(String arg[])
{
new Gui();
}
}

How can I create a text into a link in a Java Swing GUI?

Please suggest a proper code.

Om_09
  • 1
  • 2
  • Yes it did , but can you please put it an answer – Om_09 Aug 08 '20 at 05:40
  • Generally on stackoverflow if a previously answered question answers a new question the new question will be closed as a duplicate. Before the question is closed it needs to be reviewed by close vote reviewers. The close vote review queue is currently 4 thousand questions long so it might take a while before this question is closed. – PiRocks Aug 08 '20 at 05:44

0 Answers0