Question: Complete this Code with the appropriate Listeners and Events to make it a functional login window that works with JDBC that has username: abc and

Complete this Code with the appropriate Listeners and Events to make it a functional login window that works with JDBC that has username: abc and password: 123 A pop-up window should appear after a successful login ______________________________ import java.awt.*; import java.awt.event.*;

public class Login { private Frame f; private Panel p1, p2, p3; private Label l1, l2; private TextField tf1, tf2; private Button b1; public Login(){ f = new Frame("Login"); p1 = new Panel(); p2 = new Panel(); p3 = new Panel(); l1 = new Label("Username: "); l2 = new Label("Password: ");

tf1 = new TextField("", 15); tf2 = new TextField("", 15); b1 = new Button("Login"); } public void startApp(){ p1.add(l1); p1.add(tf1); p2.add(l2); p2.add(tf2);

p3.add(b1); f.setLayout(new GridLayout(3, 1));

f.add(p1); f.add(p2); f.add(p3); f.pack(); f.setVisible(true); f.addWindowListener(new MyCloseButtonHandler()); } public void actionPerformed(ActionEvent e){ } private class MyCloseButtonHandler extends WindowAdapter { @Override public void windowClosing(WindowEvent we) { System.exit(0); } } public static void main(String args[]) { Login sc = new Login(); sc.startApp(); } } _____________________________________________

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!