0

I have a class which has three tabs. What I want to do is ask the user to enter password every time they switch between those tabs(of course I will use a JFrame for the user to enter password). And what is the best way to do it? Thank you!

Mithun Adhikari
  • 521
  • 6
  • 13
  • You need some kind of vetoable selection listener – MadProgrammer Oct 09 '17 at 05:58
  • A quick [google](https://www.google.com.au/search?client=safari&rls=en&dcr=0&q=jtabbedpane+vetoable&oq=jtabbedpane+vetoable&gs_l=psy-ab.3..0i22i30k1.3859.5260.0.5378.8.8.0.0.0.0.192.736.0j4.4.0..3..0...1.1.64.psy-ab..4.4.736...0j0i22i10i30k1.0.gjOkXcQN1WM) might provide a starting point – MadProgrammer Oct 09 '17 at 06:03
  • *"of course I will use a JFrame for the user to enter password"* Of course you are misusing frames if there is more than one. See [The Use of Multiple JFrames, Good/Bad Practice?](http://stackoverflow.com/q/9554636/418556) – Andrew Thompson Oct 09 '17 at 15:38
  • Thanks @AndrewThompson. I will use JInternalFrame or any other recommended approach. – Mithun Adhikari Oct 09 '17 at 16:36
  • The best option for prompting for a password is *usually* by popping up a `JOptionPane` or modal `JDialog`.. – Andrew Thompson Oct 10 '17 at 01:47

0 Answers0