Java JFrame background color not working

前端 未结 4 1460
名媛妹妹
名媛妹妹 2020-12-11 19:05

I tried using:

frame1.getContentPane().setBackground(Color.yellow);

But it is not working. Can anyone help me?

import java.         


        
4条回答
  •  遥遥无期
    2020-12-11 19:39

    You should give background color to JPanel and then use this JPanel in your JFrame rather than giving direct background to your JFrame.

提交回复
热议问题