|
|
发表于 2005/2/23 16:49:08
|
显示全部楼层
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
} |
|