JAVA Action listener write small case "raj kumar" output Capital "RAJ KUMAR"

JAVA Action listener write small case  "raj kumar" output  "RAJ KUMAR"


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////





Copy this code Perform this operation..............................................


package Listener;

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

class Frame extends JFrame implements ActionListener

{

    Container c;

    JTextField t1;

    public Frame()

    {

        c=this.getContentPane();

        c.setLayout(null);

        t1=new JTextField();

        t1.setBounds(100,100,100,30);

        c.add(t1);

        t1.setFont(new Font("arial",Font.BOLD,15));

        t1.addActionListener(this);

    }

    public void actionPerformed(ActionEvent e)

    {

        String str=t1.getText();

        t1.setText(str.toUpperCase());

    }

}

public class ActionEvent2

{

    public static void main(String[] args) 

    {

        Frame f=new Frame();

        f.setTitle("Action Event ");

        f.setBounds(100,100,400,400);

        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        f.setVisible(true);

    }

}

Thank you for reading my Blog................ 

Comments

Popular posts from this blog

ADD TWO NO. IN JAVA USING APPLET

JARVIS AI

TO-DO LIST USING HTML CSS JS