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)
- OSMC on Raspberry PI with Setup and Control using Android App - July 7, 2017
- DHT12 Interfacing with Raspberry Pi using Pi4J - June 19, 2017
- Send data using MQTT from Raspberry Pi with JAVA - June 12, 2017