Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在编写一个小程序,它需要 JFrame 减小宽度直到它达到 0。但是,我相信操作系统会阻止窗口变得比某个宽度更窄,以防止阻塞左上角的按钮(我已经观察到这个在 Windows 10 和 OS X 上)。有没有办法覆盖或防止这种情况?
不,它是由操作系统设置的。如果你想让它看起来JFrame消失,只需visible在一定宽度后将其设置为 false。
JFrame
visible
if(frame.width < someNumber) { frame.setVisible(false); }