简体   繁体   English

如何阻止帧大小调整JFrame swing SeaGlass L&F

[英]How to block frame resizing JFrame swing SeaGlass L&F

I need for my next project a little better Look and Feel than that which java originally provide. 我的下一个项目需要比Java最初提供的外观更好的外观。 I choosed to dive into SeaGlass L&F which seems to be pretty nice. 我选择潜入SeaGlass L&F,这似乎非常不错。 However I encountered the problem. 但是我遇到了问题。 I can't prevent user of app from resizing and maximazing my JFrame. 我不能阻止应用程序用户调整JFrame的大小并使其最大化。 From what I found it is well-known issue in SeaGlass and it will be fixed in 2.1 version (what its stated here ). 从我发现它是在SEAGLASS众所周知的问题,这将是固定在2.1版本(它是什么说这里 )。 Unfortunately, last available version is 2.0 and it looks like this project is abandoned - last update is one year old. 不幸的是,最新的可用版本是2.0,看来该项目已被放弃-最新的更新已经有一年了。 My question is: is there any work-around to stop user from resizing my JFrame? 我的问题是:有什么解决方法可以阻止用户调整JFrame的大小? Maybe something with Mouse Listener? 也许与鼠标侦听器有关?

FYI setUndecorated(true); 仅供参考setUndecorated(true); is not working too. 也不起作用。

I have figuered it out. 我已经弄清楚了。

JFrame must implement ComponentListener and in overridden componentResized method you must put that code: JFrame必须实现ComponentListener,并且必须在重写的componentResized方法中放入该代码:

setSize(410, 240);
setLocation(startLocation);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM