I'm working on a java project that it has a menu where you can click File > Login to pop out a dialog for user to enter their login info.
My problem is, when the login dialog is present, user and focus back to the main JFrame and select File > Login to pop out another dialog. I'm searching for a way to prevent this from happening. So far I thought about two solutions but I don't know which is the best way to go about solving this kind of issue:
Solution 1: In my customzied JFrame class, declare a boolean that holds the visibility of the login dialog. Whenever the user goes File > Login, it will first check to see if it's already visible or not, then open the dialog if it's not already opened.
Solution 2: Prevent user to set focus back to the main JFrame when the dialog box is opened.
If you were me, how would you approach this problem? And which one is more effective or a common practice?
Apparently a single Reddit user posted a bunch of made up stuff about it being spyware and Steam users started review bombing it like mindless sheep. People have read the actual updated EULA and said that there's nothing notably different in it and nothing pointing to it being spyware. (replied to wrong post)
These gains are probably moot though if you use a Gecko based browser that can support adblocking on a much deeper level than Manifest V3 limits you to. The speed benefits from excellent blocking of careless ad networks are just ridiculous and instantly felt.
While these updates may improve loading performance by a few percents after a lot of hard engineering work, blocking ads on a deep level ahead of even loading them can instead easily cut several megabytes in one go.
Question
iczman
I'm working on a java project that it has a menu where you can click File > Login to pop out a dialog for user to enter their login info.
My problem is, when the login dialog is present, user and focus back to the main JFrame and select File > Login to pop out another dialog. I'm searching for a way to prevent this from happening. So far I thought about two solutions but I don't know which is the best way to go about solving this kind of issue:
Solution 1: In my customzied JFrame class, declare a boolean that holds the visibility of the login dialog. Whenever the user goes File > Login, it will first check to see if it's already visible or not, then open the dialog if it's not already opened.
Solution 2: Prevent user to set focus back to the main JFrame when the dialog box is opened.
If you were me, how would you approach this problem? And which one is more effective or a common practice?
Link to comment
https://www.neowin.net/forum/topic/434096-java-prevent-opening-duplicate-dialogs/Share on other sites
8 answers to this question
Recommended Posts