Q:

Making counter work in java

I'm a beginner student with java and this is my first time using the programming language java in the netbeans IDE. 
I have came up to this point where I made my application that will be used to make top trumps card: 
![1]: https://i.stack.imgur.com/b77C2.png
However the counter Jlabel named available points goes bellow 0 into negative numbers which I dont want, everything else works great!
Here is my code for the counter: 
public class addingPointsUI extends javax.swing.JFrame {
void availablePoints() {
    if(Integer.parseInt(availablePoints.getText()) >=0 && Integer.parseInt(availablePoints.getText()) <=50)
    {
    System.out.println("...");
    }
else{
     JOptionPane.showMessageDialog (null,"You have no more available points");
         }
}
int pointsAvailable=50;
    int speed=0;
    int power=0;
    int focus=0;
    int agility=0;
    int defence=0;
    int attack=0;

public addingPointsUI() {
    initComponents();
}

Here is the code for the speed plus button: 
if (speed < 10 ){

        speed = speed + 1 ;

        pointsAvailable = pointsAvailable - 1 ;

        availablePoints.setText(String.valueOf(pointsAvailable));

        speedPoints.setText(String.valueOf(speed));

         } else{

         JOptionPane.showMessageDialog (null, "You have maxed out your Speed");
    }
}            

Here is the code for the speed minus button:
if (speed > 0 ){

        speed = speed - 1;

        pointsAvailable = pointsAvailable +1;

        availablePoints.setText(String.valueOf(pointsAvailable));

        speedPoints.setText(String.valueOf(speed));

    }else {

            JOptionPane.showMessageDialog(null,"You cannot take anymore points from Speed");
    }
}                                          

Please take in mind that I'm a beginner with using java I'm also new to this website.
Thank your for your kind replies.

A:

Before you allow users to add any more points, you could check to make sure there are points available.
if (speed < 10 ) {
    if (pointAvaialable <= 0) {
        JOptionPane.showMessageDialog(null, "You are out of available points");
        return;
    }

    speed = speed + 1 ;
    pointsAvailable = pointsAvailable - 1 ;
    availablePoints.setText(String.valueOf(pointsAvailable));
    speedPoints.setText(String.valueOf(speed));
} else {
     JOptionPane.showMessageDialog (null, "You have maxed out your Speed");
}

