import java.awt.*; import java.awt.event.*; import java.io.*; public class FileFinder extends MainFrame implements ActionListener { Label msg = new Label("", Label.CENTER); TextField tf = new TextField(); public FileFinder() { super("File Finder: Enter Name, press ENTER"); setLayout(new BorderLayout()); add(tf, "North"); tf.addActionListener(this); msg.setFont(new Font("SansSerif", Font.BOLD, 18)); add(msg, "South"); setSize(350, 125); show(); } public void actionPerformed(ActionEvent e) { File f = new File(tf.getText()); if (f.exists()) { msg.setForeground(Color.green); if (f.isDirectory()) msg.setText("Directory: " +f.getAbsolutePath()); else msg.setText("File : " + f.getName() + " : " + f.length() + " bytes"); } else { msg.setForeground(Color.red); msg.setText(tf.getText() + " does not exist"); } } public static void main(String[] args) { new FileFinder(); } }