如何变换背景颜色? 怎么变换整个得背景颜色?? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 换什么的背景?setBackgound(Color c)方法颜色没有变的话先setOpaque(true) import java.awt.*;import java.awt.event.*;public class mywindow extends Frame implements ActionListener{ Button b1=new Button("1"); Button b2=new Button("2"); Button b3=new Button("3"); public mywindow(String title) { super(title); setLayout(new FlowLayout()); add(b1); b1.addActionListener(this); } public void actionPerformed(ActionEvent e) { setBackground(Color.red); } } 楼主可以参考一下希望对你有帮助 为什么总说red,,,white这些变量不对???哎!>.................... 大哥,应该是Color.red Color.white 等等... 我用的是contentPane=(JPanel)this.getContentPane(); changecolor.setLabel("变换颜色"); changecolor.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ setBackground(Color.red); }但是只有乱点界面的时候有以瞬间的红色底色......一般还是白的界面...怎么回事阿..麻烦大家了! void jButton1_actionPerformed(ActionEvent e) { Color backcolor=JColorChooser.showDialog(this,"选择颜色",contentPane.getBackground()); if(backcolor!=null) {contentPane.setBackground(backcolor);} } 计算器 JNI问题 重论继承多态 怎么取出不同分隔符中间的字符串 讨论:如何实现在线编辑公式(讨论者有分) 需要下载《Struts开发实例》请进,UP可得分 如何得到系统的时间,再将它写入数据库中呢? 我想请教一个问题:如何在一个project中引入另一个package,谢谢 java API原码 麻烦各位“有钱”的大侠们别再:“高兴!大家往我身上浇几盆水吧,不然我就兴奋过度了!” 请高手帮忙解答,谢谢 各位大哥,帮我看下,顺便改下,多谢
setBackgound(Color c)方法
颜色没有变的话先setOpaque(true)
import java.awt.event.*;public class mywindow extends Frame implements ActionListener
{
Button b1=new Button("1");
Button b2=new Button("2");
Button b3=new Button("3");
public mywindow(String title)
{
super(title);
setLayout(new FlowLayout());
add(b1);
b1.addActionListener(this); } public void actionPerformed(ActionEvent e)
{
setBackground(Color.red);
}
} 楼主可以参考一下
希望对你有帮助
changecolor.setLabel("变换颜色");
changecolor.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
setBackground(Color.red);
}但是只有乱点界面的时候有以瞬间的红色底色......一般还是白的界面...怎么回事阿..麻烦大家了!
Color backcolor=JColorChooser.showDialog(this,"选择颜色",contentPane.getBackground());
if(backcolor!=null)
{contentPane.setBackground(backcolor);}
}