[英]Set JMenuBar position below JPanel
I am working with a JDialog that is setUndecorated(true) and has a JPanel included to replace the default title bar. 我正在使用setUndecorated(true)并包含一个JPanel来替换默认标题栏的JDialog。 Currently there is an internal frame inside the JDialog which has among other things a JMenuBar attached to it.
当前,JDialog内部有一个内部框架,其中除其他外还附加了一个JMenuBar。
I would like to move the JMenuBar to the JDialog but have it displayed below the JPanel. 我想将JMenuBar移至JDialog,但将其显示在JPanel下方。 How can I have a JMenuBar which is added to a JDialog appear below a JPanel which is added to the same JDialog.
我如何在添加到同一JDialog的JPanel下方出现添加到JDialog的JMenuBar。
Make sure your panel uses a BorderLayout. 确保您的面板使用BorderLayout。 Then you can use:
然后,您可以使用:
panel.add(menuBar, BorderLayout.South);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.