Java JFrame background color not working

前端 未结 4 1474
名媛妹妹
名媛妹妹 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:37

    I know this is a very old question, but for others that are looking for the right answer this could also be written as following:

    frame1.getContentPane().setBackground(new Color (255,255,102)); //or whatever color you want in the RGB range
    

提交回复
热议问题