3
여기에 코드가 있습니다. 텍스트 영역에 배경 이미지가 표시되지 않는 이유를 모르겠 음JTextArea painting Java?
import java.awt.*;
import javax.swing.*;
public class UserInterface extends JFrame {
public static void main(String[] args){
System.out.print("Yes the application is working!");
drop();
}
public static void drop(){
javax.swing.JFrame frame = new javax.swing.JFrame("FileDrop");
//javax.swing.border.TitledBorder dragBorder = new javax.swing.border.TitledBorder("Drop 'em");
JTextArea text = new JTextArea(){
{setOpaque(false);}
public void paint (Graphics g)
{
ImageIcon ii=new ImageIcon("/Users/tushar_chutani/Downloads/Play1Disabled.png");
Image image= ii.getImage();
g.drawImage(image,0,0,null,this);
super.paintComponent(g);
}
};
frame.setBounds(50, 50, 167, 167);
frame.setDefaultCloseOperation(frame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
이것은 전체 코드입니다. 어떤 도움이
감사 apritiated 것, TC
감사합니다. 그런 suuid 질문에 사과드립니다. –