• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Thread parent name

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

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.

many thanks

 
Marshal
Posts: 25682
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
elad cohen
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Marshal
Posts: 69896
278
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
elad cohen
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
any JtextFiles I configured as non-editable so customer could not change it.
 
Campbell Ritchie
Marshal
Posts: 69896
278
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If it isn't editable, why use a text field? Why not use a JLabel, which is uneditable by default.
 
elad cohen
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK. I'll change it.
in this case, how can I achieve my goal, how can I open the product list view as editable for a specific user ?
 
Rancher
Posts: 4625
47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
Paul Clapham
Marshal
Posts: 25682
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Saloon Keeper
Posts: 22289
151
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Paul Clapham
Marshal
Posts: 25682
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Destroy anything that stands in your way. Except this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic