Is there anyway to listen to a bool value? I have a login window that has a loggedIn boolean value, I need to watch that value in the main thread so when it changes to true it returns to the main thread and loads up the rest of the program, i used to have it trailing through the program, ie, if you logged in the login listener would then start the main program but due to threading problems i am trying to keep it returning the the main thread to control it all. If there is another way i havent thought of that doesnt use listeners let me know, I dont really want to have to use a loop which checks it all the time.
Black Knight
0
Light Poster
Recommended Answers
Jump to PostI think you need to look at the Observer class. I'm not entirely sure how to use it, but it sounds like thats what you need.
Jump to Postwhy don't you make a method which assigns true instead of just declaring loggedIn = true;
in other words
loggedIn = setTrue(); public boolean setTrue() { //do some stuff when the variable is set true here! return true; }
All 8 Replies
Phaelax
52
Practically a Posting Shark
paradox814
1
Posting Whiz
server_crash
64
Postaholic
Black Knight
0
Light Poster
paradox814
1
Posting Whiz
jwenting
1,889
duckman
Team Colleague
Black Knight
0
Light Poster
Black Knight
0
Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.