Java - adding components to JFrame

前端 未结 3 2260
日久生厌
日久生厌 2020-12-18 15:28

I\'ve seen a couple of ways of doing theism they both seem to work but I\'m just wondering if one is better practice over the other.

For example, with a JFrame

3条回答
  •  轮回少年
    2020-12-18 16:11

    From Java5 isn't required

    • to add JComponents to the ContentPane, just JFrame.add(JComponent)

    • JFrame has implemented BorderLayout, then myFrame.add(new JButton("OK")); is placed to the CENTER area

提交回复
热议问题