请高手帮我看看一下代码,为什么jpLeft里面的颜色改变不了呢?

问题描述

publicFrameTest4(){//设置顶级容器ContainerContain=this.getContentPane();//给整个容器设置左右两个面板jpLeftjpRight;//JLabeljpLeft=newJLabel();//JLabeljpRight=newJLabel();//把jpRight分割成两个面板jpRightUpjpRightDownJLabeljpRightUp=newJLabel();//JLabeljpRightDown=newJLabel();//把jpLeft分割成两个面板jpLeftUpjpLeftDownJLabeljpLeftUp=newJLabel();JLabeljpLeftDown=newJLabel();//把右下边的面板再次进行分割jpRightDown1=newJPanel();jpRightDown2=newJPanel();//(1)在左上边容器中添加按钮//注意:要使用组件的.setBounds(380,370,10,20);方法,其容器的布局必须是null,则setLayout(null);jpLeftUp.setLayout(null);//设置其行列jpLeftUp.setBackground(newColor(25,187,190));JButtonJB1=newJButton("人事部门");JB1.setBounds(40,30,120,35);JButtonJB2=newJButton("财务部门");JB2.setBounds(40,75,120,35);JButtonJB3=newJButton("管理部门");JB3.setBounds(40,120,120,35);JButtonJB4=newJButton("技术部门");JB4.setBounds(40,165,120,35);jpLeftUp.add(JB1);jpLeftUp.add(JB2);jpLeftUp.add(JB3);jpLeftUp.add(JB4);Contain.add(jpLeftUp);

解决方案

解决方案二:
JLabel是默认透明的组件想改变它的背景色不仅仅是一句setBackground就够的还需要加一句setOpaque(true);

时间: 2024-08-02 04:48:11

请高手帮我看看一下代码,为什么jpLeft里面的颜色改变不了呢?的相关文章

css百度分享-请高手帮改一个CSS代码 让百度分享和文章链接并排

问题描述 请高手帮改一个CSS代码 让百度分享和文章链接并排 .Article-Tool{ border:1px solid #c3d4e7; position:relative; top:-1px; text-align:right; padding:8px; vertical-align:middle; height:15px; background-color:#f4f8fd} .Article-Tool a{width:16px;height:16px;line-height:16px;

请高手帮我看一下代码出现什么问题

问题描述 请高手帮我看一下代码出现什么问题,就是红色部分出现问题!红色部分问题描述为:多步OLEDB操作产生错误.如果可能,请检查每个OLEDB状态值.没有工作被完成.usingSystem;usingSystem.Data;usingSystem.Data.OleDb;usingSystem.Configuration;usingSystem.Collections;usingSystem.Web;usingSystem.Web.Security;usingSystem.Web.UI;usin

请高手帮我修改下代码,实现大文件下载。(目前只能下载10MB左右文件)

问题描述 usingSystem;usingSystem.Data;usingSystem.Configuration;usingSystem.Collections;usingSystem.Web;usingSystem.Web.Security;usingSystem.Web.UI;usingSystem.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Web.UI.HtmlControls;usi

path-c++代码,请高手帮我看一下这个代码怎么修改

问题描述 c++代码,请高手帮我看一下这个代码怎么修改 return 0; } TCHAR szPath[MAX_PATH] = { 0 }; HRESULT hr; hr = SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, szPath); if(SUCCEEDED(hr)) { CString strPath = szPath; strPath += _T("\temp"); hr = ::URLDow

python文件语句解析-请高手帮我解释下这些语句的意思,跪谢!

问题描述 请高手帮我解释下这些语句的意思,跪谢! import osimport ref_cg=open('dm_cg.txt''w')f_sb=open('dm_sb.txt''w')dir_list=[]for file in os.listdir(): if os.path.splitext(file)[1] == '.txt': dir_list.append(file)dir_list.remove('dm_cg.txt')dir_list.remove('dm_sb.txt')#数据

往数据库插入不了数据,而且很奇怪,同一个页面,能插入试卷的选择信息,但插入不了考试成绩?我看不出是什么原因,请高手帮帮忙!!!!

问题描述 往数据库插入不了数据,而且很奇怪,同一个页面,能插入试卷的选择信息,但插入不了考试成绩?我看不出是什么原因,请高手帮帮忙!!!!usingSystem;usingSystem.Data;usingSystem.Configuration;usingSystem.Collections;usingSystem.Web;usingSystem.Web.Security;usingSystem.Web.UI;usingSystem.Web.UI.WebControls;usingSystem

请高手帮忙把以下JAVA代码翻译成PHP,100分全给你了

问题描述 以下JAVA代码是一个解密算法,请哪位高手帮下忙把以下JAVA类的代码翻译成PHP的类,非常感谢.importjava.io.IOException;importjava.io.UnsupportedEncodingException;importjava.net.URLDecoder;importjava.net.URLEncoder;importjava.security.InvalidAlgorithmParameterException;importjava.security.

请高手帮我解决一个VB.NET调用c++ DLL 中的回调函数的问题

问题描述 我有个test.dll是c++写的dll,现在我要用vb.net调用这个dll中的SetCallback回调函数,请问怎么在vb.net中实现,请高手们具体列出代码,应我是新手,谢谢.以下是c++中的头文件定义的一部分typedefvoid(__stdcall*CCallback)(unsignedlongmsg,unsignedlonghparam,unsignedlonglparam);extern"C"voidR888DLL_API__stdcallSetCallbac

Struts2.1+Hibernate3.3+Spring3.0请高手帮帮忙

问题描述 我是个Java初学者,现在用Struts2.1+Hibernate3.3+Spring3.0出现如图所示的问题sessionFactory的配置如图:listener的配置如图:请高手们帮帮忙啊 解决方案 解决方案二:检查一下驱动jar,还有listeners在这里配置吗?解决方案三:有没少jar包?web.xml有没配下面的:<!--向监听器类中传递初始化参数,以获取BeanFactory对象(告诉spring到哪里去加载配置文件)--><context-param>&