Future of world with technology grow, thrive, empower yourself, one step at a time. Sucess unlocked.
The journey of self-motivation and personal growth is a lifelong path, filled with twists and turns, triumphs and setbacks. By embracing this journey, we can develop the skills, confidence, and resilience needed to achieve our goals and live a fulfilling life. I hope that my insights and experiences will inspire and motivate you to embark on your own journey of self-discovery and growth. Join me as I share insights, experiences, and practical tips on living a fulfilling life.
Sunday, February 10, 2019
Java program for String operations in swing
JAVA PROGRAM FOR String Operations in swing:
import java.awt.*;
import java.lang.*;
import java.awt.event.*;
import javax.swing.*;
/*<applet code="StrOp" width=400 height=400></applet>*/
public class StrOp extends JApplet implements ActionListener
{
JTextField text5;
JTextField text4;
JTextField text3;
JTextField text2;
JTextField text1;
public void init()
{
Container contentPane=getContentPane();
contentPane.setLayout(new GridLayout(5,2,40,40));
JLabel enter=new JLabel("Enter String:");
contentPane.add(enter);
text1=new JTextField();
contentPane.add(text1);
JButton lower=new JButton("LOWER");
lower.addActionListener(this);
contentPane.add(lower);
text2=new JTextField();
contentPane.add(text2);
JButton upper=new JButton("UPPER");
upper.addActionListener(this);
contentPane.add(upper);
text3=new JTextField();
contentPane.add(text3);
JButton italic=new JButton("ITALIC");
italic.addActionListener(this);
contentPane.add(italic);
text4=new JTextField();
text4.setFont(new Font("TimesNewRoman",Font.ITALIC,12));
contentPane.add(text4);
JButton bold=new JButton("BOLD");
bold.addActionListener(this);
contentPane.add(bold);
text5=new JTextField();
text5.setFont(new Font("TimesNewRoman",Font.BOLD,12));
contentPane.add(text5);
}
public void actionPerformed(ActionEvent e)
{
String str=text1.getText();
if(e.getActionCommand()=="LOWER")
text2.setText(str.toLowerCase());
else if(e.getActionCommand()=="UPPER")
text3.setText(str.toUpperCase());
else if(e.getActionCommand()=="ITALIC")
text4.setText(str);
else if(e.getActionCommand()=="BOLD")
text5.setText(str);
}
}
*****************************************
OUTPUT
*****************************************
Enter String : vijay
Lower : vijay
Upper : VIJAY
Italic : vijay
Bold : vijay
Subscribe to:
Comments (Atom)
Featured posts
सौंफ के फायदे
सौंफ त्रिदोषनाशक है, इसकी तासीर ठंडी है, पर यह जठराग्नि को मंद नहीं करती। आंखों की रोशनी सौंफ का सेवन करके बढ़ाया जा सकता है। सौ...
Popular posts
-
Precautions to be taken during war During a war, taking precautions is crucial to ensure safety and minimize harm. Here are some key precau...
-
C solved practical slips of F.Y.B.Sc. Computer Science: