Question
import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.JTextField; /** * * @author */ public class Login {
import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.JTextField;
/** * * @author */ public class Login {
static JFrame frame = new JFrame("Login");
public static void main(String s[]) { JPanel panel = new JPanel(); panel.setLayout(null); JLabel label1 = new JLabel("User Id"); label1.setBounds(175, 50, 100, 30); JTextField user = new JTextField(10); user.setBounds(250, 50, 200, 30); JLabel label2 = new JLabel("Password"); label2.setBounds(175, 100, 100, 30);
// password field JPasswordField password = new JPasswordField(10); password.setBounds(250, 100, 200, 30); JButton login = new JButton(); login.setText("Login"); login.setBounds(200, 150, 100, 20); JButton exit = new JButton(); exit.setText("Exit"); exit.setBounds(320, 150, 100, 20); exit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
// to close the frame Login.frame.dispose();
}
});
panel.add(label1); panel.add(label2); panel.add(user); panel.add(password); panel.add(login); panel.add(exit); frame.add(panel); frame.setSize(600, 300); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true);
}
}
How to convert this into Java FX insted of Java swing
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started