How to “do something” on Swing component resizing?

后端 未结 8 1199
遇见更好的自我
遇见更好的自我 2021-01-17 07:53

I\'ve a class which extends JPanel. I overwrote protected void paintComponent(Graphics g).

There is a variable which has to be recalculate

8条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-17 08:22

    It resizes automatically if it's

    1. inside a BorderLayout panel and
    2. put there as BorderLayout.CENTER component.

    If it doesn't work, you probably have forgotten one of these two.

提交回复
热议问题