62,620
社区成员
发帖
与我相关
我的任务
分享
backimage = new BackImage();
imgBackground=new ImageIcon("image/psptxs118.jpg");
noticePanel = new JPanel();
noticePanel.setLayout(null);
noticeta = new JTextArea(noticestr);
noticeta.setLineWrap(true);
noticeta.setEditable(false);
noticeta.setSize(430,110);
noticeta.setLocation(20,20);
backimage.setBackTextArea(noticeta, imgBackground);//就是这行
// noticePanel.setBackground(Color.WHITE);
// noticeta.setBackground(Color.WHITE);
noticeta.setFont(new Font("notice",Font.BOLD,15));
noticePanel.add(noticeta);
void setBackTextArea(JTextArea textarea,ImageIcon imgBackground){
this.textarea=textarea;
this.imgBackground=imgBackground;
textarea.setOpaque(false);
JLabel background=new JLabel(imgBackground);
textarea.add(background,new Integer(Integer.MIN_VALUE));
background.setBounds(0,0,imgBackground.getIconWidth(), imgBackground.getIconHeight());
}