Friday, July 30, 2010

PASSWORD DEVELOPER

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include<conio.h>
int n;
char *rand_str(char *dst, int size)
{
   static const char text[] = "abcdefghijklmnopqrstuvwxyz"
                  "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
                  "1234567890"
                  "`~!@#$%^&*()_+,./;':?><[]{}|\"";
   int i,len=rand()%(size-1);
   for ( i = 0; i < n ; ++i )
   {
      dst[i] = text[rand() % (sizeof text - 1)];
   }
   dst[i] = '\0';
   return dst;
}

int main (void)
{
   clrscr();
   printf("\n\n\n\t\t\tPASSWORD DEVELOPER\n\n\n");
   printf("  enter the length of password required\t");
   scanf("%d",&n);
   char mytext[10];
   srand(time(0));
   gotoxy(9,10);
   printf("a C programmed random password is ");
   puts(rand_str(mytext, sizeof mytext));
   printf("\n\thit any key to exit......");
   getch();
   return 0;
}

Thursday, July 29, 2010

CORE JAVA PROJECT

import  java.applet.*;

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

/*<applet  code="fontadjust"  width=800 height=500>

</applet>*/

public class  fontadjust  extends Applet implements ActionListener,ComponentListener,AdjustmentListener,KeyListener

{

TextField t;

Button r1,r2,r3;

Button move,size,hide,show,submit,col;

Scrollbar redbar,greenbar,bluebar;

Label red,green,blue;

int x,y,w,h,s;

Font f;

Label l,l1;

public void init()

{

setLayout(null);

l1=new Label("PROGRAM BY KRISHNAPRASAD AND VINAYKUMAR");

l1.setBounds(350,450,290,10);

add(l1);

t=new TextField();

red=new Label("red:0");

green=new Label("green:0");

blue=new Label("blue:0");

redbar=new Scrollbar(Scrollbar.HORIZONTAL,0,1,0,256);

greenbar=new Scrollbar(Scrollbar.HORIZONTAL,0,1,0,256);

bluebar=new Scrollbar(Scrollbar.HORIZONTAL,0,1,0,256);

add(red);

red.setBounds(10,370,70,30);

add(green);

green.setBounds(90,370,70,30);

add(blue);

blue.setBounds(190,370,70,30);

add(redbar);

redbar.setBounds(10,400,70,30);

add(greenbar);

greenbar.setBounds(90,400,70,30);

add(bluebar);

bluebar.setBounds(190,400,70,30);

redbar.addAdjustmentListener(this);

greenbar.addAdjustmentListener(this);

bluebar.addAdjustmentListener(this);

submit=new Button("submit");

add(t);

add(submit);

t.setBounds(20,10,250,30);

submit.setBounds(50,60,70,30);

submit.addActionListener(this);

move=new Button("move");

size=new Button("size");

hide=new Button("hide");

show=new Button("show");

x=10;

y=10;

w=100;

h=30;

add(move);

move.setBounds(10,450,70,30);

add(size);

size.setBounds(90,450,70,30);

add(hide);

hide.setBounds(190,450,70,30);

add(show);

show.setBounds(270,450,70,30);

col=new Button("colors");

col.setBounds(450,30,70,30);

add(col);

col.addActionListener(this);

move.addActionListener(this);

size.addActionListener(this);

hide.addActionListener(this);

show.addActionListener(this);

submit.addKeyListener(this);

t.addKeyListener(this);

t.requestFocus();



}

public void keyPressed(KeyEvent ke)

{

if(ke.getSource()==submit)

if (ke.getKeyCode()==KeyEvent.VK_ENTER)

{

l=new Label(t.getText());

add(l);

l.setBounds(20,10,100,30);

f=new Font("Times New Roman",Font.ITALIC,10);

s=10;

l.setFont(f);

l.addComponentListener(this);

remove(submit);

remove(t);

}

}

public void keyReleased(KeyEvent ke)

{

if(ke.getSource()==t)

{

if(ke.getKeyCode()==KeyEvent.VK_F1)

{

Color c=getBackground();

if(c!=Color.red)

setBackground(Color.red);

else

setBackground(Color.white);

}

if(ke.getKeyCode()==KeyEvent.VK_F2)

{

Color c=getBackground();

if(c!=Color.green)

setBackground(Color.green);

else

setBackground(Color.white);

}

if(ke.getKeyCode()==KeyEvent.VK_F3)

{

Color c=getBackground();

if(c!=Color.blue)

setBackground(Color.blue);

else

setBackground(Color.white);

}

}

}

public void keyTyped(KeyEvent ke){}

public  void componentResized(ComponentEvent ce)

{

s=s+1;

f=new Font("Times New Roman",Font.ITALIC,s);

l.setFont(f);

}

public  void componentMoved(ComponentEvent ce)

{

}

public  void componentHidden(ComponentEvent ce)

{

}

public  void componentShown(ComponentEvent ce)

{

}

public void actionPerformed(ActionEvent ae)

{

if(ae.getSource()==submit)

{

showStatus("copyrights reserved");

l=new Label(t.getText());

add(l);

l.setBounds(20,10,100,30);

f=new Font("Times New Roman",Font.ITALIC,10);

s=10;

l.setFont(f);

l.addComponentListener(this);

remove(submit);

remove(t);

}

else if(ae.getSource()==move)

{

x=x+30;

if(x>=400)

{

y=y+10;

x=10;

}

l.setLocation(x,y);

}

else if(ae.getSource()==size)

{

w=w+10;

h=h+5;

l.setSize(w,h);

}

else if(ae.getSource()==hide)

l.setVisible(false);

else if(ae.getSource()==col)

{



r1=new Button("red");

r1.setBackground(Color.red);

r1.setBounds(450,30,70,30);

add(r1);

r2=new Button("green");

r2.setBackground(Color.green);

r2.setBounds(450,70,70,30);

add(r2);

r3=new Button("blue");

r3.setBackground(Color.blue);

r3.setBounds(450,110,70,30);

add(r3);

r1.addActionListener(this);

r2.addActionListener(this);

r3.addActionListener(this);

remove(col);

}

else if(ae.getSource()==r1)

{

Color c=getBackground();

if(c!=Color.red)

{

setBackground(Color.red);

l.setBackground(Color.red);

}

else

{

setBackground(Color.white);

l.setBackground(Color.white);

}

}

else if(ae.getSource()==r2)

{

Color c=getBackground();

if(c!=Color.green)

{

setBackground(Color.green);

l.setBackground(Color.green);

}

else

{

setBackground(Color.white);

l.setBackground(Color.white);

}

}

else if(ae.getSource()==r3)

{

Color c=getBackground();

if(c!=Color.blue)

{

setBackground(Color.blue);

l.setBackground(Color.blue);

}

else

{

setBackground(Color.white);

l.setBackground(Color.white);

}

}

else

l.setVisible(true);

}

public void adjustmentValueChanged(AdjustmentEvent ae)

{

red.setText("red:"+redbar.getValue());

green.setText("green:"+greenbar.getValue());

blue.setText("blue:"+bluebar.getValue());

Color c=new Color(redbar.getValue(),greenbar.getValue(),bluebar.getValue());

l.setForeground(c);

}

}





