Why isn't JMenu always on top?

前端 未结 2 1785
夕颜
夕颜 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:46

    I'd suggest reading Mixing Heavyweight and Lightweight Components for more information.

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题