你能告诉我JAVA SWING下面怎么做。
答案 0 :(得分:1)
JTextField textField = new JTextField() {
protected void paintComponent(Graphics g) {
super.paintComponent(g);
int y = (getHeight() - image.getHeight())/2;
g.drawImage(image, x0, y, this);
}
};
答案 1 :(得分:1)
答案 2 :(得分:0)
阅读本教程。他完全按照你要做的做法: http://harryjoy.me/2012/07/14/jtextfield-with-image-inside-it/