Wednesday, July 28, 2010

COMPLEX NUMBERS

#include<iostream>
using namespace std;
class complex
{
float x,y;
public:
complex()
{}
complex(float real,float imag)
{
x=real;
y=imag;
}
complex operator+(complex);
void display()
{
cout<<x<<"+j"<<y<<"\n";
}
};
complex complex :: operator+(complex c )
{
complex temp;
temp.x=x+c.x;
temp.y=y+c.y;
return(temp);
}
int main()
{
complex c1,c2,c3;
c1=complex(2.5,2.7);
c2=complex(1.6,5.5);
c3=c1+c2;
cout<<"c1=";
c1.display();
cout<<"c2=";
c2.display();
cout<<"c3=";
c3.display();
return 0;
}



STRING OVERLOADING

#include<stdio.h>
#include<iostream>
using namespace std;
class str
{
 char *p;
 int len;
 public:
        str()
        {
        len=0;
        p=0;
        }
        str(const char *s);
        str(const str &s);
        friend str operator+(const str &s,const str &t);
        friend int operator>(const str &s,const str &t);
        friend int operator==(const str &s,const str &t);
        friend void show(const str &s);
};
str::str(const char *s)
{
 len=strlen(s);
 p=new char[len+1];
 strcpy(p,s);
}
str::str(const str &s)
{
 len=s.len;
 p=new char[len+1];
 strcpy(p,s.p);
}
int operator>(const str&s,const str &t)
{
 int m=strlen(s.p);
 int n=strlen(t.p);
 if(m>n)
 return(1);
 else if(m==n)
 {
 show(s.p);
 cout<< " equals to ";
 show(t.p);
 cout<<endl;
 }
 else
 {
 show(s.p);
 cout<< " lesser than ";
 show(t.p);
 cout<<endl;
 }
}
void show(const str &s)
{
 cout<<s.p;
}
str operator+(const str &s,const str &t)
{
 str temp;
 temp.len=s.len+t.len;
 temp.p=new char[temp.len+1];
 strcpy(temp.p,s.p);
 strcat(temp.p,t.p);
return(temp);
}
int main()
{
str t1,t2,t3;
int ch;
char s1[100],s2[100];
cout<<"enter two strings s1 and s2\n";
cin>>s1>>s2;
t1=s1;
t2=s2;
cout<<"given strings are\n";
cout<<"string1==";
show(t1);
cout<<endl;
cout<<"string2=";
show(t2);
cout<<endl;
while(1)
{
cout<<"STRING FUNCTIONS\n";
cout<<"1.comparision\n2.concatenation\n3.exit\nenter your choice:\t";
cin>>ch;
switch(ch)
{
case 1:if(t1>t2)
       {
       show(t1);
       cout<<" is greater than ";
       show(t2);
       cout<<endl;
       }
       break;
case 2:t3=t1+t2;
       cout<<"concatenated string is ";
       show(t3);
       cout<<endl;
       break;
case 3:exit(1);
        break;
}
}
return(0);
}



