How do i restrict access to other JFrame?

if i open my main frame and click the add button, the user will not be able to go back to the main frame.

how do i do that?

Recommended Answers

All 5 Replies

hide it by using the setVisible method

hide it by using the setVisible method

i tried using hide but i get this error

Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
at java.util.Vector.<init>(Vector.java:111)

i have 20 JFrames connected to one Frame...

so i was thinking that i should just show one frame except for the main frame but the second frame should not let the user access the main frame.

what do you think is the solution?

Like when i use my IE and click Internet Options, it restricts me to access anything except the Internet Options window

OutOfMemoryError: Java heap space

Is your program in a loop using up memory?
Did you post the FULL text of the error message?

restricts me to access anything except the Internet Options window

That sounds like a modal window. Can you use a modal dialog window?

well,
1/ that's very bad idea create more than one JFrame, replace that with JDialog
2/ that's very bad idea helt lots of JFrames/JDialog at Runtime, replace its contents (switch with JPanel inside)
3/ one JFrame + two max. three JDialog

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.