Hello,
I'm trying to create a simple GUI with couple of buttons and 2 different users. I would like to use the same GUI for "user" and "admin" where some of those buttons are disabled for "user".
I have imagined that I would create a template GUI with all the buttons and on run-time it will decide whether to disable certain buttons or not to.
I am a bit stuck coming up with proper solution since I don't quite know how to approach.
* I have thought about using 2D arrays where I add the button to the 1st dimension and I would use the 2nd dimension for deciding whether to enable or disable the button. Afterwards I would add those buttons to the JPanel from the array.
* I have thought about creating 2 classes (user & admin) where user has int value as "accessLevel" and admin extends from it and re-writes it with different value. Then I would use that "accessLevel" value to determine whether to disable or not to.
I would really appreciate some pseudo code or some other pointers how should I approach the given problem.
I'm trying to create a simple GUI with couple of buttons and 2 different users. I would like to use the same GUI for "user" and "admin" where some of those buttons are disabled for "user".
I have imagined that I would create a template GUI with all the buttons and on run-time it will decide whether to disable certain buttons or not to.
I am a bit stuck coming up with proper solution since I don't quite know how to approach.
* I have thought about using 2D arrays where I add the button to the 1st dimension and I would use the 2nd dimension for deciding whether to enable or disable the button. Afterwards I would add those buttons to the JPanel from the array.
* I have thought about creating 2 classes (user & admin) where user has int value as "accessLevel" and admin extends from it and re-writes it with different value. Then I would use that "accessLevel" value to determine whether to disable or not to.
I would really appreciate some pseudo code or some other pointers how should I approach the given problem.