宝贝些我这个变透明了得但是底层背景不显示是什么情况

[复制链接]
查看11 | 回复0 | 2021-1-27 05:29:12 | 显示全部楼层 |阅读模式
window=newJFrame("服务端");
window.setLayout(null);
window.setBounds(300,200,600,530);
window.setResizable(false);//大小不可改变
Stringpath="123.jpg";//路径
ImageIconbackground=newImageIcon(path);//背景图片
JLabellabel=newJLabel(background);//把背景图片显示在一个标签里面
label.setBounds(0,0,window.getWidth(),window.getHeight());//设置图片大小
JPanelimage=(JPanel)window.getContentPane();//将图片转变为Jpanel
image.setOpaque(false);//使内容透明
window.getLayeredPane().add(label,newInteger(Integer.MIN_VALUE));//放在底层
JLabellabel1=newJLabel("端口号:");
label1.setBounds(200,8,60,30);
window.add(label1);
portServer=newJTextField();
portServer.setBounds(250,8,130,25);
portServer.setOpaque(false);
window.add(portServer);

start=newJButton("启动");
start.setBounds(90,8,100,25);
start.setOpaque(false);
window.add(start);
//start.setIcon(newImageIcon("5.jpg"));
exit=newJButton("关闭");
exit.setBounds(390,8,100,25);
window.add(exit);


JLabellabel2=newJLabel("用户列表");
label2.setBounds(440,50,100,30);
window.add(label2);

user=newJList();
JScrollPanescrollPane=newJScrollPane(user);//添加滚动条
scrollPane.setBounds(400,80,140,360);
scrollPane.setBackground(newColor(0,0,0,0));
window.add(scrollPane);
JLabellabel3=newJLabel("聊天记录");
label3.setBounds(40,50,100,30);
window.add(label3);
textMessage=newJTextArea();
textMessage.setBounds(135,80,340,220);
textMessage.setOpaque(false);
textMessage.setEditable(false);//不可编辑
//文本内容换行的两个需要配合着用
textMessage.setLineWrap(true);//设置文本内容自动换行,在超出文本区域时,可能会切断单词
textMessage.setWrapStyleWord(true);//设置以自动换行,以单词为整体,保证单词不会被切断
JScrollPanescrollPane1=newJScrollPane(textMessage);//设置滚动条
scrollPane1.setBounds(30,80,350,360);
window.add(scrollPane1);

message=newJTextField();
message.setBounds(10,300,360,50);
message.setOpaque(false);

分 -->
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行