Why to add JPanel to a JLabel, under what circumstance, this situation can arise?

前端 未结 3 1428
轻奢々
轻奢々 2020-12-07 03:41

Today while surfing through various questions, I encountered one QUESTION, this seems to me a bit weird, why would one wants to add a JPanel to a JLabel

3条回答
  •  时光取名叫无心
    2020-12-07 03:57

    this seems to me a bit weird, why would one wants to add 
    a JPanel to a JLabel,
    

    yes thats right

    are there any genuine reasons as to such situation can arise, 
    so is it just trivial?
    

    no, isn't trivial, because only JFrame/JDialog/JWindow and JPanel have got pre_implemented LayoutManager, for rest of "Custom JComponent" you have to declare proper LayoutManager, programatically

提交回复
热议问题