1 / 7
文档名称:

Java图形界面设置背景颜色.doc

格式:doc   大小:68KB   页数:7
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

Java图形界面设置背景颜色.doc

上传人:liangwei2005 2019/10/18 文件大小:68 KB

下载得到文件列表

Java图形界面设置背景颜色.doc

文档介绍

文档介绍:我的Java图形界面设置的背景颜色怎么不显示啊??程序很简单。。2011-12-0119:10shensuiliunian|分类:JAVA相关|;;lassTryWindow{staticJFrameaWindow=newJFrame("ThisisawindowTitle"); publicstaticvoidmain(String[]args){intwindowWidth=400;intwindowHeight=150;(50,100,windowWidth,windowHeight);(newColor(99,00,180));();(());(true); }}办法A:在完成初始化,调用getContentPane()方法得到一个contentPane容器,然后将其设置为不可见,即setVisible(false)。这样,你就可以看到JFrame的庐山真面貌啦!().setVisible(false);//得到contentPane容器,设置为不可见实例完整代码如下:/* *  * * Created on 2011-5-8, 0:21:20 */package testjframebgcolor;import ;/** * * ***@author 叶科良 */public class TestJFrameBGColor extends  {    /** Creates new form TestJFrameBGColor */    public TestJFrameBGColor() {        ponents();        ().setVisible(false);//得到contentPane容器,设置为不可见    }    /** This method is called from within the constructor to     * initialize the form.     * WARNING: Do NOT modify this code. The content of this method is     * always regenerated by the Form Editor.     */    ***@SuppressWarnings("unchecked")    // <editor-fold defaultstate="collapsed" desc="Generated Code">    private void ponents() {        setDefaultCloseOperation(java