0

Can you tell me how to do like below in JAVA SWING.

enter image description here

4

3 回答 3

2
JTextField textField = new JTextField() {  
            protected void paintComponent(Graphics g) {  
                super.paintComponent(g);  
                int y = (getHeight() - image.getHeight())/2;  
                g.drawImage(image, x0, y, this);  
            }  
        };  
于 2013-09-11T09:55:07.343 回答
1

构建自定义组件。

看看http://gmigdos.wordpress.com/2010/03/30/java-a-custom-jtextfield-for-searching/

于 2013-09-11T09:55:29.093 回答
0

阅读本教程。他做你想做的事:http: //harryjoy.me/2012/07/14/jtextfield-with-image-inside-it/

于 2013-09-11T10:01:35.170 回答