When does a JPanel paint (or repaint) its child components?

后端 未结 5 809
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-11 21:17

I\'ve got a JButton which is painted using a custom UI delegate (CustomButtonUI extends BasicButtonUI). The CustomButtonUI\'s paint() method draws the button with rounded \"

5条回答
  •  遥遥无期
    2020-12-11 22:18

    For antialiasing to work consistently, your component needs to return false for isOpaque. Otherwise, the RepaintManager is free to skip painting the region behind your component.

    I suspect that if you use a screen magnifier to look at the "unaliased" edges, you will find they really are antialiased. But it was done against against a black, unpainted background, not the parent's background.

提交回复
热议问题