How to make a modal JFrame? [duplicate]
问题 This question already has answers here : Closed 6 years ago . Possible Duplicate: How to make a JFrame Modal in Swing java I have 2 JFrames one is the main JFrame and the other one is a sub JFrame, and I'm trying to make the main JFrame inaccessible to user interactions when I display the sub JFrame. 回答1: How to make a modal JFrame? Don't. Use a modal JDialog -- that's precisely what they're for. You understand of course that a JDialog can hold a complex GUI, as complex as any held by a