STACK USING CLASS

#include<iostream>
#define MAX 5
using namespace std;
int top=-1;
class stackop
{
int stack[MAX];
public:
void push()
{
int i;
cout<<"\nenter a number to push";
cin>>i;
if (top>=MAX-1)
cout<<"\nstack is full";
else
{
top++;
stack[top]=i;
cout<<"pushed element is"<<stack[top];
}
}
void pop()
{
int b;
if(top==-1)
cout<<"\nstack is empty";
else
{
cout<<"\ndeleted element is "<<stack[top];
top--;
}
}
void display()
{
int i;
if(top>=0)
{
cout<<"\nstack elements are";
for (i=0;i<=top;i++)
cout<<"\t"<<stack[i];
}
else
cout<<"\nno elements";
}
};
int main()
{
stackop s;
int x,y;
while(1)
{
cout<<"\nSTACK OPERATIONS USING C++";
cout<<"\n1.push\n2.pop\n3.display\n4.exit\n enter your choice\n";
cin>>y;
switch(y)
{
case 1:s.push();
       break;
case 2:s.pop();
      break;
case 3:s.display();
       break;
case 4:exit(0);
break;
default:cout<<"wrong choice entered";
}
}
return 0;
}



Friday, July 23, 2010

FILE STATUS

import java.io.*;
import java.util.*;
class files
{
public static void main(String args[]) throws IOException
{
Scanner in=new Scanner(System.in);
String name;
System.out.println("Enter  filename");
name=in.nextLine();
File f=new File(name);
System.out.println("Name of the file is:" +f.getName());
System.out.println("path of the file is:" +f.getPath());
System.out.println("parent of the file is:" +f.getParent());
System.out.println("File  exists :" +f.exists());
System.out.println("file is a  Directory:" +f.isDirectory());
System.out.println("file  is a ordinary file:" +f.isFile());
System.out.println("file has read permission:" +f.canRead());
System.out.println("file has write permission:" +f.canWrite());
System.out.println("size of the file is:" +f.length());
}
}

colors

import java.applet.*;
import java.awt.*;
/*<applet code="colors" width=300 height=300>
</applet>*/

public class colors extends Applet
{

public void paint(Graphics g)
{
//setBackground(Color.yellow);
g.setColor(Color.red);
g.drawString("krishna prasad",100,100);
g.setColor(Color.blue);
g.drawString("nandeti",100,130);
g.setColor(Color.green);
g.drawString("computer engineer",100,160);
Color c=new Color(100,200,200);
g.setColor(c);
g.drawString("SIR CRR College of Engg",100,190);
}
}


Saturday, July 17, 2010

FLAMES


