简体   繁体   English

在另一个 Jframe 上方显示 Jframe

[英]display Jframe above another Jframe

when I call a JFrame from another JFrame by creating an object it gets display under it so I have to minimize the first one in order to see the second one.当我通过创建一个对象从另一个 JFrame 调用 JFrame 时,它​​会显示在它下面,所以我必须最小化第一个才能看到第二个。 Does anyone know how can I get the second JFrame on the first JFrame?有谁知道如何在第一个 JFrame 上获得第二个 JFrame? thx a lot!!多谢!!

Use frame2.setVisible(true);使用frame2.setVisible(true); . .

The method setVisible() will show you the frame you used it on, on top of all the other frames you have.方法setVisible()将在您拥有的所有其他框架之上显示您使用它的框架。

尝试这个

frame.setAlwaysOnTop( true );

Try尝试

frame2.setVisible(true); //makes frame visible

but add when you initialize your second frame following:但是在初始化第二帧时添加以下内容:

frame2.setAlwaysOnTop(true);

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

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