I need help with a few things for this part of my application to work.

1) need to search a text file for matches to whatever user types in JTextField, basically if they search for the "description" [tool name] or the "type" [tool type], then result set would appear in the Table, after clicking SEARCH button [CLEAR BUTTON clears all the data displayed in the table, and that seems to work]
2) how do you populate a Table from a text file?
3) how would I get the JTextField to be only 100 pixels wide instead of the width of JPanel or JFrame?
(4) and if time allows, how could I incorporate the Table to allow changes to records in the file?


Here's the JFrame that loads first
, with a JTabbedPane. It instantiates several JPanels which are separate Java Files themselves [this is how my instructor wants it, not all the JPanel classes set up as subclasses in the StartUp class, as was suggested to me] There will be 5 JPanels instantiated that create the different tabs of the JTabbedPane.

Code:
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;
import java.util.*;


public class StartUp extends JFrame implements ActionListener
{
    JFrame frame = new JFrame("Tool Inventory");
    JTabbedPane jtp = new JTabbedPane();
    
    InputPanel tab1 = new InputPanel();
    SearchPanel tab2 = new SearchPanel();
    JPanel tab3 = new JPanel();
    WebBrowser tab4 = new WebBrowser();
    JPanel tab5 = new JPanel();
    
    /** Creates a new instance of StartUp */
    public StartUp() 
    {
        frame.setSize(650,500);
        frame.setLocation(75,30);
        frame.getContentPane().add(jtp);
        jtp.add("Input Tool", tab1);
        jtp.add("Search File",tab2);
        jtp.add("Print File",tab3);
        jtp.add("Search Web",tab4);
        jtp.add("Tax Report",tab5);
        
        frame.addWindowListener(new WindowAdapter()
        {
          public void windowClosing(WindowEvent e)
          {
             System.exit(0);   
          }
        });
        
        frame.setVisible(true);
    }
    
    public static void main(String[] args)
    {
       new StartUp();
       
    }
    
    public void actionPerformed(ActionEvent e) 
    {
    
    }
    
}

Here is the separate java file with the Class SearchPanel
that needs help. The ListSelectionEvent part at the end is not clear to me what it is for. We put it in a sample program to demonstrate some things, including a combobox in a cell, but I don't have a combobox in this class.

If I had time, I would like to input code that would allow the user to be able to change "elements" or "members" of the record, and I guess delete the old record from the file and append the new change as a new record to the file....or just change a record in the file without deleting the order of the records and appending to it. Is that what the ListSelectionEvent is for, for displaying only when changes made. I don't get that one.

Code:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.io.*;
import java.util.*;
import javax.swing.table.*;

public class SearchPanel extends JPanel implements ActionListener, ListSelectionListener

{
    JPanel north = new JPanel();
    JPanel south = new JPanel();
    JPanel center = new JPanel();
    JButton search = new JButton("Search For:");
    JButton clear = new JButton("Clear table");
    JTextField text = new JTextField(100);   //should only be 100 pixels, not full width of screen
    JTable table;
    ListSelectionModel selected;  //What does this do? 
    DefaultTableModel tm;
    String [] headers = {"Description","Type","Qty","Cost"};
    String [][] cellData = {    //does this part have to be different to set up the table until the Search button populates the Table???
        {"","","",""}
    };
    JScrollPane sp;
   
    
    /** Creates a new instance of SearchPanel */
    public SearchPanel() 
    {
        this.setSize(400, 400);
        this.setLocation(20,20);
        add(north,BorderLayout.NORTH);
        add(south,BorderLayout.SOUTH);
        north.add(text);
        text.addActionListener(this);  //is this necessary??
        south.add(search);
        south.add(clear);
        search.addActionListener(this);
        clear.addActionListener(this);
        tm = new DefaultTableModel(cellData,headers);
        table = new JTable(tm);
//what does this part do?     
        selected = table.getSelectionModel();
        selected.addListSelectionListener(this);

        sp = new JScrollPane(table);
        add(sp,BorderLayout.CENTER);
        text.addMouseListener(new MouseAdapter()
        {
            public void mouseEntered(MouseEvent e)
            {
              text.setBackground(Color.MAGENTA);    
            }
            
            public void mouseExited(MouseEvent e)
            {
              text.setBackground(Color.WHITE);   
            }
            
        });
        
    }
    
    public void actionPerformed(ActionEvent e) 
    {
        //displays all tools in inventory that match 
        //the description
       if(e.getSource() == search)
       {
         //need code to search entire file and find matches 
         //and populate table
       }
       
       //clears all cells in table
       else if(e.getSource() == clear)
       {
          int x = tm.getRowCount();
          for (int y = 1; y <=x; y++)
          {
             tm.removeRow(0);   
          }
       }
       
    }
    
    public void valueChanged(ListSelectionEvent e)
    {
        text.setText(tm.getValueAt(table.getSelectedRow(), 0)+"");
    }
    
}