不说具体怎么做,只告诉你怎么去模仿;
首先得对awt和swing有透彻的理解;然后,反编译永中office,看看他里面的大量界面控件是如何实现的(由于永中使用了极强的混码技术,这个比较费事)。

解决方案 »

  1.   

    不要用上面,你会走火入魔。不如直接研究一下 swing 的源码
    还有,可能你想复杂了,如果是我的话会先试试 在文本框后面插一张图片 然后设置它背景透明
      

  2.   

    试试这个.
    public void paintComponent(Graphics g) 
    {
    Insets insets = getInsets();
    icon.paintIcon(this, g, insets.left, insets.top);
    super.paintComponent(g);  
    }
      

  3.   

    这个……和我的方法只在super的调用上调换了位置啊…… -0-
      

  4.   

    试了。
    icon.paintIcon(this, g, insets.left, insets.top);
    super.paintComponent(g);  
    这样的顺序是可以显示文字但是图片显示不了super.paintComponent(g);  
    icon.paintIcon(this, g, insets.left, insets.top);
    这样的顺序是可以显示文字但是图片显示不了-0-
      

  5.   

    import javax.swing.JFrame;
    import javax.swing.JTextPane;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import javax.swing.JScrollPane;
    import javax.swing.ImageIcon;
    import java.net.URL;
    import java.awt.Image;
    import java.awt.Graphics;
    import java.net.MalformedURLException;public class Test {
      private JFrame frame;
      private JTextPane textP;
      private JScrollPane sPan;
      private ImageIcon imageIcon;  public Test() {
        jbInit();
      }  public void jbInit() {
        frame = new JFrame("给JTextPane加入底图");
        String url="http://www.csdn.net/images/Homeother/BTS2004.JPG";
        try {
          imageIcon = new ImageIcon(new URL(url));
        }
        catch (MalformedURLException ex) {
        }
        textP = new JTextPane(){
          Image image = imageIcon.getImage();
          {setOpaque(false);}
          public void paintComponent (Graphics g) {
            g.drawImage(image, 0, 0, this);
            super.paintComponent(g);
          }    };
        sPan = new JScrollPane(textP);
        frame.getContentPane().add(sPan);    frame.addWindowListener(new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
          }
        });
        frame.setSize(230, 160);
        frame.setVisible(true);
      }  public static void main(String[] args) {
        new Test();
      }
    }
    <------ 树欲静而风不止 ------>
      

  6.   

    太感谢了!!!!!!!!!!!!!!!!!!100分送给楼上的了给大家看看我正在设计的东东 ^0^TRPGzone用来玩AD&D游戏的网络聊天工具~http://www.impk.net/marquis/TRPGzone/TRPGchat%20v0.1.6.jpg