首页 新闻 会员 周边

窗体为什么设置背景颜色不出来呢?? 大小也出不来??

0
悬赏园豆:10 [待解决问题]

public void jframe(){            Container cc=this.getContentPane();      this.setVisible(true);      cc.setBackground(new Color(0, 224, 121));      this.setBounds(100, 100,300, 300);    }  public static void main(String[] args) {   new jframe().setVisible(true);  }

}

清风素颜的主页 清风素颜 | 初学一级 | 园豆:192
提问于:2015-08-20 20:37
< >
分享
所有回答(3)
0

public jframe(){            Container cc=this.getContentPane();      this.setVisible(true);      cc.setBackground(new Color(0, 224, 121));      this.setBounds(100, 100,300, 300);    }  public static void main(String[] args) {   new jframe().setVisible(true);  }

}

huihuishouliqu | 园豆:208 (菜鸟二级) | 2015-08-20 22:20
0

你这是SWING,还是winform,可能是楼上说的构造函数的问题

稳稳的河 | 园豆:4216 (老鸟四级) | 2015-08-21 09:35
0

Container cc=this.getContentPane();   把这个去掉试试;

 

public jframe(){      

      

    

   this.setBounds(100, 100,300, 300);   

 this.setBackground(new Color(0, 224, 121)); 

 this.setVisible(true);   

}  

public static void main(String[] args) {   

new jframe();

 }

}

猿哥爱码 | 园豆:258 (菜鸟二级) | 2015-08-27 00:03
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册