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.
是否有一种方法可以检查 JInternalFrame 的大小是否大于设置的最大大小setMaximumSize?
setMaximumSize
目前我正在执行一个pack;,这可能会导致一个大于这个最大值的窗口。
pack
这将检查框架的宽度和高度是否大于最大设置。
if(frame.getWidth() > frame.getMaximumSize().getWidth() && frame.getHeight() > frame.getMaximumSize().getHeight()) { // Do something }
然而,宽度或高度仍有可能大于最大设置。要检查是否超过最大值,请将&&(AND)替换为||(OR)。
&&
||