import java.io.*;
class flames
{
    public static void main(String args[]) throws IOException
    {   int m;
        BufferedReader br=new BufferedReader(new
InputStreamReader(System.in));
        System.out.println("Enter ur name: ");
        String first=br.readLine();
        System.out.println("Enter ur partner's name: ");
        String second=br.readLine();
        StringBuffer s1=new StringBuffer(first);
        StringBuffer s2=new StringBuffer(second);
        int a=s1.length();
        int b=s2.length();

        //comparing two names
        label: for(int i=0;i<a;i++)
        {
            char c=s1.charAt(i);
        //    System.out.println(c);
            for(int j=0;j<b;j++)
            {
                char d=s2.charAt(j);
                if(c==d)
                {
                     ////k++;
                     s1.deleteCharAt(i);
                     s2.deleteCharAt(j);
                     ////System.out.println(s1 +" " +s2);
                     a=s1.length();
                     //m=a;
                     b=s2.length();
                     i=0;
                     j=0;
                    // continue label;
                }
                        }

    ////    System.out.println(k);
        }
      int d=(a+b);
      System.out.println("the number is : " +d);
      //int n=-1,l=0,p=0;
      StringBuffer s3=new StringBuffer("flames");
      String s4=new String();

label1:    for(int i=0;i<5;i++)
        {int n=-1,l=0,p=0;
            for(int j=1;j<=d;j++)
            {
            n++;
            l++;
            //int p=0;
            if(n>s3.length()-1)
                {
                char e=s3.charAt(p);
                if(l==d)
                    {
                    s3.deleteCharAt(p);
                    //String s4=new String();
                    s4=s3.substring(p,s3.length());
                    ////System.out.println(s4);
                    s3.delete(p,s3.length());
                    ////System.out.println(s3);
                    s3.insert(0,s4);
                    ////System.out.println(s3);
                    break;
                    }
                    else{ p++;
                         if(p==s3.length())
                         {p=0;
                         }
                        }
                }
            else
                {
                char e=s3.charAt(n);
                if(l==d)
                    {
                    s3.deleteCharAt(n);

                    s4=s3.substring(n,s3.length());
                    ////System.out.println(s4);
                    s3.delete(n,s3.length());
                    ////System.out.println(s3);
                    s3.insert(0,s4);
                    ////System.out.println(s3);
                    break;
                    }
                    //break;
                }

            }
            }
    ////System.out.println(s3);
    char result=s3.charAt(0);
    switch(result){
        case 'f':
             System.out.println(second+" is ur Friend");
             break;
        case 'l':
             System.out.println(second+" is ur Love");
             break;
        case 'a':
             System.out.println(second+" is ur Affection");
             break;
        case 'm':
             System.out.println("u r going to marry "+ second);
             break;
        case 'e':
             System.out.println(second + " is ur Enemy");
             break;
        case 's':
             System.out.println(second +" is ur Sister");
             break;
                  }
    }
}


JAVA NOTEPAD

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;

public class notepro extends JFrame implements ActionListener
{
    MenuBar mbar;
    Menu file,edit,format,font,font1,font2;
    MenuItem item1,item2,item3,item4;
    MenuItem item5,item6,item7,item8,item9,item10;
    MenuItem fname1,fname2,fname3,fname4;
    MenuItem fstyle1,fstyle2,fstyle3,fstyle4;
    MenuItem fsize1,fsize2,fsize3,fsize4;

    JPanel mainpanel;
    TextArea text;

    Font f;
    String months[]={
        "Jan","Feb","Mar","Apr",
        "May","Jun","Jul","Aug",
        "Sep","Oct","Nov","Dec"};

    GregorianCalendar  gcalendar;


    String command=" ";
    String str=" ";

    String str1=" ",str2=" ",str3=" ";
    String str4=" ";

    String str6=" ";
    String str7=" ",str8=" ",str9=" ";

    int len1;

    int i=0;
    int pos1;
    int len;

