I have a GUI with a JMenuBar
, the problem is that sometimes a JMenu
doesn't appear until i resize or minimize the JFrame
. Can someone help me?
I had the same problem, and I solved it by setting the JFrame
visible AFTER the code for the menu. So you first create a JFrame
after that add the JMenuBar
and at last: frame.setVisible(true);
(my frame is just called "frame" replace the "frame" with the name of your frame)
另外,比@马尔科的解决方案不太漂亮,是调用frame.revalidate()
后frame.setJMenuBar()
-call。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.