Why isn't JMenu always on top?

前端 未结 2 1790
夕颜
夕颜 2021-01-07 11:17

The JMenu behaves normally until a JButton is used to update a JTable on the JFrame. Then the JMenu is mostly hidden by a JPanel (see images below). Shouldn\'t the JMenu alw

2条回答
  •  南笙
    南笙 (楼主)
    2021-01-07 11:54

    Probably because you are using a Canvas when you should be using a JPanel. Canvas is an AWT component and is painted on top of Swing components. Don't use AWT components in a Swing application.

    Edit:

    If you really need to use an AWT component then you need a current release of the JDK. See Mixing Heavy and Light Components.

自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题