Any help would be appreciated

I finished a number to vaildate south african id numbers. I wounder if there where any mistakes I made and if there were any ways to make it shorter. Please can you look at my code and tell me any tips or criticism you might have which i will used to learn from. Thanks

/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {

//check lenght methode
String Idnumber = jTextField1.getText();
int lenght = Idnumber.length(); //Gets the lenght of the string and stores it in the variable lenght
System.out.println(lenght);// prints the lenght that is stored in lenght

Nicholas Lefebvre wrote:I finished a number to vaildate south african id numbers. I wounder if there where any mistakes I made and if there were any ways to make it shorter. Please can you look at my code and tell me any tips or criticism you might have which i will used to learn from. Thanks

What do you mean when you say

I finished a number to vaildate south african id numbers.

? Can you explain what is it that you are attempting to achieve here? The problem statement.

You want to make code which validates South African ID numbers, and you want it shorter than that? Well, you've got a couple of hundred lines of GUI code. You don't need any of that to validate a number, so for a start you could remove all of the GUI stuff.

You may think I'm joking, but I'm only sort of joking. Seriously, if you want us to look at your validation code then don't bury it in a mountain of unrelated code. Just post the method which does the validation and ask about that. You do have it in a method, don't you?

too much code and not enough comments. And comments that say "End of <whatever> method" are pointless and distracting.

Why in heaven would you loop through Idnumber character by character (lines 18-20) and then immediately afterwards explicitly look at each (lines 22-34)? loop through the string once and do everything you need. Your code will break if the length of an ID changes to something other than 13 characters.

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors