//OpeningIETest.java
//Author : Justin , 2006 ,please distibute this but do keep the source
open
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
class OpeningIE extends JFrame
{
Process p =null;
ImageIcon IEIcon ;
Icon IEIcon2;
JTextField fieldInput;
JButton buttonOpen;
JLabel labelAddress;
Cursor myCursor;
OpeningIE ()
{
Container c = getContentPane();
c.setLayout(new FlowLayout());
c.setBackground(Color.BLACK);
labelAddress = new JLabel ("Address:");
labelAddress .setForeground(Color.RED);
myCursor =new Cursor( HAND_CURSOR );
fieldInput = new JTextField (15);
fieldInput .setForeground(Color.PINK);
fieldInput .setFont(new Font("SansSerif" , Font.BOLD, 17));
fieldInput .setToolTipText("Enter the address of the site here");
fieldInput.setBackground(Color.BLACK);
IEIcon = new ImageIcon("ieIcon.jpg");
IEIcon2 = new ImageIcon("ieIcon2.jpg");
buttonOpen = new JButton("Click to open internet explorer",IEIcon );
buttonOpen.setRolloverIcon(IEIcon2 );
buttonOpen.setCursor(myCursor );
buttonOpen.setBackground(Color.ORANGE);
c.add(labelAddress );
c.add(fieldInput );
c.add(buttonOpen );
OpeningIEHandler o1 = new OpeningIEHandler ();
buttonOpen.addActionListener(o1);
fieldInput.addActionListener(o1);
} //end of constructor
private class OpeningIEHandler implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
String address = fieldInput.getText();
Runtime r = Runtime.getRuntime();
try
{
p =r.exec("C:\\Program Files\\Internet Explorer\\IEXPLORE.EXE
"+address);
}
catch(Exception ex)
{
}
} //end of actionPerformed
} // end of inner class
} //end of outer class
class OpeningIETest
{
public static void main(String args[])
{
OpeningIE o1 = new OpeningIE ();
o1.setSize(300,400);
o1.setVisible(true);
o1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
//********************************************************************
TypingTutor ()
{
Container c = getContentPane();
c.setLayout(new FlowLayout());
textToType = new JTextArea ("Open source describes practices in
production and development that promote access to the end
product's sources. Some consider it as a philosophy, and others
consider it as a pragmatic methodology. Before open source became
widely adopted,
developers and producers used a variety of phrases to describe the
concept; the term open source gained popularity with the rise of the
Internet and
its enabling of diverse production models, communication paths, and
interactive communities. Subsequently, open source software became the
most prominent face of open source."+
"The open source model can allow for the concurrent use of different
agendas and approaches in production, in contrast with more centralized
models of development such as those typically used in commercial
software companies.",10,50);
textToType .setLineWrap(true);
textToType .setForeground(Color.BLUE );
textToType .setFont(new Font("SansSerif" , Font.BOLD, 15));
fieldInput = new JTextArea(10,50);
fieldInput .setFont(new Font("SansSerif" , Font.BOLD, 15));
fieldInput .setLineWrap(true);
c.add(textToType );
c.add(fieldInput );
}
}
public class TypingTutorTest
{
public static void main(String args[])
{
TypingTutor t1 = new TypingTutor ();
t1.setSize(700,600);
t1.setVisible(true);
t1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
//***************************************************************
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class GhostImage extends JFrame
{
JTextField fieldName ,fieldGhost1 ,fieldGhost2 ,fieldGhost3
,fieldGhost4 ,fieldGhost5 ,fieldGhost6 ;
JLabel labelEnterName;
String hisName;
Container c ;
String ghostString="";
GhostImage ()
{
c = getContentPane();
c.setLayout(new FlowLayout());
labelEnterName = new JLabel("Enter your name");
c.add(labelEnterName );
fieldName = new JTextField (20);
c.add(fieldName);
fieldGhost1 = new JTextField (20);
fieldGhost1 .setForeground(Color.PINK);
fieldGhost1.setFont(new Font("SansSerif" , Font.BOLD, 17));
c.add(fieldGhost1);
fieldGhost2 = new JTextField (20);
fieldGhost2.setFont(new Font("SansSerif" , Font.BOLD, 17));
fieldGhost2 .setForeground(Color.BLUE);
c.add(fieldGhost2);
fieldGhost3 = new JTextField (20);
fieldGhost3.setFont(new Font("SansSerif" , Font.BOLD, 17));
fieldGhost3.setForeground(Color.CYAN);
c.add(fieldGhost3);
fieldGhost4 = new JTextField (20);
fieldGhost4.setFont(new Font("SansSerif" , Font.BOLD, 17));
fieldGhost4 .setForeground(Color.GREEN);
c.add(fieldGhost4);
fieldGhost5 = new JTextField (20);
fieldGhost5.setFont(new Font("SansSerif" , Font.BOLD, 17));
fieldGhost5 .setForeground(Color.MAGENTA);
c.add(fieldGhost5);
fieldGhost6 = new JTextField (20);
fieldGhost6.setFont(new Font("SansSerif" , Font.BOLD, 17));
fieldGhost6 .setForeground(Color.ORANGE);
c.add(fieldGhost6);
MyKeyAdapter myKey = new MyKeyAdapter ();
fieldName.addKeyListener(myKey);
} //end of constructor
private class MyKeyAdapter extends KeyAdapter
{
public void keyReleased(KeyEvent e)
{
ghostString = ghostString +e.getKeyChar();
fieldGhost1.setText(fieldName.getText() );
fieldGhost2.setText(fieldName.getText() );
fieldGhost3.setText(fieldName.getText());
fieldGhost4.setText(fieldName.getText() );
fieldGhost5.setText(fieldName.getText());
fieldGhost6.setText(fieldName.getText());
} //end ofkeyTyped
} //end of private inner class
} //end of outer class
class GhostImageTest
{
public static void main(String args[])
{
GhostImage g1 = new GhostImage ();
g1.setSize(300,600);
g1.setVisible(true);
g1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
//***************************************************************************************