    public notepro(String str)
    {

    super(str);

    mainpanel=new JPanel();
    mainpanel=(JPanel)getContentPane();
    mainpanel.setLayout(new FlowLayout());



    mbar=new MenuBar();
    setMenuBar(mbar);

    file=new Menu("File");
    edit=new Menu("Edit");
    format=new Menu("Format");
    font=new Menu("Font");
    font1=new Menu("Font Style");
    font2=new Menu("Size");

    file.add(item1=new MenuItem("New..."));
    file.add(item2=new MenuItem("Open"));
    file.add(item3=new MenuItem("Save As..."));
    file.add(item4=new MenuItem("Exit"));
    mbar.add(file);


    edit.add(item5=new MenuItem("Cut"));
    edit.add(item6=new MenuItem("Copy"));
    edit.add(item7=new MenuItem("Paste"));
    edit.add(item8=new MenuItem("Delete"));
    edit.add(item10=new MenuItem("Select All"));
    edit.add(item9=new MenuItem("Time/Date"));
    mbar.add(edit);

    format.add(font);
    format.add(font1);
    format.add(font2);

    font.add(fname1=new MenuItem("Courier"));
    font.add(fname2=new MenuItem("Sans Serif"));
    font.add(fname3=new MenuItem("Monospaced"));
    font.add(fname4=new MenuItem("Symbol"));

    font1.add(fstyle1=new MenuItem("Regular"));
    font1.add(fstyle2=new MenuItem("Bold"));
    font1.add(fstyle3=new MenuItem("Italic"));
    font1.add(fstyle4=new MenuItem("Bold Italic"));

    font2.add(fsize1=new MenuItem("12"));
    font2.add(fsize2=new MenuItem("14"));
    font2.add(fsize3=new MenuItem("18"));
    font2.add(fsize4=new MenuItem("20"));

    mbar.add(format);



    item1.addActionListener(this);
    item2.addActionListener(this);
    item3.addActionListener(this);
    item4.addActionListener(this);
    item5.addActionListener(this);
    item6.addActionListener(this);
    item7.addActionListener(this);
    item8.addActionListener(this);
    item9.addActionListener(this);
    item10.addActionListener(this);
    fname1.addActionListener(this);
    fname2.addActionListener(this);
    fname3.addActionListener(this);
    fname4.addActionListener(this);
    fstyle1.addActionListener(this);
    fstyle2.addActionListener(this);
    fstyle3.addActionListener(this);
    fstyle4.addActionListener(this);
    fsize1.addActionListener(this);
    fsize2.addActionListener(this);
    fsize3.addActionListener(this);
    fsize4.addActionListener(this);


    text=new TextArea(26,60);
    mainpanel.add(text);

    f=new Font("Monotype Corsiva",Font.PLAIN,15);
    text.setFont(f);
    }




