import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class JHelloFrame extends JFrame implements ActionListener{
JLabel question= new JLabel("What is your name");
Font bigFont= new Font("Arial",Font.BOLD,16);
JTextField answer= new JTextField(12);
JButton pressMe=new JButton("RressMe");
JLabel greeting= new JLabel("");
final int Width=175;
final int Height=225;
public JHelloFrame()
{
super("Hello Frame");
setSize(Width,Height);
setLayout(new FlowLayout());
question.setFont(bigFont);
greeting.setFont(bigFont);
add(question);
add(answer);
add(pressMe);
add(greeting);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
pressMe.addActionListener(this);
}
public void ActionListener(ActionEvent e){
String name=answer.getText();
String greet="Hello,"+name;
greeting.setText(greet);
}
}
MAIN
public class JHelloDemo
{
public static void main(String [] args){
JHelloFrame Frame= new JHelloFrame();
}
}
Can you please identify what the problem it doesn't run
this is the error
public class JHelloDemo
{
public static void main(String [] args){
JHelloFrame Frame= new JHelloFrame();
}
}