I'm writing my first APP with JAVA Swing.
My app including some product list which customers can add to his cart.
my goal is - when superuser sign in gives him permission to edit price.
the price writes into JTextFiled which root user needs to change.
I wondering how can i give specif permission for ant kind of user - customer/superuser.
I think that (not sure) give specific thread name when superuser call and a different one for customer, verify the name on the list class will do that.
please help me understand how can I do that.
please feel free to advise a differnt way to do that.
Swing? If you're looking for a solution for your scenario where some user can modify component X and some other user can't, then threads are absolutely not part of that solution. All access to GUI components run on the same thread, that's a key part of Swing.
I assume your scenario looks something like this:
Customer is sitting (or standing) next to a screen choosing items to order. At some point customer likes the item but not the price, so he calls over Pat (the boss) who can change the price.
So what I would imagine after that is, Pat clicks on the "Super Signon" button and enters their password. Then changes the price, then clicks on the "Super Signoff" button, and the customer carries on from there.
Am I way off from what you were thinking? I don't see how you could possibly bring threads into that scenario even if you tried.
thanks for your comment.
I have 2 scenarios that i need to achive.
Customer login(with username and pass) to the system with login page and forward to the product list without the option to change prices - working for this moment.
superUser login (with a SPECIFIC username and pass) and forward to the product list but now with the option to edit the prices., meaning change the JTextFiled which present the price.
Why are you putting prices in a text field? That usually allows the user to edit its content. Can you think of any way to maintain a list of customers permitted to give themselves a discount? Have you ever seen a company/website where users are permitted to give themselves a discount? They all require membership or a discount code.
Dave Tolls wrote:Make the list view editable depending on the user that is logged in.
One way is to add a part of the page that is an editable version for the super user, and a read only version for the customer.
Or just use the setEnabled method to make the component editable or not, depending on the logged-in user.
If you're doing a shopping app in Swing, it had better be one for academic purposes only.
If you're trying to do an Internet-based shopping app, you couldn't use Swing, because Swing only works when running on the local user's computer. You'd need a web app to run on the Internet and webapps do their graphics in HTML, not Swing.
Bjoke: A "Bully Joke". A Statement or action made with malicious intent - unless challenged. At which point it magically transforms into "I was just funnin'" or "What's the matter, can't take a joke?"
Tim Holloway wrote:If you're doing a shopping app in Swing, it had better be one for academic purposes only.
That's why I sort of tried to ask whether the application design included the super-user being in the same room as the customer. But I got brushed off, so for now it's just an academic exercise as far as I can tell.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop