field442 0 Newbie Poster

I'm doing my first year project at uni and have hit a stumbling block. I have to make a basic version of a media player that will allow a user to add tracks that are stored in a MS Access database to a playlist, and give them a rating.

My first problem is in the rating of the track. I want to be able to enter a numeric value and have the rating displayed in an number of * corresponding to the value. Can you see what im doing wrong in this piece of code?

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

public class Update extends JFrame
                  implements ActionListener {
    JTextField trackNo = new JTextField(2);
	JTextField rate = new JTextField(2);
    TextArea information = new TextArea(6, 50);
    JButton find = new JButton("Find Track");
    JButton rating = new JButton("Rate");

    public Update() {
        setLayout(new BorderLayout());
        setBounds(100, 100, 400, 200);
        setTitle("Update Playlist");

        setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

        JPanel top = new JPanel();
        top.add(new JLabel("Enter Track Number:"));
        top.add(trackNo);
        top.add(find); find.addActionListener(this);
		add("North", top);

		JPanel bottom = new JPanel();
		bottom.add(new JLabel("Rate Track:"));
		bottom.add(rate);
        bottom.add(rating); rating.addActionListener(this);
		add("South", bottom);

        JPanel middle = new JPanel();
        middle.add(information);
        add("Center", middle);

        setResizable(false);
        setVisible(true);
	}
	    public void actionPerformed(ActionEvent e) {
		
        if (e.getSource() == find) {
			String key = trackNo.getText();
            String name = LibraryData.getName(key);
            information.setText(name + " - " + LibraryData.getArtist(key));
			information.append("\nPlay count: " + LibraryData.getPlayCount(key));
            if (name == null) {
                information.setText("No such track number");}
				}if (e.getSource() == rating){
					String key = trackNo.getText();
					String stars = rate.getText();
					information.append("\nRating: " + stars);
				
			
		}
	}

    private String stars(int rate) {
        String stars = "";
        for (int i = 0; i < rate; ++i) {
            stars += "*";
        }
        return stars;
    }
}

I also have to be able to increment the play count for each track when the play button is used. I have no idea where to start on this. Here is the code

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

public class Playlist extends JFrame
                  implements ActionListener {
    JTextField trackNo = new JTextField(2);
    TextArea information = new TextArea(6, 50);
    JButton add = new JButton("Add track to playlist");
    JButton play = new JButton("Play Playlist");
	JButton clear = new JButton("Clear Playlist");
    
	public Playlist() {
        setLayout(new BorderLayout());
        setBounds(100, 100, 400, 200);
        setTitle("Create Playlist");

        setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

        JPanel top = new JPanel();
        top.add(new JLabel("Enter Track Number:"));
        top.add(trackNo);
        top.add(add); add.addActionListener(this);
		add("North", top);

		JPanel bottom = new JPanel();
        bottom.add(play); play.addActionListener(this);
        bottom.add(clear); clear.addActionListener(this);
		add("South", bottom);

        JPanel middle = new JPanel();
        middle.add(information);
        add("Center", middle);

        setResizable(false);
        setVisible(true);
	}
	    public void actionPerformed(ActionEvent e) {
		
        if (e.getSource() == add) {
			String key = trackNo.getText();
            String name = LibraryData.getName(key);
            information.setText(name + " - " + LibraryData.getArtist(key));
			information.append("\n" + "Test");
				if (name == null) {
					information.setText("No such track number"); }
						} if (e.getSource() == clear){
							information.setText("");
			
		}
	}
}