Thank you
actually it is my first time when I am searching for help this way.. so maybe that is why some information is always missing
So from the research I've done.. I notice that usually this mechanism of code registration is usually done via a database (sql) but my version is not.
So I have a known registration code which is : admin.
/*HelpInregistrare.java class */
1. I have JPasswordField called JPcodinregistrare
2. I am extracting information from JPasswordField like this:
String cod = String.valueOf(JPcodinregistrare.getPassword());
3. Then I am verifying if what is written in JPasswordField is "admin"like this: cod.contains ("admin")
4. It it is all good.. and what is written by user in JPasswordField is "admin" then this JCheckBox called check is being enabled.
This JCheckBox I put there as a variable in order to tell me if the validation was a success.
Otherwise everyhting is false and JOptionPane comes with Error msg, and JCheckBox stays false and invisible.
/*in MenuPage.java */
this method public void initialize(){ .. } contains the elements that appear when frame is called to be visible.
I call this method in main like this:
MenuPage mp = new MenuPage();
mp.initialize();
So in my mind I am thinking like this: when method initialize() is called from main, there in initialize should be a condition to choose how the menu element should be displayed ( some menu items enable, others not enable)
As a trigger variable I used the JCheckBox : if JCheckBox ( var name check) is true then means registration code is "admin" so the Menu should have those Menu Items enabled.. otherwise.. the other version.
I hope I succeed to explain myself better this time