class LoginFrame extends Frame implements ActionListener
public void windowClosing(WindowEvent we)
l1=new Label("User Name:");
Font f=new Font("arial",Font.BOLD,20);
public void actionPerformed(ActionEvent ae)
if(uname.equals("aditya") && upwd.equals("picture"))
public void paint(Graphics g)
Font f=new Font("arial",Font.BOLD,30);
public static void main(String args)
LoginFrame lf=new LoginFrame();
So as we see, it is a matter of using AWT concept. The import statement which imports the awt.events.* package will be helpful to use the classes, interfaces and pre-defined methodssuch as ActionListener, windowAdapter and so on.
First the textfields and buttons are to be created, which will be useful to enter data and tap for the required operation. Then the window size, windows colour and the alphabet style should be defined whose format can be seen from the code. One thing is to be noted here is that to make visible all the graphics you want, we have to use a pre-defined method paint() . Another notable point here is that one should never forget to write the repaint() method, which is responsible to refresh the login frame.
Please note that, to get the window closing button you must write the pre-defined windowClosing() forgetting which we will be missing the most important thing, the window closing button!!
So try this one and see if you get the output. If you face any bug, comment below the problem or feel free to contact me, you can find the contact details are mentioned in my profile.
Latest posts by Bikash Panda (see all)
- Automatic project structure/git creation in Windows - January 27, 2019
- ESP32 LoRaWAN Node using Arduino - December 31, 2018
- Wi-FI Remote for MI TV using ESP8266 - November 15, 2018