swing - Java中pane和panel有什么区别?
天蓬老师
天蓬老师 2017-04-17 14:55:15
0
2
587

今天看自己写的代码,原本定义的变量名是contentPane,误以为写错了,改成contentPanel,到下面看到setContentPane方法,才发现自己原来没有写错,是记错了……
那么,pane和panel有什么区别呢?

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(2)
阿神
  • Panel is a panel, just a basic component that is rarely used directly, or is inherited and overridden, or used to organize other components.

  • Pane is a fully functional and independent sub-pane.
    Look at the naming in Swing, JPanel is a basic component; and those with complete functions/performing their duties are called Pane, such as JTabbedPane, JSplitPane.

Ty80

You can understand it this way: pane is a control in Java and does not have the function of containing other controls; although panel is also a control, it also has an identity of layout, which can manage other controls. . If you have done Android development, it may be easier to understand

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template