研究、分享我学习零售业SAP的历程
------------打造中国第一个零售SAP博客
Copy the MyTree.java to your C:\compiere-all\client\Src\org\compiere\grid\tree

And edit the VTreePanel.java
To add private MyTree tree = new Mytree() (see below in bold)
And change the C10030.jpg
In the client\src\org\compiere\image
And recompile the source code
.
.
.
.
        private BorderLayout mainLayout = new BorderLayout();
//        private JTree tree = new JTree();
        private MyTree tree = new MyTree();  
        private DefaultTreeModel treeModel;
        private DefaultTreeSelectionModel treeSelect = new DefaultTreeSelectionModel();
        private CPanel southPanel = new CPanel();
        private CCheckBox treeExpand = new CCheckBox();
        private CTextField treeSearch = new CTextField(10);
        private JPopupMenu popMenuTree = new JPopupMenu();
        private JPopupMenu popMenuBar = new JPopupMenu();
        private JMenuItem mFrom = new JMenuItem();
        private JMenuItem mTo = new JMenuItem();
        private CPanel bar = new CPanel();
        private JMenuItem mBarAdd = new JMenuItem();
        private JMenuItem mBarRemove = new JMenuItem();
        private BorderLayout southLayout = new BorderLayout();
        private JSplitPane centerSplitPane = new JSplitPane();
        private JScrollPane treePane = new JScrollPane();
        private MouseListener mouseListener = new VTreePanel_mouseAdapter(this);
        private KeyListener keyListener = new VTreePanel_keyAdapter(this);


#4  

The following is cut from MyTree.java:


package org.compiere.grid.tree;

import java.awt.*;
import java.awt.dnd.*;
import java.awt.datatransfer.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
import javax.swing.tree.*;
import java.sql.*;

import org.compiere.apps.*;
import org.compiere.model.*;
import org.compiere.util.*;
import org.compiere.plaf.*;
import org.compiere.swing.*;


/*

This class is created only for displaying photo on the
background of the tree.

*/




public class MyTree extends JTree
{

public void paint( Graphics g )
        {
          ImageIcon image = Env.getImageIcon("C10030.jpg");
  ImageIcon image2 = Env.getImageIcon("empty.jpg");
          System.out.println("Printing background image");
          setOpaque(false);
          // First draw the background image - tiled
          Dimension d = getSize();

                  /*
                  for (int x = 0; x < d.width; x += image.getIconWidth())
            for (int y = 0; y < d.height; y += image.getIconHeight())
              g.drawImage(image.getImage(), x, y, null, null);
          */
g.drawImage(image.getImage(),  d.width-image.getIconWidth(), 0, null, null);
g.drawImage(image2.getImage(),  0, 0,         d.width-image.getIconWidth(),d.height,null, null);
g.drawImage(image2.getImage(),  0, image.getIconHeight(), d.width,d.height,null, null);

          super.paint(g);
                                        }//paint

}
posted on 2007-06-16 13:31  会东  阅读(698)  评论(0编辑  收藏  举报