    public void actionPerformed(ActionEvent ae)
    {


        command=(String)ae.getActionCommand();

        if(command.equals("New..."))
        {
        dispose();
        notepro note1 = new notepro("Untitled-Notepad");
        note1.setSize(500,500);
        note1.setVisible(true);
        }

        try
        {

        if(command.equals("Open"))
        {

        str4=" ";
        FileDialog dialog=new FileDialog(this,"Open");
        dialog.setVisible(true);

        str1=dialog.getDirectory();
        str2=dialog.getFile();
        str3=str1+str2;
        File f=new File(str3);
        FileInputStream fobj=new FileInputStream(f);
        len=(int)f.length();
        for(int j=0;j<len;j++)
        {
            char str5=(char)fobj.read();
            str4=str4 + str5;

        }

        text.setText(str4);

        }
        }
        catch(IOException e)
        {}


        try
        {

        if(command.equals("Save As..."))
        {
        FileDialog dialog1=new FileDialog(this,"Save As",FileDialog.SAVE);
        dialog1.setVisible(true);

        str7=dialog1.getDirectory();
        str8=dialog1.getFile();
        str9=str7+str8;


        str6=text.getText();
        len1=str6.length();
        byte buf[]=str6.getBytes();

        File f1=new File(str9);
        FileOutputStream fobj1=new FileOutputStream(f1);
        for(int k=0;k<len1;k++)
        {
        fobj1.write(buf[k]);
        }
        fobj1.close();
        }

        this.setTitle(str8);

        }
        catch(IOException e){}



        if(command.equals("Exit"))
        {
        System.exit(0);
        }

        if(command.equals("Cut"))
        {
        str=text.getSelectedText();
        i=text.getText().indexOf(str);
        text.replaceRange(" ",i,i+str.length());
        }

        if(command.equals("Copy"))
        {
        str=text.getSelectedText();
        }

        if(command.equals("Paste"))
        {
        pos1=text.getCaretPosition();
        text.insert(str,pos1);
        }
        if(command.equals("Delete"))
        {
        String msg=text.getSelectedText();
        i=text.getText().indexOf(msg);
        text.replaceRange(" ",i,i+msg.length());
        }
        if(command.equals("Time/Date"))
        {
        gcalendar=new GregorianCalendar();
        String h=String.valueOf(gcalendar.get(Calendar.HOUR));
        String m=String.valueOf(gcalendar.get(Calendar.MINUTE));
        String s=String.valueOf(gcalendar.get(Calendar.SECOND));
        String date=String.valueOf(gcalendar.get(Calendar.DATE));
        String mon=months[gcalendar.get(Calendar.MONTH)];
        String year=String.valueOf(gcalendar.get(Calendar.YEAR));
        String hms="Time"+" - "+h+":"+m+":"+s+"  Date"+"  -  "+date+"  
"+mon+"
"+year;
        int loc=text.getCaretPosition();
        text.insert(hms,loc);
        }
        if(command.equals("Courier"))
        {

        String fontName=f.getName();
        String fontFamily=f.getFamily();
        int fontSize=f.getSize();
        int fontStyle=f.getStyle();

        f=new Font("Courier",fontStyle,fontSize);
        text.setFont(f);
        }
        if(command.equals("Sans Serif"))
        {
        String fontName=f.getName();
        String fontFamily=f.getFamily();
        int fontSize=f.getSize();
        int fontStyle=f.getStyle();

        f=new Font("Sans Serif",fontStyle,fontSize);
        text.setFont(f);
        }
        if(command.equals("Monospaced"))
        {
        String fontName=f.getName();
        String fontFamily=f.getFamily();
        int fontSize=f.getSize();
        int fontStyle=f.getStyle();

        f=new Font("Monospaced",fontStyle,fontSize);
        text.setFont(f);
        }

        if(command.equals("Symbol"))
        {
        String fontName=f.getName();
        String fontFamily=f.getFamily();
        int fontSize=f.getSize();
        int fontStyle=f.getStyle();

        f=new Font("Symbol",fontStyle,fontSize);
        text.setFont(f);
        System.out.println(f.getFamily());
        }
        if(command.equals("Regular"))
        {
        String fontName=f.getName();
        String fontFamily=f.getFamily();
        int fontSize=f.getSize();
        int fontStyle=f.getStyle();

        f=new Font(fontName,Font.PLAIN,fontSize);
        text.setFont(f);
        }
        if(command.equals("Bold"))
        {
        String fontName=f.getName();
        String fontFamily=f.getFamily();
        int fontSize=f.getSize();
        int fontStyle=f.getStyle();

        f=new Font(fontName,Font.BOLD,fontSize);
        text.setFont(f);
        }
        if(command.equals("Italic"))
        {
        String fontName=f.getName();
        String fontFamily=f.getFamily();
        int fontSize=f.getSize();
        int fontStyle=f.getStyle();

        f=new Font(fontName,Font.ITALIC,fontSize);
        text.setFont(f);
        }
        if(command.equals("Bold Italic"))
        {
        String fontName=f.getName();
        String fontFamily=f.getFamily();
        int fontSize=f.getSize();
        int fontStyle=f.getStyle();

        f=new Font(fontName,Font.BOLD|Font.ITALIC,fontSize);
        text.setFont(f);
        }

        if(command.equals("12"))
        {
        String fontName=f.getName();
        String fontFamily=f.getFamily();
        int fontSize=f.getSize();
        int fontStyle=f.getStyle();

        f=new Font(fontName,fontStyle,12);
        text.setFont(f);
        }

        if(command.equals("14"))
        {
        String fontName=f.getName();
        String fontFamily=f.getFamily();
        int fontSize=f.getSize();
        int fontStyle=f.getStyle();

        f=new Font(fontName,fontStyle,14);
        text.setFont(f);
        }
        if(command.equals("18"))
        {
        String fontName=f.getName();
        String fontFamily=f.getFamily();
        int fontSize=f.getSize();
        int fontStyle=f.getStyle();

        f=new Font(fontName,fontStyle,18);
        text.setFont(f);
        }
        if(command.equals("20"))
        {
        String fontName=f.getName();
        String fontFamily=f.getFamily();
        int fontSize=f.getSize();
        int fontStyle=f.getStyle();

        f=new Font(fontName,fontStyle,20);
        text.setFont(f);
        }
        if(command.equals("Select All"))
        {
        String strText=text.getText();
        int strLen=strText.length();
        text.select(0,strLen);
        }


    }



    public static void main(String args[])
    {
    notepro note = new notepro("Untitled-Notepad");
    note.setSize(500,500);
    note.setVisible(true);
    }
}

FOLLOWERS